Commit e5cdb86a authored by zhangkaixuan11's avatar zhangkaixuan11

提交修改

parent 216ac2a3
{
"java.configuration.updateBuildConfiguration": "interactive"
}
\ No newline at end of file
...@@ -134,7 +134,9 @@ android { ...@@ -134,7 +134,9 @@ android {
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
renderscriptSupportModeEnabled true
} }
splits { splits {
abi { abi {
reset() reset()
...@@ -150,6 +152,14 @@ android { ...@@ -150,6 +152,14 @@ android {
keyAlias 'androiddebugkey' keyAlias 'androiddebugkey'
keyPassword 'android' keyPassword 'android'
} }
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
} }
buildTypes { buildTypes {
debug { debug {
...@@ -158,7 +168,8 @@ android { ...@@ -158,7 +168,8 @@ android {
release { release {
// Caution! In production, you need to generate your own keystore file. // Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android. // see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug // signingConfig signingConfigs.debug
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
} }
...@@ -182,11 +193,17 @@ android { ...@@ -182,11 +193,17 @@ android {
dependencies { dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"]) implementation fileTree(dir: "libs", include: ["*.jar"])
// 数字请根据最新版自行添加
implementation 'com.github.netless-io:whiteboard-android:2.13.18'
//noinspection GradleDynamicVersion //noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
implementation 'com.github.yalantis:ucrop:2.2.2-native'
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni' exclude group:'com.facebook.fbjni'
} }
......
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="com.fenghua_student_client"> package="com.fenghua_student_client">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application <application
tools:replace="android:allowBackup" tools:replace="android:allowBackup"
android:name=".MainApplication" android:name=".MainApplication"
...@@ -24,6 +25,9 @@ ...@@ -24,6 +25,9 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" /> <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<activity android:name="com.ahmedadeltito.photoeditor.PhotoEditorActivity" />
<activity android:name="com.yalantis.ucrop.UCropActivity" />
</application> </application>
</manifest> </manifest>
package com.fenghua_student_client;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class AppReactPackage implements ReactPackage {
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
List<ViewManager> viewManagers = new ArrayList<>();
viewManagers.add(new WhiteboardUI());
// viewManagers.add(new TextViewUI());
return viewManagers;
}
// @Override
// public List<Class<? extends JavaScriptModule>> createJSModules() {
// return Collections.emptyList();
// }
@Override
public List<NativeModule> createNativeModules(
ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new ToastModule(reactContext));
modules.add(new WhiteboardModule(reactContext));
return modules;
}
}
...@@ -11,16 +11,16 @@ import com.zmxv.RNSound.RNSoundPackage; ...@@ -11,16 +11,16 @@ import com.zmxv.RNSound.RNSoundPackage;
import com.zmxv.RNSound.RNSoundPackage; import com.zmxv.RNSound.RNSoundPackage;
import com.brentvatne.react.ReactVideoPackage; import com.brentvatne.react.ReactVideoPackage;
import org.devio.rn.splashscreen.SplashScreenReactPackage; import org.devio.rn.splashscreen.SplashScreenReactPackage;
import com.reactnativecommunity.cameraroll.CameraRollPackage; //import com.reactnativecommunity.cameraroll.CameraRollPackage;
import com.reactnative.ivpusic.imagepicker.PickerPackage; import com.reactnative.ivpusic.imagepicker.PickerPackage;
import com.marcshilling.idletimer.IdleTimerPackage; import com.marcshilling.idletimer.IdleTimerPackage;
import com.rnfs.RNFSPackage; import com.rnfs.RNFSPackage;
import com.reactnativecommunity.art.ARTPackage; //import com.reactnativecommunity.art.ARTPackage;
import com.beefe.picker.PickerViewPackage; import com.beefe.picker.PickerViewPackage;
import com.BV.LinearGradient.LinearGradientPackage; import com.BV.LinearGradient.LinearGradientPackage;
import io.agora.agora_rtm.AgoraRTMPackage; import io.agora.agora_rtm.AgoraRTMPackage;
import com.reactnativecommunity.asyncstorage.AsyncStoragePackage; //import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
import com.reactnativecommunity.asyncstorage.AsyncStoragePackage; //import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage; import com.facebook.react.ReactPackage;
...@@ -43,6 +43,9 @@ public class MainApplication extends Application implements ReactApplication { ...@@ -43,6 +43,9 @@ public class MainApplication extends Application implements ReactApplication {
List<ReactPackage> packages = new PackageList(this).getPackages(); List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example: // Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage()); // packages.add(new MyReactNativePackage());
packages.add(new AppReactPackage());
return packages; return packages;
} }
......
package com.fenghua_student_client;
import android.widget.Toast;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import java.util.Map;
import java.util.HashMap;
//回调需要引入的包start
import com.facebook.react.bridge.Callback;
//回调需要引入的包end
//sendEvent需要引入的包start
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.uimanager.IllegalViewOperationException;
import com.facebook.react.uimanager.PixelUtil;
import com.herewhite.sdk.WhiteboardView;
//sendEvent需要引入的包end
import com.herewhite.sdk.WhiteSdk;
import com.herewhite.sdk.WhiteSdkConfiguration;
import com.herewhite.sdk.WhiteboardView;
public class ToastModule extends ReactContextBaseJavaModule {
private static ReactApplicationContext reactContext;
private static final String DURATION_SHORT_KEY = "SHORT";
private static final String DURATION_LONG_KEY = "LONG";
public ToastModule(ReactApplicationContext context) {
super(context);
reactContext = context;
}
// 必须的方法 起名
@Override
public String getName() {
return "ToastExample";
}
//不一定需要实现,但在定义一些可以被 JavaScript 同步访问到的预定义的值时非常有用
@Override
public Map<String, Object> getConstants() {
final Map<String, Object> constants = new HashMap<>();
constants.put(DURATION_SHORT_KEY, Toast.LENGTH_SHORT);
constants.put(DURATION_LONG_KEY, Toast.LENGTH_LONG);
return constants;
}
// RN 调用原生
@ReactMethod
public void show(String message, int duration) {
Toast.makeText(getReactApplicationContext(), message, duration).show();
}
// public void joinRoom(String uuid, String roomToken) {
// WhiteboardView
// WhiteSdkConfiguration sdkConfiguration = new WhiteSdkConfiguration("AppIdentifier", true);
// WhiteSdk whiteSdk = new WhiteSdk(whiteboardView, this, sdkConfiguration,
// new CommonCallbacks() {
// @Override
// public String urlInterrupter(String sourceUrl) {
// return sourceUrl;
// }
//
// @Override
// public void sdkSetupFail(SDKError error) {
// Log.e("ROOM_ERROR", error.toString());
// }
//
// @Override
// public void throwError(Object args) {
//
// }
//
// @Override
// public void onPPTMediaPlay() {
// logAction();
// }
//
// @Override
// public void onPPTMediaPause() {
// logAction();
// }
// });
// logRoomInfo("room uuid: " + uuid + "roomToken" + roomToken);
//
// whiteSdk.joinRoom(new RoomParams(uuid, roomToken), new AbstractRoomCallbacks() {
// @Override
// public void onPhaseChanged(RoomPhase phase) {
// showToast(phase.name());
// }
//
// @Override
// public void onRoomStateChanged(RoomState modifyState) {
// logRoomInfo(gson.toJson(modifyState));
// }
// }, new Promise<Room>() {
// @Override
// public void then(Room wRoom) {
// logRoomInfo("join in room success");
// room = wRoom;
// }
//
// @Override
// public void catchEx(SDKError t) {
// showToast(t.getMessage());
// }
// });
// }
// RN 调用原生给到回调
@ReactMethod
public void measureLayout(
int tag,
int ancestorTag,
Callback errorCallback,
Callback successCallback) {
try {
successCallback.invoke(100, 100, 100, 100);
} catch (IllegalViewOperationException e) {
errorCallback.invoke(e.getMessage());
}
}
//RN 调用原生 然后触发 send Event
//声明方法
private void sendEvent(ReactContext reactContext,
String eventName,
@Nullable WritableMap params) {
reactContext
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit(eventName, params);
}
@ReactMethod
public void addListener(String eventName) {
// Set up any upstream listeners or background tasks as necessary
}
@ReactMethod
public void removeListeners(Integer count) {
// Remove upstream listeners, stop unnecessary background tasks
}
//定义被调用的方法
@ReactMethod
public void emitListener() {
WritableMap params = Arguments.createMap();
params.putString("eventProperty", "someValue");
sendEvent(reactContext, "EventReminder", params);
}
}
package com.fenghua_student_client;
import android.widget.Toast;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import java.util.Map;
import java.util.HashMap;
//回调需要引入的包start
import com.facebook.react.bridge.Callback;
//回调需要引入的包end
//sendEvent需要引入的包start
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.uimanager.IllegalViewOperationException;
import com.facebook.react.uimanager.PixelUtil;
//import com.herewhite.sdk.WhiteboardView;
//sendEvent需要引入的包end
import com.herewhite.sdk.WhiteSdk;
import com.herewhite.sdk.WhiteSdkConfiguration;
import com.herewhite.sdk.WhiteboardView;
import com.fenghua_student_client.netless.WhiteboardAPI;
public class WhiteboardModule extends ReactContextBaseJavaModule {
private static ReactApplicationContext reactContext;
private static final String DURATION_SHORT_KEY = "SHORT";
private static final String DURATION_LONG_KEY = "LONG";
public WhiteboardModule(ReactApplicationContext context) {
super(context);
reactContext = context;
}
// 必须的方法 起名
@Override
public String getName() {
return "TICBridgeManager";
}
//RN 调用原生 然后触发 send Event
//声明方法
private void sendEvent(ReactContext reactContext, String eventName,
@Nullable WritableMap params) {
reactContext
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit(eventName, params);
}
@ReactMethod
public void addListener(String eventName) {
// Set up any upstream listeners or background tasks as necessary
}
@ReactMethod
public void removeListeners(Integer count) {
// Remove upstream listeners, stop unnecessary background tasks
}
//不一定需要实现,但在定义一些可以被 JavaScript 同步访问到的预定义的值时非常有用
@Override
public Map<String, Object> getConstants() {
final Map<String, Object> constants = new HashMap<>();
constants.put(DURATION_SHORT_KEY, Toast.LENGTH_SHORT);
constants.put(DURATION_LONG_KEY, Toast.LENGTH_LONG);
return constants;
}
// RN 调用原生
@ReactMethod
public void initEngine(String appIdentifier, ReadableMap info, Promise promise) {
// 加入房间
WhiteboardAPI.getInstance().initSdk(appIdentifier, reactContext);
promise.resolve(1);
}
@ReactMethod
public void callMethod(String functionName, ReadableMap obj, Promise promise) {
WhiteboardAPI.getInstance().callMethod( functionName, obj, promise);
}
// RN 调用原生
@ReactMethod
public void joinRoom(String uuid, String roomToken,Promise promise) {
// 加入房间
WhiteboardAPI.getInstance().joinRoom(uuid, roomToken,promise);
}
// RN 调用原生
@ReactMethod
public void leaveRoom(Promise promise) {
// 加入房间
WhiteboardAPI.getInstance().releaseRoom(promise);
}
}
package com.fenghua_student_client;
import android.graphics.Color;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.SimpleViewManager;
import com.facebook.react.uimanager.ThemedReactContext;
import com.herewhite.sdk.CommonCallbacks;
import com.herewhite.sdk.WhiteSdk;
import com.herewhite.sdk.WhiteSdkConfiguration;
import com.herewhite.sdk.WhiteboardView;
import com.herewhite.sdk.domain.SDKError;
import com.fenghua_student_client.netless.WhiteboardAPI;
import org.json.JSONObject;
public class WhiteboardUI extends SimpleViewManager<View> {
public static final String REACT_CLASS = "WhiteboardUI";
ReactApplicationContext mCallerContext;
WhiteboardView whiteboardView;
// public WhiteboardUI(ReactApplicationContext reactContext) {
// mCallerContext = reactContext;
// }
@Override
public String getName() {
return "TICBridgeView";
}
@NonNull
@Override
protected View createViewInstance(ThemedReactContext reactContext) {
// whiteboardView = new NetlessView(reactContext).findViewById
LinearLayout ll_Layout = (LinearLayout) LayoutInflater.from(reactContext).inflate(R.layout.activity_main, null);
whiteboardView = ll_Layout.findViewById(R.id.white);
// int mycolor = getResources().getColor(R.color.mycolor);
// whiteboardView.setBackgroundColor(2d3036");
whiteboardView.setBackgroundColor(Color.argb(0xff, 0x2d, 0x30, 0x36));
// 初始化
WhiteboardAPI.getInstance().initContext(whiteboardView);
return ll_Layout;
}
@Override
public void onDropViewInstance(View view) {//销毁对象时释放一些资源
super.onDropViewInstance(view);
whiteboardView.removeAllViews();
whiteboardView.destroy();
}
}
package com.fenghua_student_client.netless;
import android.content.Context;
import android.util.Log;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.ReadableNativeMap;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.uimanager.ThemedReactContext;
import com.herewhite.sdk.AbstractRoomCallbacks;
import com.herewhite.sdk.CommonCallbacks;
import com.herewhite.sdk.Room;
import com.herewhite.sdk.RoomParams;
import com.herewhite.sdk.WhiteSdk;
import com.herewhite.sdk.WhiteSdkConfiguration;
import com.herewhite.sdk.WhiteboardView;
import com.herewhite.sdk.domain.MemberState;
import com.herewhite.sdk.domain.Promise;
import com.herewhite.sdk.domain.RoomPhase;
import com.herewhite.sdk.domain.RoomState;
import com.herewhite.sdk.domain.SDKError;
import org.json.JSONObject;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* Netless操作的API
*/
public class WhiteboardAPI {
private static WhiteboardAPI api = null;
private WhiteSdk whiteSdk;
private WhiteboardView whiteboardView;
private Room room;
public static WhiteboardAPI getInstance() {
if (api == null) {
api = new WhiteboardAPI();
}
return api;
}
/**
* 初始化
*
* @param whiteboardView
*/
public void initContext(WhiteboardView whiteboardView) {
this.whiteboardView = whiteboardView;
}
/**
* 初始化SDK
* @param appIdentifier
*/
public void initSdk(String appIdentifier, Context context) {
WhiteSdkConfiguration sdkConfiguration = new WhiteSdkConfiguration(appIdentifier, true);
whiteSdk = new WhiteSdk(whiteboardView, context, sdkConfiguration,
new CommonCallbacks() {
@Override
public String urlInterrupter(String sourceUrl) {
return sourceUrl;
}
@Override
public void sdkSetupFail(SDKError error) {
Log.e("ROOM_ERROR", error.toString());
}
@Override
public void throwError(Object args) {
}
@Override
public void onPPTMediaPlay() {
// logAction();
}
@Override
public void onPPTMediaPause() {
// logAction();
}
@Override
public void onMessage(JSONObject object) {
}
});
}
/*释放房间*/
public void releaseRoom(com.facebook.react.bridge.Promise promises){
whiteSdk.releaseRoom();
}
/**
* 加入房间
*
* @param uuid
* @param roomToken
*/
public void joinRoom(String uuid,
String roomToken,com.facebook.react.bridge.Promise promises) {
whiteSdk.joinRoom(new RoomParams(uuid,roomToken), new AbstractRoomCallbacks() {
@Override
public void onPhaseChanged(RoomPhase phase) {
}
@Override
public void onRoomStateChanged(RoomState modifyState) {
}
}, new Promise<Room>() {
@Override
public void then(Room wRoom) {
Log.i("ROOM_JOIN_SUCCESS", "白板加入成功");
room = wRoom;
// room.disableDeviceInputs(true);
promises.resolve("join sucess");
// MemberState memberState = new MemberState();
// memberState.setCurrentApplianceName("pencil");
// room.setMemberState(memberState);
}
@Override
public void catchEx(SDKError t) {
// errorCallback.invoke("join room error", t.getMessage());
}
});
}
private void disableDeviceInputs(ReadableMap obj, com.facebook.react.bridge.Promise promise) {
Map map1 = obj.toHashMap();
Boolean boo = (Boolean) map1.get("disable");
room.disableDeviceInputs(boo);
promise.resolve(map1.get("disable"));
}
private void disableOperations(ReadableMap obj, com.facebook.react.bridge.Promise promise) {
Map map1 = obj.toHashMap();
room.disableOperations((Boolean) map1.get("readonly"));
promise.resolve(map1.get("readonly"));
}
private void setToolType(ReadableMap obj, com.facebook.react.bridge.Promise promise) {
Map map1 = obj.toHashMap();
MemberState memberState = new MemberState();
String type = (String) map1.get("type");
memberState.setCurrentApplianceName(type);
room.setMemberState(memberState);
promise.resolve(type);
}
private void setBrushThin(ReadableMap obj, com.facebook.react.bridge.Promise promise) {
Map map1 = obj.toHashMap();
MemberState memberState = new MemberState();
Double dValue = (Double) map1.get("thin");
int type = dValue.intValue();
memberState.setStrokeWidth(type);
room.setMemberState(memberState);
promise.resolve("setBrushThin: true");
}
private void setBrushColor(ReadableMap obj, com.facebook.react.bridge.Promise promise) {
Map map1 = obj.toHashMap();
MemberState memberState = new MemberState();
// int[] type =(int[]) map1.get("color");
List type = (List) map1.get("color");
int[] d = new int[type.size()];
for(int i = 0;i<type.size();i++){
Double dValue = (Double) type.get(i);
d[i] = dValue.intValue();
}
memberState.setStrokeColor(d);
room.setMemberState(memberState);
promise.resolve("setBrushColor: true");
}
public void callMethod (String functionName, ReadableMap obj, com.facebook.react.bridge.Promise promise) {
switch (functionName){
case "disableDeviceInputs":
disableDeviceInputs(obj,promise);
break;
case "disableOperations":
disableOperations(obj,promise);
break;
case "setToolType":
setToolType(obj,promise);
break;
case "setBrushColor":
setBrushColor(obj,promise);
break;
case "setBrushThin":
setBrushThin(obj,promise);
break;
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/black"
android:color="@color/black"
tools:context=".MainActivity">
<com.herewhite.sdk.WhiteboardView
android:id="@+id/white"
android:background="@color/black"
android:color="@color/black"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible" />
</LinearLayout>
...@@ -12,6 +12,8 @@ buildscript { ...@@ -12,6 +12,8 @@ buildscript {
maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
// maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
google() google()
jcenter() jcenter()
} }
...@@ -39,6 +41,7 @@ allprojects { ...@@ -39,6 +41,7 @@ allprojects {
maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
// maven { url "https://maven.google.com" }
maven { url 'https://www.jitpack.io' } maven { url 'https://www.jitpack.io' }
} }
} }
...@@ -26,3 +26,18 @@ android.enableJetifier=true ...@@ -26,3 +26,18 @@ android.enableJetifier=true
# Version of flipper SDK to use with React Native # Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.54.0 FLIPPER_VERSION=0.54.0
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=123456
MYAPP_RELEASE_KEY_PASSWORD=123456
#开启线程守护,第一次编译时开线程,之后就不会再开了
org.gradle.daemon=true
#配置编译时的虚拟机大小
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#开启并行编译,相当于多条线程再走
org.gradle.parallel=true
#启用新的孵化模式
#org.gradle.configureondemand=true
...@@ -282,6 +282,7 @@ let LiveCSS = StyleSheet.create({ ...@@ -282,6 +282,7 @@ let LiveCSS = StyleSheet.create({
}, },
wbWrapper: { wbWrapper: {
backgroundColor: '#2d3036', backgroundColor: '#2d3036',
// background:'black',
width: Constants.height, width: Constants.height,
height: Constants.width - Constants.statusBarHeight - Constants.unitWidth * 40, height: Constants.width - Constants.statusBarHeight - Constants.unitWidth * 40,
// width: Constants.unitWidth * 400, // width: Constants.unitWidth * 400,
......
...@@ -5,5 +5,6 @@ ...@@ -5,5 +5,6 @@
import {AppRegistry} from 'react-native'; import {AppRegistry} from 'react-native';
import App from './App'; import App from './App';
import {name as appName} from './app.json'; import {name as appName} from './app.json';
console.ignoredYellowBox = ['Warning: Each child','renamed'];
console.disableYellowBox = true;
AppRegistry.registerComponent(appName, () => App); AppRegistry.registerComponent(appName, () => App);
...@@ -37,6 +37,7 @@ export default class Login extends Component { ...@@ -37,6 +37,7 @@ export default class Login extends Component {
} }
componentDidMount = () => { componentDidMount = () => {
Constants.readData('rememberPwd').then((data) => { Constants.readData('rememberPwd').then((data) => {
console.log(1111)
if (data !== null) { if (data !== null) {
this.setState({ this.setState({
rememberPwd: data === '1' ? true : false rememberPwd: data === '1' ? true : false
...@@ -418,6 +419,7 @@ export default class Login extends Component { ...@@ -418,6 +419,7 @@ export default class Login extends Component {
</TouchableHighlight> </TouchableHighlight>
</KeyboardAwareScrollView> </KeyboardAwareScrollView>
<Toast onHide={() => { <Toast onHide={() => {
console.log(this.state)
this.setState({ this.setState({
showToast: false showToast: false
}) })
......
...@@ -39,6 +39,8 @@ export default class Toast extends Component { ...@@ -39,6 +39,8 @@ export default class Toast extends Component {
} }
render() { render() {
// alert()
if(!this.state.show) return null
return ( return (
<View style={{ <View style={{
position: 'absolute', position: 'absolute',
......
...@@ -218,6 +218,21 @@ export default class Index extends Component { ...@@ -218,6 +218,21 @@ export default class Index extends Component {
flexDirection: 'column' flexDirection: 'column'
}, PublicCSS.centerAll]}> }, PublicCSS.centerAll]}>
<Button onPress={() => { <Button onPress={() => {
this.props.navigation.navigate('LiveIndex', {
liveRoomUid: item.liveRoomUid,
channelId: item.channelId,
netlessUuid: item.netlessUuid,
students: item.clazzStudentList,
teachers: item.clazzTeacherList,
courseName: item.courseScheduleName,
studentName: item.studentName,
classId: item.classId,
classScheduleId: item.classScheduleId,
startTime: item.startTime,
endTime: item.endTime,
lessonDate: item.lessonDate,
})
return
if (item.status === '10') { if (item.status === '10') {
if (item.startDate.getTime() - _date.getTime() < 900000) { if (item.startDate.getTime() - _date.getTime() < 900000) {
this.props.navigation.navigate('LiveIndex', { this.props.navigation.navigate('LiveIndex', {
......
...@@ -204,14 +204,19 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -204,14 +204,19 @@ export default class Index extends Component<Props, State, HomeState, AppContext
componentDidMount() { componentDidMount() {
StatusBar.setBarStyle('light-content'); StatusBar.setBarStyle('light-content');
const whBoard = new NativeEventEmitter(NativeModules.TICBridgeManager); // const whBoard = new NativeEventEmitter(NativeModules.TICBridgeManager);
whBoard.addListener('joinRoomSuccess', (data) => { WhiteBoardEngine.addListener('joinRoomSuccess', (data) => {
console.log('joinRoomSuccess', data); console.log('joinRoomSuccess', data);
this.setState({ this.setState({
showNetless2: true showNetless2: true
}); });
}); });
if(Platform.OS != 'ios'){
this.setState({
showNetless:true,
showNetless2: true
});
}
let teacherUid = 0; let teacherUid = 0;
let teacherName = ''; let teacherName = '';
if (this.props.route.params.teachers && this.props.route.params.teachers.length > 0) { if (this.props.route.params.teachers && this.props.route.params.teachers.length > 0) {
...@@ -300,6 +305,8 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -300,6 +305,8 @@ export default class Index extends Component<Props, State, HomeState, AppContext
showAddNote: true, showAddNote: true,
noteImage: image noteImage: image
}) })
}else{
console.log(data.memo)
} }
}) })
.catch(error => { .catch(error => {
...@@ -312,17 +319,19 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -312,17 +319,19 @@ export default class Index extends Component<Props, State, HomeState, AppContext
screenShot = () => { screenShot = () => {
captureScreen({ captureScreen({
format: "jpg", format: "jpg",
quality: 0.8 quality: 0.8,
// result: 'base64'
}).then( }).then(
uri => { uri => {
console.log("Image saved to", uri); console.log("Image saved to", uri);
// const screenShotShowImg = `data:image/png;base64,${uri}`;
PhotoEditor.Edit({ PhotoEditor.Edit({
path: uri, path: uri,
hiddenControls: ['save', 'share'], hiddenControls: ['save', 'share'],
onDone: (uri) => { onDone: (uri) => {
console.log('save image photo editor', uri); console.log('save image photo editor', uri);
// 上传文件 // 上传文件
this.uploadScreenShot(uri); // this.uploadScreenShot(uri);
// this.setState({ // this.setState({
// showAddNote: true, // showAddNote: true,
// noteImage: uri // noteImage: uri
...@@ -480,7 +489,12 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -480,7 +489,12 @@ export default class Index extends Component<Props, State, HomeState, AppContext
// this.checkConnection(); // this.checkConnection();
console.log(
'initEngine',
{
width: Constants.height, height: Constants.width - Constants.statusBarHeight - Constants.unitWidth * 126
}
)
WhiteBoardEngine.initEngine(this.state.appIdentifier, { WhiteBoardEngine.initEngine(this.state.appIdentifier, {
width: Constants.height, height: Constants.width - Constants.statusBarHeight - Constants.unitWidth * 126 width: Constants.height, height: Constants.width - Constants.statusBarHeight - Constants.unitWidth * 126
}).then((e) => { }).then((e) => {
...@@ -2124,12 +2138,11 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -2124,12 +2138,11 @@ export default class Index extends Component<Props, State, HomeState, AppContext
zIndex: this.state.canEditWB && this.state.wbTool !== '' ? 100 : -1 zIndex: this.state.canEditWB && this.state.wbTool !== '' ? 100 : -1
}]}/> }]}/>
} }
<View style={{ <View style={[LiveCSS.wbWrapper,{backgroundColor: 'none',zIndex:1}]}></View>
flex: 1,
}}></View>
{/*文字爆嗨窗口 x: Constants.height - Constants.unitWidth * 310, {/*文字爆嗨窗口 x: Constants.height - Constants.unitWidth * 310,
y: Constants.unitWidth * 156 */} y: Constants.unitWidth * 156 */}
{
this.state.showChat &&
<View style={[LiveCSS.chatBox, { <View style={[LiveCSS.chatBox, {
display: this.state.showChat ? 'flex' : 'none' display: this.state.showChat ? 'flex' : 'none'
}]}> }]}>
...@@ -2178,44 +2191,49 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -2178,44 +2191,49 @@ export default class Index extends Component<Props, State, HomeState, AppContext
</Button> </Button>
</View> </View>
</View> </View>
<View style={[LiveCSS.chatBox, { }
display: this.state.showNote ? 'flex' : 'none' {
}]}> this.state.showNote &&
<View style={[LiveCSS.chatBoxHeader, PublicCSS.centerAll]}> <View style={[LiveCSS.chatBox, {
<Text onPress={() => { display: this.state.showNote ? 'flex' : 'none'
}} allowFontScaling={false} style={LiveCSS.chatBoxTitle}>课堂笔记</Text> }]}>
</View> <View style={[LiveCSS.chatBoxHeader, PublicCSS.centerAll]}>
<View style={LiveCSS.chatBoxList}> <Text onPress={() => {
{/* <FlatList }} allowFontScaling={false} style={LiveCSS.chatBoxTitle}>课堂笔记</Text>
scrollEnabled={true} </View>
style={{flex: 1}} <View style={LiveCSS.chatBoxList}>
initialScrollIndex={this.renderChatItem.length > 0 ? this.renderChatItem.length - 1 : 0} {/* <FlatList
showsVerticalScrollIndicator={false} scrollEnabled={true}
data={this.state.noteList} style={{flex: 1}}
renderItem={this.rendeNote} initialScrollIndex={this.renderChatItem.length > 0 ? this.renderChatItem.length - 1 : 0}
ref={(ref) => {this.noteList = ref;}} showsVerticalScrollIndicator={false}
onLayout={({nativeEvent:e})=>this.noteListLayout(e)} data={this.state.noteList}
onContentSizeChange={({nativeEvent:e})=>this.noteListLayout(e)} renderItem={this.rendeNote}
/> */} ref={(ref) => {this.noteList = ref;}}
<ScrollView> onLayout={({nativeEvent:e})=>this.noteListLayout(e)}
{ onContentSizeChange={({nativeEvent:e})=>this.noteListLayout(e)}
this.state.noteList.map((item, index) => { /> */}
return this.rendeNote({item, index}); <ScrollView>
}) {
} this.state.noteList.map((item, index) => {
</ScrollView> return this.rendeNote({item, index});
</View> })
<Button onPress={() => { }
this.setState({ </ScrollView>
showNote: false </View>
}); <Button onPress={() => {
setTimeout(this.screenShot, 100); this.setState({
}}> showNote: false
<View style={LiveCSS.noteBtnWrapper}> });
<Text allowFontScaling={false} style={LiveCSS.noteAddBtn}>添加笔记</Text> setTimeout(this.screenShot, 100);
}}>
<View style={LiveCSS.noteBtnWrapper}>
<Text allowFontScaling={false} style={LiveCSS.noteAddBtn}>添加笔记</Text>
</View>
</Button>
</View> </View>
</Button> }
</View>
</View> </View>
<View style={LiveCSS.toolbar}> <View style={LiveCSS.toolbar}>
<View style={LiveCSS.toolbarLeft}> <View style={LiveCSS.toolbarLeft}>
...@@ -2761,8 +2779,14 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -2761,8 +2779,14 @@ export default class Index extends Component<Props, State, HomeState, AppContext
{this.state.showColor && <Color color={this.state.color} value={this.state.pencilHeightRate} setData={(data) => { {this.state.showColor && <Color color={this.state.color} value={this.state.pencilHeightRate} setData={(data) => {
this.setState(data); this.setState(data);
setTimeout(() => { setTimeout(() => {
WhiteBoardEngine.setBrushColor(this.state.color); WhiteBoardEngine.setBrushColor(this.state.color).then(e=>{
WhiteBoardEngine.setBrushThin(Math.ceil(this.state.pencilHeightRate * pencelHeightMax)); console.log(this.state.color,e,'this.state.color')
});
WhiteBoardEngine.setBrushThin(Math.ceil(this.state.pencilHeightRate * pencelHeightMax)).then(e=>{
console.log(this.state.pencilHeightRate,e,'this.state.pencilHeightRate')
});;
}, 100) }, 100)
}}/>} }}/>}
{ {
...@@ -2773,45 +2797,50 @@ export default class Index extends Component<Props, State, HomeState, AppContext ...@@ -2773,45 +2797,50 @@ export default class Index extends Component<Props, State, HomeState, AppContext
zIndex: 10000 zIndex: 10000
}} source={{uri: this.state.viewShot}}/> }} source={{uri: this.state.viewShot}}/>
} }
<AddNote show={this.state.showAddNote} cancel={() => { {
this.state.showAddNote && <AddNote show={this.state.showAddNote} cancel={() => {
this.setState({
showAddNote: false,
showNote: true
})
}} onHide={()=>{
this.setState({
showAddNote: false
})
}} onSuccess={() => {
this.setState({
showAddNote: false,
showNote: true
})
this.getNoteList();
}} image={this.state.noteImage}
classId={this.state.classId}
classScheduleId={this.state.classScheduleId}
/>
}
{
this.state.showEditNote&& <EditNote show={this.state.showEditNote} cancel={() => {
this.setState({ this.setState({
showAddNote: false, showEditNote: false,
showNote: true showNote: true
}) })
}} onHide={()=>{ }} onHide={()=>{
this.setState({ this.setState({
showAddNote: false showEditNote: false
}) })
}} onSuccess={() => { }} onSuccess={() => {
this.setState({ this.setState({
showAddNote: false, showEditNote: false,
showNote: true showNote: true
}) });
this.getNoteList(); this.getNoteList();
}} image={this.state.noteImage} }} image={this.state.editNoteImage}
classId={this.state.classId} classId={this.state.classId}
classScheduleId={this.state.classScheduleId} classScheduleId={this.state.classScheduleId}
/> id={this.state.editNoteId} note={this.state.noteRemark}
<EditNote show={this.state.showEditNote} cancel={() => { />
this.setState({ }
showEditNote: false,
showNote: true
})
}} onHide={()=>{
this.setState({
showEditNote: false
})
}} onSuccess={() => {
this.setState({
showEditNote: false,
showNote: true
});
this.getNoteList();
}} image={this.state.editNoteImage}
classId={this.state.classId}
classScheduleId={this.state.classScheduleId}
id={this.state.editNoteId} note={this.state.noteRemark}
/>
{this.state.showDeleteConfirm && <Confirm msg="确定要删除吗?" onHide={() => { {this.state.showDeleteConfirm && <Confirm msg="确定要删除吗?" onHide={() => {
this.setState({ this.setState({
showDeleteConfirm: false showDeleteConfirm: false
......
...@@ -3,6 +3,7 @@ import { NativeModules, NativeEventEmitter } from 'react-native'; ...@@ -3,6 +3,7 @@ import { NativeModules, NativeEventEmitter } from 'react-native';
import TestView from "../components/TestView"; import TestView from "../components/TestView";
const TICBridgeManager = NativeModules.TICBridgeManager; const TICBridgeManager = NativeModules.TICBridgeManager;
console.log(TICBridgeManager,'TICBridgeManager')
const RtcEngineEvent = new NativeEventEmitter(TICBridgeManager); const RtcEngineEvent = new NativeEventEmitter(TICBridgeManager);
class WhiteBoardEngine { class WhiteBoardEngine {
constructor() {} constructor() {}
......
{
"compilerOptions": {
"module": "commonjs",
"target": "es2020",
"jsx": "preserve",
"strictFunctionTypes": true,
"sourceMap": true
},
"exclude": [
"node_modules",
"**/node_modules/*"
]
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment