react-native-ota-hot-update 1.1.1 → 2.0.0
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/LICENSE +1 -2
- package/README.md +20 -8
- package/android/build.gradle +32 -4
- package/android/generated/java/com/otahotupdate/NativeOtaHotUpdateSpec.java +54 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/RNOtaHotUpdateSpec-generated.cpp +56 -0
- package/android/generated/jni/RNOtaHotUpdateSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/ComponentDescriptors.cpp +22 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/ComponentDescriptors.h +24 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/EventEmitters.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/EventEmitters.h +17 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/Props.cpp +19 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/Props.h +18 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/RNOtaHotUpdateSpecJSI-generated.cpp +56 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/RNOtaHotUpdateSpecJSI.h +103 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/ShadowNodes.cpp +17 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/ShadowNodes.h +23 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/States.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/States.h +19 -0
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/otahotupdate/OtaHotUpdate.kt +57 -0
- package/android/src/main/java/com/otahotupdate/OtaHotUpdateModule.kt +142 -0
- package/android/src/newarch/OtaHotUpdateSpec.kt +7 -0
- package/android/src/oldarch/OtaHotUpdateSpec.kt +15 -0
- package/ios/OtaHotUpdate.h +13 -0
- package/ios/{RNhotupdate.m → OtaHotUpdate.mm} +50 -33
- package/ios/generated/RNOtaHotUpdateSpec/ComponentDescriptors.cpp +22 -0
- package/ios/generated/RNOtaHotUpdateSpec/ComponentDescriptors.h +24 -0
- package/ios/generated/RNOtaHotUpdateSpec/EventEmitters.cpp +16 -0
- package/ios/generated/RNOtaHotUpdateSpec/EventEmitters.h +17 -0
- package/ios/generated/RNOtaHotUpdateSpec/Props.cpp +19 -0
- package/ios/generated/RNOtaHotUpdateSpec/Props.h +18 -0
- package/ios/generated/RNOtaHotUpdateSpec/RCTComponentViewHelpers.h +18 -0
- package/ios/generated/RNOtaHotUpdateSpec/RNOtaHotUpdateSpec-generated.mm +67 -0
- package/ios/generated/RNOtaHotUpdateSpec/RNOtaHotUpdateSpec.h +72 -0
- package/ios/generated/RNOtaHotUpdateSpec/ShadowNodes.cpp +17 -0
- package/ios/generated/RNOtaHotUpdateSpec/ShadowNodes.h +23 -0
- package/ios/generated/RNOtaHotUpdateSpec/States.cpp +16 -0
- package/ios/generated/RNOtaHotUpdateSpec/States.h +19 -0
- package/ios/generated/RNOtaHotUpdateSpecJSI-generated.cpp +56 -0
- package/ios/generated/RNOtaHotUpdateSpecJSI.h +103 -0
- package/lib/commonjs/NativeOtaHotUpdate.js +9 -0
- package/lib/commonjs/NativeOtaHotUpdate.js.map +1 -0
- package/lib/commonjs/download.d.js +2 -0
- package/lib/commonjs/download.d.js.map +1 -0
- package/lib/commonjs/index.js +113 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/NativeOtaHotUpdate.js +5 -0
- package/lib/module/NativeOtaHotUpdate.js.map +1 -0
- package/lib/module/download.d.js +2 -0
- package/lib/module/download.d.js.map +1 -0
- package/lib/module/index.js +109 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeOtaHotUpdate.d.ts +11 -0
- package/lib/typescript/commonjs/src/NativeOtaHotUpdate.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +25 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeOtaHotUpdate.d.ts +11 -0
- package/lib/typescript/module/src/NativeOtaHotUpdate.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +25 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +184 -12
- package/{rn-hotupdate.podspec → react-native-ota-hot-update.podspec} +3 -3
- package/react-native.config.js +10 -6
- package/src/NativeOtaHotUpdate.ts +12 -0
- package/src/download.d.ts +759 -689
- package/src/index.tsx +67 -40
- package/android/src/main/java/com/rnhotupdate/HotUpdateModule.java +0 -161
- package/android/src/main/java/com/rnhotupdate/OtaHotUpdate.java +0 -45
- package/ios/RNhotupdate.h +0 -12
- package/ios/RNhotupdate.xcodeproj/project.pbxproj +0 -281
- package/ios/RNhotupdate.xcworkspace/contents.xcworkspacedata +0 -7
- /package/android/src/main/java/com/{rnhotupdate → otahotupdate}/SharedPrefs.kt +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleObjCpp
|
|
8
|
+
*
|
|
9
|
+
* We create an umbrella header (and corresponding implementation) here since
|
|
10
|
+
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
|
|
11
|
+
* must have a single output. More files => more genrule()s => slower builds.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#ifndef __cplusplus
|
|
15
|
+
#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
// Avoid multiple includes of RNOtaHotUpdateSpec symbols
|
|
19
|
+
#ifndef RNOtaHotUpdateSpec_H
|
|
20
|
+
#define RNOtaHotUpdateSpec_H
|
|
21
|
+
|
|
22
|
+
#import <Foundation/Foundation.h>
|
|
23
|
+
#import <RCTRequired/RCTRequired.h>
|
|
24
|
+
#import <RCTTypeSafety/RCTConvertHelpers.h>
|
|
25
|
+
#import <RCTTypeSafety/RCTTypedModuleConstants.h>
|
|
26
|
+
#import <React/RCTBridgeModule.h>
|
|
27
|
+
#import <React/RCTCxxConvert.h>
|
|
28
|
+
#import <React/RCTManagedPointer.h>
|
|
29
|
+
#import <ReactCommon/RCTTurboModule.h>
|
|
30
|
+
#import <optional>
|
|
31
|
+
#import <vector>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@protocol NativeOtaHotUpdateSpec <RCTBridgeModule, RCTTurboModule>
|
|
35
|
+
|
|
36
|
+
- (void)setupBundlePath:(NSString *)path
|
|
37
|
+
extension:(NSString *)extension
|
|
38
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
39
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
40
|
+
- (void)deleteBundle:(double)i
|
|
41
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
42
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
43
|
+
- (void)restart;
|
|
44
|
+
- (void)getCurrentVersion:(double)a
|
|
45
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
46
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
47
|
+
- (void)setCurrentVersion:(NSString *)version
|
|
48
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
49
|
+
reject:(RCTPromiseRejectBlock)reject;
|
|
50
|
+
|
|
51
|
+
@end
|
|
52
|
+
|
|
53
|
+
@interface NativeOtaHotUpdateSpecBase : NSObject {
|
|
54
|
+
@protected
|
|
55
|
+
facebook::react::EventEmitterCallback _eventEmitterCallback;
|
|
56
|
+
}
|
|
57
|
+
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper;
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@end
|
|
61
|
+
|
|
62
|
+
namespace facebook::react {
|
|
63
|
+
/**
|
|
64
|
+
* ObjC++ class for module 'NativeOtaHotUpdate'
|
|
65
|
+
*/
|
|
66
|
+
class JSI_EXPORT NativeOtaHotUpdateSpecJSI : public ObjCTurboModule {
|
|
67
|
+
public:
|
|
68
|
+
NativeOtaHotUpdateSpecJSI(const ObjCTurboModule::InitParams ¶ms);
|
|
69
|
+
};
|
|
70
|
+
} // namespace facebook::react
|
|
71
|
+
|
|
72
|
+
#endif // RNOtaHotUpdateSpec_H
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateShadowNodeCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "ShadowNodes.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateShadowNodeH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include "EventEmitters.h"
|
|
14
|
+
#include "Props.h"
|
|
15
|
+
#include "States.h"
|
|
16
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
|
+
#include <jsi/jsi.h>
|
|
18
|
+
|
|
19
|
+
namespace facebook::react {
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateStateCpp.js
|
|
9
|
+
*/
|
|
10
|
+
#include "States.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateStateH.js
|
|
8
|
+
*/
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#ifdef ANDROID
|
|
12
|
+
#include <folly/dynamic.h>
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleCpp.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "RNOtaHotUpdateSpecJSI.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
static jsi::Value __hostFunction_NativeOtaHotUpdateCxxSpecJSI_setupBundlePath(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
15
|
+
return static_cast<NativeOtaHotUpdateCxxSpecJSI *>(&turboModule)->setupBundlePath(
|
|
16
|
+
rt,
|
|
17
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
|
18
|
+
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt)
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
static jsi::Value __hostFunction_NativeOtaHotUpdateCxxSpecJSI_deleteBundle(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
22
|
+
return static_cast<NativeOtaHotUpdateCxxSpecJSI *>(&turboModule)->deleteBundle(
|
|
23
|
+
rt,
|
|
24
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
static jsi::Value __hostFunction_NativeOtaHotUpdateCxxSpecJSI_restart(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
28
|
+
static_cast<NativeOtaHotUpdateCxxSpecJSI *>(&turboModule)->restart(
|
|
29
|
+
rt
|
|
30
|
+
);
|
|
31
|
+
return jsi::Value::undefined();
|
|
32
|
+
}
|
|
33
|
+
static jsi::Value __hostFunction_NativeOtaHotUpdateCxxSpecJSI_getCurrentVersion(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
34
|
+
return static_cast<NativeOtaHotUpdateCxxSpecJSI *>(&turboModule)->getCurrentVersion(
|
|
35
|
+
rt,
|
|
36
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
static jsi::Value __hostFunction_NativeOtaHotUpdateCxxSpecJSI_setCurrentVersion(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
40
|
+
return static_cast<NativeOtaHotUpdateCxxSpecJSI *>(&turboModule)->setCurrentVersion(
|
|
41
|
+
rt,
|
|
42
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
NativeOtaHotUpdateCxxSpecJSI::NativeOtaHotUpdateCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
47
|
+
: TurboModule("OtaHotUpdate", jsInvoker) {
|
|
48
|
+
methodMap_["setupBundlePath"] = MethodMetadata {2, __hostFunction_NativeOtaHotUpdateCxxSpecJSI_setupBundlePath};
|
|
49
|
+
methodMap_["deleteBundle"] = MethodMetadata {1, __hostFunction_NativeOtaHotUpdateCxxSpecJSI_deleteBundle};
|
|
50
|
+
methodMap_["restart"] = MethodMetadata {0, __hostFunction_NativeOtaHotUpdateCxxSpecJSI_restart};
|
|
51
|
+
methodMap_["getCurrentVersion"] = MethodMetadata {1, __hostFunction_NativeOtaHotUpdateCxxSpecJSI_getCurrentVersion};
|
|
52
|
+
methodMap_["setCurrentVersion"] = MethodMetadata {1, __hostFunction_NativeOtaHotUpdateCxxSpecJSI_setCurrentVersion};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleH.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <ReactCommon/TurboModule.h>
|
|
13
|
+
#include <react/bridging/Bridging.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class JSI_EXPORT NativeOtaHotUpdateCxxSpecJSI : public TurboModule {
|
|
19
|
+
protected:
|
|
20
|
+
NativeOtaHotUpdateCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
|
+
|
|
22
|
+
public:
|
|
23
|
+
virtual jsi::Value setupBundlePath(jsi::Runtime &rt, jsi::String path, jsi::String extension) = 0;
|
|
24
|
+
virtual jsi::Value deleteBundle(jsi::Runtime &rt, double i) = 0;
|
|
25
|
+
virtual void restart(jsi::Runtime &rt) = 0;
|
|
26
|
+
virtual jsi::Value getCurrentVersion(jsi::Runtime &rt, double a) = 0;
|
|
27
|
+
virtual jsi::Value setCurrentVersion(jsi::Runtime &rt, jsi::String version) = 0;
|
|
28
|
+
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
template <typename T>
|
|
32
|
+
class JSI_EXPORT NativeOtaHotUpdateCxxSpec : public TurboModule {
|
|
33
|
+
public:
|
|
34
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
35
|
+
return delegate_.get(rt, propName);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static constexpr std::string_view kModuleName = "OtaHotUpdate";
|
|
39
|
+
|
|
40
|
+
protected:
|
|
41
|
+
NativeOtaHotUpdateCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
42
|
+
: TurboModule(std::string{NativeOtaHotUpdateCxxSpec::kModuleName}, jsInvoker),
|
|
43
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
private:
|
|
47
|
+
class Delegate : public NativeOtaHotUpdateCxxSpecJSI {
|
|
48
|
+
public:
|
|
49
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
50
|
+
NativeOtaHotUpdateCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
jsi::Value setupBundlePath(jsi::Runtime &rt, jsi::String path, jsi::String extension) override {
|
|
55
|
+
static_assert(
|
|
56
|
+
bridging::getParameterCount(&T::setupBundlePath) == 3,
|
|
57
|
+
"Expected setupBundlePath(...) to have 3 parameters");
|
|
58
|
+
|
|
59
|
+
return bridging::callFromJs<jsi::Value>(
|
|
60
|
+
rt, &T::setupBundlePath, jsInvoker_, instance_, std::move(path), std::move(extension));
|
|
61
|
+
}
|
|
62
|
+
jsi::Value deleteBundle(jsi::Runtime &rt, double i) override {
|
|
63
|
+
static_assert(
|
|
64
|
+
bridging::getParameterCount(&T::deleteBundle) == 2,
|
|
65
|
+
"Expected deleteBundle(...) to have 2 parameters");
|
|
66
|
+
|
|
67
|
+
return bridging::callFromJs<jsi::Value>(
|
|
68
|
+
rt, &T::deleteBundle, jsInvoker_, instance_, std::move(i));
|
|
69
|
+
}
|
|
70
|
+
void restart(jsi::Runtime &rt) override {
|
|
71
|
+
static_assert(
|
|
72
|
+
bridging::getParameterCount(&T::restart) == 1,
|
|
73
|
+
"Expected restart(...) to have 1 parameters");
|
|
74
|
+
|
|
75
|
+
return bridging::callFromJs<void>(
|
|
76
|
+
rt, &T::restart, jsInvoker_, instance_);
|
|
77
|
+
}
|
|
78
|
+
jsi::Value getCurrentVersion(jsi::Runtime &rt, double a) override {
|
|
79
|
+
static_assert(
|
|
80
|
+
bridging::getParameterCount(&T::getCurrentVersion) == 2,
|
|
81
|
+
"Expected getCurrentVersion(...) to have 2 parameters");
|
|
82
|
+
|
|
83
|
+
return bridging::callFromJs<jsi::Value>(
|
|
84
|
+
rt, &T::getCurrentVersion, jsInvoker_, instance_, std::move(a));
|
|
85
|
+
}
|
|
86
|
+
jsi::Value setCurrentVersion(jsi::Runtime &rt, jsi::String version) override {
|
|
87
|
+
static_assert(
|
|
88
|
+
bridging::getParameterCount(&T::setCurrentVersion) == 2,
|
|
89
|
+
"Expected setCurrentVersion(...) to have 2 parameters");
|
|
90
|
+
|
|
91
|
+
return bridging::callFromJs<jsi::Value>(
|
|
92
|
+
rt, &T::setCurrentVersion, jsInvoker_, instance_, std::move(version));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private:
|
|
96
|
+
friend class NativeOtaHotUpdateCxxSpec;
|
|
97
|
+
T *instance_;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
Delegate delegate_;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing('OtaHotUpdate');
|
|
9
|
+
//# sourceMappingURL=NativeOtaHotUpdate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeOtaHotUpdate.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAUpCC,gCAAmB,CAACC,YAAY,CAAO,cAAc,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["download.d.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
const LINKING_ERROR = `The package 'react-native-ota-hot-update' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
9
|
+
ios: "- You have run 'pod install'\n",
|
|
10
|
+
default: ''
|
|
11
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
12
|
+
|
|
13
|
+
// @ts-expect-error
|
|
14
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
15
|
+
const OtaHotUpdateModule = isTurboModuleEnabled ? require('./NativeOtaHotUpdate').default : _reactNative.NativeModules.OtaHotUpdate;
|
|
16
|
+
const RNhotupdate = OtaHotUpdateModule ? OtaHotUpdateModule : new Proxy({}, {
|
|
17
|
+
get() {
|
|
18
|
+
throw new Error(LINKING_ERROR);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const downloadBundleFile = async (downloadManager, uri, headers, callback) => {
|
|
22
|
+
const res = await downloadManager.config({
|
|
23
|
+
fileCache: _reactNative.Platform.OS === 'android'
|
|
24
|
+
}).fetch('GET', uri, {
|
|
25
|
+
...headers
|
|
26
|
+
}).progress((received, total) => {
|
|
27
|
+
if (callback) {
|
|
28
|
+
callback(received, total);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return res.path();
|
|
32
|
+
};
|
|
33
|
+
function setupBundlePath(path, extension) {
|
|
34
|
+
return RNhotupdate.setupBundlePath(path, extension);
|
|
35
|
+
}
|
|
36
|
+
function deleteBundlePath() {
|
|
37
|
+
return RNhotupdate.deleteBundle(1);
|
|
38
|
+
}
|
|
39
|
+
function getCurrentVersion() {
|
|
40
|
+
return RNhotupdate.getCurrentVersion(0);
|
|
41
|
+
}
|
|
42
|
+
async function getVersionAsNumber() {
|
|
43
|
+
const rawVersion = await getCurrentVersion();
|
|
44
|
+
return +rawVersion;
|
|
45
|
+
}
|
|
46
|
+
function setCurrentVersion(version) {
|
|
47
|
+
return RNhotupdate.setCurrentVersion(version + '');
|
|
48
|
+
}
|
|
49
|
+
async function resetApp() {
|
|
50
|
+
RNhotupdate.restart();
|
|
51
|
+
}
|
|
52
|
+
function removeBundle(restartAfterRemoved) {
|
|
53
|
+
deleteBundlePath().then(data => {
|
|
54
|
+
if (data && restartAfterRemoved) {
|
|
55
|
+
setTimeout(() => {
|
|
56
|
+
resetApp();
|
|
57
|
+
}, 300);
|
|
58
|
+
if (data) {
|
|
59
|
+
setCurrentVersion(0);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
const installFail = (option, e) => {
|
|
65
|
+
option?.updateFail?.(JSON.stringify(e));
|
|
66
|
+
console.error('Download bundle fail', JSON.stringify(e));
|
|
67
|
+
};
|
|
68
|
+
async function downloadBundleUri(downloadManager, uri, version, option) {
|
|
69
|
+
if (!uri) {
|
|
70
|
+
installFail(option, 'Please give a valid URL!');
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (!version) {
|
|
74
|
+
installFail(option, 'Please give a valid version!');
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const currentVersion = await getVersionAsNumber();
|
|
78
|
+
if (version <= currentVersion) {
|
|
79
|
+
installFail(option, 'Please give a bigger version than the current version, the current version now has setted by: ' + currentVersion);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
const path = await downloadBundleFile(downloadManager, uri, option?.headers, option?.progress);
|
|
84
|
+
if (path) {
|
|
85
|
+
setupBundlePath(path, option?.extensionBundle).then(success => {
|
|
86
|
+
if (success) {
|
|
87
|
+
setCurrentVersion(version);
|
|
88
|
+
option?.updateSuccess?.();
|
|
89
|
+
if (option?.restartAfterInstall) {
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
resetApp();
|
|
92
|
+
}, 300);
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
installFail(option);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
} else {
|
|
99
|
+
installFail(option);
|
|
100
|
+
}
|
|
101
|
+
} catch (e) {
|
|
102
|
+
installFail(option, e);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
var _default = exports.default = {
|
|
106
|
+
setupBundlePath,
|
|
107
|
+
removeUpdate: removeBundle,
|
|
108
|
+
downloadBundleUri,
|
|
109
|
+
resetApp,
|
|
110
|
+
getCurrentVersion: getVersionAsNumber,
|
|
111
|
+
setCurrentVersion
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","isTurboModuleEnabled","global","__turboModuleProxy","OtaHotUpdateModule","NativeModules","OtaHotUpdate","RNhotupdate","Proxy","get","Error","downloadBundleFile","downloadManager","uri","headers","callback","res","config","fileCache","OS","fetch","progress","received","total","path","setupBundlePath","extension","deleteBundlePath","deleteBundle","getCurrentVersion","getVersionAsNumber","rawVersion","setCurrentVersion","version","resetApp","restart","removeBundle","restartAfterRemoved","then","data","setTimeout","installFail","option","e","updateFail","JSON","stringify","console","error","downloadBundleUri","currentVersion","extensionBundle","success","updateSuccess","restartAfterInstall","_default","exports","removeUpdate"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA,MAAMC,aAAa,GACjB,sFAAsF,GACtFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,kBAAkB,IAAI,IAAI;AAU9D,MAAMC,kBAAkB,GAAGH,oB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MAAM,EAAErB,QACV,CAAC;IACD,IAAIG,IAAI,EAAE;MACRC,eAAe,CAACD,IAAI,EAAEkB,MAAM,EAAES,eAAe,CAAC,CAACb,IAAI,CAAEc,OAAO,IAAK;QAC/D,IAAIA,OAAO,EAAE;UACXpB,iBAAiB,CAACC,OAAO,CAAC;UAC1BS,MAAM,EAAEW,aAAa,GAAG,CAAC;UACzB,IAAIX,MAAM,EAAEY,mBAAmB,EAAE;YAC/Bd,UAAU,CAAC,MAAM;cACfN,QAAQ,CAAC,CAAC;YACZ,CAAC,EAAE,GAAG,CAAC;UACT;QACF,CAAC,MAAM;UACLO,WAAW,CAACC,MAAM,CAAC;QACrB;MACF,CAAC,CAAC;IACJ,CAAC,MAAM;MACLD,WAAW,CAACC,MAAM,CAAC;IACrB;EACF,CAAC,CAAC,OAAOC,CAAC,EAAE;IACVF,WAAW,CAACC,MAAM,EAAEC,CAAC,CAAC;EACxB;AACF;AAAC,IAAAY,QAAA,GAAAC,OAAA,CAAAxD,OAAA,GAEc;EACbyB,eAAe;EACfgC,YAAY,EAAErB,YAAY;EAC1Ba,iBAAiB;EACjBf,QAAQ;EACRL,iBAAiB,EAAEC,kBAAkB;EACrCE;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeOtaHotUpdate.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAUlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,cAAc,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["download.d.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativeModules, Platform } from 'react-native';
|
|
4
|
+
const LINKING_ERROR = `The package 'react-native-ota-hot-update' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
5
|
+
ios: "- You have run 'pod install'\n",
|
|
6
|
+
default: ''
|
|
7
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
8
|
+
|
|
9
|
+
// @ts-expect-error
|
|
10
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
11
|
+
const OtaHotUpdateModule = isTurboModuleEnabled ? require('./NativeOtaHotUpdate').default : NativeModules.OtaHotUpdate;
|
|
12
|
+
const RNhotupdate = OtaHotUpdateModule ? OtaHotUpdateModule : new Proxy({}, {
|
|
13
|
+
get() {
|
|
14
|
+
throw new Error(LINKING_ERROR);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const downloadBundleFile = async (downloadManager, uri, headers, callback) => {
|
|
18
|
+
const res = await downloadManager.config({
|
|
19
|
+
fileCache: Platform.OS === 'android'
|
|
20
|
+
}).fetch('GET', uri, {
|
|
21
|
+
...headers
|
|
22
|
+
}).progress((received, total) => {
|
|
23
|
+
if (callback) {
|
|
24
|
+
callback(received, total);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return res.path();
|
|
28
|
+
};
|
|
29
|
+
function setupBundlePath(path, extension) {
|
|
30
|
+
return RNhotupdate.setupBundlePath(path, extension);
|
|
31
|
+
}
|
|
32
|
+
function deleteBundlePath() {
|
|
33
|
+
return RNhotupdate.deleteBundle(1);
|
|
34
|
+
}
|
|
35
|
+
function getCurrentVersion() {
|
|
36
|
+
return RNhotupdate.getCurrentVersion(0);
|
|
37
|
+
}
|
|
38
|
+
async function getVersionAsNumber() {
|
|
39
|
+
const rawVersion = await getCurrentVersion();
|
|
40
|
+
return +rawVersion;
|
|
41
|
+
}
|
|
42
|
+
function setCurrentVersion(version) {
|
|
43
|
+
return RNhotupdate.setCurrentVersion(version + '');
|
|
44
|
+
}
|
|
45
|
+
async function resetApp() {
|
|
46
|
+
RNhotupdate.restart();
|
|
47
|
+
}
|
|
48
|
+
function removeBundle(restartAfterRemoved) {
|
|
49
|
+
deleteBundlePath().then(data => {
|
|
50
|
+
if (data && restartAfterRemoved) {
|
|
51
|
+
setTimeout(() => {
|
|
52
|
+
resetApp();
|
|
53
|
+
}, 300);
|
|
54
|
+
if (data) {
|
|
55
|
+
setCurrentVersion(0);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const installFail = (option, e) => {
|
|
61
|
+
option?.updateFail?.(JSON.stringify(e));
|
|
62
|
+
console.error('Download bundle fail', JSON.stringify(e));
|
|
63
|
+
};
|
|
64
|
+
async function downloadBundleUri(downloadManager, uri, version, option) {
|
|
65
|
+
if (!uri) {
|
|
66
|
+
installFail(option, 'Please give a valid URL!');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (!version) {
|
|
70
|
+
installFail(option, 'Please give a valid version!');
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const currentVersion = await getVersionAsNumber();
|
|
74
|
+
if (version <= currentVersion) {
|
|
75
|
+
installFail(option, 'Please give a bigger version than the current version, the current version now has setted by: ' + currentVersion);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
const path = await downloadBundleFile(downloadManager, uri, option?.headers, option?.progress);
|
|
80
|
+
if (path) {
|
|
81
|
+
setupBundlePath(path, option?.extensionBundle).then(success => {
|
|
82
|
+
if (success) {
|
|
83
|
+
setCurrentVersion(version);
|
|
84
|
+
option?.updateSuccess?.();
|
|
85
|
+
if (option?.restartAfterInstall) {
|
|
86
|
+
setTimeout(() => {
|
|
87
|
+
resetApp();
|
|
88
|
+
}, 300);
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
installFail(option);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
} else {
|
|
95
|
+
installFail(option);
|
|
96
|
+
}
|
|
97
|
+
} catch (e) {
|
|
98
|
+
installFail(option, e);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
export default {
|
|
102
|
+
setupBundlePath,
|
|
103
|
+
removeUpdate: removeBundle,
|
|
104
|
+
downloadBundleUri,
|
|
105
|
+
resetApp,
|
|
106
|
+
getCurrentVersion: getVersionAsNumber,
|
|
107
|
+
setCurrentVersion
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","isTurboModuleEnabled","global","__turboModuleProxy","OtaHotUpdateModule","require","OtaHotUpdate","RNhotupdate","Proxy","get","Error","downloadBundleFile","downloadManager","uri","headers","callback","res","config","fileCache","OS","fetch","progress","received","total","path","setupBundlePath","extension","deleteBundlePath","deleteBundle","getCurrentVersion","getVersionAsNumber","rawVersion","setCurrentVersion","version","resetApp","restart","removeBundle","restartAfterRemoved","then","data","setTimeout","installFail","option","e","updateFail","JSON","stringify","console","error","downloadBundleUri","currentVersion","extensionBundle","success","updateSuccess","restartAfterInstall","removeUpdate"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAGtD,MAAMC,aAAa,GACjB,sFAAsF,GACtFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,kBAAkB,IAAI,IAAI;AAU9D,MAAMC,kBAAkB,GAAGH,oBAAoB,GAC3CI,OAAO,CAAC,sBAAsB,CAAC,CAACL,OAAO,GACvCL,aAAa,CAACW,YAAY;AAE9B,MAAMC,WAAW,GAAGH,kBAAkB,GAClCA,kBAAkB,GAClB,IAAII,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACb,aAAa,CAAC;EACh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AAIX,MAAM,EAAEY,mBAAmB,EAAE;YAC/Bd,UAAU,CAAC,MAAM;cACfN,QAAQ,CAAC,CAAC;YACZ,CAAC,EAAE,GAAG,CAAC;UACT;QACF,CAAC,MAAM;UACLO,WAAW,CAACC,MAAM,CAAC;QACrB;MACF,CAAC,CAAC;IACJ,CAAC,MAAM;MACLD,WAAW,CAACC,MAAM,CAAC;IACrB;EACF,CAAC,CAAC,OAAOC,CAAC,EAAE;IACVF,WAAW,CAACC,MAAM,EAAEC,CAAC,CAAC;EACxB;AACF;AAEA,eAAe;EACblB,eAAe;EACf8B,YAAY,EAAEnB,YAAY;EAC1Ba,iBAAiB;EACjBf,QAAQ;EACRL,iBAAiB,EAAEC,kBAAkB;EACrCE;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
setupBundlePath(path: string, extension: string): Promise<boolean>;
|
|
4
|
+
deleteBundle(i: number): Promise<boolean>;
|
|
5
|
+
restart(): void;
|
|
6
|
+
getCurrentVersion(a: number): Promise<string>;
|
|
7
|
+
setCurrentVersion(version: string): Promise<boolean>;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: Spec;
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=NativeOtaHotUpdate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeOtaHotUpdate.d.ts","sourceRoot":"","sources":["../../../../src/NativeOtaHotUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnE,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,OAAO,IAAI,IAAI,CAAC;IAChB,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtD;;AAED,wBAAsE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DownloadManager } from './download';
|
|
2
|
+
export interface UpdateOption {
|
|
3
|
+
headers?: object;
|
|
4
|
+
progress?(received: string, total: string): void;
|
|
5
|
+
updateSuccess?(): void;
|
|
6
|
+
updateFail?(message?: string): void;
|
|
7
|
+
restartAfterInstall?: boolean;
|
|
8
|
+
extensionBundle?: string;
|
|
9
|
+
}
|
|
10
|
+
declare function setupBundlePath(path: string, extension?: string): Promise<boolean>;
|
|
11
|
+
declare function getVersionAsNumber(): Promise<number>;
|
|
12
|
+
declare function setCurrentVersion(version: number): Promise<boolean>;
|
|
13
|
+
declare function resetApp(): Promise<void>;
|
|
14
|
+
declare function removeBundle(restartAfterRemoved?: boolean): void;
|
|
15
|
+
declare function downloadBundleUri(downloadManager: DownloadManager, uri: string, version: number, option?: UpdateOption): Promise<void>;
|
|
16
|
+
declare const _default: {
|
|
17
|
+
setupBundlePath: typeof setupBundlePath;
|
|
18
|
+
removeUpdate: typeof removeBundle;
|
|
19
|
+
downloadBundleUri: typeof downloadBundleUri;
|
|
20
|
+
resetApp: typeof resetApp;
|
|
21
|
+
getCurrentVersion: typeof getVersionAsNumber;
|
|
22
|
+
setCurrentVersion: typeof setCurrentVersion;
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAWlD,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACjD,aAAa,CAAC,IAAI,IAAI,CAAC;IACvB,UAAU,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAoCD,iBAAS,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAE3E;AAOD,iBAAe,kBAAkB,oBAGhC;AACD,iBAAS,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAE5D;AACD,iBAAe,QAAQ,kBAEtB;AACD,iBAAS,YAAY,CAAC,mBAAmB,CAAC,EAAE,OAAO,QAWlD;AAKD,iBAAe,iBAAiB,CAC9B,eAAe,EAAE,eAAe,EAChC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,YAAY,iBA8CtB;;;;;;;;;AAED,wBAOE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
setupBundlePath(path: string, extension: string): Promise<boolean>;
|
|
4
|
+
deleteBundle(i: number): Promise<boolean>;
|
|
5
|
+
restart(): void;
|
|
6
|
+
getCurrentVersion(a: number): Promise<string>;
|
|
7
|
+
setCurrentVersion(version: string): Promise<boolean>;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: Spec;
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=NativeOtaHotUpdate.d.ts.map
|