1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-11-01 05:43:11 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
sunnylqm
2019-11-16 00:31:30 +08:00
parent b489199572
commit ddc12186b0
60 changed files with 1142 additions and 1162 deletions

View File

@@ -1,80 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91C5EFFE1C76ECA90037E727"
BuildableName = "libRCTHotUpdate.a"
BlueprintName = "RCTHotUpdate"
ReferencedContainer = "container:RCTHotUpdate.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91C5EFFE1C76ECA90037E727"
BuildableName = "libRCTHotUpdate.a"
BlueprintName = "RCTHotUpdate"
ReferencedContainer = "container:RCTHotUpdate.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91C5EFFE1C76ECA90037E727"
BuildableName = "libRCTHotUpdate.a"
BlueprintName = "RCTHotUpdate"
ReferencedContainer = "container:RCTHotUpdate.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>RCTHotUpdate.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>22</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>91C5EFFE1C76ECA90037E727</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

View File

@@ -1,80 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91C5EFFE1C76ECA90037E727"
BuildableName = "libRCTHotUpdate.a"
BlueprintName = "RCTHotUpdate"
ReferencedContainer = "container:RCTHotUpdate.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91C5EFFE1C76ECA90037E727"
BuildableName = "libRCTHotUpdate.a"
BlueprintName = "RCTHotUpdate"
ReferencedContainer = "container:RCTHotUpdate.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "91C5EFFE1C76ECA90037E727"
BuildableName = "libRCTHotUpdate.a"
BlueprintName = "RCTHotUpdate"
ReferencedContainer = "container:RCTHotUpdate.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>RCTHotUpdate.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>91C5EFFE1C76ECA90037E727</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

View File

