@aks-dev/easyui 1.1.7 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +43 -28
- package/android/src/main/java/com/easyui/{UpgradeModule.java → RNEasyuiModuleImpl.java} +71 -28
- package/android/src/main/java/com/easyui/RNEasyuiPackage.java +31 -19
- package/android/src/newarch/com/easyui/RNEasyuiModule.java +76 -0
- package/android/src/oldarch/com/easyui/RNEasyuiModule.java +79 -0
- package/dist/components/MutiPictureView/MutiPictureView.js +36 -40
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/jsbridge/RNEasyui.d.ts +28 -3
- package/dist/jsbridge/RNEasyui.d.ts.map +1 -1
- package/dist/jsbridge/RNEasyui.js +36 -1
- package/dist/jsbridge/UpgradeModule.d.ts +3 -3
- package/dist/jsbridge/UpgradeModule.d.ts.map +1 -1
- package/dist/specs/NativeRNEasyui.d.ts +18 -0
- package/dist/specs/NativeRNEasyui.d.ts.map +1 -0
- package/dist/specs/NativeRNEasyui.js +2 -0
- package/package.json +16 -4
- package/src/specs/NativeRNEasyui.ts +20 -0
- package/android/src/main/java/com/easyui/RNEasyuiModule.java +0 -86
package/android/build.gradle
CHANGED
|
@@ -1,51 +1,66 @@
|
|
|
1
|
-
|
|
2
1
|
buildscript {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
dependencies {
|
|
15
|
-
classpath("com.android.tools.build:gradle:4.2.2")
|
|
16
|
-
}
|
|
2
|
+
ext.safeExtGet = {prop, fallback ->
|
|
3
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
4
|
+
}
|
|
5
|
+
repositories {
|
|
6
|
+
google()
|
|
7
|
+
gradlePluginPortal()
|
|
8
|
+
}
|
|
9
|
+
dependencies {
|
|
10
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet("kotlinVersion", "1.9.24")}")
|
|
11
|
+
classpath("com.android.tools.build:gradle:8.13.0")
|
|
17
12
|
}
|
|
18
13
|
}
|
|
19
14
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
def isNewArchitectureEnabled() {
|
|
16
|
+
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
17
|
+
}
|
|
23
18
|
|
|
19
|
+
apply plugin: "com.android.library"
|
|
20
|
+
apply plugin: "kotlin-android"
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
if (isNewArchitectureEnabled()) {
|
|
23
|
+
apply plugin: "com.facebook.react"
|
|
27
24
|
}
|
|
28
25
|
|
|
29
|
-
|
|
30
26
|
android {
|
|
31
|
-
|
|
27
|
+
namespace "com.easyui"
|
|
28
|
+
|
|
29
|
+
buildToolsVersion safeExtGet("buildToolsVersion", "35.0.0")
|
|
30
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 35)
|
|
32
31
|
|
|
32
|
+
buildFeatures {
|
|
33
|
+
buildConfig true
|
|
34
|
+
}
|
|
33
35
|
defaultConfig {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
targetSdkVersion safeExtGet(
|
|
36
|
+
buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
|
|
37
|
+
minSdkVersion safeExtGet("minSdkVersion", 24)
|
|
38
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 35)
|
|
37
39
|
}
|
|
38
40
|
lintOptions {
|
|
39
41
|
abortOnError false
|
|
40
42
|
}
|
|
43
|
+
sourceSets {
|
|
44
|
+
main {
|
|
45
|
+
if (isNewArchitectureEnabled()) {
|
|
46
|
+
java.srcDirs += ["src/newarch"]
|
|
47
|
+
} else {
|
|
48
|
+
java.srcDirs += ["src/oldarch"]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
41
52
|
}
|
|
42
53
|
|
|
43
54
|
repositories {
|
|
55
|
+
maven {
|
|
56
|
+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
57
|
+
url("$rootDir/../node_modules/react-native/android")
|
|
58
|
+
}
|
|
59
|
+
google()
|
|
44
60
|
mavenCentral()
|
|
45
61
|
}
|
|
46
62
|
|
|
47
63
|
dependencies {
|
|
48
|
-
|
|
49
|
-
implementation
|
|
64
|
+
//noinspection GradleDynamicVersion
|
|
65
|
+
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
50
66
|
}
|
|
51
|
-
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author: shiguo
|
|
3
|
-
* @Date: 2022-
|
|
3
|
+
* @Date: 2022-04-25 17:57:29
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime:
|
|
6
|
-
* @FilePath: /@aks-dev/easyui/android/src/main/java/com/easyui/
|
|
5
|
+
* @LastEditTime: 2022-10-24 16:08:50
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/android/src/main/java/com/easyui/RNEasyuiModule.java
|
|
7
7
|
*/
|
|
8
|
+
|
|
8
9
|
package com.easyui;
|
|
9
10
|
|
|
10
11
|
import android.Manifest;
|
|
@@ -14,6 +15,15 @@ import android.app.ProgressDialog;
|
|
|
14
15
|
import android.content.Context;
|
|
15
16
|
import android.content.ContextWrapper;
|
|
16
17
|
import android.content.Intent;
|
|
18
|
+
|
|
19
|
+
import androidx.core.app.ActivityCompat;
|
|
20
|
+
import androidx.core.content.FileProvider;
|
|
21
|
+
|
|
22
|
+
import com.facebook.react.bridge.Promise;
|
|
23
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
24
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
25
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
26
|
+
|
|
17
27
|
import android.content.pm.PackageInfo;
|
|
18
28
|
import android.content.pm.PackageManager;
|
|
19
29
|
import android.graphics.Color;
|
|
@@ -26,7 +36,6 @@ import android.os.Handler;
|
|
|
26
36
|
import android.os.Looper;
|
|
27
37
|
import android.os.PowerManager;
|
|
28
38
|
import android.util.DisplayMetrics;
|
|
29
|
-
import android.view.Display;
|
|
30
39
|
import android.view.View;
|
|
31
40
|
import android.view.Window;
|
|
32
41
|
import android.view.WindowManager;
|
|
@@ -34,18 +43,6 @@ import android.widget.Button;
|
|
|
34
43
|
import android.widget.TextView;
|
|
35
44
|
import android.widget.Toast;
|
|
36
45
|
|
|
37
|
-
import androidx.annotation.NonNull;
|
|
38
|
-
import androidx.core.app.ActivityCompat;
|
|
39
|
-
import androidx.core.content.FileProvider;
|
|
40
|
-
|
|
41
|
-
import com.facebook.react.bridge.Promise;
|
|
42
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
43
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
44
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
45
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
46
|
-
|
|
47
|
-
import org.w3c.dom.Text;
|
|
48
|
-
|
|
49
46
|
import java.io.File;
|
|
50
47
|
import java.io.FileOutputStream;
|
|
51
48
|
import java.io.IOException;
|
|
@@ -55,9 +52,9 @@ import java.net.HttpURLConnection;
|
|
|
55
52
|
import java.net.URL;
|
|
56
53
|
import java.util.HashMap;
|
|
57
54
|
|
|
58
|
-
public class
|
|
59
|
-
|
|
60
|
-
private ReactApplicationContext context;
|
|
55
|
+
public class RNEasyuiModuleImpl {
|
|
56
|
+
public static final String NAME = "RNEasyui";
|
|
57
|
+
private final ReactApplicationContext context;
|
|
61
58
|
public static final int EXTERNAL_STORAGE_REQ_CODE = 10 ;
|
|
62
59
|
private static Handler mHandler = new Handler(Looper.getMainLooper());
|
|
63
60
|
private ProgressDialog mProgressDialog;
|
|
@@ -67,21 +64,66 @@ public class UpgradeModule extends ReactContextBaseJavaModule {
|
|
|
67
64
|
private static void runOnMainThread(Runnable runnable) {
|
|
68
65
|
mHandler.postDelayed(runnable, 0);
|
|
69
66
|
}
|
|
67
|
+
public RNEasyuiModuleImpl(ReactApplicationContext reactContext) {
|
|
68
|
+
context = reactContext;
|
|
69
|
+
}
|
|
70
70
|
|
|
71
|
-
@NonNull
|
|
72
|
-
@Override
|
|
73
71
|
public String getName() {
|
|
74
|
-
return
|
|
72
|
+
return NAME;
|
|
75
73
|
}
|
|
76
74
|
|
|
77
75
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
@ReactMethod
|
|
77
|
+
public void getDeviceBrand(Promise promise) {
|
|
78
|
+
promise.resolve( Build.BRAND+ Build.MODEL);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@Deprecated
|
|
82
|
+
@ReactMethod
|
|
83
|
+
public void getStatusBarHeight(final Promise promise) {
|
|
84
|
+
|
|
85
|
+
// int status_bar_height = context.getResources().getDimensionPixelSize(context.getResources().getIdentifier("status_bar_height", "dimen", "android"));
|
|
86
|
+
// promise.resolve(status_bar_height);
|
|
87
|
+
int result = 0;
|
|
88
|
+
int resId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
|
|
89
|
+
if (resId > 0) {
|
|
90
|
+
result = context.getResources().getDimensionPixelSize(resId);
|
|
91
|
+
}
|
|
92
|
+
promise.resolve(result);
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
81
98
|
|
|
99
|
+
|
|
100
|
+
@Deprecated
|
|
101
|
+
@ReactMethod
|
|
102
|
+
public void getNavigationBarHeight(final Promise promise) {
|
|
103
|
+
|
|
104
|
+
// int navigation_bar_height = context.getResources().getDimensionPixelSize(context.getResources().getIdentifier("navigation_bar_height", "dimen", "android"));
|
|
105
|
+
// promise.resolve(navigation_bar_height);
|
|
106
|
+
|
|
107
|
+
int resourceId = 0;
|
|
108
|
+
int rid = context.getResources().getIdentifier("config_showNavigationBar", "bool", "android");
|
|
109
|
+
if (rid != 0) {
|
|
110
|
+
resourceId = context.getResources().getIdentifier("navigation_bar_height", "dimen", "android");
|
|
111
|
+
int result = context.getResources().getDimensionPixelSize(resourceId);
|
|
112
|
+
promise.resolve(result);
|
|
113
|
+
} else {
|
|
114
|
+
promise.resolve(0);
|
|
115
|
+
}
|
|
82
116
|
}
|
|
83
117
|
|
|
84
118
|
|
|
119
|
+
@ReactMethod
|
|
120
|
+
public void gotoDesktop() {
|
|
121
|
+
//启动一个意图,回到桌面
|
|
122
|
+
Intent desktop = new Intent(Intent.ACTION_MAIN);
|
|
123
|
+
desktop.addCategory(Intent.CATEGORY_HOME);
|
|
124
|
+
ActivityCompat.startActivity(context.getCurrentActivity(), desktop, null);
|
|
125
|
+
}
|
|
126
|
+
|
|
85
127
|
private String getAppVersionName() {
|
|
86
128
|
try {
|
|
87
129
|
PackageManager manager = context.getPackageManager();
|
|
@@ -261,7 +303,7 @@ public class UpgradeModule extends ReactContextBaseJavaModule {
|
|
|
261
303
|
//安装应用
|
|
262
304
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
263
305
|
//sg
|
|
264
|
-
ContextWrapper cw = new ContextWrapper(
|
|
306
|
+
ContextWrapper cw = new ContextWrapper(context);
|
|
265
307
|
File directory = cw.getExternalFilesDir(Environment.DIRECTORY_MUSIC);
|
|
266
308
|
Activity currentActivity = context.getCurrentActivity();
|
|
267
309
|
//判断是否是AndroidN以及更高的版本
|
|
@@ -317,7 +359,7 @@ public class UpgradeModule extends ReactContextBaseJavaModule {
|
|
|
317
359
|
|
|
318
360
|
mDownloadFile = "app_" + String.valueOf(System.currentTimeMillis()) + ".apk";
|
|
319
361
|
//sg
|
|
320
|
-
ContextWrapper cw = new ContextWrapper(
|
|
362
|
+
ContextWrapper cw = new ContextWrapper(context);
|
|
321
363
|
File directory = cw.getExternalFilesDir(Environment.DIRECTORY_MUSIC);
|
|
322
364
|
file = new File(directory, mDownloadFile);
|
|
323
365
|
//
|
|
@@ -394,4 +436,5 @@ public class UpgradeModule extends ReactContextBaseJavaModule {
|
|
|
394
436
|
}
|
|
395
437
|
}
|
|
396
438
|
}
|
|
397
|
-
|
|
439
|
+
|
|
440
|
+
}
|
|
@@ -8,31 +8,43 @@
|
|
|
8
8
|
|
|
9
9
|
package com.easyui;
|
|
10
10
|
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import java.util.List;
|
|
11
|
+
import androidx.annotation.NonNull;
|
|
12
|
+
import androidx.annotation.Nullable;
|
|
14
13
|
|
|
15
|
-
import com.facebook.react.
|
|
14
|
+
import com.facebook.react.BaseReactPackage;
|
|
16
15
|
import com.facebook.react.bridge.NativeModule;
|
|
17
16
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
18
|
-
import com.facebook.react.
|
|
19
|
-
import com.facebook.react.
|
|
20
|
-
public class RNEasyuiPackage implements ReactPackage {
|
|
21
|
-
@Override
|
|
22
|
-
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
|
23
|
-
List<NativeModule> modules = new ArrayList<>();
|
|
24
|
-
modules.add(new RNEasyuiModule(reactContext));
|
|
25
|
-
modules.add(new UpgradeModule(reactContext));
|
|
26
|
-
return modules;
|
|
27
|
-
}
|
|
17
|
+
import com.facebook.react.module.model.ReactModuleInfo;
|
|
18
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider;
|
|
28
19
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
import java.util.HashMap;
|
|
21
|
+
import java.util.Map;
|
|
22
|
+
|
|
23
|
+
public class RNEasyuiPackage extends BaseReactPackage {
|
|
24
|
+
@Nullable
|
|
25
|
+
@Override
|
|
26
|
+
public NativeModule getModule(@NonNull String s, @NonNull ReactApplicationContext reactApplicationContext) {
|
|
27
|
+
if (s.equals(RNEasyuiModuleImpl.NAME)) {
|
|
28
|
+
return new RNEasyuiModule(reactApplicationContext);
|
|
29
|
+
} else {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
@NonNull
|
|
34
35
|
@Override
|
|
35
|
-
public
|
|
36
|
-
|
|
36
|
+
public ReactModuleInfoProvider getReactModuleInfoProvider() {
|
|
37
|
+
return ()->{
|
|
38
|
+
Map<String, ReactModuleInfo> map = new HashMap<>();
|
|
39
|
+
map.put(RNEasyuiModuleImpl.NAME, new ReactModuleInfo(
|
|
40
|
+
RNEasyuiModuleImpl.NAME, // name
|
|
41
|
+
RNEasyuiModuleImpl.NAME, // className
|
|
42
|
+
false, // canOverrideExistingModule
|
|
43
|
+
false, // needsEagerInit
|
|
44
|
+
false, // isCXXModule
|
|
45
|
+
true // isTurboModule
|
|
46
|
+
));
|
|
47
|
+
return map;
|
|
48
|
+
};
|
|
37
49
|
}
|
|
38
50
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-04-25 17:57:29
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-10-24 16:08:50
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/android/src/main/java/com/easyui/RNEasyuiModule.java
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
package com.easyui;
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
import androidx.annotation.NonNull;
|
|
14
|
+
|
|
15
|
+
import com.facebook.react.bridge.Promise;
|
|
16
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
17
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
18
|
+
import com.facebook.react.module.annotations.ReactModule;
|
|
19
|
+
|
|
20
|
+
@ReactModule(name = RNEasyuiModuleImpl.NAME)
|
|
21
|
+
public class RNEasyuiModule extends NativeRNEasyuiSpec{
|
|
22
|
+
final private RNEasyuiModuleImpl mRNEasyuiModuleImpl;
|
|
23
|
+
|
|
24
|
+
public RNEasyuiModule(ReactApplicationContext reactContext) {
|
|
25
|
+
super(reactContext);
|
|
26
|
+
mRNEasyuiModuleImpl = new RNEasyuiModuleImpl(reactContext);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@NonNull
|
|
30
|
+
@Override
|
|
31
|
+
public String getName() {
|
|
32
|
+
return RNEasyuiModuleImpl.NAME;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@Override
|
|
37
|
+
public void getDeviceBrand(Promise promise) {
|
|
38
|
+
mRNEasyuiModuleImpl.getDeviceBrand(promise);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Deprecated
|
|
42
|
+
public void getStatusBarHeight(final Promise promise) {
|
|
43
|
+
mRNEasyuiModuleImpl.getStatusBarHeight(promise);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@Deprecated
|
|
51
|
+
public void getNavigationBarHeight(final Promise promise) {
|
|
52
|
+
mRNEasyuiModuleImpl.getNavigationBarHeight(promise);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@Override
|
|
57
|
+
public void gotoDesktop() {
|
|
58
|
+
mRNEasyuiModuleImpl.gotoDesktop();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@Override
|
|
63
|
+
public void getAppVersion(final Promise promise) {
|
|
64
|
+
mRNEasyuiModuleImpl.getAppVersion(promise);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@Override
|
|
68
|
+
public void getOSVersion(Promise promise) {
|
|
69
|
+
mRNEasyuiModuleImpl.getOSVersion(promise);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@Override
|
|
73
|
+
public void upgrade(final ReadableMap info, final Promise promise) {
|
|
74
|
+
mRNEasyuiModuleImpl.upgrade(info, promise);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-04-25 17:57:29
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-10-24 16:08:50
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/android/src/main/java/com/easyui/RNEasyuiModule.java
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
package com.easyui;
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
import androidx.annotation.NonNull;
|
|
14
|
+
|
|
15
|
+
import com.facebook.react.bridge.Promise;
|
|
16
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
17
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
18
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
19
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
20
|
+
import com.facebook.react.module.annotations.ReactModule;
|
|
21
|
+
|
|
22
|
+
@ReactModule(name = RNEasyuiModuleImpl.NAME)
|
|
23
|
+
public class RNEasyuiModule extends ReactContextBaseJavaModule {
|
|
24
|
+
final private RNEasyuiModuleImpl mRNEasyuiModuleImpl;
|
|
25
|
+
|
|
26
|
+
public RNEasyuiModule(ReactApplicationContext reactContext) {
|
|
27
|
+
super(reactContext);
|
|
28
|
+
mRNEasyuiModuleImpl = new RNEasyuiModuleImpl(reactContext);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@NonNull
|
|
32
|
+
@Override
|
|
33
|
+
public String getName() {
|
|
34
|
+
return RNEasyuiModuleImpl.NAME;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@ReactMethod
|
|
39
|
+
public void getDeviceBrand(Promise promise) {
|
|
40
|
+
mRNEasyuiModuleImpl.getDeviceBrand(promise);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@Deprecated
|
|
44
|
+
@ReactMethod
|
|
45
|
+
public void getStatusBarHeight(final Promise promise) {
|
|
46
|
+
mRNEasyuiModuleImpl.getStatusBarHeight(promise);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@Deprecated
|
|
53
|
+
@ReactMethod
|
|
54
|
+
public void getNavigationBarHeight(final Promise promise) {
|
|
55
|
+
mRNEasyuiModuleImpl.getNavigationBarHeight(promise);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@ReactMethod
|
|
60
|
+
public void gotoDesktop() {
|
|
61
|
+
mRNEasyuiModuleImpl.gotoDesktop();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@ReactMethod
|
|
66
|
+
public void getAppVersion(final Promise promise) {
|
|
67
|
+
mRNEasyuiModuleImpl.getAppVersion(promise);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@ReactMethod
|
|
71
|
+
public void getOSVersion(Promise promise) {
|
|
72
|
+
mRNEasyuiModuleImpl.getOSVersion(promise);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@ReactMethod
|
|
76
|
+
public void upgrade(final ReadableMap info, final Promise promise) {
|
|
77
|
+
mRNEasyuiModuleImpl.upgrade(info, promise);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -9,6 +9,7 @@ import * as React from "react";
|
|
|
9
9
|
import { Image, View, StyleSheet, Keyboard, TouchableOpacity, Text, } from "react-native";
|
|
10
10
|
import { px2dp } from "../../screen/px2dp";
|
|
11
11
|
import { px2sp } from "../../screen/px2sp";
|
|
12
|
+
import SYImagePicker from "@aks-dev/react-native-syan-image-picker";
|
|
12
13
|
let icon_add_image = require("./assets/icon_add_image.png");
|
|
13
14
|
let icon_del_image = require("./assets/icon_del_image.png");
|
|
14
15
|
const MutiPictureView = (props) => {
|
|
@@ -22,46 +23,41 @@ const MutiPictureView = (props) => {
|
|
|
22
23
|
if (!images) {
|
|
23
24
|
throw new Error("viewModel没有定义photos字段");
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// console.log("打开相机失败");
|
|
61
|
-
// }
|
|
62
|
-
// },
|
|
63
|
-
// );
|
|
64
|
-
// }
|
|
26
|
+
if (type == "showImagePicker") {
|
|
27
|
+
SYImagePicker.showImagePicker({
|
|
28
|
+
imageCount: maxCount - (viewModel.photos?.length || 0),
|
|
29
|
+
isCrop: false,
|
|
30
|
+
isRecordSelected: false,
|
|
31
|
+
quality: 20,
|
|
32
|
+
}, (err, photos) => {
|
|
33
|
+
if (!err) {
|
|
34
|
+
let imgs = photos.map((it) => {
|
|
35
|
+
return { uri: it.uri };
|
|
36
|
+
});
|
|
37
|
+
images = images.concat(imgs);
|
|
38
|
+
setViewModel({ photos: images });
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (type == "openCamera") {
|
|
43
|
+
SYImagePicker.openCamera({
|
|
44
|
+
imageCount: maxCount - (viewModel.photos?.length || 0),
|
|
45
|
+
isCrop: false,
|
|
46
|
+
isRecordSelected: false,
|
|
47
|
+
quality: 20,
|
|
48
|
+
}, (err, photos) => {
|
|
49
|
+
if (!err) {
|
|
50
|
+
let imgs = photos.map((it) => {
|
|
51
|
+
return { uri: it.uri };
|
|
52
|
+
});
|
|
53
|
+
images = images.concat(imgs);
|
|
54
|
+
setViewModel({ photos: images });
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
console.log("打开相机失败");
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
65
61
|
};
|
|
66
62
|
const deletePhoto = (index) => {
|
|
67
63
|
Keyboard.dismiss();
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,GAAG,EACH,WAAW,EACX,WAAW,EACX,SAAS,EACT,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,WAAW,EACX,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EACL,OAAO,IAAI,WAAW,EACtB,YAAY,EACZ,WAAW,GACZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EACL,OAAO,IAAI,oBAAoB,EAC/B,MAAM,GACP,MAAM,wDAAwD,CAAC;AAEhE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,UAAU;AACV,cAAc,UAAU,CAAC;AACzB,QAAQ;AACR,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,QAAQ;AACR,OAAO,KAAK,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,GAAG,EACH,WAAW,EACX,WAAW,EACX,SAAS,EACT,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,WAAW,EACX,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EACL,OAAO,IAAI,WAAW,EACtB,YAAY,EACZ,WAAW,GACZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EACL,OAAO,IAAI,oBAAoB,EAC/B,MAAM,GACP,MAAM,wDAAwD,CAAC;AAEhE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,UAAU;AACV,cAAc,UAAU,CAAC;AACzB,QAAQ;AACR,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,QAAQ;AACR,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,22 +2,47 @@
|
|
|
2
2
|
* @description: 获取设备品牌
|
|
3
3
|
* @return {*}
|
|
4
4
|
*/
|
|
5
|
-
export declare const getDeviceBrand: () =>
|
|
5
|
+
export declare const getDeviceBrand: () => Promise<string>;
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated 测量不准确,已放弃
|
|
8
8
|
* @description: 获取status_bar_height
|
|
9
9
|
* @return {*}
|
|
10
10
|
*/
|
|
11
|
-
export declare const getStatusBarHeight: () =>
|
|
11
|
+
export declare const getStatusBarHeight: () => Promise<number>;
|
|
12
12
|
/**
|
|
13
13
|
* @deprecated 测量不准确,已放弃
|
|
14
14
|
* @description: 获取navigation_bar_height
|
|
15
15
|
* @return {*}
|
|
16
16
|
*/
|
|
17
|
-
export declare const getNavigationBarHeight: () =>
|
|
17
|
+
export declare const getNavigationBarHeight: () => Promise<number>;
|
|
18
18
|
/**
|
|
19
19
|
* only android
|
|
20
20
|
* 返回桌面
|
|
21
21
|
*/
|
|
22
22
|
export declare const gotoDesktop: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* @description: 获取App版本号
|
|
25
|
+
* @param {*}
|
|
26
|
+
* @return {*}
|
|
27
|
+
*/
|
|
28
|
+
export declare const getAppVersion: () => Promise<string>;
|
|
29
|
+
/**
|
|
30
|
+
* @description: 获取操作系统版本
|
|
31
|
+
*
|
|
32
|
+
react-native-device-info
|
|
33
|
+
* @return {*}
|
|
34
|
+
*/
|
|
35
|
+
export declare const getOSVersion: () => Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* @description: app升级
|
|
38
|
+
* @return {*}
|
|
39
|
+
*/
|
|
40
|
+
export type UpgradeOptions = {
|
|
41
|
+
title?: string;
|
|
42
|
+
version: string;
|
|
43
|
+
downloadUrl: string;
|
|
44
|
+
note: string;
|
|
45
|
+
force: boolean;
|
|
46
|
+
};
|
|
47
|
+
export declare const upgrade: (options: UpgradeOptions) => Promise<string>;
|
|
23
48
|
//# sourceMappingURL=RNEasyui.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RNEasyui.d.ts","sourceRoot":"","sources":["../../src/jsbridge/RNEasyui.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RNEasyui.d.ts","sourceRoot":"","sources":["../../src/jsbridge/RNEasyui.ts"],"names":[],"mappings":"AAiBA;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,CACtB,CAAC;AAC5B;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,OAAO,CAAC,MAAM,CAOpD,CAAC;AACF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,OAAO,CAAC,MAAM,CAIxD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,IAE/B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,OAAO,CAAC,MAAM,CACtB,CAAC;AAC3B;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,OAAO,CAAC,MAAM,CACtB,CAAC;AAC1B;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,MAAM,CA4BhE,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @LastEditTime: 2023-03-10 14:05:17
|
|
6
6
|
* @FilePath: /@aks-dev/easyui/jsbridge/RNEasyui.ts
|
|
7
7
|
*/
|
|
8
|
-
import { Dimensions, NativeModules, Platform } from "react-native";
|
|
8
|
+
import { Dimensions, NativeModules, Platform, PermissionsAndroid, } from "react-native";
|
|
9
9
|
const { RNEasyui } = NativeModules;
|
|
10
10
|
/**
|
|
11
11
|
* @description: 获取设备品牌
|
|
@@ -44,3 +44,38 @@ export const gotoDesktop = () => {
|
|
|
44
44
|
if (Platform.OS == "android")
|
|
45
45
|
RNEasyui?.gotoDesktop();
|
|
46
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* @description: 获取App版本号
|
|
49
|
+
* @param {*}
|
|
50
|
+
* @return {*}
|
|
51
|
+
*/
|
|
52
|
+
export const getAppVersion = () => RNEasyui.getAppVersion();
|
|
53
|
+
/**
|
|
54
|
+
* @description: 获取操作系统版本
|
|
55
|
+
*
|
|
56
|
+
react-native-device-info
|
|
57
|
+
* @return {*}
|
|
58
|
+
*/
|
|
59
|
+
export const getOSVersion = () => RNEasyui.getOSVersion();
|
|
60
|
+
export const upgrade = async (options) => {
|
|
61
|
+
const { title = "提示" } = options;
|
|
62
|
+
if (Platform.OS == "android") {
|
|
63
|
+
try {
|
|
64
|
+
const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE, {
|
|
65
|
+
title: "提示",
|
|
66
|
+
message: "应用升级需要获取APP的写入权限",
|
|
67
|
+
buttonNeutral: "稍后再询问",
|
|
68
|
+
buttonNegative: "取消",
|
|
69
|
+
buttonPositive: "确定",
|
|
70
|
+
});
|
|
71
|
+
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
|
72
|
+
return RNEasyui.upgrade(options);
|
|
73
|
+
}
|
|
74
|
+
return Promise.reject("没有应用升级权限!");
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
return Promise.reject("请求权限异常!");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return RNEasyui.upgrade(options);
|
|
81
|
+
};
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* @param {*}
|
|
4
4
|
* @return {*}
|
|
5
5
|
*/
|
|
6
|
-
export declare const getAppVersion: () =>
|
|
6
|
+
export declare const getAppVersion: () => Promise<string>;
|
|
7
7
|
/**
|
|
8
8
|
* @description: 获取操作系统版本
|
|
9
9
|
*
|
|
10
10
|
react-native-device-info
|
|
11
11
|
* @return {*}
|
|
12
12
|
*/
|
|
13
|
-
export declare const getOSVersion: () =>
|
|
13
|
+
export declare const getOSVersion: () => Promise<string>;
|
|
14
14
|
/**
|
|
15
15
|
* @description: app升级
|
|
16
16
|
* @return {*}
|
|
@@ -22,5 +22,5 @@ export type UpgradeOptions = {
|
|
|
22
22
|
note: string;
|
|
23
23
|
force: boolean;
|
|
24
24
|
};
|
|
25
|
-
export declare const upgrade: (options: UpgradeOptions) => Promise<
|
|
25
|
+
export declare const upgrade: (options: UpgradeOptions) => Promise<string>;
|
|
26
26
|
//# sourceMappingURL=UpgradeModule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpgradeModule.d.ts","sourceRoot":"","sources":["../../src/jsbridge/UpgradeModule.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"UpgradeModule.d.ts","sourceRoot":"","sources":["../../src/jsbridge/UpgradeModule.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,OAAO,CAAC,MAAM,CACjB,CAAC;AAChC;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,OAAO,CAAC,MAAM,CACjB,CAAC;AAC/B;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,MAAM,CA4BhE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
type UpgradeOptions = {
|
|
3
|
+
title?: string;
|
|
4
|
+
version: string;
|
|
5
|
+
downloadUrl: string;
|
|
6
|
+
note: string;
|
|
7
|
+
force: boolean;
|
|
8
|
+
};
|
|
9
|
+
export interface Spec extends TurboModule {
|
|
10
|
+
getAppVersion(): Promise<string>;
|
|
11
|
+
getOSVersion(): Promise<string>;
|
|
12
|
+
getDeviceBrand(): Promise<string>;
|
|
13
|
+
gotoDesktop(): void;
|
|
14
|
+
upgrade: (options: UpgradeOptions) => Promise<string>;
|
|
15
|
+
}
|
|
16
|
+
declare const _default: Spec;
|
|
17
|
+
export default _default;
|
|
18
|
+
//# sourceMappingURL=NativeRNEasyui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeRNEasyui.d.ts","sourceRoot":"","sources":["../../src/specs/NativeRNEasyui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,KAAK,cAAc,GAAG;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAClB,CAAC;AACF,MAAM,WAAW,IAAK,SAAQ,WAAW;IACrC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,WAAW,IAAG,IAAI,CAAC;IACnB,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CACxD;wBAII,IAAI;AAFT,wBAEU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aks-dev/easyui",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "工具箱",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"!/tsconfig.md",
|
|
37
37
|
"!/i.sh",
|
|
38
38
|
"!/src/**/assets/*",
|
|
39
|
-
"!/docs"
|
|
39
|
+
"!/docs",
|
|
40
|
+
"/src/specs"
|
|
40
41
|
],
|
|
41
42
|
"homepage": "https://gitee.com/the_period_of_the_ten_kingdoms",
|
|
42
43
|
"repository": {
|
|
@@ -50,11 +51,13 @@
|
|
|
50
51
|
"react-native": "*",
|
|
51
52
|
"react-native-permissions": "*",
|
|
52
53
|
"react-native-vision-camera": "*",
|
|
53
|
-
"react-native-webview": "*"
|
|
54
|
+
"react-native-webview": "*",
|
|
55
|
+
"@aks-dev/react-native-syan-image-picker": "*"
|
|
54
56
|
},
|
|
55
57
|
"dependencies": {
|
|
56
58
|
"echarts": "^6.0.0",
|
|
57
59
|
"react-native-image-zoom-viewer": "^3.0.1",
|
|
60
|
+
"react-native-modal": "^14.0.0-rc.1",
|
|
58
61
|
"react-native-smart-refresh": "^1.1.6",
|
|
59
62
|
"react-native-swipe-list-view": "^3.2.9"
|
|
60
63
|
},
|
|
@@ -64,12 +67,21 @@
|
|
|
64
67
|
"react-native": "^0.84.1",
|
|
65
68
|
"react-native-permissions": "^5.5.1",
|
|
66
69
|
"react-native-vision-camera": "^4.7.3",
|
|
67
|
-
"react-native-webview": "^13.16.1"
|
|
70
|
+
"react-native-webview": "^13.16.1",
|
|
71
|
+
"@aks-dev/react-native-syan-image-picker": "^1.0.1"
|
|
68
72
|
},
|
|
69
73
|
"resolutions": {
|
|
70
74
|
"@types/react": "*"
|
|
71
75
|
},
|
|
72
76
|
"publishConfig": {
|
|
73
77
|
"registry": "https://registry.npmjs.org/"
|
|
78
|
+
},
|
|
79
|
+
"codegenConfig": {
|
|
80
|
+
"name": "RNEasyuiSpec",
|
|
81
|
+
"type": "modules",
|
|
82
|
+
"jsSrcsDir": "./src/specs",
|
|
83
|
+
"android": {
|
|
84
|
+
"javaPackageName": "com.easyui"
|
|
85
|
+
}
|
|
74
86
|
}
|
|
75
87
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
type UpgradeOptions = {
|
|
4
|
+
title?: string;
|
|
5
|
+
version: string;
|
|
6
|
+
downloadUrl: string;
|
|
7
|
+
note: string;
|
|
8
|
+
force: boolean;
|
|
9
|
+
};
|
|
10
|
+
export interface Spec extends TurboModule {
|
|
11
|
+
getAppVersion(): Promise<string>;
|
|
12
|
+
getOSVersion(): Promise<string>;
|
|
13
|
+
getDeviceBrand(): Promise<string>;
|
|
14
|
+
gotoDesktop():void;
|
|
15
|
+
upgrade: (options: UpgradeOptions) => Promise<string>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
19
|
+
'RNEasyui',
|
|
20
|
+
) as Spec;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: shiguo
|
|
3
|
-
* @Date: 2022-04-25 17:57:29
|
|
4
|
-
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-10-24 16:08:50
|
|
6
|
-
* @FilePath: /@aks-dev/easyui/android/src/main/java/com/easyui/RNEasyuiModule.java
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
package com.easyui;
|
|
10
|
-
|
|
11
|
-
import android.content.Intent;
|
|
12
|
-
|
|
13
|
-
import androidx.core.app.ActivityCompat;
|
|
14
|
-
|
|
15
|
-
import com.facebook.react.bridge.Promise;
|
|
16
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
17
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
18
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
19
|
-
import android.os.Build;
|
|
20
|
-
|
|
21
|
-
public class RNEasyuiModule extends ReactContextBaseJavaModule {
|
|
22
|
-
|
|
23
|
-
private final ReactApplicationContext context;
|
|
24
|
-
|
|
25
|
-
public RNEasyuiModule(ReactApplicationContext reactContext) {
|
|
26
|
-
super(reactContext);
|
|
27
|
-
this.context = reactContext;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@Override
|
|
31
|
-
public String getName() {
|
|
32
|
-
return "RNEasyui";
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
@ReactMethod
|
|
37
|
-
public void getDeviceBrand(Promise promise) {
|
|
38
|
-
promise.resolve( Build.BRAND+ Build.MODEL);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@Deprecated
|
|
42
|
-
@ReactMethod
|
|
43
|
-
public void getStatusBarHeight(final Promise promise) {
|
|
44
|
-
|
|
45
|
-
// int status_bar_height = context.getResources().getDimensionPixelSize(context.getResources().getIdentifier("status_bar_height", "dimen", "android"));
|
|
46
|
-
// promise.resolve(status_bar_height);
|
|
47
|
-
int result = 0;
|
|
48
|
-
int resId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
|
|
49
|
-
if (resId > 0) {
|
|
50
|
-
result = context.getResources().getDimensionPixelSize(resId);
|
|
51
|
-
}
|
|
52
|
-
promise.resolve(result);
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
@Deprecated
|
|
61
|
-
@ReactMethod
|
|
62
|
-
public void getNavigationBarHeight(final Promise promise) {
|
|
63
|
-
|
|
64
|
-
// int navigation_bar_height = context.getResources().getDimensionPixelSize(context.getResources().getIdentifier("navigation_bar_height", "dimen", "android"));
|
|
65
|
-
// promise.resolve(navigation_bar_height);
|
|
66
|
-
|
|
67
|
-
int resourceId = 0;
|
|
68
|
-
int rid = context.getResources().getIdentifier("config_showNavigationBar", "bool", "android");
|
|
69
|
-
if (rid != 0) {
|
|
70
|
-
resourceId = context.getResources().getIdentifier("navigation_bar_height", "dimen", "android");
|
|
71
|
-
int result = context.getResources().getDimensionPixelSize(resourceId);
|
|
72
|
-
promise.resolve(result);
|
|
73
|
-
} else {
|
|
74
|
-
promise.resolve(0);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
@ReactMethod
|
|
80
|
-
public void gotoDesktop() {
|
|
81
|
-
//启动一个意图,回到桌面
|
|
82
|
-
Intent desktop = new Intent(Intent.ACTION_MAIN);
|
|
83
|
-
desktop.addCategory(Intent.CATEGORY_HOME);
|
|
84
|
-
ActivityCompat.startActivity(getCurrentActivity(), desktop, null);
|
|
85
|
-
}
|
|
86
|
-
}
|