mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-09-16 11:31:37 +08:00
chore: cleanup
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#import "AppDelegate.h"
|
#import "AppDelegate.h"
|
||||||
|
#import "RCTPushy.h"
|
||||||
#import <React/RCTBridge.h>
|
#import <React/RCTBridge.h>
|
||||||
#import <React/RCTBundleURLProvider.h>
|
#import <React/RCTBundleURLProvider.h>
|
||||||
#import <React/RCTRootView.h>
|
#import <React/RCTRootView.h>
|
||||||
@@ -87,7 +87,7 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
|
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
|
||||||
#else
|
#else
|
||||||
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
|
return [RCTPushy bundleURL];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,6 +24,19 @@
|
|||||||
<string>1</string>
|
<string>1</string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>NSAppTransportSecurity</key>
|
||||||
|
<dict>
|
||||||
|
<key>NSAllowsArbitraryLoads</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSExceptionDomains</key>
|
||||||
|
<dict>
|
||||||
|
<key>localhost</key>
|
||||||
|
<dict>
|
||||||
|
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
<key>NSLocationWhenInUseUsageDescription</key>
|
<key>NSLocationWhenInUseUsageDescription</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
<key>UILaunchStoryboardName</key>
|
<key>UILaunchStoryboardName</key>
|
||||||
@@ -40,18 +53,5 @@
|
|||||||
</array>
|
</array>
|
||||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>NSAppTransportSecurity</key>
|
|
||||||
<dict>
|
|
||||||
<key>NSAllowsArbitraryLoads</key>
|
|
||||||
<true/>
|
|
||||||
<key>NSExceptionDomains</key>
|
|
||||||
<dict>
|
|
||||||
<key>localhost</key>
|
|
||||||
<dict>
|
|
||||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@@ -53,6 +53,7 @@ typedef NS_ENUM(NSInteger, PushyType) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static BOOL ignoreRollback = false;
|
static BOOL ignoreRollback = false;
|
||||||
|
static BOOL isUsingBundleUrl = false;
|
||||||
|
|
||||||
@implementation RCTPushy {
|
@implementation RCTPushy {
|
||||||
RCTPushyManager *_fileManager;
|
RCTPushyManager *_fileManager;
|
||||||
@@ -65,6 +66,7 @@ RCT_EXPORT_MODULE(RCTPushy);
|
|||||||
|
|
||||||
+ (NSURL *)bundleURL
|
+ (NSURL *)bundleURL
|
||||||
{
|
{
|
||||||
|
isUsingBundleUrl = true;
|
||||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
|
||||||
NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo];
|
NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo];
|
||||||
@@ -161,6 +163,7 @@ RCT_EXPORT_MODULE(RCTPushy);
|
|||||||
ret[@"uuid"] = [defaults objectForKey:keyUuid];
|
ret[@"uuid"] = [defaults objectForKey:keyUuid];
|
||||||
NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo];
|
NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo];
|
||||||
ret[@"currentVersion"] = [pushyInfo objectForKey:paramCurrentVersion];
|
ret[@"currentVersion"] = [pushyInfo objectForKey:paramCurrentVersion];
|
||||||
|
ret[@"isUsingBundleUrl"] = @(isUsingBundleUrl);
|
||||||
|
|
||||||
// clear isFirstTimemarked
|
// clear isFirstTimemarked
|
||||||
if (ret[@"isFirstTime"]) {
|
if (ret[@"isFirstTime"]) {
|
||||||
|
@@ -1,51 +1,45 @@
|
|||||||
/**
|
|
||||||
* @format
|
|
||||||
* @flow strict-local
|
|
||||||
*/
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
|
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
|
||||||
import { TurboModuleRegistry } from 'react-native';
|
import { TurboModuleRegistry } from 'react-native';
|
||||||
|
|
||||||
export interface Spec extends TurboModule {
|
export interface Spec extends TurboModule {
|
||||||
getConstants: () => {
|
getConstants: () => {
|
||||||
downloadRootDir: string,
|
downloadRootDir: string;
|
||||||
packageVersion: string,
|
packageVersion: string;
|
||||||
currentVersion: string,
|
currentVersion: string;
|
||||||
isFirstTime: boolean,
|
isFirstTime: boolean;
|
||||||
rolledBackVersion: string,
|
rolledBackVersion: string;
|
||||||
buildTime: string,
|
buildTime: string;
|
||||||
blockUpdate: Object,
|
blockUpdate: Object;
|
||||||
uuid: string,
|
uuid: string;
|
||||||
isUsingBundleUrl: boolean,
|
isUsingBundleUrl: boolean;
|
||||||
};
|
};
|
||||||
setLocalHashInfo(hash: string, info: string): Promise<void>;
|
setLocalHashInfo(hash: string, info: string): Promise<void>;
|
||||||
getLocalHashInfo(hash: string): Promise<string>;
|
getLocalHashInfo(hash: string): Promise<string>;
|
||||||
setUuid(uuid: string): Promise<void>;
|
setUuid(uuid: string): Promise<void>;
|
||||||
setBlockUpdate(options: { reason: string, until: number }): Promise<void>;
|
setBlockUpdate(options: { reason: string; until: number }): Promise<void>;
|
||||||
reloadUpdate(options: { hash: string }): Promise<void>;
|
reloadUpdate(options: { hash: string }): Promise<void>;
|
||||||
setNeedUpdate(options: { hash: string }): Promise<void>;
|
setNeedUpdate(options: { hash: string }): Promise<void>;
|
||||||
markSuccess(): Promise<void>;
|
markSuccess(): Promise<void>;
|
||||||
downloadPatchFromPpk(options: {
|
downloadPatchFromPpk(options: {
|
||||||
updateUrl: string,
|
updateUrl: string;
|
||||||
hash: string,
|
hash: string;
|
||||||
originHash: string,
|
originHash: string;
|
||||||
}): Promise<void>;
|
}): Promise<void>;
|
||||||
downloadPatchFromPackage(options: {
|
downloadPatchFromPackage(options: {
|
||||||
updateUrl: string,
|
updateUrl: string;
|
||||||
hash: string,
|
hash: string;
|
||||||
}): Promise<void>;
|
}): Promise<void>;
|
||||||
downloadFullUpdate(options: {
|
downloadFullUpdate(options: {
|
||||||
updateUrl: string,
|
updateUrl: string;
|
||||||
hash: string,
|
hash: string;
|
||||||
}): Promise<void>;
|
}): Promise<void>;
|
||||||
downloadAndInstallApk(options: {
|
downloadAndInstallApk(options: {
|
||||||
url: string,
|
url: string;
|
||||||
target: string,
|
target: string;
|
||||||
hash: string,
|
hash: string;
|
||||||
}): Promise<void>;
|
}): Promise<void>;
|
||||||
addListener(eventName: string): void;
|
addListener(eventName: string): void;
|
||||||
removeListeners(count: number): void;
|
removeListeners(count: number): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (TurboModuleRegistry.get<Spec>('Pushy'): ?Spec);
|
export default TurboModuleRegistry.get<Spec>('Pushy') as Spec | null;
|
@@ -44,7 +44,7 @@ export const buildTime = PushyConstants.buildTime;
|
|||||||
let blockUpdate = PushyConstants.blockUpdate;
|
let blockUpdate = PushyConstants.blockUpdate;
|
||||||
let uuid = PushyConstants.uuid;
|
let uuid = PushyConstants.uuid;
|
||||||
|
|
||||||
if (Platform.OS === 'android' && !PushyConstants.isUsingBundleUrl) {
|
if (!PushyConstants.isUsingBundleUrl) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'react-native-update模块无法加载,请对照文档检查Bundle URL的配置',
|
'react-native-update模块无法加载,请对照文档检查Bundle URL的配置',
|
||||||
);
|
);
|
||||||
|
@@ -1,8 +1,7 @@
|
|||||||
require 'json'
|
require 'json'
|
||||||
|
|
||||||
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
||||||
folly_version = '2021.06.28.00-v2'
|
|
||||||
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = package['name']
|
s.name = package['name']
|
||||||
s.version = package['version']
|
s.version = package['version']
|
||||||
@@ -41,18 +40,5 @@ Pod::Spec.new do |s|
|
|||||||
'android/jni/lzma/C/Lzma2Dec.{h,c}']
|
'android/jni/lzma/C/Lzma2Dec.{h,c}']
|
||||||
ss.private_header_files = 'ios/RCTPushy/HDiffPatch/**/*.h'
|
ss.private_header_files = 'ios/RCTPushy/HDiffPatch/**/*.h'
|
||||||
end
|
end
|
||||||
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
|
install_modules_dependencies(s)
|
||||||
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
||||||
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
||||||
s.pod_target_xcconfig = {
|
|
||||||
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
||||||
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
||||||
}
|
|
||||||
|
|
||||||
s.dependency "React-Codegen"
|
|
||||||
s.dependency "RCT-Folly", folly_version
|
|
||||||
s.dependency "RCTRequired"
|
|
||||||
s.dependency "RCTTypeSafety"
|
|
||||||
s.dependency "ReactCommon/turbomodule/core"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user