chore: cleanup
This commit is contained in:
parent
8bf1fed3f8
commit
6d01ce5152
@ -1,5 +1,5 @@
|
||||
#import "AppDelegate.h"
|
||||
|
||||
#import "RCTPushy.h"
|
||||
#import <React/RCTBridge.h>
|
||||
#import <React/RCTBundleURLProvider.h>
|
||||
#import <React/RCTRootView.h>
|
||||
@ -87,7 +87,7 @@ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
|
||||
#if DEBUG
|
||||
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
|
||||
#else
|
||||
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
|
||||
return [RCTPushy bundleURL];
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,19 @@
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<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>
|
||||
<string></string>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
@ -40,18 +53,5 @@
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<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>
|
||||
</plist>
|
||||
|
@ -53,6 +53,7 @@ typedef NS_ENUM(NSInteger, PushyType) {
|
||||
};
|
||||
|
||||
static BOOL ignoreRollback = false;
|
||||
static BOOL isUsingBundleUrl = false;
|
||||
|
||||
@implementation RCTPushy {
|
||||
RCTPushyManager *_fileManager;
|
||||
@ -65,6 +66,7 @@ RCT_EXPORT_MODULE(RCTPushy);
|
||||
|
||||
+ (NSURL *)bundleURL
|
||||
{
|
||||
isUsingBundleUrl = true;
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo];
|
||||
@ -161,6 +163,7 @@ RCT_EXPORT_MODULE(RCTPushy);
|
||||
ret[@"uuid"] = [defaults objectForKey:keyUuid];
|
||||
NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo];
|
||||
ret[@"currentVersion"] = [pushyInfo objectForKey:paramCurrentVersion];
|
||||
ret[@"isUsingBundleUrl"] = @(isUsingBundleUrl);
|
||||
|
||||
// clear isFirstTimemarked
|
||||
if (ret[@"isFirstTime"]) {
|
||||
|
@ -1,51 +1,45 @@
|
||||
/**
|
||||
* @format
|
||||
* @flow strict-local
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
|
||||
import { TurboModuleRegistry } from 'react-native';
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
getConstants: () => {
|
||||
downloadRootDir: string,
|
||||
packageVersion: string,
|
||||
currentVersion: string,
|
||||
isFirstTime: boolean,
|
||||
rolledBackVersion: string,
|
||||
buildTime: string,
|
||||
blockUpdate: Object,
|
||||
uuid: string,
|
||||
isUsingBundleUrl: boolean,
|
||||
downloadRootDir: string;
|
||||
packageVersion: string;
|
||||
currentVersion: string;
|
||||
isFirstTime: boolean;
|
||||
rolledBackVersion: string;
|
||||
buildTime: string;
|
||||
blockUpdate: Object;
|
||||
uuid: string;
|
||||
isUsingBundleUrl: boolean;
|
||||
};
|
||||
setLocalHashInfo(hash: string, info: string): Promise<void>;
|
||||
getLocalHashInfo(hash: string): Promise<string>;
|
||||
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>;
|
||||
setNeedUpdate(options: { hash: string }): Promise<void>;
|
||||
markSuccess(): Promise<void>;
|
||||
downloadPatchFromPpk(options: {
|
||||
updateUrl: string,
|
||||
hash: string,
|
||||
originHash: string,
|
||||
updateUrl: string;
|
||||
hash: string;
|
||||
originHash: string;
|
||||
}): Promise<void>;
|
||||
downloadPatchFromPackage(options: {
|
||||
updateUrl: string,
|
||||
hash: string,
|
||||
updateUrl: string;
|
||||
hash: string;
|
||||
}): Promise<void>;
|
||||
downloadFullUpdate(options: {
|
||||
updateUrl: string,
|
||||
hash: string,
|
||||
updateUrl: string;
|
||||
hash: string;
|
||||
}): Promise<void>;
|
||||
downloadAndInstallApk(options: {
|
||||
url: string,
|
||||
target: string,
|
||||
hash: string,
|
||||
url: string;
|
||||
target: string;
|
||||
hash: string;
|
||||
}): Promise<void>;
|
||||
addListener(eventName: string): 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 uuid = PushyConstants.uuid;
|
||||
|
||||
if (Platform.OS === 'android' && !PushyConstants.isUsingBundleUrl) {
|
||||
if (!PushyConstants.isUsingBundleUrl) {
|
||||
throw new Error(
|
||||
'react-native-update模块无法加载,请对照文档检查Bundle URL的配置',
|
||||
);
|
||||
|
@ -1,8 +1,7 @@
|
||||
require '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|
|
||||
s.name = package['name']
|
||||
s.version = package['version']
|
||||
@ -41,18 +40,5 @@ Pod::Spec.new do |s|
|
||||
'android/jni/lzma/C/Lzma2Dec.{h,c}']
|
||||
ss.private_header_files = 'ios/RCTPushy/HDiffPatch/**/*.h'
|
||||
end
|
||||
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
|
||||
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
|
||||
install_modules_dependencies(s)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user