@@ -7,12 +7,12 @@
objects = {
/* Begin PBXBuildFile section */
91C5F0031C76ECA90037E727 /* RCTHotUpdate.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91C5F0021C76ECA90037E727 /* RCTHotUpdate.h */; };
91C5F0051C76ECA90037E727 /* RCTHotUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 91C5F0041C76ECA90037E727 /* RCTHotUpdate.m */; };
9F1BCB1D1CAE5937000EF2CB /* RCTHotUpdateManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F1BCB1C1CAE5937000EF2CB /* RCTHotUpdateManager.m */; };
91C5F0031C76ECA90037E727 /* RCTPushy.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91C5F0021C76ECA90037E727 /* RCTPushy.h */; };
91C5F0051C76ECA90037E727 /* RCTPushy.m in Sources */ = {isa = PBXBuildFile; fileRef = 91C5F0041C76ECA90037E727 /* RCTPushy.m */; };
9F1BCB1D1CAE5937000EF2CB /* RCTPushyManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F1BCB1C1CAE5937000EF2CB /* RCTPushyManager.m */; };
9F1BCB461CAF6B3E000EF2CB /* bspatch.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F1BCB3B1CAF6B3E000EF2CB /* bspatch.c */; };
9F1BCB4F1CAF6B68000EF2CB /* BSDiff.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F1BCB4E1CAF6B68000EF2CB /* BSDiff.m */; };
9F292F7D1C7C44290095945D /* RCTHotUpdateDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F292F7C1C7C44290095945D /* RCTHotUpdateDownloader.m */; };
9F292F7D1C7C44290095945D /* RCTPushyDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F292F7C1C7C44290095945D /* RCTPushyDownloader.m */; };
9F394D7D1C7C25DC00C794C0 /* aescrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F394D5B1C7C25DC00C794C0 /* aescrypt.c */; };
9F394D7E1C7C25DC00C794C0 /* aeskey.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F394D5C1C7C25DC00C794C0 /* aeskey.c */; };
9F394D7F1C7C25DC00C794C0 /* aestab.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F394D5E1C7C25DC00C794C0 /* aestab.c */; };
@@ -36,24 +36,24 @@
dstPath = "include/$(PRODUCT_NAME)";
dstSubfolderSpec = 16;
files = (
91C5F0031C76ECA90037E727 /* RCTHotUpdate.h in CopyFiles */,
91C5F0031C76ECA90037E727 /* RCTPushy.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
91C5EFFF1C76ECA90037E727 /* libRCTHotUpdate.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTHotUpdate.a; sourceTree = BUILT_PRODUCTS_DIR; };
91C5F0021C76ECA90037E727 /* RCTHotUpdate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTHotUpdate.h; sourceTree = "<group>"; };
91C5F0041C76ECA90037E727 /* RCTHotUpdate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTHotUpdate.m; sourceTree = "<group>"; };
9F1BCB1B1CAE5937000EF2CB /* RCTHotUpdateManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTHotUpdateManager.h; sourceTree = "<group>"; };
9F1BCB1C1CAE5937000EF2CB /* RCTHotUpdateManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTHotUpdateManager.m; sourceTree = "<group>"; };
91C5EFFF1C76ECA90037E727 /* libRCTPushy.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTPushy.a; sourceTree = BUILT_PRODUCTS_DIR; };
91C5F0021C76ECA90037E727 /* RCTPushy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTPushy.h; sourceTree = "<group>"; };
91C5F0041C76ECA90037E727 /* RCTPushy.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTPushy.m; sourceTree = "<group>"; };
9F1BCB1B1CAE5937000EF2CB /* RCTPushyManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPushyManager.h; sourceTree = "<group>"; };
9F1BCB1C1CAE5937000EF2CB /* RCTPushyManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPushyManager.m; sourceTree = "<group>"; };
9F1BCB3B1CAF6B3E000EF2CB /* bspatch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bspatch.c; sourceTree = "<group>"; };
9F1BCB3C1CAF6B3E000EF2CB /* bspatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bspatch.h; sourceTree = "<group>"; };
9F1BCB4D1CAF6B68000EF2CB /* BSDiff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSDiff.h; sourceTree = "<group>"; };
9F1BCB4E1CAF6B68000EF2CB /* BSDiff.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSDiff.m; sourceTree = "<group>"; };
9F292F7B1C7C44290095945D /* RCTHotUpdateDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTHotUpdateDownloader.h; sourceTree = "<group>"; };
9F292F7C1C7C44290095945D /* RCTHotUpdateDownloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTHotUpdateDownloader.m; sourceTree = "<group>"; };
9F292F7B1C7C44290095945D /* RCTPushyDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPushyDownloader.h; sourceTree = "<group>"; };
9F292F7C1C7C44290095945D /* RCTPushyDownloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPushyDownloader.m; sourceTree = "<group>"; };
9F394D591C7C25DC00C794C0 /* aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes.h; sourceTree = "<group>"; };
9F394D5A1C7C25DC00C794C0 /* aes_via_ace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes_via_ace.h; sourceTree = "<group>"; };
9F394D5B1C7C25DC00C794C0 /* aescrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aescrypt.c; sourceTree = "<group>"; };
@@ -105,7 +105,7 @@
91C5EFF61C76ECA90037E727 = {
isa = PBXGroup;
children = (
91C5F0011C76ECA90037E727 /* RCTHotUpdate */,
91C5F0011C76ECA90037E727 /* RCTPushy */,
91C5F0001C76ECA90037E727 /* Products */,
);
sourceTree = "<group>";
@@ -113,24 +113,24 @@
91C5F0001C76ECA90037E727 /* Products */ = {
isa = PBXGroup;
children = (
91C5EFFF1C76ECA90037E727 /* libRCTHotUpdate.a */,
91C5EFFF1C76ECA90037E727 /* libRCTPushy.a */,
);
name = Products;
sourceTree = "<group>";
};
91C5F0011C76ECA90037E727 /* RCTHotUpdate */ = {
91C5F0011C76ECA90037E727 /* RCTPushy */ = {
isa = PBXGroup;
children = (
9F1BCB381CAF6B3E000EF2CB /* BSDiff */,
9F394D571C7C25DC00C794C0 /* SSZipArchive */,
91C5F0021C76ECA90037E727 /* RCTHotUpdate.h */,
91C5F0041C76ECA90037E727 /* RCTHotUpdate.m */,
9F1BCB1B1CAE5937000EF2CB /* RCTHotUpdateManager.h */,
9F1BCB1C1CAE5937000EF2CB /* RCTHotUpdateManager.m */,
9F292F7B1C7C44290095945D /* RCTHotUpdateDownloader.h */,
9F292F7C1C7C44290095945D /* RCTHotUpdateDownloader.m */,
91C5F0021C76ECA90037E727 /* RCTPushy.h */,
91C5F0041C76ECA90037E727 /* RCTPushy.m */,
9F1BCB1B1CAE5937000EF2CB /* RCTPushyManager.h */,
9F1BCB1C1CAE5937000EF2CB /* RCTPushyManager.m */,
9F292F7B1C7C44290095945D /* RCTPushyDownloader.h */,
9F292F7C1C7C44290095945D /* RCTPushyDownloader.m */,
);
path = RCTHotUpdate;
path = RCTPushy;
sourceTree = "<group>";
};
9F1BCB381CAF6B3E000EF2CB /* BSDiff */ = {
@@ -213,9 +213,9 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
91C5EFFE1C76ECA90037E727 /* RCTHotUpdate */ = {
91C5EFFE1C76ECA90037E727 /* RCTPushy */ = {
isa = PBXNativeTarget;
buildConfigurationList = 91C5F0081C76ECA90037E727 /* Build configuration list for PBXNativeTarget "RCTHotUpdate" */;
buildConfigurationList = 91C5F0081C76ECA90037E727 /* Build configuration list for PBXNativeTarget "RCTPushy" */;
buildPhases = (
91C5EFFB1C76ECA90037E727 /* Sources */,
91C5EFFC1C76ECA90037E727 /* Frameworks */,
@@ -225,9 +225,9 @@
);
dependencies = (
);
name = RCTHotUpdate;
productName = RCTHotUpdate;
productReference = 91C5EFFF1C76ECA90037E727 /* libRCTHotUpdate.a */;
name = RCTPushy;
productName = RCTPushy;
productReference = 91C5EFFF1C76ECA90037E727 /* libRCTPushy.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
@@ -244,11 +244,12 @@
};
};
};
buildConfigurationList = 91C5EFFA1C76ECA90037E727 /* Build configuration list for PBXProject "RCTHotUpdate" */;
buildConfigurationList = 91C5EFFA1C76ECA90037E727 /* Build configuration list for PBXProject "RCTPushy" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 91C5EFF61C76ECA90037E727;
@@ -256,7 +257,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
91C5EFFE1C76ECA90037E727 /* RCTHotUpdate */,
91C5EFFE1C76ECA90037E727 /* RCTPushy */,
);
};
/* End PBXProject section */
@@ -271,20 +272,20 @@
9F394D871C7C25DC00C794C0 /* mztools.c in Sources */,
9F394D821C7C25DC00C794C0 /* hmac.c in Sources */,
9F394D881C7C25DC00C794C0 /* unzip.c in Sources */,
9F1BCB1D1CAE5937000EF2CB /* RCTHotUpdateManager.m in Sources */,
9F1BCB1D1CAE5937000EF2CB /* RCTPushyManager.m in Sources */,
9F1BCB4F1CAF6B68000EF2CB /* BSDiff.m in Sources */,
9F394D7E1C7C25DC00C794C0 /* aeskey.c in Sources */,
9F394D7F1C7C25DC00C794C0 /* aestab.c in Sources */,
9F394D7D1C7C25DC00C794C0 /* aescrypt.c in Sources */,
9F394D801C7C25DC00C794C0 /* entropy.c in Sources */,
9F292F7D1C7C44290095945D /* RCTHotUpdateDownloader.m in Sources */,
9F292F7D1C7C44290095945D /* RCTPushyDownloader.m in Sources */,
9F394D831C7C25DC00C794C0 /* prng.c in Sources */,
9F394D861C7C25DC00C794C0 /* ioapi.c in Sources */,
9F1BCB461CAF6B3E000EF2CB /* bspatch.c in Sources */,
9F394D8A1C7C25DC00C794C0 /* SSZipArchive.m in Sources */,
9F394D891C7C25DC00C794C0 /* zip.c in Sources */,
9F394D841C7C25DC00C794C0 /* pwd2key.c in Sources */,
91C5F0051C76ECA90037E727 /* RCTHotUpdate.m in Sources */,
91C5F0051C76ECA90037E727 /* RCTPushy.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -400,7 +401,7 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
91C5EFFA1C76ECA90037E727 /* Build configuration list for PBXProject "RCTHotUpdate" */ = {
91C5EFFA1C76ECA90037E727 /* Build configuration list for PBXProject "RCTPushy" */ = {
isa = XCConfigurationList;
buildConfigurations = (
91C5F0061C76ECA90037E727 /* Debug */,
@@ -409,7 +410,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
91C5F0081C76ECA90037E727 /* Build configuration list for PBXNativeTarget "RCTHotUpdate" */ = {
91C5F0081C76ECA90037E727 /* Build configuration list for PBXNativeTarget "RCTPushy" */ = {
isa = XCConfigurationList;
buildConfigurations = (
91C5F0091C76ECA90037E727 /* Debug */,

View File

@@ -1,6 +1,6 @@
//
// BSDiff.h
// RCTHotUpdate
// RCTPushy
//
// Created by lvbingru on 16/4/2.
// Copyright © 2016年 erica. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// BSDiff.m
// RCTHotUpdate
// RCTPushy
//
// Created by lvbingru on 16/4/2.
// Copyright © 2016 erica. All rights reserved.

View File

@@ -1,6 +1,6 @@
//
// RCTHotUpdate.h
// RCTHotUpdate
// RCTPushy.h
// RCTPushy
//
// Created by LvBingru on 2/19/16.
// Copyright © 2016 erica. All rights reserved.
@@ -12,7 +12,7 @@
#import "RCTBridgeModule.h"
#endif
@interface RCTHotUpdate : NSObject<RCTBridgeModule>
@interface RCTPushy : NSObject<RCTBridgeModule>
+ (NSURL *)bundleURL;

View File

@@ -1,14 +1,14 @@
//
// RCTHotUpdate.m
// RCTHotUpdate
// RCTPushy.m
// RCTPushy
//
// Created by LvBingru on 2/19/16.
// Copyright © 2016 erica. All rights reserved.
//
#import "RCTHotUpdate.h"
#import "RCTHotUpdateDownloader.h"
#import "RCTHotUpdateManager.h"
#import "RCTPushy.h"
#import "RCTPushyDownloader.h"
#import "RCTPushyManager.h"
#if __has_include(<React/RCTBridge.h>)
#import "React/RCTEventDispatcher.h"
@@ -21,15 +21,15 @@
#endif
//
static NSString *const keyUpdateInfo = @"REACTNATIVECN_HOTUPDATE_INFO_KEY";
static NSString *const keyPushyInfo = @"REACTNATIVECN_PUSHY_INFO_KEY";
static NSString *const paramPackageVersion = @"packageVersion";
static NSString *const paramLastVersion = @"lastVersion";
static NSString *const paramCurrentVersion = @"currentVersion";
static NSString *const paramIsFirstTime = @"isFirstTime";
static NSString *const paramIsFirstLoadOk = @"isFirstLoadOK";
static NSString *const keyFirstLoadMarked = @"REACTNATIVECN_HOTUPDATE_FIRSTLOADMARKED_KEY";
static NSString *const keyRolledBackMarked = @"REACTNATIVECN_HOTUPDATE_ROLLEDBACKMARKED_KEY";
static NSString *const KeyPackageUpdatedMarked = @"REACTNATIVECN_HOTUPDATE_ISPACKAGEUPDATEDMARKED_KEY";
static NSString *const keyFirstLoadMarked = @"REACTNATIVECN_PUSHY_FIRSTLOADMARKED_KEY";
static NSString *const keyRolledBackMarked = @"REACTNATIVECN_PUSHY_ROLLEDBACKMARKED_KEY";
static NSString *const KeyPackageUpdatedMarked = @"REACTNATIVECN_PUSHY_ISPACKAGEUPDATEDMARKED_KEY";
// app info
static NSString * const AppVersionKey = @"appVersion";
@@ -46,52 +46,52 @@ static NSString * const ERROR_BSDIFF = @"bsdiff error";
static NSString * const ERROR_FILE_OPERATION = @"file operation error";
// event def
static NSString * const EVENT_PROGRESS_DOWNLOAD = @"RCTHotUpdateDownloadProgress";
static NSString * const EVENT_PROGRESS_UNZIP = @"RCTHotUpdateUnzipProgress";
static NSString * const EVENT_PROGRESS_DOWNLOAD = @"RCTPushyDownloadProgress";
static NSString * const EVENT_PROGRESS_UNZIP = @"RCTPushyUnzipProgress";
static NSString * const PARAM_PROGRESS_HASHNAME = @"hashname";
static NSString * const PARAM_PROGRESS_RECEIVED = @"received";
static NSString * const PARAM_PROGRESS_TOTAL = @"total";
typedef NS_ENUM(NSInteger, HotUpdateType) {
HotUpdateTypeFullDownload = 1,
HotUpdateTypePatchFromPackage = 2,
HotUpdateTypePatchFromPpk = 3,
typedef NS_ENUM(NSInteger, PushyType) {
PushyTypeFullDownload = 1,
PushyTypePatchFromPackage = 2,
PushyTypePatchFromPpk = 3,
};
static BOOL ignoreRollback = false;
@implementation RCTHotUpdate {
RCTHotUpdateManager *_fileManager;
@implementation RCTPushy {
RCTPushyManager *_fileManager;
}
@synthesize bridge = _bridge;
@synthesize methodQueue = _methodQueue;
RCT_EXPORT_MODULE(RCTHotUpdate);
RCT_EXPORT_MODULE(RCTPushy);
+ (NSURL *)bundleURL
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *updateInfo = [defaults dictionaryForKey:keyUpdateInfo];
if (updateInfo) {
NSString *curPackageVersion = [RCTHotUpdate packageVersion];
NSString *packageVersion = [updateInfo objectForKey:paramPackageVersion];
NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo];
if (pushyInfo) {
NSString *curPackageVersion = [RCTPushy packageVersion];
NSString *packageVersion = [pushyInfo objectForKey:paramPackageVersion];
BOOL needClearUpdateInfo = ![curPackageVersion isEqualToString:packageVersion];
if (needClearUpdateInfo) {
[defaults setObject:nil forKey:keyUpdateInfo];
BOOL needClearPushyInfo = ![curPackageVersion isEqualToString:packageVersion];
if (needClearPushyInfo) {
[defaults setObject:nil forKey:keyPushyInfo];
[defaults setObject:@(YES) forKey:KeyPackageUpdatedMarked];
[defaults synchronize];
// ...need clear files later
}
else {
NSString *curVersion = updateInfo[paramCurrentVersion];
NSString *lastVersion = updateInfo[paramLastVersion];
NSString *curVersion = pushyInfo[paramCurrentVersion];
NSString *lastVersion = pushyInfo[paramLastVersion];
BOOL isFirstTime = [updateInfo[paramIsFirstTime] boolValue];
BOOL isFirstLoadOK = [updateInfo[paramIsFirstLoadOk] boolValue];
BOOL isFirstTime = [pushyInfo[paramIsFirstTime] boolValue];
BOOL isFirstLoadOK = [pushyInfo[paramIsFirstLoadOk] boolValue];
NSString *loadVersioin = curVersion;
BOOL needRollback = (!ignoreRollback && isFirstTime == NO && isFirstLoadOK == NO) || loadVersioin.length<=0;
@@ -104,11 +104,11 @@ RCT_EXPORT_MODULE(RCTHotUpdate);
paramIsFirstTime:@(NO),
paramIsFirstLoadOk:@(YES),
paramPackageVersion:curPackageVersion}
forKey:keyUpdateInfo];
forKey:keyPushyInfo];
}
else {
// roll back to bundle
[defaults setObject:nil forKey:keyUpdateInfo];
[defaults setObject:nil forKey:keyPushyInfo];
}
[defaults setObject:@(YES) forKey:keyRolledBackMarked];
[defaults synchronize];
@@ -118,15 +118,15 @@ RCT_EXPORT_MODULE(RCTHotUpdate);
// bundleURL may be called many times, ignore rollbacks before process restarted again.
ignoreRollback = true;
NSMutableDictionary *newInfo = [[NSMutableDictionary alloc] initWithDictionary:updateInfo];
NSMutableDictionary *newInfo = [[NSMutableDictionary alloc] initWithDictionary:pushyInfo];
newInfo[paramIsFirstTime] = @(NO);
[defaults setObject:newInfo forKey:keyUpdateInfo];
[defaults setObject:newInfo forKey:keyPushyInfo];
[defaults setObject:@(YES) forKey:keyFirstLoadMarked];
[defaults synchronize];
}
if (loadVersioin.length) {
NSString *downloadDir = [RCTHotUpdate downloadDir];
NSString *downloadDir = [RCTPushy downloadDir];
NSString *bundlePath = [[downloadDir stringByAppendingPathComponent:loadVersioin] stringByAppendingPathComponent:BUNDLE_FILE_NAME];
if ([[NSFileManager defaultManager] fileExistsAtPath:bundlePath isDirectory:NULL]) {
@@ -137,7 +137,7 @@ RCT_EXPORT_MODULE(RCTHotUpdate);
}
}
return [RCTHotUpdate binaryBundleURL];
return [RCTPushy binaryBundleURL];
}
+ (BOOL)requiresMainQueueSetup {
@@ -150,13 +150,13 @@ RCT_EXPORT_MODULE(RCTHotUpdate);
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSMutableDictionary *ret = [NSMutableDictionary new];
ret[@"downloadRootDir"] = [RCTHotUpdate downloadDir];
ret[@"packageVersion"] = [RCTHotUpdate packageVersion];
ret[@"buildTime"] = [RCTHotUpdate buildTime];
ret[@"downloadRootDir"] = [RCTPushy downloadDir];
ret[@"packageVersion"] = [RCTPushy packageVersion];
ret[@"buildTime"] = [RCTPushy buildTime];
ret[@"isRolledBack"] = [defaults objectForKey:keyRolledBackMarked];
ret[@"isFirstTime"] = [defaults objectForKey:keyFirstLoadMarked];
NSDictionary *updateInfo = [defaults dictionaryForKey:keyUpdateInfo];
ret[@"currentVersion"] = [updateInfo objectForKey:paramCurrentVersion];
NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo];
ret[@"currentVersion"] = [pushyInfo objectForKey:paramCurrentVersion];
// clear isFirstTimemarked
if ([[defaults objectForKey:keyFirstLoadMarked] boolValue]) {
@@ -183,7 +183,7 @@ RCT_EXPORT_MODULE(RCTHotUpdate);
{
self = [super init];
if (self) {
_fileManager = [RCTHotUpdateManager new];
_fileManager = [RCTPushyManager new];
}
return self;
}
@@ -192,7 +192,7 @@ RCT_EXPORT_METHOD(downloadUpdate:(NSDictionary *)options
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)
{
[self hotUpdate:HotUpdateTypeFullDownload options:options callback:^(NSError *error) {
[self doPushy:PushyTypeFullDownload options:options callback:^(NSError *error) {
if (error) {
reject([NSString stringWithFormat: @"%lu", (long)error.code], error.localizedDescription, error);
}
@@ -206,7 +206,7 @@ RCT_EXPORT_METHOD(downloadPatchFromPackage:(NSDictionary *)options
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)
{
[self hotUpdate:HotUpdateTypePatchFromPackage options:options callback:^(NSError *error) {
[self doPushy:PushyTypePatchFromPackage options:options callback:^(NSError *error) {
if (error) {
reject([NSString stringWithFormat: @"%lu", (long)error.code], error.localizedDescription, error);
}
@@ -220,7 +220,7 @@ RCT_EXPORT_METHOD(downloadPatchFromPpk:(NSDictionary *)options
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)
{
[self hotUpdate:HotUpdateTypePatchFromPpk options:options callback:^(NSError *error) {
[self doPushy:PushyTypePatchFromPpk options:options callback:^(NSError *error) {
if (error) {
reject([NSString stringWithFormat: @"%lu", (long)error.code], error.localizedDescription, error);
}
@@ -236,9 +236,9 @@ RCT_EXPORT_METHOD(setNeedUpdate:(NSDictionary *)options)
if (hashName.length) {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *lastVersion = nil;
if ([defaults objectForKey:keyUpdateInfo]) {
NSDictionary *updateInfo = [defaults objectForKey:keyUpdateInfo];
lastVersion = updateInfo[paramCurrentVersion];
if ([defaults objectForKey:keyPushyInfo]) {
NSDictionary *pushyInfo = [defaults objectForKey:keyPushyInfo];
lastVersion = pushyInfo[paramCurrentVersion];
}
NSMutableDictionary *newInfo = [[NSMutableDictionary alloc] init];
@@ -246,8 +246,8 @@ RCT_EXPORT_METHOD(setNeedUpdate:(NSDictionary *)options)
newInfo[paramLastVersion] = lastVersion;
newInfo[paramIsFirstTime] = @(YES);
newInfo[paramIsFirstLoadOk] = @(NO);
newInfo[paramPackageVersion] = [RCTHotUpdate packageVersion];
[defaults setObject:newInfo forKey:keyUpdateInfo];
newInfo[paramPackageVersion] = [RCTPushy packageVersion];
[defaults setObject:newInfo forKey:keyPushyInfo];
[defaults synchronize];
}
@@ -269,12 +269,12 @@ RCT_EXPORT_METHOD(reloadUpdate:(NSDictionary *)options)
RCT_EXPORT_METHOD(markSuccess)
{
// update package info
// up package info
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSMutableDictionary *packageInfo = [[NSMutableDictionary alloc] initWithDictionary:[defaults objectForKey:keyUpdateInfo]];
NSMutableDictionary *packageInfo = [[NSMutableDictionary alloc] initWithDictionary:[defaults objectForKey:keyPushyInfo]];
[packageInfo setObject:@(NO) forKey:paramIsFirstTime];
[packageInfo setObject:@(YES) forKey:paramIsFirstLoadOk];
[defaults setObject:packageInfo forKey:keyUpdateInfo];
[defaults setObject:packageInfo forKey:keyPushyInfo];
[defaults synchronize];
// clear other package dir
@@ -282,7 +282,7 @@ RCT_EXPORT_METHOD(markSuccess)
}
#pragma mark - private
- (void)hotUpdate:(HotUpdateType)type options:(NSDictionary *)options callback:(void (^)(NSError *error))callback
- (void)doPushy:(PushyType)type options:(NSDictionary *)options callback:(void (^)(NSError *error))callback
{
NSString *updateUrl = [RCTConvert NSString:options[@"updateUrl"]];
NSString *hashName = [RCTConvert NSString:options[@"hashName"]];
@@ -291,12 +291,12 @@ RCT_EXPORT_METHOD(markSuccess)
return;
}
NSString *originHashName = [RCTConvert NSString:options[@"originHashName"]];
if (type == HotUpdateTypePatchFromPpk && originHashName<=0) {
if (type == PushyTypePatchFromPpk && originHashName<=0) {
callback([self errorWithMessage:ERROR_OPTIONS]);
return;
}
NSString *dir = [RCTHotUpdate downloadDir];
NSString *dir = [RCTPushy downloadDir];
BOOL success = [_fileManager createDir:dir];
if (!success) {
callback([self errorWithMessage:ERROR_FILE_OPERATION]);
@@ -306,8 +306,8 @@ RCT_EXPORT_METHOD(markSuccess)
NSString *zipFilePath = [dir stringByAppendingPathComponent:[NSString stringWithFormat:@"%@%@",hashName, [self zipExtension:type]]];
NSString *unzipDir = [dir stringByAppendingPathComponent:hashName];
RCTLogInfo(@"RNUpdate -- download file %@", updateUrl);
[RCTHotUpdateDownloader download:updateUrl savePath:zipFilePath progressHandler:^(long long receivedBytes, long long totalBytes) {
RCTLogInfo(@"RCTPushy -- download file %@", updateUrl);
[RCTPushyDownloader download:updateUrl savePath:zipFilePath progressHandler:^(long long receivedBytes, long long totalBytes) {
[self.bridge.eventDispatcher sendAppEventWithName:EVENT_PROGRESS_DOWNLOAD
body:@{
PARAM_PROGRESS_HASHNAME:hashName,
@@ -319,7 +319,7 @@ RCT_EXPORT_METHOD(markSuccess)
callback(error);
}
else {
RCTLogInfo(@"RNUpdate -- unzip file %@", zipFilePath);
RCTLogInfo(@"RCTPushy -- unzip file %@", zipFilePath);
NSString *unzipFilePath = [dir stringByAppendingPathComponent:hashName];
[_fileManager unzipFileAtPath:zipFilePath toDestination:unzipFilePath progressHandler:^(NSString *entry,long entryNumber, long total) {
[self.bridge.eventDispatcher sendAppEventWithName:EVENT_PROGRESS_UNZIP
@@ -336,14 +336,14 @@ RCT_EXPORT_METHOD(markSuccess)
}
else {
switch (type) {
case HotUpdateTypePatchFromPackage:
case PushyTypePatchFromPackage:
{
NSString *sourceOrigin = [[NSBundle mainBundle] resourcePath];
NSString *bundleOrigin = [[RCTHotUpdate binaryBundleURL] path];
NSString *bundleOrigin = [[RCTPushy binaryBundleURL] path];
[self patch:hashName fromBundle:bundleOrigin source:sourceOrigin callback:callback];
}
break;
case HotUpdateTypePatchFromPpk:
case PushyTypePatchFromPpk:
{
NSString *lastVertionDir = [dir stringByAppendingPathComponent:originHashName];
@@ -365,7 +365,7 @@ RCT_EXPORT_METHOD(markSuccess)
- (void)patch:(NSString *)hashName fromBundle:(NSString *)bundleOrigin source:(NSString *)sourceOrigin callback:(void (^)(NSError *error))callback
{
NSString *unzipDir = [[RCTHotUpdate downloadDir] stringByAppendingPathComponent:hashName];
NSString *unzipDir = [[RCTPushy downloadDir] stringByAppendingPathComponent:hashName];
NSString *sourcePatch = [unzipDir stringByAppendingPathComponent:SOURCE_PATCH_NAME];
NSString *bundlePatch = [unzipDir stringByAppendingPathComponent:BUNDLE_PATCH_NAME];
@@ -401,10 +401,10 @@ RCT_EXPORT_METHOD(markSuccess)
- (void)clearInvalidFiles
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *updateInfo = [defaults objectForKey:keyUpdateInfo];
NSString *curVersion = [updateInfo objectForKey:paramCurrentVersion];
NSDictionary *pushyInfo = [defaults objectForKey:keyPushyInfo];
NSString *curVersion = [pushyInfo objectForKey:paramCurrentVersion];
NSString *downloadDir = [RCTHotUpdate downloadDir];
NSString *downloadDir = [RCTPushy downloadDir];
NSError *error = nil;
NSArray *list = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:downloadDir error:&error];
if (error) {
@@ -418,14 +418,14 @@ RCT_EXPORT_METHOD(markSuccess)
}
}
- (NSString *)zipExtension:(HotUpdateType)type
- (NSString *)zipExtension:(PushyType)type
{
switch (type) {
case HotUpdateTypeFullDownload:
case PushyTypeFullDownload:
return @".ppk";
case HotUpdateTypePatchFromPackage:
case PushyTypePatchFromPackage:
return @".apk.patch";
case HotUpdateTypePatchFromPpk:
case PushyTypePatchFromPpk:
return @".ppk.patch";
default:
break;
@@ -434,7 +434,7 @@ RCT_EXPORT_METHOD(markSuccess)
- (NSError *)errorWithMessage:(NSString *)errorMessage
{
return [NSError errorWithDomain:@"cn.reactnative.hotupdate"
return [NSError errorWithDomain:@"cn.reactnative.pushy"
code:-1
userInfo:@{ NSLocalizedDescriptionKey: errorMessage}];
}
@@ -442,7 +442,7 @@ RCT_EXPORT_METHOD(markSuccess)
+ (NSString *)downloadDir
{
NSString *directory = [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) firstObject];
NSString *downloadDir = [directory stringByAppendingPathComponent:@"reactnativecnhotupdate"];
NSString *downloadDir = [directory stringByAppendingPathComponent:@"rctpushy"];
return downloadDir;
}

View File

@@ -1,6 +1,6 @@
//
// RCTHotUpdateDownloader.h
// RCTHotUpdate
// RCTPushyDownloader.h
// RCTPushy
//
// Created by lvbingru on 16/2/23.
// Copyright © 2016年 erica. All rights reserved.
@@ -8,7 +8,7 @@
#import <Foundation/Foundation.h>
@interface RCTHotUpdateDownloader : NSObject
@interface RCTPushyDownloader : NSObject
+ (void)download:(NSString *)downloadPath savePath:(NSString *)savePath
progressHandler:(void (^)(long long, long long))progressHandler

View File

@@ -1,21 +1,21 @@
//
// RCTHotUpdateDownloader.m
// RCTHotUpdate
// RCTPushyDownloader.m
// RCTPushy
//
// Created by lvbingru on 16/2/23.
// Copyright © 2016 erica. All rights reserved.
//
#import "RCTHotUpdateDownloader.h"
#import "RCTPushyDownloader.h"
@interface RCTHotUpdateDownloader()<NSURLSessionDelegate>
@interface RCTPushyDownloader()<NSURLSessionDelegate>
@property (copy) void (^progressHandler)(long long, long long);
@property (copy) void (^completionHandler)(NSString*, NSError*);
@property (copy) NSString *savePath;
@end
@implementation RCTHotUpdateDownloader
@implementation RCTPushyDownloader
+ (void)download:(NSString *)downloadPath savePath:(NSString *)savePath
progressHandler:(void (^)(long long receivedBytes, long long totalBytes))progressHandler
@@ -24,7 +24,7 @@ completionHandler:(void (^)(NSString *path, NSError *error))completionHandler
NSAssert(downloadPath, @"no download path");
NSAssert(savePath, @"no save path");
RCTHotUpdateDownloader *downloader = [RCTHotUpdateDownloader new];
RCTPushyDownloader *downloader = [RCTPushyDownloader new];
downloader.progressHandler = progressHandler;
downloader.completionHandler = completionHandler;
downloader.savePath = savePath;

View File

@@ -1,6 +1,6 @@
//
// RCTHotUpdateManager.h
// RCTHotUpdate
// RCTPushyManager.h
// RCTPushy
//
// Created by lvbingru on 16/4/1.
// Copyright © 2016年 erica. All rights reserved.
@@ -8,7 +8,7 @@
#import <Foundation/Foundation.h>
@interface RCTHotUpdateManager : NSObject
@interface RCTPushyManager : NSObject
- (BOOL)createDir:(NSString *)dir;

View File

@@ -1,17 +1,17 @@
//
// RCTHotUpdateManager.m
// RCTHotUpdate
// RCTPushyManager.m
// RCTPushy
//
// Created by lvbingru on 16/4/1.
// Copyright © 2016 erica. All rights reserved.
//
#import "RCTHotUpdateManager.h"
#import "RCTPushyManager.h"
#import "ZipArchive.h"
#import "BSDiff.h"
#import "bspatch.h"
@implementation RCTHotUpdateManager {
@implementation RCTPushyManager {
dispatch_queue_t _opQueue;
}
@@ -19,7 +19,7 @@
{
self = [super init];
if (self) {
_opQueue = dispatch_queue_create("cn.reactnative.hotupdate", DISPATCH_QUEUE_SERIAL);
_opQueue = dispatch_queue_create("cn.reactnative.pushy", DISPATCH_QUEUE_SERIAL);
}
return self;
}

View File

@@ -1 +1 @@
1570371472
1573835204