@aks-dev/easyui 1.0.27 → 1.0.30
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/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/easyui/UpgradeModule.java +7 -4
- package/android/src/main/res/drawable/update_cancel_btn.xml +11 -0
- package/android/src/main/res/drawable/update_confirm_btn.xml +11 -0
- package/android/src/main/res/drawable/upgrade_bg.png +0 -0
- package/android/src/main/res/layout/update_dialog.xml +1 -1
- package/jsbridge/UpgradeModule.tsx +7 -3
- package/jsbridge/index.ts +17 -3
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<application>
|
|
21
21
|
<provider
|
|
22
22
|
android:name="androidx.core.content.FileProvider"
|
|
23
|
-
android:authorities="
|
|
23
|
+
android:authorities="${applicationId}.provider"
|
|
24
24
|
android:exported="false"
|
|
25
25
|
android:grantUriPermissions="true">
|
|
26
26
|
<meta-data
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-05-05 13:57:25
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-05-
|
|
5
|
+
* @LastEditTime: 2022-05-23 18:21:04
|
|
6
6
|
* @FilePath: /@aks-dev/easyui/android/src/main/java/com/easyui/UpgradeModule.java
|
|
7
7
|
*/
|
|
8
8
|
package com.easyui;
|
|
@@ -107,7 +107,8 @@ public class UpgradeModule extends ReactContextBaseJavaModule {
|
|
|
107
107
|
String note = (String) hashMap.get("note");
|
|
108
108
|
Boolean force = (Boolean) hashMap.get("force");
|
|
109
109
|
if (!checkUpdate(version, this.getAppVersionName())) {
|
|
110
|
-
|
|
110
|
+
|
|
111
|
+
promise.reject("error_app_upgrade","已是最新版本");
|
|
111
112
|
}
|
|
112
113
|
Activity currentActivity = context.getCurrentActivity();
|
|
113
114
|
int permission = ActivityCompat.checkSelfPermission(context.getApplicationContext(),
|
|
@@ -119,7 +120,6 @@ public class UpgradeModule extends ReactContextBaseJavaModule {
|
|
|
119
120
|
EXTERNAL_STORAGE_REQ_CODE);
|
|
120
121
|
}
|
|
121
122
|
|
|
122
|
-
|
|
123
123
|
runOnMainThread(new Runnable() {
|
|
124
124
|
@Override
|
|
125
125
|
public void run() {
|
|
@@ -164,6 +164,8 @@ public class UpgradeModule extends ReactContextBaseJavaModule {
|
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
166
|
});
|
|
167
|
+
|
|
168
|
+
promise.resolve("发现新版本");
|
|
167
169
|
}
|
|
168
170
|
|
|
169
171
|
/**
|
|
@@ -249,8 +251,9 @@ public class UpgradeModule extends ReactContextBaseJavaModule {
|
|
|
249
251
|
File directory = cw.getExternalFilesDir(Environment.DIRECTORY_MUSIC);
|
|
250
252
|
Activity currentActivity = context.getCurrentActivity();
|
|
251
253
|
//判断是否是AndroidN以及更高的版本
|
|
254
|
+
String packageName = context.getPackageName();
|
|
252
255
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
253
|
-
Uri contentUri = FileProvider.getUriForFile(currentActivity,"
|
|
256
|
+
Uri contentUri = FileProvider.getUriForFile(currentActivity,packageName+".provider", new File(directory, mDownloadFile));
|
|
254
257
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
255
258
|
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
|
256
259
|
intent.setDataAndType(contentUri,"application/vnd.android.package-archive");
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
android:shape="rectangle">
|
|
4
|
+
<!-- 填充的颜色 -->
|
|
5
|
+
<!--<solid android:color="@android:color/transparent" />-->
|
|
6
|
+
<!-- 设置按钮的四个角为弧形 -->
|
|
7
|
+
<!-- android:radius 弧形的半径 -->
|
|
8
|
+
<corners android:radius="4dp" />
|
|
9
|
+
<!--边框的宽度及颜色-->
|
|
10
|
+
<stroke android:width="2px" android:color="#CCCCCC" />
|
|
11
|
+
</shape>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
android:shape="rectangle">
|
|
4
|
+
<!-- 填充的颜色 -->
|
|
5
|
+
<solid android:color="#EA6561" />
|
|
6
|
+
<!-- 设置按钮的四个角为弧形 -->
|
|
7
|
+
<!-- android:radius 弧形的半径 -->
|
|
8
|
+
<corners android:radius="4dp" />
|
|
9
|
+
<!--边框的宽度及颜色-->
|
|
10
|
+
<!--<stroke android:width="2px" android:color="#388e3c" />-->
|
|
11
|
+
</shape>
|
|
Binary file
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
android:id="@+id/btn_comfirm"
|
|
33
33
|
android:layout_width="200dp"
|
|
34
34
|
android:layout_height="35dp"
|
|
35
|
-
android:textColor="
|
|
35
|
+
android:textColor="#FFFFFF"
|
|
36
36
|
android:background="@drawable/update_confirm_btn"
|
|
37
37
|
android:text="立即升级"
|
|
38
38
|
style="?android:attr/borderlessButtonStyle" />
|
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-05-05 14:19:39
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-05-
|
|
6
|
-
* @FilePath: /@aks/easyui/jsbridge/UpgradeModule.tsx
|
|
5
|
+
* @LastEditTime: 2022-05-23 18:22:39
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/jsbridge/UpgradeModule.tsx
|
|
7
7
|
*/
|
|
8
8
|
import { NativeModules } from 'react-native';
|
|
9
9
|
|
|
10
10
|
const { UpgradeModule } = NativeModules;
|
|
11
11
|
|
|
12
|
+
import type { UpgradeOptions } from '.'
|
|
12
13
|
|
|
13
|
-
export const getAppVersion = () => UpgradeModule.getAppVersion();
|
|
14
|
+
export const getAppVersion = () => UpgradeModule.getAppVersion();
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export const upgrade = (props: UpgradeOptions) => UpgradeModule.upgrade(props)
|
package/jsbridge/index.ts
CHANGED
|
@@ -2,12 +2,26 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-19 10:23:01
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-05-
|
|
6
|
-
* @FilePath: /@aks/easyui/jsbridge/index.ts
|
|
5
|
+
* @LastEditTime: 2022-05-23 18:25:02
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/jsbridge/index.ts
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* @description: 获取App版本号
|
|
10
10
|
* @param {*}
|
|
11
11
|
* @return {*}
|
|
12
12
|
*/
|
|
13
|
-
export declare const getAppVersion:()=>Promise<string>;
|
|
13
|
+
export declare const getAppVersion: () => Promise<string>;
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export declare type UpgradeOptions = {
|
|
17
|
+
version: string;
|
|
18
|
+
downloadUrl: string;
|
|
19
|
+
note: string;
|
|
20
|
+
force: boolean;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @description: app升级
|
|
25
|
+
* @return {*}
|
|
26
|
+
*/
|
|
27
|
+
export declare const upgrade: (props: UpgradeOptions) => Promise<string>;
|