react-native-stallion 1.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/README.md +36 -0
- package/android/build.gradle +100 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +8 -0
- package/android/src/main/java/com/stallion/Stallion.java +26 -0
- package/android/src/main/java/com/stallion/StallionConstants.java +27 -0
- package/android/src/main/java/com/stallion/StallionDefaultErrorActivity.java +27 -0
- package/android/src/main/java/com/stallion/StallionModule.java +250 -0
- package/android/src/main/java/com/stallion/StallionPackage.java +29 -0
- package/android/src/main/java/com/stallion/StallionStorage.java +54 -0
- package/android/src/main/java/com/stallion/StallionZip.java +127 -0
- package/android/src/main/res/layout/stallion_default_error_activity.xml +60 -0
- package/android/src/noop/java/com/stallion/Stallion.java +13 -0
- package/android/src/noop/java/com/stallion/StallionConstants.java +10 -0
- package/android/src/noop/java/com/stallion/StallionModule.java +26 -0
- package/android/src/noop/java/com/stallion/StallionPackage.java +29 -0
- package/ios/Stallion.xcodeproj/project.pbxproj +283 -0
- package/ios/main/Stallion-Bridging-Header.h +3 -0
- package/ios/main/Stallion.m +21 -0
- package/ios/main/Stallion.swift +69 -0
- package/ios/main/StallionConstants.swift +42 -0
- package/ios/main/StallionDownloader.swift +124 -0
- package/ios/main/StallionModule.h +13 -0
- package/ios/main/StallionModule.m +71 -0
- package/ios/main/StallionUtil.swift +29 -0
- package/ios/noop/Stallion-Bridging-Header.h +2 -0
- package/ios/noop/Stallion.m +12 -0
- package/ios/noop/Stallion.swift +7 -0
- package/ios/noop/StallionModule.h +13 -0
- package/ios/noop/StallionModule.m +20 -0
- package/package.json +62 -0
- package/react-native-stallion.podspec +50 -0
- package/src/StallionNativeModule.js +5 -0
- package/src/StallionNativeModule.js.map +1 -0
- package/src/index.js +29 -0
- package/src/index.js.map +1 -0
- package/src/main/components/common/ButtonFullWidth/index.js +20 -0
- package/src/main/components/common/ButtonFullWidth/index.js.map +1 -0
- package/src/main/components/common/ButtonFullWidth/styles.js +42 -0
- package/src/main/components/common/ButtonFullWidth/styles.js.map +1 -0
- package/src/main/components/common/ErrorView/index.js +18 -0
- package/src/main/components/common/ErrorView/index.js.map +1 -0
- package/src/main/components/common/ErrorView/styles.js +20 -0
- package/src/main/components/common/ErrorView/styles.js.map +1 -0
- package/src/main/components/common/Footer/index.js +49 -0
- package/src/main/components/common/Footer/index.js.map +1 -0
- package/src/main/components/common/Footer/styles.js +76 -0
- package/src/main/components/common/Footer/styles.js.map +1 -0
- package/src/main/components/common/Header/index.js +50 -0
- package/src/main/components/common/Header/index.js.map +1 -0
- package/src/main/components/common/Header/styles.js +63 -0
- package/src/main/components/common/Header/styles.js.map +1 -0
- package/src/main/components/common/OverlayLoader/index.js +26 -0
- package/src/main/components/common/OverlayLoader/index.js.map +1 -0
- package/src/main/components/common/OverlayLoader/styles.js +33 -0
- package/src/main/components/common/OverlayLoader/styles.js.map +1 -0
- package/src/main/components/common/ProfileOverlay/index.js +39 -0
- package/src/main/components/common/ProfileOverlay/index.js.map +1 -0
- package/src/main/components/common/ProfileOverlay/styles.js +37 -0
- package/src/main/components/common/ProfileOverlay/styles.js.map +1 -0
- package/src/main/components/common/Spinner/index.js +9 -0
- package/src/main/components/common/Spinner/index.js.map +1 -0
- package/src/main/components/modules/listing/components/BucketCard.js +33 -0
- package/src/main/components/modules/listing/components/BucketCard.js.map +1 -0
- package/src/main/components/modules/listing/components/BucketCardInfoSection.js +56 -0
- package/src/main/components/modules/listing/components/BucketCardInfoSection.js.map +1 -0
- package/src/main/components/modules/listing/components/BundleCard.js +36 -0
- package/src/main/components/modules/listing/components/BundleCard.js.map +1 -0
- package/src/main/components/modules/listing/components/BundleCardInfoSection.js +72 -0
- package/src/main/components/modules/listing/components/BundleCardInfoSection.js.map +1 -0
- package/src/main/components/modules/listing/components/CardDescriptionContent.js +34 -0
- package/src/main/components/modules/listing/components/CardDescriptionContent.js.map +1 -0
- package/src/main/components/modules/listing/components/styles/index.js +65 -0
- package/src/main/components/modules/listing/components/styles/index.js.map +1 -0
- package/src/main/components/modules/listing/hooks/useListing.js +71 -0
- package/src/main/components/modules/listing/hooks/useListing.js.map +1 -0
- package/src/main/components/modules/listing/index.js +39 -0
- package/src/main/components/modules/listing/index.js.map +1 -0
- package/src/main/components/modules/listing/styles.js +12 -0
- package/src/main/components/modules/listing/styles.js.map +1 -0
- package/src/main/components/modules/login/components/Email.js +37 -0
- package/src/main/components/modules/login/components/Email.js.map +1 -0
- package/src/main/components/modules/login/components/Otp.js +41 -0
- package/src/main/components/modules/login/components/Otp.js.map +1 -0
- package/src/main/components/modules/login/components/styles/index.js +24 -0
- package/src/main/components/modules/login/components/styles/index.js.map +1 -0
- package/src/main/components/modules/login/hooks/useLoginFlow.js +60 -0
- package/src/main/components/modules/login/hooks/useLoginFlow.js.map +1 -0
- package/src/main/components/modules/login/index.js +54 -0
- package/src/main/components/modules/login/index.js.map +1 -0
- package/src/main/components/modules/login/styles/index.js +34 -0
- package/src/main/components/modules/login/styles/index.js.map +1 -0
- package/src/main/components/modules/modal/StallionModal.js +73 -0
- package/src/main/components/modules/modal/StallionModal.js.map +1 -0
- package/src/main/components/modules/modal/hooks/useStallionModal.js +92 -0
- package/src/main/components/modules/modal/hooks/useStallionModal.js.map +1 -0
- package/src/main/constants/apiConstants.js +10 -0
- package/src/main/constants/apiConstants.js.map +1 -0
- package/src/main/constants/appConstants.js +71 -0
- package/src/main/constants/appConstants.js.map +1 -0
- package/src/main/constants/colors.js +14 -0
- package/src/main/constants/colors.js.map +1 -0
- package/src/main/index.js +7 -0
- package/src/main/index.js.map +1 -0
- package/src/main/state/actionCreators/useBucketActions.js +37 -0
- package/src/main/state/actionCreators/useBucketActions.js.map +1 -0
- package/src/main/state/actionCreators/useBundleActions.js +45 -0
- package/src/main/state/actionCreators/useBundleActions.js.map +1 -0
- package/src/main/state/actionCreators/useDownloadActions.js +47 -0
- package/src/main/state/actionCreators/useDownloadActions.js.map +1 -0
- package/src/main/state/actionCreators/useMetaActions.js +19 -0
- package/src/main/state/actionCreators/useMetaActions.js.map +1 -0
- package/src/main/state/actionCreators/useUserActions.js +97 -0
- package/src/main/state/actionCreators/useUserActions.js.map +1 -0
- package/src/main/state/actions/bucketActions.js +19 -0
- package/src/main/state/actions/bucketActions.js.map +1 -0
- package/src/main/state/actions/bundleActions.js +25 -0
- package/src/main/state/actions/bundleActions.js.map +1 -0
- package/src/main/state/actions/downloadActions.js +19 -0
- package/src/main/state/actions/downloadActions.js.map +1 -0
- package/src/main/state/actions/metaActions.js +8 -0
- package/src/main/state/actions/metaActions.js.map +1 -0
- package/src/main/state/actions/userActions.js +31 -0
- package/src/main/state/actions/userActions.js.map +1 -0
- package/src/main/state/index.js +70 -0
- package/src/main/state/index.js.map +1 -0
- package/src/main/state/reducers/bucketReducer.js +36 -0
- package/src/main/state/reducers/bucketReducer.js.map +1 -0
- package/src/main/state/reducers/bundleReducer.js +47 -0
- package/src/main/state/reducers/bundleReducer.js.map +1 -0
- package/src/main/state/reducers/downloadReducer.js +39 -0
- package/src/main/state/reducers/downloadReducer.js.map +1 -0
- package/src/main/state/reducers/metaReducer.js +17 -0
- package/src/main/state/reducers/metaReducer.js.map +1 -0
- package/src/main/state/reducers/userReducer.js +70 -0
- package/src/main/state/reducers/userReducer.js.map +1 -0
- package/src/main/utils/ErrorBoundary.js +13 -0
- package/src/main/utils/ErrorBoundary.js.map +1 -0
- package/src/main/utils/SharedDataManager.js +25 -0
- package/src/main/utils/SharedDataManager.js.map +1 -0
- package/src/main/utils/StallionNaitveUtils.js +7 -0
- package/src/main/utils/StallionNaitveUtils.js.map +1 -0
- package/src/main/utils/apiUtils.js +16 -0
- package/src/main/utils/apiUtils.js.map +1 -0
- package/src/main/utils/dateUtil.js +39 -0
- package/src/main/utils/dateUtil.js.map +1 -0
- package/src/main/utils/errorUtil.js +10 -0
- package/src/main/utils/errorUtil.js.map +1 -0
- package/src/main/utils/useStallionModal.js +18 -0
- package/src/main/utils/useStallionModal.js.map +1 -0
- package/src/main/utils/withStallion.js +16 -0
- package/src/main/utils/withStallion.js.map +1 -0
- package/src/nativeScripts/getStallionEnabled.js +8 -0
- package/src/nativeScripts/getStallionEnabled.js.map +1 -0
- package/src/noop/useStallionModal.js +12 -0
- package/src/noop/useStallionModal.js.map +1 -0
- package/src/noop/withStallion.js +13 -0
- package/src/noop/withStallion.js.map +1 -0
- package/src/types/bucket.types.js +7 -0
- package/src/types/bucket.types.js.map +1 -0
- package/src/types/bundle.types.js +8 -0
- package/src/types/bundle.types.js.map +1 -0
- package/src/types/download.types.js +7 -0
- package/src/types/download.types.js.map +1 -0
- package/src/types/globalProvider.types.js +2 -0
- package/src/types/globalProvider.types.js.map +1 -0
- package/src/types/meta.types.js +6 -0
- package/src/types/meta.types.js.map +1 -0
- package/src/types/user.types.js +9 -0
- package/src/types/user.types.js.map +1 -0
- package/src/types/utils.types.js +2 -0
- package/src/types/utils.types.js.map +1 -0
- package/types/StallionNativeModule.d.ts +4 -0
- package/types/StallionNativeModule.d.ts.map +1 -0
- package/types/__tests__/index.test.d.ts +1 -0
- package/types/__tests__/index.test.d.ts.map +1 -0
- package/types/index.d.ts +4 -0
- package/types/index.d.ts.map +1 -0
- package/types/main/components/common/ButtonFullWidth/index.d.ts +10 -0
- package/types/main/components/common/ButtonFullWidth/index.d.ts.map +1 -0
- package/types/main/components/common/ButtonFullWidth/styles.d.ts +39 -0
- package/types/main/components/common/ButtonFullWidth/styles.d.ts.map +1 -0
- package/types/main/components/common/ErrorView/index.d.ts +7 -0
- package/types/main/components/common/ErrorView/index.d.ts.map +1 -0
- package/types/main/components/common/ErrorView/styles.d.ts +17 -0
- package/types/main/components/common/ErrorView/styles.d.ts.map +1 -0
- package/types/main/components/common/Footer/index.d.ts +13 -0
- package/types/main/components/common/Footer/index.d.ts.map +1 -0
- package/types/main/components/common/Footer/styles.d.ts +73 -0
- package/types/main/components/common/Footer/styles.d.ts.map +1 -0
- package/types/main/components/common/Header/index.d.ts +11 -0
- package/types/main/components/common/Header/index.d.ts.map +1 -0
- package/types/main/components/common/Header/styles.d.ts +59 -0
- package/types/main/components/common/Header/styles.d.ts.map +1 -0
- package/types/main/components/common/OverlayLoader/index.d.ts +7 -0
- package/types/main/components/common/OverlayLoader/index.d.ts.map +1 -0
- package/types/main/components/common/OverlayLoader/styles.d.ts +30 -0
- package/types/main/components/common/OverlayLoader/styles.d.ts.map +1 -0
- package/types/main/components/common/ProfileOverlay/index.d.ts +10 -0
- package/types/main/components/common/ProfileOverlay/index.d.ts.map +1 -0
- package/types/main/components/common/ProfileOverlay/styles.d.ts +34 -0
- package/types/main/components/common/ProfileOverlay/styles.d.ts.map +1 -0
- package/types/main/components/common/Spinner/index.d.ts +4 -0
- package/types/main/components/common/Spinner/index.d.ts.map +1 -0
- package/types/main/components/modules/listing/components/BucketCard.d.ts +13 -0
- package/types/main/components/modules/listing/components/BucketCard.d.ts.map +1 -0
- package/types/main/components/modules/listing/components/BucketCardInfoSection.d.ts +11 -0
- package/types/main/components/modules/listing/components/BucketCardInfoSection.d.ts.map +1 -0
- package/types/main/components/modules/listing/components/BundleCard.d.ts +14 -0
- package/types/main/components/modules/listing/components/BundleCard.d.ts.map +1 -0
- package/types/main/components/modules/listing/components/BundleCardInfoSection.d.ts +12 -0
- package/types/main/components/modules/listing/components/BundleCardInfoSection.d.ts.map +1 -0
- package/types/main/components/modules/listing/components/CardDescriptionContent.d.ts +8 -0
- package/types/main/components/modules/listing/components/CardDescriptionContent.d.ts.map +1 -0
- package/types/main/components/modules/listing/components/styles/index.d.ts +62 -0
- package/types/main/components/modules/listing/components/styles/index.d.ts.map +1 -0
- package/types/main/components/modules/listing/hooks/useListing.d.ts +11 -0
- package/types/main/components/modules/listing/hooks/useListing.d.ts.map +1 -0
- package/types/main/components/modules/listing/index.d.ts +4 -0
- package/types/main/components/modules/listing/index.d.ts.map +1 -0
- package/types/main/components/modules/listing/styles.d.ts +10 -0
- package/types/main/components/modules/listing/styles.d.ts.map +1 -0
- package/types/main/components/modules/login/components/Email.d.ts +13 -0
- package/types/main/components/modules/login/components/Email.d.ts.map +1 -0
- package/types/main/components/modules/login/components/Otp.d.ts +12 -0
- package/types/main/components/modules/login/components/Otp.d.ts.map +1 -0
- package/types/main/components/modules/login/components/styles/index.d.ts +21 -0
- package/types/main/components/modules/login/components/styles/index.d.ts.map +1 -0
- package/types/main/components/modules/login/hooks/useLoginFlow.d.ts +18 -0
- package/types/main/components/modules/login/hooks/useLoginFlow.d.ts.map +1 -0
- package/types/main/components/modules/login/index.d.ts +4 -0
- package/types/main/components/modules/login/index.d.ts.map +1 -0
- package/types/main/components/modules/login/styles/index.d.ts +31 -0
- package/types/main/components/modules/login/styles/index.d.ts.map +1 -0
- package/types/main/components/modules/modal/StallionModal.d.ts +4 -0
- package/types/main/components/modules/modal/StallionModal.d.ts.map +1 -0
- package/types/main/components/modules/modal/hooks/useStallionModal.d.ts +23 -0
- package/types/main/components/modules/modal/hooks/useStallionModal.d.ts.map +1 -0
- package/types/main/constants/apiConstants.d.ts +9 -0
- package/types/main/constants/apiConstants.d.ts.map +1 -0
- package/types/main/constants/appConstants.d.ts +65 -0
- package/types/main/constants/appConstants.d.ts.map +1 -0
- package/types/main/constants/colors.d.ts +14 -0
- package/types/main/constants/colors.d.ts.map +1 -0
- package/types/main/index.d.ts +7 -0
- package/types/main/index.d.ts.map +1 -0
- package/types/main/state/actionCreators/useBucketActions.d.ts +7 -0
- package/types/main/state/actionCreators/useBucketActions.d.ts.map +1 -0
- package/types/main/state/actionCreators/useBundleActions.d.ts +8 -0
- package/types/main/state/actionCreators/useBundleActions.d.ts.map +1 -0
- package/types/main/state/actionCreators/useDownloadActions.d.ts +7 -0
- package/types/main/state/actionCreators/useDownloadActions.d.ts.map +1 -0
- package/types/main/state/actionCreators/useMetaActions.d.ts +7 -0
- package/types/main/state/actionCreators/useMetaActions.d.ts.map +1 -0
- package/types/main/state/actionCreators/useUserActions.d.ts +12 -0
- package/types/main/state/actionCreators/useUserActions.d.ts.map +1 -0
- package/types/main/state/actions/bucketActions.d.ts +5 -0
- package/types/main/state/actions/bucketActions.d.ts.map +1 -0
- package/types/main/state/actions/bundleActions.d.ts +6 -0
- package/types/main/state/actions/bundleActions.d.ts.map +1 -0
- package/types/main/state/actions/downloadActions.d.ts +5 -0
- package/types/main/state/actions/downloadActions.d.ts.map +1 -0
- package/types/main/state/actions/metaActions.d.ts +3 -0
- package/types/main/state/actions/metaActions.d.ts.map +1 -0
- package/types/main/state/actions/userActions.d.ts +7 -0
- package/types/main/state/actions/userActions.d.ts.map +1 -0
- package/types/main/state/index.d.ts +6 -0
- package/types/main/state/index.d.ts.map +1 -0
- package/types/main/state/reducers/bucketReducer.d.ts +4 -0
- package/types/main/state/reducers/bucketReducer.d.ts.map +1 -0
- package/types/main/state/reducers/bundleReducer.d.ts +4 -0
- package/types/main/state/reducers/bundleReducer.d.ts.map +1 -0
- package/types/main/state/reducers/downloadReducer.d.ts +4 -0
- package/types/main/state/reducers/downloadReducer.d.ts.map +1 -0
- package/types/main/state/reducers/metaReducer.d.ts +4 -0
- package/types/main/state/reducers/metaReducer.d.ts.map +1 -0
- package/types/main/state/reducers/userReducer.d.ts +4 -0
- package/types/main/state/reducers/userReducer.d.ts.map +1 -0
- package/types/main/utils/ErrorBoundary.d.ts +7 -0
- package/types/main/utils/ErrorBoundary.d.ts.map +1 -0
- package/types/main/utils/SharedDataManager.d.ts +14 -0
- package/types/main/utils/SharedDataManager.d.ts.map +1 -0
- package/types/main/utils/StallionNaitveUtils.d.ts +7 -0
- package/types/main/utils/StallionNaitveUtils.d.ts.map +1 -0
- package/types/main/utils/apiUtils.d.ts +7 -0
- package/types/main/utils/apiUtils.d.ts.map +1 -0
- package/types/main/utils/dateUtil.d.ts +3 -0
- package/types/main/utils/dateUtil.d.ts.map +1 -0
- package/types/main/utils/errorUtil.d.ts +10 -0
- package/types/main/utils/errorUtil.d.ts.map +1 -0
- package/types/main/utils/useStallionModal.d.ts +4 -0
- package/types/main/utils/useStallionModal.d.ts.map +1 -0
- package/types/main/utils/withStallion.d.ts +4 -0
- package/types/main/utils/withStallion.d.ts.map +1 -0
- package/types/noop/useStallionModal.d.ts +4 -0
- package/types/noop/useStallionModal.d.ts.map +1 -0
- package/types/noop/withStallion.d.ts +4 -0
- package/types/noop/withStallion.d.ts.map +1 -0
- package/types/types/bucket.types.d.ts +33 -0
- package/types/types/bucket.types.d.ts.map +1 -0
- package/types/types/bundle.types.d.ts +41 -0
- package/types/types/bundle.types.d.ts.map +1 -0
- package/types/types/download.types.d.ts +27 -0
- package/types/types/download.types.d.ts.map +1 -0
- package/types/types/globalProvider.types.d.ts +36 -0
- package/types/types/globalProvider.types.d.ts.map +1 -0
- package/types/types/meta.types.d.ts +15 -0
- package/types/types/meta.types.d.ts.map +1 -0
- package/types/types/user.types.d.ts +40 -0
- package/types/types/user.types.d.ts.map +1 -0
- package/types/types/utils.types.d.ts +26 -0
- package/types/types/utils.types.d.ts.map +1 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
package com.stallion;
|
|
2
|
+
|
|
3
|
+
import static android.content.ContentValues.TAG;
|
|
4
|
+
|
|
5
|
+
import android.os.Build;
|
|
6
|
+
import android.util.Log;
|
|
7
|
+
|
|
8
|
+
import java.io.BufferedOutputStream;
|
|
9
|
+
import java.io.File;
|
|
10
|
+
import java.io.FileOutputStream;
|
|
11
|
+
import java.io.IOException;
|
|
12
|
+
import java.io.InputStream;
|
|
13
|
+
import java.io.OutputStream;
|
|
14
|
+
import java.nio.charset.Charset;
|
|
15
|
+
import java.util.Enumeration;
|
|
16
|
+
import java.util.zip.ZipEntry;
|
|
17
|
+
import java.util.zip.ZipFile;
|
|
18
|
+
|
|
19
|
+
public class StallionZip {
|
|
20
|
+
private static final int BUF_SIZE = 0x1000;
|
|
21
|
+
|
|
22
|
+
public static void unzipFile(final String zipFilePath, final String destDirectory) {
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
if (!new File(zipFilePath).exists()) {
|
|
26
|
+
throw new Error("File not exists");
|
|
27
|
+
}
|
|
28
|
+
} catch (NullPointerException e) {
|
|
29
|
+
throw new Error(e);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
String charset = "UTF-8";
|
|
34
|
+
|
|
35
|
+
File destDir = new File(destDirectory);
|
|
36
|
+
if (!destDir.exists()) {
|
|
37
|
+
destDir.mkdirs();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
ZipFile zipFile = null;
|
|
42
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
43
|
+
zipFile = new ZipFile(zipFilePath, Charset.forName(charset));
|
|
44
|
+
} else {
|
|
45
|
+
zipFile = new ZipFile(zipFilePath);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
final Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
|
49
|
+
Log.d(TAG, "Zip has " + zipFile.size() + " entries");
|
|
50
|
+
while (entries.hasMoreElements()) {
|
|
51
|
+
final ZipEntry entry = entries.nextElement();
|
|
52
|
+
if (entry.isDirectory()) continue;
|
|
53
|
+
|
|
54
|
+
File fout = new File(destDirectory, entry.getName());
|
|
55
|
+
String canonicalPath = fout.getCanonicalPath();
|
|
56
|
+
String destDirCanonicalPath = (new File(destDirectory).getCanonicalPath()) + File.separator;
|
|
57
|
+
|
|
58
|
+
if (!canonicalPath.startsWith(destDirCanonicalPath)) {
|
|
59
|
+
throw new SecurityException(String.format("Found Zip Path Traversal Vulnerability with %s", canonicalPath));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (!fout.exists()) {
|
|
63
|
+
(new File(fout.getParent())).mkdirs();
|
|
64
|
+
}
|
|
65
|
+
InputStream in = null;
|
|
66
|
+
BufferedOutputStream Bout = null;
|
|
67
|
+
try {
|
|
68
|
+
in = zipFile.getInputStream(entry);
|
|
69
|
+
Bout = new BufferedOutputStream(new FileOutputStream(fout));
|
|
70
|
+
copy(in, Bout);
|
|
71
|
+
Bout.close();
|
|
72
|
+
in.close();
|
|
73
|
+
} catch (IOException ex) {
|
|
74
|
+
if (in != null) {
|
|
75
|
+
try {
|
|
76
|
+
in.close();
|
|
77
|
+
} catch (Exception ignored) {
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (Bout != null) {
|
|
81
|
+
try {
|
|
82
|
+
Bout.close();
|
|
83
|
+
} catch (Exception ignored) {
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
zipFile.close();
|
|
90
|
+
Log.d("", destDirectory);
|
|
91
|
+
} catch (Exception ex) {
|
|
92
|
+
throw new Error(ex);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
private static long copy(InputStream from, OutputStream to) throws IOException {
|
|
98
|
+
byte[] buf = new byte[BUF_SIZE];
|
|
99
|
+
long total = 0;
|
|
100
|
+
while (true) {
|
|
101
|
+
int r = from.read(buf);
|
|
102
|
+
if (r == -1) {
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
to.write(buf, 0, r);
|
|
106
|
+
total += r;
|
|
107
|
+
}
|
|
108
|
+
return total;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
public static void deleteFileOrFolderSilently(File file) {
|
|
112
|
+
if (file.isDirectory()) {
|
|
113
|
+
File[] files = file.listFiles();
|
|
114
|
+
for (File fileEntry : files) {
|
|
115
|
+
if (fileEntry.isDirectory()) {
|
|
116
|
+
deleteFileOrFolderSilently(fileEntry);
|
|
117
|
+
} else {
|
|
118
|
+
fileEntry.delete();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (!file.delete()) {
|
|
124
|
+
throw new Error("Error deleting file " + file.getName());
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
4
|
+
xmlns:tools="http://schemas.android.com/tools"
|
|
5
|
+
android:layout_width="match_parent"
|
|
6
|
+
android:layout_height="match_parent"
|
|
7
|
+
android:fillViewport="true"
|
|
8
|
+
android:background="#FFF"
|
|
9
|
+
android:orientation="vertical"
|
|
10
|
+
android:visibility="visible">
|
|
11
|
+
<LinearLayout
|
|
12
|
+
android:padding="20dp"
|
|
13
|
+
android:layout_width="match_parent"
|
|
14
|
+
android:orientation="vertical"
|
|
15
|
+
android:layout_height="wrap_content">
|
|
16
|
+
<TextView
|
|
17
|
+
android:layout_width="match_parent"
|
|
18
|
+
android:layout_height="wrap_content"
|
|
19
|
+
android:textSize="20sp"
|
|
20
|
+
android:gravity="center"
|
|
21
|
+
android:textStyle="bold"
|
|
22
|
+
android:textColor="#000"
|
|
23
|
+
android:padding="10dp"
|
|
24
|
+
android:text="Stallion Error Boundary"/>
|
|
25
|
+
|
|
26
|
+
<TextView
|
|
27
|
+
android:id="@+id/textView"
|
|
28
|
+
android:layout_width="match_parent"
|
|
29
|
+
android:layout_height="wrap_content"
|
|
30
|
+
android:gravity="center"
|
|
31
|
+
android:textColor="#000"
|
|
32
|
+
android:padding="10dp"
|
|
33
|
+
android:layout_margin="10dp"
|
|
34
|
+
android:text="A crash occurred in the app. We have switched Stallion off. Check crash report below. Continue crash to invoke other exception handlers." />
|
|
35
|
+
<Button
|
|
36
|
+
android:id="@+id/seb_continue_button"
|
|
37
|
+
android:layout_width="match_parent"
|
|
38
|
+
android:layout_height="wrap_content"
|
|
39
|
+
android:background="#4f46e5"
|
|
40
|
+
android:textColor="#fff"
|
|
41
|
+
android:text="Continue Crash"/>
|
|
42
|
+
<TextView
|
|
43
|
+
android:id="@+id/seb_stack_trace_header"
|
|
44
|
+
android:layout_width="match_parent"
|
|
45
|
+
android:layout_height="wrap_content"
|
|
46
|
+
android:gravity="center"
|
|
47
|
+
android:textStyle="bold"
|
|
48
|
+
android:layout_margin="10dp"
|
|
49
|
+
android:text="Exception Stack Trace -"
|
|
50
|
+
/>
|
|
51
|
+
<TextView
|
|
52
|
+
android:id="@+id/seb_stack_trace_text_view"
|
|
53
|
+
android:layout_width="match_parent"
|
|
54
|
+
android:layout_height="wrap_content"
|
|
55
|
+
android:background="#EEE"
|
|
56
|
+
android:text=""
|
|
57
|
+
/>
|
|
58
|
+
|
|
59
|
+
</LinearLayout>
|
|
60
|
+
</ScrollView>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
package com.stallion;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
|
|
5
|
+
public class Stallion {
|
|
6
|
+
public static String getJSBundleFile (Context applicationContext) {
|
|
7
|
+
return StallionConstants.DEFAULT_JS_BUNDLE_LOCATION_BASE + StallionConstants.ANDROID_BUNDLE_FILE_NAME;
|
|
8
|
+
}
|
|
9
|
+
public static String getJSBundleFile(Context applicationContext, String defaultBundlePath) {
|
|
10
|
+
if (defaultBundlePath != null) return defaultBundlePath;
|
|
11
|
+
return StallionConstants.DEFAULT_JS_BUNDLE_LOCATION_BASE + StallionConstants.ANDROID_BUNDLE_FILE_NAME;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
package com.stallion;
|
|
2
|
+
|
|
3
|
+
import java.util.Map;
|
|
4
|
+
|
|
5
|
+
public class StallionConstants {
|
|
6
|
+
public static final String MODULE_NAME = "Stallion";
|
|
7
|
+
public static final String ANDROID_BUNDLE_FILE_NAME = "index.android.bundle";
|
|
8
|
+
public static final String DEFAULT_JS_BUNDLE_LOCATION_BASE = "assets://";
|
|
9
|
+
}
|
|
10
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
package com.stallion;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
6
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
7
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
8
|
+
import com.facebook.react.module.annotations.ReactModule;
|
|
9
|
+
|
|
10
|
+
@ReactModule(name = StallionConstants.MODULE_NAME)
|
|
11
|
+
public class StallionModule extends ReactContextBaseJavaModule {
|
|
12
|
+
|
|
13
|
+
public StallionModule(ReactApplicationContext reactContext) {
|
|
14
|
+
super(reactContext);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@Override
|
|
18
|
+
@NonNull
|
|
19
|
+
public String getName() {
|
|
20
|
+
return StallionConstants.MODULE_NAME;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@ReactMethod
|
|
24
|
+
public void dummyMethod() {
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
package com.stallion;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
|
|
5
|
+
import com.facebook.react.ReactPackage;
|
|
6
|
+
import com.facebook.react.bridge.NativeModule;
|
|
7
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
8
|
+
import com.facebook.react.uimanager.ViewManager;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
import java.util.ArrayList;
|
|
12
|
+
import java.util.Collections;
|
|
13
|
+
import java.util.List;
|
|
14
|
+
|
|
15
|
+
public class StallionPackage implements ReactPackage {
|
|
16
|
+
@NonNull
|
|
17
|
+
@Override
|
|
18
|
+
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
|
|
19
|
+
List<NativeModule> modules = new ArrayList<>();
|
|
20
|
+
modules.add(new StallionModule(reactContext));
|
|
21
|
+
return modules;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@NonNull
|
|
25
|
+
@Override
|
|
26
|
+
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
|
|
27
|
+
return Collections.emptyList();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
// !$*UTF8*$!
|
|
2
|
+
{
|
|
3
|
+
archiveVersion = 1;
|
|
4
|
+
classes = {
|
|
5
|
+
};
|
|
6
|
+
objectVersion = 46;
|
|
7
|
+
objects = {
|
|
8
|
+
|
|
9
|
+
/* Begin PBXBuildFile section */
|
|
10
|
+
5E555C0D2413F4C50049A1A2 /* Stallion.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* Stallion.m */; };
|
|
11
|
+
F4FF95D7245B92E800C19C63 /* Stallion.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* Stallion.swift */; };
|
|
12
|
+
/* End PBXBuildFile section */
|
|
13
|
+
|
|
14
|
+
/* Begin PBXCopyFilesBuildPhase section */
|
|
15
|
+
58B511D91A9E6C8500147676 /* CopyFiles */ = {
|
|
16
|
+
isa = PBXCopyFilesBuildPhase;
|
|
17
|
+
buildActionMask = 2147483647;
|
|
18
|
+
dstPath = "include/$(PRODUCT_NAME)";
|
|
19
|
+
dstSubfolderSpec = 16;
|
|
20
|
+
files = (
|
|
21
|
+
);
|
|
22
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
23
|
+
};
|
|
24
|
+
/* End PBXCopyFilesBuildPhase section */
|
|
25
|
+
|
|
26
|
+
/* Begin PBXFileReference section */
|
|
27
|
+
134814201AA4EA6300B7C361 /* libStallion.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libStallion.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
28
|
+
B3E7B5891CC2AC0600A0062D /* Stallion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Stallion.m; sourceTree = "<group>"; };
|
|
29
|
+
F4FF95D5245B92E700C19C63 /* Stallion-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Stallion-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
30
|
+
F4FF95D6245B92E800C19C63 /* Stallion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Stallion.swift; sourceTree = "<group>"; };
|
|
31
|
+
/* End PBXFileReference section */
|
|
32
|
+
|
|
33
|
+
/* Begin PBXFrameworksBuildPhase section */
|
|
34
|
+
58B511D81A9E6C8500147676 /* Frameworks */ = {
|
|
35
|
+
isa = PBXFrameworksBuildPhase;
|
|
36
|
+
buildActionMask = 2147483647;
|
|
37
|
+
files = (
|
|
38
|
+
);
|
|
39
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
40
|
+
};
|
|
41
|
+
/* End PBXFrameworksBuildPhase section */
|
|
42
|
+
|
|
43
|
+
/* Begin PBXGroup section */
|
|
44
|
+
134814211AA4EA7D00B7C361 /* Products */ = {
|
|
45
|
+
isa = PBXGroup;
|
|
46
|
+
children = (
|
|
47
|
+
134814201AA4EA6300B7C361 /* libStallion.a */,
|
|
48
|
+
);
|
|
49
|
+
name = Products;
|
|
50
|
+
sourceTree = "<group>";
|
|
51
|
+
};
|
|
52
|
+
58B511D21A9E6C8500147676 = {
|
|
53
|
+
isa = PBXGroup;
|
|
54
|
+
children = (
|
|
55
|
+
F4FF95D6245B92E800C19C63 /* Stallion.swift */,
|
|
56
|
+
B3E7B5891CC2AC0600A0062D /* Stallion.m */,
|
|
57
|
+
F4FF95D5245B92E700C19C63 /* Stallion-Bridging-Header.h */,
|
|
58
|
+
134814211AA4EA7D00B7C361 /* Products */,
|
|
59
|
+
);
|
|
60
|
+
sourceTree = "<group>";
|
|
61
|
+
};
|
|
62
|
+
/* End PBXGroup section */
|
|
63
|
+
|
|
64
|
+
/* Begin PBXNativeTarget section */
|
|
65
|
+
58B511DA1A9E6C8500147676 /* Stallion */ = {
|
|
66
|
+
isa = PBXNativeTarget;
|
|
67
|
+
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Stallion" */;
|
|
68
|
+
buildPhases = (
|
|
69
|
+
58B511D71A9E6C8500147676 /* Sources */,
|
|
70
|
+
58B511D81A9E6C8500147676 /* Frameworks */,
|
|
71
|
+
58B511D91A9E6C8500147676 /* CopyFiles */,
|
|
72
|
+
);
|
|
73
|
+
buildRules = (
|
|
74
|
+
);
|
|
75
|
+
dependencies = (
|
|
76
|
+
);
|
|
77
|
+
name = Stallion;
|
|
78
|
+
productName = RCTDataManager;
|
|
79
|
+
productReference = 134814201AA4EA6300B7C361 /* libStallion.a */;
|
|
80
|
+
productType = "com.apple.product-type.library.static";
|
|
81
|
+
};
|
|
82
|
+
/* End PBXNativeTarget section */
|
|
83
|
+
|
|
84
|
+
/* Begin PBXProject section */
|
|
85
|
+
58B511D31A9E6C8500147676 /* Project object */ = {
|
|
86
|
+
isa = PBXProject;
|
|
87
|
+
attributes = {
|
|
88
|
+
LastUpgradeCheck = 0920;
|
|
89
|
+
ORGANIZATIONNAME = Facebook;
|
|
90
|
+
TargetAttributes = {
|
|
91
|
+
58B511DA1A9E6C8500147676 = {
|
|
92
|
+
CreatedOnToolsVersion = 6.1.1;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Stallion" */;
|
|
97
|
+
compatibilityVersion = "Xcode 3.2";
|
|
98
|
+
developmentRegion = English;
|
|
99
|
+
hasScannedForEncodings = 0;
|
|
100
|
+
knownRegions = (
|
|
101
|
+
English,
|
|
102
|
+
en,
|
|
103
|
+
);
|
|
104
|
+
mainGroup = 58B511D21A9E6C8500147676;
|
|
105
|
+
productRefGroup = 58B511D21A9E6C8500147676;
|
|
106
|
+
projectDirPath = "";
|
|
107
|
+
projectRoot = "";
|
|
108
|
+
targets = (
|
|
109
|
+
58B511DA1A9E6C8500147676 /* Stallion */,
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
/* End PBXProject section */
|
|
113
|
+
|
|
114
|
+
/* Begin PBXSourcesBuildPhase section */
|
|
115
|
+
58B511D71A9E6C8500147676 /* Sources */ = {
|
|
116
|
+
isa = PBXSourcesBuildPhase;
|
|
117
|
+
buildActionMask = 2147483647;
|
|
118
|
+
files = (
|
|
119
|
+
F4FF95D7245B92E800C19C63 /* Stallion.swift in Sources */,
|
|
120
|
+
B3E7B58A1CC2AC0600A0062D /* Stallion.m in Sources */,
|
|
121
|
+
);
|
|
122
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
123
|
+
};
|
|
124
|
+
/* End PBXSourcesBuildPhase section */
|
|
125
|
+
|
|
126
|
+
/* Begin XCBuildConfiguration section */
|
|
127
|
+
58B511ED1A9E6C8500147676 /* Debug */ = {
|
|
128
|
+
isa = XCBuildConfiguration;
|
|
129
|
+
buildSettings = {
|
|
130
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
131
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
132
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
133
|
+
CLANG_ENABLE_MODULES = YES;
|
|
134
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
135
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
136
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
137
|
+
CLANG_WARN_COMMA = YES;
|
|
138
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
139
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
140
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
141
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
142
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
143
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
144
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
145
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
146
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
147
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
148
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
149
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
150
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
151
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
152
|
+
COPY_PHASE_STRIP = NO;
|
|
153
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
154
|
+
ENABLE_TESTABILITY = YES;
|
|
155
|
+
"EXCLUDED_ARCHS[sdk=*]" = arm64;
|
|
156
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
157
|
+
GCC_DYNAMIC_NO_PIC = NO;
|
|
158
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
159
|
+
GCC_OPTIMIZATION_LEVEL = 0;
|
|
160
|
+
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
161
|
+
"DEBUG=1",
|
|
162
|
+
"$(inherited)",
|
|
163
|
+
);
|
|
164
|
+
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
|
165
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
166
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
167
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
168
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
169
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
170
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
171
|
+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
172
|
+
MTL_ENABLE_DEBUG_INFO = YES;
|
|
173
|
+
ONLY_ACTIVE_ARCH = YES;
|
|
174
|
+
SDKROOT = iphoneos;
|
|
175
|
+
};
|
|
176
|
+
name = Debug;
|
|
177
|
+
};
|
|
178
|
+
58B511EE1A9E6C8500147676 /* Release */ = {
|
|
179
|
+
isa = XCBuildConfiguration;
|
|
180
|
+
buildSettings = {
|
|
181
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
182
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
183
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
184
|
+
CLANG_ENABLE_MODULES = YES;
|
|
185
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
186
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
187
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
188
|
+
CLANG_WARN_COMMA = YES;
|
|
189
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
190
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
191
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
192
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
193
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
194
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
195
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
196
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
197
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
198
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
199
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
200
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
201
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
202
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
203
|
+
COPY_PHASE_STRIP = YES;
|
|
204
|
+
ENABLE_NS_ASSERTIONS = NO;
|
|
205
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
206
|
+
"EXCLUDED_ARCHS[sdk=*]" = arm64;
|
|
207
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
208
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
209
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
210
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
211
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
212
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
213
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
214
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
215
|
+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
216
|
+
MTL_ENABLE_DEBUG_INFO = NO;
|
|
217
|
+
SDKROOT = iphoneos;
|
|
218
|
+
VALIDATE_PRODUCT = YES;
|
|
219
|
+
};
|
|
220
|
+
name = Release;
|
|
221
|
+
};
|
|
222
|
+
58B511F01A9E6C8500147676 /* Debug */ = {
|
|
223
|
+
isa = XCBuildConfiguration;
|
|
224
|
+
buildSettings = {
|
|
225
|
+
HEADER_SEARCH_PATHS = (
|
|
226
|
+
"$(inherited)",
|
|
227
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
228
|
+
"$(SRCROOT)/../../../React/**",
|
|
229
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
230
|
+
);
|
|
231
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
232
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
233
|
+
PRODUCT_NAME = Stallion;
|
|
234
|
+
SKIP_INSTALL = YES;
|
|
235
|
+
SWIFT_OBJC_BRIDGING_HEADER = "Stallion-Bridging-Header.h";
|
|
236
|
+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
|
237
|
+
SWIFT_VERSION = 5.0;
|
|
238
|
+
};
|
|
239
|
+
name = Debug;
|
|
240
|
+
};
|
|
241
|
+
58B511F11A9E6C8500147676 /* Release */ = {
|
|
242
|
+
isa = XCBuildConfiguration;
|
|
243
|
+
buildSettings = {
|
|
244
|
+
HEADER_SEARCH_PATHS = (
|
|
245
|
+
"$(inherited)",
|
|
246
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
247
|
+
"$(SRCROOT)/../../../React/**",
|
|
248
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
249
|
+
);
|
|
250
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
251
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
252
|
+
PRODUCT_NAME = Stallion;
|
|
253
|
+
SKIP_INSTALL = YES;
|
|
254
|
+
SWIFT_OBJC_BRIDGING_HEADER = "Stallion-Bridging-Header.h";
|
|
255
|
+
SWIFT_VERSION = 5.0;
|
|
256
|
+
};
|
|
257
|
+
name = Release;
|
|
258
|
+
};
|
|
259
|
+
/* End XCBuildConfiguration section */
|
|
260
|
+
|
|
261
|
+
/* Begin XCConfigurationList section */
|
|
262
|
+
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Stallion" */ = {
|
|
263
|
+
isa = XCConfigurationList;
|
|
264
|
+
buildConfigurations = (
|
|
265
|
+
58B511ED1A9E6C8500147676 /* Debug */,
|
|
266
|
+
58B511EE1A9E6C8500147676 /* Release */,
|
|
267
|
+
);
|
|
268
|
+
defaultConfigurationIsVisible = 0;
|
|
269
|
+
defaultConfigurationName = Release;
|
|
270
|
+
};
|
|
271
|
+
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Stallion" */ = {
|
|
272
|
+
isa = XCConfigurationList;
|
|
273
|
+
buildConfigurations = (
|
|
274
|
+
58B511F01A9E6C8500147676 /* Debug */,
|
|
275
|
+
58B511F11A9E6C8500147676 /* Release */,
|
|
276
|
+
);
|
|
277
|
+
defaultConfigurationIsVisible = 0;
|
|
278
|
+
defaultConfigurationName = Release;
|
|
279
|
+
};
|
|
280
|
+
/* End XCConfigurationList section */
|
|
281
|
+
};
|
|
282
|
+
rootObject = 58B511D31A9E6C8500147676 /* Project object */;
|
|
283
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
#import <React/RCTEventEmitter.h>
|
|
3
|
+
|
|
4
|
+
@interface RCT_EXTERN_MODULE(Stallion, NSObject)
|
|
5
|
+
|
|
6
|
+
RCT_EXTERN_METHOD(downloadPackage:(NSDictionary *)bundleInfo
|
|
7
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
8
|
+
withRejecter:(RCTPromiseRejectBlock)reject
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
RCT_EXTERN_METHOD(getStallionMeta: (RCTResponseSenderBlock)callback)
|
|
12
|
+
RCT_EXTERN_METHOD(getApiKey: (RCTResponseSenderBlock)callback)
|
|
13
|
+
RCT_EXTERN_METHOD(setApiKey: (NSString *)apiKey)
|
|
14
|
+
RCT_EXTERN_METHOD(toggleStallionSwitch: (BOOL *)isOn)
|
|
15
|
+
|
|
16
|
+
+ (BOOL)requiresMainQueueSetup
|
|
17
|
+
{
|
|
18
|
+
return NO;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
@objc(Stallion)
|
|
4
|
+
class Stallion: RCTEventEmitter {
|
|
5
|
+
public static var shared: RCTEventEmitter?
|
|
6
|
+
|
|
7
|
+
override init() {
|
|
8
|
+
super.init()
|
|
9
|
+
Stallion.shared = self
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
override func supportedEvents() -> [String]! {
|
|
13
|
+
return [StallionConstants.DOWNLOAD_PROGRESS_EVENT]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@objc(downloadPackage:withResolver:withRejecter:)
|
|
17
|
+
func downloadPackage(bundleInfo: NSDictionary, resolve: @escaping RCTPromiseResolveBlock,reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
18
|
+
guard let receivedBucketId = bundleInfo.value(forKey: StallionConstants.DownloadReqBodyKeys.BucketId) else {return}
|
|
19
|
+
guard let receiveProjectId = bundleInfo.value(forKey: StallionConstants.DownloadReqBodyKeys.ProjectId) else {return}
|
|
20
|
+
let receivedVersion = bundleInfo.value(forKey: StallionConstants.DownloadReqBodyKeys.Version) as? Int ?? nil
|
|
21
|
+
var reqJson: [String: Any] = [
|
|
22
|
+
StallionConstants.DownloadReqBodyKeys.BucketId: receivedBucketId,
|
|
23
|
+
StallionConstants.DownloadReqBodyKeys.ProjectId: receiveProjectId,
|
|
24
|
+
StallionConstants.DownloadReqBodyKeys.Platform: StallionConstants.PlatformValue,
|
|
25
|
+
]
|
|
26
|
+
if (receivedVersion != nil) {
|
|
27
|
+
reqJson[StallionConstants.DownloadReqBodyKeys.Version] = receivedVersion
|
|
28
|
+
}
|
|
29
|
+
guard let fromUrl = URL(string: StallionConstants.DownloadApiUrl) else { return }
|
|
30
|
+
|
|
31
|
+
do {
|
|
32
|
+
try StallionDownloader().load(
|
|
33
|
+
url: fromUrl,
|
|
34
|
+
reqBody: reqJson,
|
|
35
|
+
resolve: resolve,
|
|
36
|
+
reject: reject
|
|
37
|
+
)
|
|
38
|
+
} catch {
|
|
39
|
+
let errorString = StallionConstants.DownloadPromiseResponses.GenericError
|
|
40
|
+
reject("500", errorString, NSError(domain: errorString, code: 500))
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@objc(setApiKey:)
|
|
45
|
+
func setApiKey(apiKey: String) {
|
|
46
|
+
StallionUtil.setLs(key: StallionUtil.LSKeys.apiKey, value: apiKey)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@objc(getApiKey:)
|
|
50
|
+
func getApiKey(_ callback: RCTResponseSenderBlock) {
|
|
51
|
+
let apiKey = StallionUtil.getLs(key: StallionUtil.LSKeys.apiKey)
|
|
52
|
+
callback([apiKey ?? ""])
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@objc(toggleStallionSwitch:)
|
|
56
|
+
func toggleStallionSwitch(isOn: Bool) {
|
|
57
|
+
StallionUtil.setLs(key: StallionUtil.LSKeys.switchStateKey, value: isOn ? StallionUtil.SwitchStates.ON : StallionUtil.SwitchStates.OFF)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@objc(getStallionMeta:)
|
|
61
|
+
func getStallionMeta(_ callback: RCTResponseSenderBlock) {
|
|
62
|
+
var metaDictionary = [String:Any]()
|
|
63
|
+
metaDictionary[StallionUtil.LSKeys.bucketKey] = StallionUtil.getLs(key: StallionUtil.LSKeys.bucketKey)
|
|
64
|
+
metaDictionary[StallionUtil.LSKeys.versionKey] = StallionUtil.getLs(key: StallionUtil.LSKeys.versionKey)
|
|
65
|
+
metaDictionary[StallionUtil.LSKeys.switchStateKey] = StallionUtil.getLs(key: StallionUtil.LSKeys.switchStateKey) == StallionUtil.SwitchStates.ON
|
|
66
|
+
let stallionMeta = NSDictionary(dictionary: metaDictionary)
|
|
67
|
+
callback([stallionMeta])
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//
|
|
2
|
+
// StallionConstants.swift
|
|
3
|
+
// react-native-stallion
|
|
4
|
+
//
|
|
5
|
+
// Created by Thor963 on 17/05/23.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
class StallionConstants {
|
|
11
|
+
public struct FilePaths {
|
|
12
|
+
static let DownloadDirectory = "StallionDownload"
|
|
13
|
+
static let TargetDirectory = "StallionPackage"
|
|
14
|
+
static let ZipFolderName = "build"
|
|
15
|
+
static let ZipExtension = "zip"
|
|
16
|
+
}
|
|
17
|
+
public struct HeaderKeys {
|
|
18
|
+
static let AccessKey = "x-access-token"
|
|
19
|
+
static let ContentType = "Content-Type"
|
|
20
|
+
}
|
|
21
|
+
public struct DownloadReqBodyKeys {
|
|
22
|
+
static let BucketId = "bucketId"
|
|
23
|
+
static let Version = "version"
|
|
24
|
+
static let Platform = "platform"
|
|
25
|
+
static let ProjectId = "projectId"
|
|
26
|
+
}
|
|
27
|
+
static let PlatformValue = "ios"
|
|
28
|
+
static let DownloadApiUrl = "https://stallion-api.redhorse.tech/api/v1/bundle/download"
|
|
29
|
+
public struct DownloadPromiseResponses {
|
|
30
|
+
static let Success = "Success"
|
|
31
|
+
static let GenericError = "Something went wrong internally"
|
|
32
|
+
static let FileSystemError = "File system error"
|
|
33
|
+
static let ApiError = "Download api error"
|
|
34
|
+
static let InitError = "Download initialisation error"
|
|
35
|
+
static let DirectoryInitError = "Directory initialisation error"
|
|
36
|
+
}
|
|
37
|
+
public struct AuthTokens {
|
|
38
|
+
static let ApiKey = "apiKey"
|
|
39
|
+
static let SecretKey = "secretKey"
|
|
40
|
+
}
|
|
41
|
+
static let DOWNLOAD_PROGRESS_EVENT = "StallionDownloadProgress";
|
|
42
|
+
}
|