@viettelpost/react-native-ota 0.1.0 → 0.1.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 +1 -0
- package/android/src/main/java/com/viettelpost/otakit/OTAUpdateModule.kt +3 -3
- package/lib/NativeOTAUpdate.js +12 -12
- package/package.json +1 -1
- package/src/NativeOTAUpdate.ts +1 -1
- /package/lib/spec/{NativeOTAUpdate.d.ts → NativeReactNativeOta.d.ts} +0 -0
- /package/lib/spec/{NativeOTAUpdate.js → NativeReactNativeOta.js} +0 -0
- /package/src/spec/{NativeOTAUpdate.ts → NativeReactNativeOta.ts} +0 -0
package/android/build.gradle
CHANGED
|
@@ -3,10 +3,10 @@ package com.viettelpost.otakit
|
|
|
3
3
|
import com.facebook.react.bridge.Promise
|
|
4
4
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
5
|
import com.facebook.react.module.annotations.ReactModule
|
|
6
|
-
import com.viettelpost.otakit.
|
|
6
|
+
import com.viettelpost.otakit.NativeReactNativeOtaSpec
|
|
7
7
|
|
|
8
8
|
@ReactModule(name = OTAUpdateModule.NAME)
|
|
9
|
-
class OTAUpdateModule(reactContext: ReactApplicationContext) :
|
|
9
|
+
class OTAUpdateModule(reactContext: ReactApplicationContext) : NativeReactNativeOtaSpec(reactContext) {
|
|
10
10
|
override fun getMetadata(promise: Promise) {
|
|
11
11
|
try {
|
|
12
12
|
val metadata = OTAUpdateStorage.readMetadata(reactApplicationContext)
|
|
@@ -135,6 +135,6 @@ class OTAUpdateModule(reactContext: ReactApplicationContext) : NativeOTAUpdateSp
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
companion object {
|
|
138
|
-
const val NAME: String =
|
|
138
|
+
const val NAME: String = NativeReactNativeOtaSpec.NAME
|
|
139
139
|
}
|
|
140
140
|
}
|
package/lib/NativeOTAUpdate.js
CHANGED
|
@@ -5,55 +5,55 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.cleanupOTAStorage = exports.getOTADiskUsage = exports.getDownloadInfo = exports.downloadAndInstallBundle = exports.getCurrentBundleInfo = exports.copyBundleFromDocuments = exports.markOTASuccess = exports.prepareManualInstall = exports.getOTADirectory = exports.resetOTAMetadata = exports.getOTAMetadata = void 0;
|
|
7
7
|
const react_native_1 = require("react-native");
|
|
8
|
-
const
|
|
8
|
+
const NativeReactNativeOta_1 = __importDefault(require("./spec/NativeReactNativeOta"));
|
|
9
9
|
async function getOTAMetadata() {
|
|
10
|
-
const metadata = await
|
|
10
|
+
const metadata = await NativeReactNativeOta_1.default.getMetadata();
|
|
11
11
|
return JSON.parse(metadata);
|
|
12
12
|
}
|
|
13
13
|
exports.getOTAMetadata = getOTAMetadata;
|
|
14
14
|
async function resetOTAMetadata() {
|
|
15
|
-
return
|
|
15
|
+
return NativeReactNativeOta_1.default.resetMetadata();
|
|
16
16
|
}
|
|
17
17
|
exports.resetOTAMetadata = resetOTAMetadata;
|
|
18
18
|
async function getOTADirectory() {
|
|
19
|
-
return
|
|
19
|
+
return NativeReactNativeOta_1.default.getOTADirectory();
|
|
20
20
|
}
|
|
21
21
|
exports.getOTADirectory = getOTADirectory;
|
|
22
22
|
async function prepareManualInstall(bundleVersion) {
|
|
23
|
-
return
|
|
23
|
+
return NativeReactNativeOta_1.default.prepareManualInstall(bundleVersion);
|
|
24
24
|
}
|
|
25
25
|
exports.prepareManualInstall = prepareManualInstall;
|
|
26
26
|
async function markOTASuccess() {
|
|
27
|
-
return
|
|
27
|
+
return NativeReactNativeOta_1.default.markSuccess();
|
|
28
28
|
}
|
|
29
29
|
exports.markOTASuccess = markOTASuccess;
|
|
30
30
|
async function copyBundleFromDocuments(bundleVersion, fileName) {
|
|
31
31
|
if (react_native_1.Platform.OS !== 'ios') {
|
|
32
32
|
return false;
|
|
33
33
|
}
|
|
34
|
-
return
|
|
34
|
+
return NativeReactNativeOta_1.default.copyBundleFromDocuments(bundleVersion, fileName);
|
|
35
35
|
}
|
|
36
36
|
exports.copyBundleFromDocuments = copyBundleFromDocuments;
|
|
37
37
|
async function getCurrentBundleInfo() {
|
|
38
|
-
const bundleInfo = await
|
|
38
|
+
const bundleInfo = await NativeReactNativeOta_1.default.getCurrentBundleInfo();
|
|
39
39
|
return JSON.parse(bundleInfo);
|
|
40
40
|
}
|
|
41
41
|
exports.getCurrentBundleInfo = getCurrentBundleInfo;
|
|
42
42
|
async function downloadAndInstallBundle(update) {
|
|
43
|
-
return
|
|
43
|
+
return NativeReactNativeOta_1.default.downloadAndInstallBundle(JSON.stringify(update));
|
|
44
44
|
}
|
|
45
45
|
exports.downloadAndInstallBundle = downloadAndInstallBundle;
|
|
46
46
|
async function getDownloadInfo(version) {
|
|
47
|
-
const downloadInfo = await
|
|
47
|
+
const downloadInfo = await NativeReactNativeOta_1.default.getDownloadInfo(version);
|
|
48
48
|
return JSON.parse(downloadInfo);
|
|
49
49
|
}
|
|
50
50
|
exports.getDownloadInfo = getDownloadInfo;
|
|
51
51
|
async function getOTADiskUsage() {
|
|
52
|
-
const diskUsage = await
|
|
52
|
+
const diskUsage = await NativeReactNativeOta_1.default.getOTADiskUsage();
|
|
53
53
|
return JSON.parse(diskUsage);
|
|
54
54
|
}
|
|
55
55
|
exports.getOTADiskUsage = getOTADiskUsage;
|
|
56
56
|
async function cleanupOTAStorage() {
|
|
57
|
-
return
|
|
57
|
+
return NativeReactNativeOta_1.default.cleanupOTAStorage();
|
|
58
58
|
}
|
|
59
59
|
exports.cleanupOTAStorage = cleanupOTAStorage;
|
package/package.json
CHANGED
package/src/NativeOTAUpdate.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|