react-native-stallion 2.4.3-alpha.1 → 2.4.3-alpha.3
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/android/src/main/java/com/stallion/networkmanager/StallionPatchHandler.java +4 -1
- package/android/src/main/java/com/stallion/storage/StallionConfig.java +2 -10
- package/android/src/main/java/com/stallion/utils/StallionSlotManager.java +1 -0
- package/ios/main/StallionConfig.m +2 -6
- package/ios/main/StallionPatchHandler.swift +4 -1
- package/ios/main/StallionSlotManager.m +5 -4
- package/package.json +1 -1
|
@@ -50,7 +50,10 @@ public class StallionPatchHandler {
|
|
|
50
50
|
// Create a temporary directory for the patched bundle
|
|
51
51
|
File tempPatchedDir = new File(diffDir.getParent(), diffDir.getName() + "_patched_temp");
|
|
52
52
|
try {
|
|
53
|
-
//
|
|
53
|
+
// Clear any leftover temp dir, then copy base bundle
|
|
54
|
+
if (tempPatchedDir.exists()) {
|
|
55
|
+
StallionFileManager.deleteFileOrFolderSilently(tempPatchedDir);
|
|
56
|
+
}
|
|
54
57
|
StallionFileManager.copyDirectory(baseBundleDir, tempPatchedDir);
|
|
55
58
|
|
|
56
59
|
// Read and parse manifest.json
|
|
@@ -4,7 +4,6 @@ import android.content.Context;
|
|
|
4
4
|
import android.content.SharedPreferences;
|
|
5
5
|
import android.content.pm.PackageInfo;
|
|
6
6
|
import android.content.res.Resources;
|
|
7
|
-
import android.provider.Settings;
|
|
8
7
|
|
|
9
8
|
import org.json.JSONException;
|
|
10
9
|
import org.json.JSONObject;
|
|
@@ -53,7 +52,7 @@ public class StallionConfig {
|
|
|
53
52
|
);
|
|
54
53
|
this.publicSigningKey = stallionPublicKeyRes != 0 ? context.getString(stallionPublicKeyRes) : "";
|
|
55
54
|
|
|
56
|
-
// get or generate UID
|
|
55
|
+
// get or generate UID (random install-scoped UUID)
|
|
57
56
|
String cachedUniqueId = sharedPreferences.getString(
|
|
58
57
|
StallionConfigConstants.UNIQUE_ID_IDENTIFIER,
|
|
59
58
|
""
|
|
@@ -61,14 +60,7 @@ public class StallionConfig {
|
|
|
61
60
|
if(!cachedUniqueId.isEmpty()) {
|
|
62
61
|
this.uid = cachedUniqueId;
|
|
63
62
|
} else {
|
|
64
|
-
|
|
65
|
-
this.uid = Settings.Secure.getString(
|
|
66
|
-
context.getContentResolver(),
|
|
67
|
-
Settings.Secure.ANDROID_ID
|
|
68
|
-
);
|
|
69
|
-
} catch (Exception ignored) {
|
|
70
|
-
this.uid = UUID.randomUUID().toString();
|
|
71
|
-
}
|
|
63
|
+
this.uid = UUID.randomUUID().toString();
|
|
72
64
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
|
73
65
|
editor.putString(StallionConfigConstants.UNIQUE_ID_IDENTIFIER, this.uid);
|
|
74
66
|
editor.apply();
|
|
@@ -69,6 +69,7 @@ public class StallionSlotManager {
|
|
|
69
69
|
File newSlot = new File(baseFolderPath, StallionConfigConstants.PROD_DIRECTORY + StallionConfigConstants.NEW_FOLDER_SLOT);
|
|
70
70
|
File stableSlot = new File(baseFolderPath, StallionConfigConstants.PROD_DIRECTORY + StallionConfigConstants.STABLE_FOLDER_SLOT);
|
|
71
71
|
|
|
72
|
+
StallionFileManager.deleteFileOrFolderSilently(stableSlot);
|
|
72
73
|
StallionFileManager.copyDirectory(newSlot, stableSlot);
|
|
73
74
|
|
|
74
75
|
String newReleaseHash = stateManager.stallionMeta.getProdNewHash();
|
|
@@ -23,16 +23,12 @@
|
|
|
23
23
|
_lastUnverifiedHash = [defaults stringForKey:LAST_UNVERIFIED_KEY_IDENTIFIER] ?: @"";
|
|
24
24
|
_baseUrl = [defaults stringForKey:BASE_URL_IDENTIFIER] ?: @"";
|
|
25
25
|
|
|
26
|
+
// get or generate UID (random install-scoped UUID)
|
|
26
27
|
NSString *cachedUid = [defaults stringForKey:UNIQUE_ID_IDENTIFIER];
|
|
27
28
|
if (cachedUid && ![cachedUid isEqualToString:@""]) {
|
|
28
29
|
_uid = cachedUid;
|
|
29
30
|
} else {
|
|
30
|
-
NSString *newUid =
|
|
31
|
-
if ([UIDevice currentDevice].identifierForVendor) {
|
|
32
|
-
newUid = [UIDevice currentDevice].identifierForVendor.UUIDString;
|
|
33
|
-
} else {
|
|
34
|
-
newUid = [[NSUUID UUID] UUIDString];
|
|
35
|
-
}
|
|
31
|
+
NSString *newUid = [[NSUUID UUID] UUIDString];
|
|
36
32
|
[defaults setObject:newUid forKey:UNIQUE_ID_IDENTIFIER];
|
|
37
33
|
[defaults synchronize];
|
|
38
34
|
_uid = newUid;
|
|
@@ -54,7 +54,10 @@ class StallionPatchHandler {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
//
|
|
57
|
+
// Clear any leftover temp dir, then copy base bundle
|
|
58
|
+
if FileManager.default.fileExists(atPath: tempPatchedDir.path) {
|
|
59
|
+
try? FileManager.default.removeItem(at: tempPatchedDir)
|
|
60
|
+
}
|
|
58
61
|
StallionFileManager.copyFileOrDirectory(from: baseBundlePath, to: tempPatchedDir.path)
|
|
59
62
|
|
|
60
63
|
// Verify copy succeeded
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
StallionStateManager *stateManager = [StallionStateManager sharedInstance];
|
|
51
51
|
NSString *baseFolderPath = stateManager.stallionConfig.filesDirectory;
|
|
52
52
|
|
|
53
|
-
[StallionFileManager deleteFileOrFolderSilently:[NSString stringWithFormat:@"
|
|
54
|
-
[StallionFileManager deleteFileOrFolderSilently:[NSString stringWithFormat:@"
|
|
55
|
-
[StallionFileManager deleteFileOrFolderSilently:[NSString stringWithFormat:@"
|
|
53
|
+
[StallionFileManager deleteFileOrFolderSilently:[NSString stringWithFormat:@"%@/%@/%@", baseFolderPath, StallionObjConstants.prod_directory, StallionObjConstants.new_folder_slot]];
|
|
54
|
+
[StallionFileManager deleteFileOrFolderSilently:[NSString stringWithFormat:@"%@/%@/%@", baseFolderPath, StallionObjConstants.prod_directory, StallionObjConstants.stable_folder_slot]];
|
|
55
|
+
[StallionFileManager deleteFileOrFolderSilently:[NSString stringWithFormat:@"%@/%@/%@", baseFolderPath, StallionObjConstants.prod_directory, StallionObjConstants.temp_folder_slot]];
|
|
56
56
|
|
|
57
57
|
[stateManager clearStallionMeta];
|
|
58
58
|
}
|
|
@@ -74,7 +74,8 @@
|
|
|
74
74
|
NSString *newSlotPath = [NSString stringWithFormat:@"%@/%@/%@", baseFolderPath, StallionObjConstants.prod_directory, StallionObjConstants.new_folder_slot];
|
|
75
75
|
NSString *stableSlotPath = [NSString stringWithFormat:@"%@/%@/%@", baseFolderPath, StallionObjConstants.prod_directory, StallionObjConstants.stable_folder_slot];
|
|
76
76
|
|
|
77
|
-
[StallionFileManager
|
|
77
|
+
[StallionFileManager deleteFileOrFolderSilently:stableSlotPath];
|
|
78
|
+
[StallionFileManager copyFileOrDirectoryFrom:newSlotPath to:stableSlotPath];
|
|
78
79
|
|
|
79
80
|
NSString *newReleaseHash = stateManager.stallionMeta.prodNewHash;
|
|
80
81
|
[stateManager.stallionMeta setProdStableHash:newReleaseHash];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-stallion",
|
|
3
|
-
"version": "2.4.3-alpha.
|
|
3
|
+
"version": "2.4.3-alpha.3",
|
|
4
4
|
"description": "Official React Native OTA updates SDK — CodePush alternative with patch updates, rollback, and bundle signing.",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"types": "types/index.d.ts",
|