@aks-dev/easyui 1.0.28 → 1.0.31

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.
@@ -20,7 +20,7 @@
20
20
  <application>
21
21
  <provider
22
22
  android:name="androidx.core.content.FileProvider"
23
- android:authorities="com.sg.upgrade.provider"
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-20 17:43:52
5
+ * @LastEditTime: 2022-05-23 19:08:47
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
- promise.resolve("已是最新版本");
110
+ promise.reject("error_app_upgrade","已是最新版本");
111
+ return ;
111
112
  }
112
113
  Activity currentActivity = context.getCurrentActivity();
113
114
  int permission = ActivityCompat.checkSelfPermission(context.getApplicationContext(),
@@ -120,6 +121,7 @@ public class UpgradeModule extends ReactContextBaseJavaModule {
120
121
  }
121
122
 
122
123
 
124
+ promise.resolve("发现新版本");
123
125
  runOnMainThread(new Runnable() {
124
126
  @Override
125
127
  public void run() {
@@ -164,6 +166,8 @@ public class UpgradeModule extends ReactContextBaseJavaModule {
164
166
  });
165
167
  }
166
168
  });
169
+
170
+
167
171
  }
168
172
 
169
173
  /**
@@ -249,8 +253,9 @@ public class UpgradeModule extends ReactContextBaseJavaModule {
249
253
  File directory = cw.getExternalFilesDir(Environment.DIRECTORY_MUSIC);
250
254
  Activity currentActivity = context.getCurrentActivity();
251
255
  //判断是否是AndroidN以及更高的版本
256
+ String packageName = context.getPackageName();
252
257
  if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
253
- Uri contentUri = FileProvider.getUriForFile(currentActivity,"com.sg.upgrade.provider", new File(directory, mDownloadFile));
258
+ Uri contentUri = FileProvider.getUriForFile(currentActivity,packageName+".provider", new File(directory, mDownloadFile));
254
259
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
255
260
  intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
256
261
  intent.setDataAndType(contentUri,"application/vnd.android.package-archive");
@@ -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="#ffffff"
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-07 11:41:41
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-05 14:29:15
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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aks-dev/easyui",
3
- "version": "1.0.28",
3
+ "version": "1.0.31",
4
4
  "description": "爱科森开发工具包(react-native)",
5
5
  "main": "./src/index.ts",
6
6
  "typings": "./src/index.d.ts",