@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.
@@ -8,6 +8,7 @@ buildscript {
8
8
  plugins {
9
9
  id "com.android.library"
10
10
  id "org.jetbrains.kotlin.android"
11
+ id "com.facebook.react"
11
12
  }
12
13
 
13
14
  def getExtOrDefault(name) {
@@ -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.NativeOTAUpdateSpec
6
+ import com.viettelpost.otakit.NativeReactNativeOtaSpec
7
7
 
8
8
  @ReactModule(name = OTAUpdateModule.NAME)
9
- class OTAUpdateModule(reactContext: ReactApplicationContext) : NativeOTAUpdateSpec(reactContext) {
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 = NativeOTAUpdateSpec.NAME
138
+ const val NAME: String = NativeReactNativeOtaSpec.NAME
139
139
  }
140
140
  }
@@ -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 NativeOTAUpdate_1 = __importDefault(require("./spec/NativeOTAUpdate"));
8
+ const NativeReactNativeOta_1 = __importDefault(require("./spec/NativeReactNativeOta"));
9
9
  async function getOTAMetadata() {
10
- const metadata = await NativeOTAUpdate_1.default.getMetadata();
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 NativeOTAUpdate_1.default.resetMetadata();
15
+ return NativeReactNativeOta_1.default.resetMetadata();
16
16
  }
17
17
  exports.resetOTAMetadata = resetOTAMetadata;
18
18
  async function getOTADirectory() {
19
- return NativeOTAUpdate_1.default.getOTADirectory();
19
+ return NativeReactNativeOta_1.default.getOTADirectory();
20
20
  }
21
21
  exports.getOTADirectory = getOTADirectory;
22
22
  async function prepareManualInstall(bundleVersion) {
23
- return NativeOTAUpdate_1.default.prepareManualInstall(bundleVersion);
23
+ return NativeReactNativeOta_1.default.prepareManualInstall(bundleVersion);
24
24
  }
25
25
  exports.prepareManualInstall = prepareManualInstall;
26
26
  async function markOTASuccess() {
27
- return NativeOTAUpdate_1.default.markSuccess();
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 NativeOTAUpdate_1.default.copyBundleFromDocuments(bundleVersion, fileName);
34
+ return NativeReactNativeOta_1.default.copyBundleFromDocuments(bundleVersion, fileName);
35
35
  }
36
36
  exports.copyBundleFromDocuments = copyBundleFromDocuments;
37
37
  async function getCurrentBundleInfo() {
38
- const bundleInfo = await NativeOTAUpdate_1.default.getCurrentBundleInfo();
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 NativeOTAUpdate_1.default.downloadAndInstallBundle(JSON.stringify(update));
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 NativeOTAUpdate_1.default.getDownloadInfo(version);
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 NativeOTAUpdate_1.default.getOTADiskUsage();
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 NativeOTAUpdate_1.default.cleanupOTAStorage();
57
+ return NativeReactNativeOta_1.default.cleanupOTAStorage();
58
58
  }
59
59
  exports.cleanupOTAStorage = cleanupOTAStorage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viettelpost/react-native-ota",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "ViettelPost React Native OTA runtime and deploy CLI",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,5 +1,5 @@
1
1
  import { Platform } from 'react-native';
2
- import NativeOTAUpdate from './spec/NativeOTAUpdate';
2
+ import NativeOTAUpdate from './spec/NativeReactNativeOta';
3
3
 
4
4
  export type OTAStatus =
5
5
  | 'active'