├── .github ├── ISSUE_TEMPLATE.md └── workflows │ └── react-native-code-push-ci.yml ├── .gitignore ├── .npmignore ├── .vscode ├── launch.json ├── settings.json └── tasks.json ├── .watchmanconfig ├── AlertAdapter.js ├── CONTRIBUTING.md ├── CodePush.js ├── CodePush.podspec ├── Examples ├── CodePushDemoApp │ ├── .babelrc │ ├── .buckconfig │ ├── .flowconfig │ ├── .gitattributes │ ├── .gitignore │ ├── .watchmanconfig │ ├── App.js │ ├── __tests__ │ │ └── App.js │ ├── android │ │ ├── .project │ │ ├── .settings │ │ │ └── org.eclipse.buildship.core.prefs │ │ ├── app │ │ │ ├── .settings │ │ │ │ └── org.eclipse.buildship.core.prefs │ │ │ ├── BUCK │ │ │ ├── build.gradle │ │ │ ├── proguard-rules.pro │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── codepushdemoapp │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ └── MainApplication.java │ │ │ │ └── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ └── values │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ ├── keystores │ │ │ ├── BUCK │ │ │ └── debug.keystore.properties │ │ └── settings.gradle │ ├── app.json │ ├── images │ │ └── laptop_phone_howitworks.png │ ├── index.js │ ├── ios │ │ ├── CodePushDemoApp-tvOS │ │ │ └── Info.plist │ │ ├── CodePushDemoApp-tvOSTests │ │ │ └── Info.plist │ │ ├── CodePushDemoApp.xcodeproj │ │ │ ├── project.pbxproj │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ ├── CodePushDemoApp-tvOS.xcscheme │ │ │ │ └── CodePushDemoApp.xcscheme │ │ ├── CodePushDemoApp │ │ │ ├── AppDelegate.h │ │ │ ├── AppDelegate.m │ │ │ ├── Base.lproj │ │ │ │ └── LaunchScreen.xib │ │ │ ├── Images.xcassets │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ └── Contents.json │ │ │ ├── Info.plist │ │ │ └── main.m │ │ └── CodePushDemoAppTests │ │ │ ├── CodePushDemoAppTests.m │ │ │ └── Info.plist │ └── package.json ├── CodePushDemoAppCpp │ ├── .buckconfig │ ├── .eslintrc.js │ ├── .flowconfig │ ├── .gitattributes │ ├── .gitignore │ ├── .prettierrc.js │ ├── .watchmanconfig │ ├── App.js │ ├── app.json │ ├── babel.config.js │ ├── images │ │ └── laptop_phone_howitworks.png │ ├── index.js │ ├── metro.config.js │ ├── package.json │ ├── windows │ │ ├── .gitignore │ │ ├── CodePushDemoAppCpp.sln │ │ └── CodePushDemoAppCpp │ │ │ ├── .gitignore │ │ │ ├── App.cpp │ │ │ ├── App.h │ │ │ ├── App.idl │ │ │ ├── App.xaml │ │ │ ├── Assets │ │ │ ├── LockScreenLogo.scale-200.png │ │ │ ├── SplashScreen.scale-200.png │ │ │ ├── Square150x150Logo.scale-200.png │ │ │ ├── Square44x44Logo.scale-200.png │ │ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ │ │ ├── StoreLogo.png │ │ │ └── Wide310x150Logo.scale-200.png │ │ │ ├── AutolinkedNativeModules.g.cpp │ │ │ ├── AutolinkedNativeModules.g.h │ │ │ ├── AutolinkedNativeModules.g.targets │ │ │ ├── CodePushDemoAppCpp.vcxproj │ │ │ ├── CodePushDemoAppCpp.vcxproj.filters │ │ │ ├── CodePushDemoAppCpp_TemporaryKey.pfx │ │ │ ├── MainPage.cpp │ │ │ ├── MainPage.h │ │ │ ├── MainPage.idl │ │ │ ├── MainPage.xaml │ │ │ ├── Package.appxmanifest │ │ │ ├── PropertySheet.props │ │ │ ├── ReactPackageProvider.cpp │ │ │ ├── ReactPackageProvider.h │ │ │ ├── packages.config │ │ │ ├── pch.cpp │ │ │ └── pch.h │ └── yarn.lock ├── create-app.js └── nexpect.js ├── LICENSE.md ├── README.md ├── Recipes ├── UpdateButton.ios.js └── UpdateOnStart.ios.js ├── android ├── _scripts │ ├── codepush.gradle │ └── react.gradle ├── app │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── microsoft │ │ └── codepush │ │ └── react │ │ ├── CodePush.java │ │ ├── CodePushBuilder.java │ │ ├── CodePushConstants.java │ │ ├── CodePushDialog.java │ │ ├── CodePushInstallMode.java │ │ ├── CodePushInvalidPublicKeyException.java │ │ ├── CodePushInvalidUpdateException.java │ │ ├── CodePushMalformedDataException.java │ │ ├── CodePushNativeModule.java │ │ ├── CodePushNotInitializedException.java │ │ ├── CodePushTelemetryManager.java │ │ ├── CodePushUnknownException.java │ │ ├── CodePushUpdateManager.java │ │ ├── CodePushUpdateState.java │ │ ├── CodePushUpdateUtils.java │ │ ├── CodePushUtils.java │ │ ├── DownloadProgress.java │ │ ├── DownloadProgressCallback.java │ │ ├── FileUtils.java │ │ ├── ReactInstanceHolder.java │ │ ├── SettingsManager.java │ │ └── TLSSocketFactory.java ├── build.gradle ├── codepush.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── code-push-plugin-testing-framework ├── package.json ├── script │ ├── index.js │ ├── platform.js │ ├── projectManager.js │ ├── serverUtil.js │ ├── test.js │ ├── testBuilder.js │ ├── testConfig.js │ └── testUtil.js └── typings │ └── code-push-plugin-testing-framework.d.ts ├── docs ├── CodePush分包.png ├── [Android]CodePush支持分包——加载不同业务的bundle包.md ├── api-android.md ├── api-ios.md ├── api-js.md ├── multi-deployment-testing-android.md ├── multi-deployment-testing-ios.md ├── setup-android.md ├── setup-ios.md └── setup-windows.md ├── ios ├── CodePush.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── CodePush │ ├── Base64 │ ├── Base64 │ │ ├── MF_Base64Additions.h │ │ └── MF_Base64Additions.m │ └── README.md │ ├── CodePush.h │ ├── CodePush.m │ ├── CodePushConfig.m │ ├── CodePushDownloadHandler.m │ ├── CodePushErrorUtils.m │ ├── CodePushPackage.m │ ├── CodePushTelemetryManager.m │ ├── CodePushUpdateUtils.m │ ├── CodePushUtils.m │ ├── JWT │ ├── Core │ │ ├── Algorithms │ │ │ ├── Base │ │ │ │ ├── JWTAlgorithm.h │ │ │ │ ├── JWTAlgorithmFactory.h │ │ │ │ ├── JWTAlgorithmFactory.m │ │ │ │ ├── JWTAlgorithmNone.h │ │ │ │ └── JWTAlgorithmNone.m │ │ │ ├── ESFamily │ │ │ │ ├── JWTAlgorithmESBase.h │ │ │ │ └── JWTAlgorithmESBase.m │ │ │ ├── HSFamily │ │ │ │ ├── JWTAlgorithmHSBase.h │ │ │ │ └── JWTAlgorithmHSBase.m │ │ │ ├── Holders │ │ │ │ ├── JWTAlgorithmDataHolder.h │ │ │ │ ├── JWTAlgorithmDataHolder.m │ │ │ │ ├── JWTAlgorithmDataHolderChain.h │ │ │ │ └── JWTAlgorithmDataHolderChain.m │ │ │ └── RSFamily │ │ │ │ ├── JWTAlgorithmRSBase.h │ │ │ │ ├── JWTAlgorithmRSBase.m │ │ │ │ ├── JWTRSAlgorithm.h │ │ │ │ └── RSKeys │ │ │ │ ├── JWTCryptoKey.h │ │ │ │ ├── JWTCryptoKey.m │ │ │ │ ├── JWTCryptoKeyExtractor.h │ │ │ │ ├── JWTCryptoKeyExtractor.m │ │ │ │ ├── JWTCryptoSecurity.h │ │ │ │ └── JWTCryptoSecurity.m │ │ ├── ClaimSet │ │ │ ├── JWTClaim.h │ │ │ ├── JWTClaim.m │ │ │ ├── JWTClaimsSet.h │ │ │ ├── JWTClaimsSet.m │ │ │ ├── JWTClaimsSetSerializer.h │ │ │ ├── JWTClaimsSetSerializer.m │ │ │ ├── JWTClaimsSetVerifier.h │ │ │ └── JWTClaimsSetVerifier.m │ │ ├── Coding │ │ │ ├── JWTCoding+ResultTypes.h │ │ │ ├── JWTCoding+ResultTypes.m │ │ │ ├── JWTCoding+VersionOne.h │ │ │ ├── JWTCoding+VersionOne.m │ │ │ ├── JWTCoding+VersionThree.h │ │ │ ├── JWTCoding+VersionThree.m │ │ │ ├── JWTCoding+VersionTwo.h │ │ │ ├── JWTCoding+VersionTwo.m │ │ │ ├── JWTCoding.h │ │ │ └── JWTCoding.m │ │ ├── FrameworkSupplement │ │ │ ├── JWT.h │ │ │ └── Map.modulemap │ │ └── Supplement │ │ │ ├── JWTBase64Coder.h │ │ │ ├── JWTBase64Coder.m │ │ │ ├── JWTDeprecations.h │ │ │ ├── JWTErrorDescription.h │ │ │ └── JWTErrorDescription.m │ ├── LICENSE │ └── README.md │ ├── RCTConvert+CodePushInstallMode.m │ ├── RCTConvert+CodePushUpdateState.m │ └── SSZipArchive │ ├── Common.h │ ├── README.md │ ├── SSZipArchive.h │ ├── SSZipArchive.m │ ├── aes │ ├── aes.h │ ├── aes_via_ace.h │ ├── aescrypt.c │ ├── aeskey.c │ ├── aesopt.h │ ├── aestab.c │ ├── aestab.h │ ├── brg_endian.h │ ├── brg_types.h │ ├── entropy.c │ ├── entropy.h │ ├── fileenc.c │ ├── fileenc.h │ ├── hmac.c │ ├── hmac.h │ ├── prng.c │ ├── prng.h │ ├── pwd2key.c │ ├── pwd2key.h │ ├── sha1.c │ └── sha1.h │ └── minizip │ ├── crypt.h │ ├── ioapi.c │ ├── ioapi.h │ ├── mztools.c │ ├── mztools.h │ ├── unzip.c │ ├── unzip.h │ ├── zip.c │ └── zip.h ├── logging.js ├── package-lock.json ├── package-mixins.js ├── package.json ├── react-native.config.js ├── request-fetch-adapter.js ├── scripts ├── generateBundledResourcesHash.js ├── getFilesInFolder.js ├── postlink │ ├── android │ │ └── postlink.js │ ├── ios │ │ └── postlink.js │ └── run.js ├── postunlink │ ├── android │ │ └── postunlink.js │ ├── ios │ │ └── postunlink.js │ └── run.js ├── recordFilesBeforeBundleCommand.js └── tools │ ├── linkToolsAndroid.js │ └── linkToolsIos.js ├── test ├── template │ ├── android │ │ └── app │ │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── com │ │ │ │ └── testcodepush │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ └── values │ │ │ └── strings.xml │ ├── codePushWrapper.js │ ├── index.android.js │ ├── index.ios.js │ ├── index.js │ ├── ios │ │ └── TestCodePush │ │ │ └── AppDelegate.m │ └── scenarios │ │ ├── scenarioCheckForUpdate.js │ │ ├── scenarioCheckForUpdateCustomKey.js │ │ ├── scenarioDisallowRestartImmediate.js │ │ ├── scenarioDisallowRestartOnResume.js │ │ ├── scenarioDisallowRestartOnSuspend.js │ │ ├── scenarioDownloadUpdate.js │ │ ├── scenarioInstall.js │ │ ├── scenarioInstallOnRestartWithRevert.js │ │ ├── scenarioInstallOnResumeWithRevert.js │ │ ├── scenarioInstallOnSuspendWithRevert.js │ │ ├── scenarioInstallRestart2x.js │ │ ├── scenarioInstallWithRevert.js │ │ ├── scenarioRestart.js │ │ ├── scenarioRestart2x.js │ │ ├── scenarioSync.js │ │ ├── scenarioSync2x.js │ │ ├── scenarioSyncMandatoryDefault.js │ │ ├── scenarioSyncMandatoryRestart.js │ │ ├── scenarioSyncMandatoryResume.js │ │ ├── scenarioSyncMandatorySuspend.js │ │ ├── scenarioSyncRestartDelay.js │ │ ├── scenarioSyncResume.js │ │ ├── scenarioSyncResumeDelay.js │ │ ├── scenarioSyncSuspend.js │ │ ├── scenarioSyncSuspendDelay.js │ │ ├── updateDeviceReady.js │ │ ├── updateNARConditional.js │ │ ├── updateNotifyApplicationReady.js │ │ ├── updateSync.js │ │ └── updateSync2x.js └── test.ts ├── tsconfig.json ├── tslint.json ├── typings └── react-native-code-push.d.ts ├── windows-legacy ├── .gitignore ├── .npmignore ├── CodePush.Net46.Test │ ├── ApplicationDataContainerTest.cs │ ├── CodePush.Net46.Test.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── TelemetryManagerTest.cs │ ├── app.config │ └── packages.config ├── CodePush.Net46 │ ├── .gitignore │ ├── Adapters │ │ ├── Http │ │ │ └── HttpProgress.cs │ │ └── Storage │ │ │ └── ApplicationDataContainer.cs │ ├── CodePush.Net46.csproj │ ├── CodePushUtils.cs │ ├── FileUtils.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── UpdateManager.cs │ ├── UpdateUtils.cs │ └── packages.config ├── CodePush.Shared │ ├── CodePush.Shared.projitems │ ├── CodePush.Shared.shproj │ ├── CodePushConstants.cs │ ├── CodePushNativeModule.cs │ ├── CodePushReactPackage.cs │ ├── CodePushUtils.cs │ ├── InstallMode.cs │ ├── MinimumBackgroundListener.cs │ ├── SettingsManager.cs │ ├── TelemetryManager.cs │ └── UpdateState.cs └── CodePush │ ├── .gitignore │ ├── CodePush.csproj │ ├── CodePushUtils.cs │ ├── FileUtils.cs │ ├── Properties │ ├── AssemblyInfo.cs │ └── CodePush.rd.xml │ ├── UpdateManager.cs │ └── UpdateUtils.cs └── windows ├── .gitignore ├── .npmignore ├── CodePush ├── .npmignore ├── CodePush.def ├── CodePush.vcxproj ├── CodePush.vcxproj.filters ├── CodePushConfig.cpp ├── CodePushConfig.h ├── CodePushConfig.idl ├── CodePushDownloadHandler.cpp ├── CodePushDownloadHandler.h ├── CodePushNativeModule.cpp ├── CodePushNativeModule.h ├── CodePushPackage.cpp ├── CodePushPackage.h ├── CodePushTelemetryManager.cpp ├── CodePushTelemetryManager.h ├── CodePushUpdateUtils.cpp ├── CodePushUpdateUtils.h ├── CodePushUtils.cpp ├── CodePushUtils.h ├── FileUtils.cpp ├── FileUtils.h ├── PropertySheet.props ├── ReactPackageProvider.cpp ├── ReactPackageProvider.h ├── ReactPackageProvider.idl ├── miniz │ ├── LICENSE │ ├── miniz.c │ ├── miniz.h │ └── readme.md ├── packages.config ├── pch.cpp └── pch.h └── Directory.Build.props /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Thanks so much for filing an issue or feature request! Please fill out the following (wherever relevant): 2 | 3 | ### Steps to Reproduce 4 | 1. 5 | 2. 6 | 3. 7 | 8 | ### Expected Behavior 9 | What you expected to happen? 10 | 11 | ### Actual Behavior 12 | What actually happens? 13 | ``` 14 | STACK TRACE AND/OR SCREENSHOTS 15 | ``` 16 | 17 | ### Reproducible Demo 18 | 19 | * Download https://github.com/microsoft/react-native-code-push/archive/master.zip and unzip. From `Examples` folder run `node create-app.js appName react-native@0.61.5 react-native-code-push@6.0.0` command to generate plain CodePushified React Native app. Please see description on top of `create-app.js` file content if needed 20 | * If you can't reproduce the bug on it, provide us as much info as possible about your project 21 | 22 | ### Environment 23 | 24 | * react-native-code-push version: 25 | * react-native version: 26 | * iOS/Android/Windows version: 27 | * Does this reproduce on a debug build or release build? 28 | * Does this reproduce on a simulator, or only on a physical device? 29 | 30 | (The more info the faster we will be able to address it!) 31 | -------------------------------------------------------------------------------- /.github/workflows/react-native-code-push-ci.yml: -------------------------------------------------------------------------------- 1 | name: React-native-code-push CI 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | test-android: 10 | name: Test Android app 11 | runs-on: macos-latest 12 | strategy: 13 | matrix: 14 | api-level: [27] 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v2 18 | - name: Start adb server 19 | run: adb devices 20 | - name: Download system image "android-${{ matrix.api-level }}" 21 | run: $ANDROID_HOME/tools/bin/sdkmanager "system-images;android-${{ matrix.api-level }};google_apis;x86" 22 | - name: Create android emulator 23 | run: $ANDROID_HOME/tools/bin/avdmanager create avd --force --name TestEmulator --abi google_apis/x86 --package 'system-images;android-${{ matrix.api-level }};google_apis;x86' --device "Nexus 6P" 24 | - name: Start android emulator 25 | run: $ANDROID_HOME/emulator/emulator -avd TestEmulator -noaudio -no-window -no-snapshot-save -no-boot-anim -memory 6144 & 26 | - run: sleep 120 27 | - run: adb shell settings put global window_animation_scale 0.0 28 | - run: adb shell settings put global transition_animation_scale 0.0 29 | - run: adb shell settings put global animator_duration_scale 0.0 30 | - name: Package Installation 31 | run: npm install 32 | - name: Install react-native-cli 33 | run: npm install react-native-cli 34 | - name: test:android 35 | run: npm run test:android 36 | 37 | test-iOS: 38 | name: Test iOS app 39 | runs-on: macos-latest 40 | steps: 41 | - name: Checkout 42 | uses: actions/checkout@v2 43 | - name: Install dependecies 44 | run: npm install 45 | - name: Install react-native-cli 46 | run: npm install react-native-cli 47 | - name: Run tests 48 | run: npm run test:ios 49 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | 24 | # node.js 25 | # 26 | node_modules/ 27 | npm-debug.log 28 | 29 | # Don't publish example apps 30 | Examples/ 31 | Recipes/ 32 | 33 | # Don't publish testing code 34 | bin/ 35 | test/ 36 | 37 | # Remove after this framework is published on NPM 38 | code-push-plugin-testing-framework/ 39 | 40 | # Android build artifacts and Android Studio bits 41 | android/app/build 42 | android/local.properties 43 | android/.gradle 44 | android/**/*.iml 45 | android/.idea 46 | 47 | 48 | # Windows 49 | windows/.vs/ 50 | windows/obj/ 51 | 52 | #Tests 53 | windows/CodePush.Net46.Test 54 | 55 | #Visual Studio files 56 | *.[Oo]bj 57 | *.user 58 | *.aps 59 | *.pch 60 | *.vspscc 61 | *.vssscc 62 | *_i.c 63 | *_p.c 64 | *.ncb 65 | *.suo 66 | *.tlb 67 | *.tlh 68 | *.bak 69 | *.[Cc]ache 70 | *.ilk 71 | *.log 72 | *.lib 73 | *.sbr 74 | *.sdf 75 | *.opensdf 76 | *.opendb 77 | *.unsuccessfulbuild 78 | ipch/ 79 | [Oo]bj/ 80 | [Bb]in 81 | [Dd]ebug*/ 82 | [Rr]elease*/ 83 | Ankh.NoLoad 84 | 85 | #NuGet 86 | packages/ 87 | *.nupkg 88 | 89 | # VSCode 90 | .vscode/ 91 | 92 | # IntelliJIDEA 93 | .idea/ 94 | 95 | 96 | # Github 97 | .github/ 98 | 99 | # Git 100 | .git/ 101 | 102 | .watchmanconfig 103 | 104 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Tests-android", 6 | "type": "node", 7 | "request": "launch", 8 | "preLaunchTask": "Setup-android", 9 | "runtimeExecutable": "npm", 10 | "runtimeArgs": [ 11 | "run", 12 | "test:debugger:android" 13 | ], 14 | "port": 9229, 15 | "stopOnEntry": false, 16 | "sourceMaps": true, 17 | "console": "internalConsole", 18 | "internalConsoleOptions": "openOnSessionStart", 19 | "autoAttachChildProcesses": true, 20 | "timeout": 100000 21 | }, 22 | { 23 | "name": "Tests-ios", 24 | "type": "node", 25 | "request": "launch", 26 | "preLaunchTask": "Setup-ios", 27 | "runtimeExecutable": "npm", 28 | "runtimeArgs": [ 29 | "run", 30 | "test:debugger:ios" 31 | ], 32 | "port": 9229, 33 | "stopOnEntry": false, 34 | "sourceMaps": true, 35 | "console": "internalConsole", 36 | "internalConsoleOptions": "openOnSessionStart", 37 | "autoAttachChildProcesses": true, 38 | "timeout": 100000 39 | } 40 | ] 41 | } 42 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules/typescript/lib" 3 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "shell", 6 | "label": "Build", 7 | "command": "npm", 8 | "args": [ 9 | "run", 10 | "build:tests" 11 | ], 12 | "presentation": { 13 | "echo": false, 14 | "focus": false 15 | }, 16 | "problemMatcher": [ 17 | "$tsc" 18 | ] 19 | }, 20 | { 21 | "type": "shell", 22 | "label": "Setup-android", 23 | "dependsOn": "Build", 24 | "command": "npm", 25 | "args": [ 26 | "run", 27 | "test:setup:android" 28 | ], 29 | "presentation": { 30 | "echo": false, 31 | "focus": false 32 | }, 33 | "problemMatcher": [ 34 | "$tsc" 35 | ] 36 | }, 37 | { 38 | "type": "shell", 39 | "label": "Setup-ios", 40 | "dependsOn": "Build", 41 | "command": "npm", 42 | "args": [ 43 | "run", 44 | "test:setup:ios" 45 | ], 46 | "presentation": { 47 | "echo": false, 48 | "focus": false 49 | }, 50 | "problemMatcher": [ 51 | "$tsc" 52 | ] 53 | } 54 | ] 55 | } 56 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /AlertAdapter.js: -------------------------------------------------------------------------------- 1 | import React, { Platform } from "react-native"; 2 | let { Alert } = React; 3 | 4 | if (Platform.OS === "android") { 5 | const { NativeModules: { CodePushDialog } } = React; 6 | 7 | Alert = { 8 | alert(title, message, buttons) { 9 | if (buttons.length > 2) { 10 | throw "Can only show 2 buttons for Android dialog."; 11 | } 12 | 13 | const button1Text = buttons[0] ? buttons[0].text : null, 14 | button2Text = buttons[1] ? buttons[1].text : null; 15 | 16 | CodePushDialog.showDialog( 17 | title, message, button1Text, button2Text, 18 | (buttonId) => { buttons[buttonId].onPress && buttons[buttonId].onPress(); }, 19 | (error) => { throw error; }); 20 | } 21 | }; 22 | } 23 | 24 | module.exports = { Alert }; -------------------------------------------------------------------------------- /CodePush.podspec: -------------------------------------------------------------------------------- 1 | require 'json' 2 | 3 | package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) 4 | 5 | Pod::Spec.new do |s| 6 | s.name = 'CodePush' 7 | s.version = package['version'].gsub(/v|-beta/, '') 8 | s.summary = package['description'] 9 | s.author = package['author'] 10 | s.license = package['license'] 11 | s.homepage = package['homepage'] 12 | s.source = { :git => 'https://github.com/microsoft/react-native-code-push.git', :tag => "v#{s.version}"} 13 | s.ios.deployment_target = '7.0' 14 | s.tvos.deployment_target = '9.0' 15 | s.preserve_paths = '*.js' 16 | s.library = 'z' 17 | s.source_files = 'ios/CodePush/*.{h,m}' 18 | s.public_header_files = ['ios/CodePush/CodePush.h'] 19 | 20 | # Note: Even though there are copy/pasted versions of some of these dependencies in the repo, 21 | # we explicitly let CocoaPods pull in the versions below so all dependencies are resolved and 22 | # linked properly at a parent workspace level. 23 | s.dependency 'React-Core' 24 | s.dependency 'SSZipArchive', '~> 2.2.2' 25 | s.dependency 'JWT', '~> 3.0.0-beta.12' 26 | s.dependency 'Base64', '~> 1.1' 27 | end 28 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["react-native"] 3 | } 4 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore unexpected extra "@providesModule" 9 | .*/node_modules/.*/node_modules/fbjs/.* 10 | 11 | ; Ignore duplicate module providers 12 | ; For RN Apps installed via npm, "Libraries" folder is inside 13 | ; "node_modules/react-native" but in the source repo it is in the root 14 | .*/Libraries/react-native/React.js 15 | 16 | ; Ignore polyfills 17 | .*/Libraries/polyfills/.* 18 | 19 | [include] 20 | 21 | [libs] 22 | node_modules/react-native/Libraries/react-native/react-native-interface.js 23 | node_modules/react-native/flow/ 24 | 25 | [options] 26 | emoji=true 27 | 28 | module.system=haste 29 | 30 | munge_underscores=true 31 | 32 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' 33 | 34 | suppress_type=$FlowIssue 35 | suppress_type=$FlowFixMe 36 | suppress_type=$FlowFixMeProps 37 | suppress_type=$FlowFixMeState 38 | suppress_type=$FixMe 39 | 40 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-3]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 41 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-3]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 42 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 43 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 44 | 45 | unsafe.enable_getters_and_setters=true 46 | 47 | [version] 48 | ^0.53.0 49 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://docs.fastlane.tools/best-practices/source-control/ 50 | 51 | */fastlane/report.xml 52 | */fastlane/Preview.html 53 | */fastlane/screenshots 54 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/__tests__/App.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import App from '../App'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | jest.mock('react-native-code-push', () => { 9 | const cp = (_) => (app) => app; 10 | Object.assign(cp, { 11 | InstallMode: {}, 12 | CheckFrequency: {}, 13 | SyncStatus: {}, 14 | UpdateState: {}, 15 | DeploymentStatus: {}, 16 | DEFAULT_UPDATE_DIALOG: {}, 17 | 18 | checkForUpdate: jest.fn(), 19 | codePushify: jest.fn(), 20 | getConfiguration: jest.fn(), 21 | getCurrentPackage: jest.fn(), 22 | getUpdateMetadata: jest.fn(), 23 | log: jest.fn(), 24 | notifyAppReady: jest.fn(), 25 | notifyApplicationReady: jest.fn(), 26 | sync: jest.fn(), 27 | }); 28 | return cp; 29 | }); 30 | 31 | it('renders correctly', () => { 32 | const tree = renderer.create( 33 | 34 | ); 35 | }); 36 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodePushDemoApp 4 | Project CodePushDemoApp created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.buildship.core.gradleprojectbuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.buildship.core.gradleprojectnature 16 | 17 | 18 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | #Mon Oct 23 14:47:04 MSK 2017 2 | connection.project.dir= 3 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/app/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | #Mon Oct 23 14:47:04 MSK 2017 2 | connection.project.dir=.. 3 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | lib_deps = [] 12 | 13 | for jarfile in glob(['libs/*.jar']): 14 | name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')] 15 | lib_deps.append(':' + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | 21 | for aarfile in glob(['libs/*.aar']): 22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] 23 | lib_deps.append(':' + name) 24 | android_prebuilt_aar( 25 | name = name, 26 | aar = aarfile, 27 | ) 28 | 29 | android_library( 30 | name = "all-libs", 31 | exported_deps = lib_deps, 32 | ) 33 | 34 | android_library( 35 | name = "app-code", 36 | srcs = glob([ 37 | "src/main/java/**/*.java", 38 | ]), 39 | deps = [ 40 | ":all-libs", 41 | ":build_config", 42 | ":res", 43 | ], 44 | ) 45 | 46 | android_build_config( 47 | name = "build_config", 48 | package = "com.codepushdemoapp", 49 | ) 50 | 51 | android_resource( 52 | name = "res", 53 | package = "com.codepushdemoapp", 54 | res = "src/main/res", 55 | ) 56 | 57 | android_binary( 58 | name = "app", 59 | keystore = "//android/keystores:debug", 60 | manifest = "src/main/AndroidManifest.xml", 61 | package_type = "debug", 62 | deps = [ 63 | ":app-code", 64 | ], 65 | ) 66 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 19 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/app/src/main/java/com/codepushdemoapp/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.codepushdemoapp; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "CodePushDemoApp"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/app/src/main/java/com/codepushdemoapp/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.codepushdemoapp; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.react.ReactApplication; 6 | import com.microsoft.codepush.react.CodePush; 7 | import com.facebook.react.ReactNativeHost; 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.react.shell.MainReactPackage; 10 | import com.facebook.soloader.SoLoader; 11 | 12 | import java.util.Arrays; 13 | import java.util.List; 14 | 15 | public class MainApplication extends Application implements ReactApplication { 16 | 17 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 18 | 19 | @Override 20 | protected String getJSBundleFile() { 21 | return CodePush.getJSBundleFile(); 22 | } 23 | 24 | @Override 25 | public boolean getUseDeveloperSupport() { 26 | return BuildConfig.DEBUG; 27 | } 28 | 29 | @Override 30 | protected List getPackages() { 31 | return Arrays.asList( 32 | new MainReactPackage(), 33 | new CodePush(getResources().getString(R.string.CodePushDeploymentKey), getApplicationContext(), BuildConfig.DEBUG) 34 | ); 35 | } 36 | 37 | @Override 38 | protected String getJSMainModuleName() { 39 | return "index"; 40 | } 41 | }; 42 | 43 | @Override 44 | public ReactNativeHost getReactNativeHost() { 45 | return mReactNativeHost; 46 | } 47 | 48 | @Override 49 | public void onCreate() { 50 | super.onCreate(); 51 | SoLoader.init(this, /* native exopackage */ false); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/Examples/CodePushDemoApp/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/Examples/CodePushDemoApp/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/Examples/CodePushDemoApp/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/Examples/CodePushDemoApp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | deployment-key-here 3 | CodePushDemoApp 4 | 5 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.2.3' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | mavenLocal() 18 | jcenter() 19 | maven { 20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 21 | url "$rootDir/../node_modules/react-native/android" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useDeprecatedNdk=true 21 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/Examples/CodePushDemoApp/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 6 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'CodePushDemoApp' 2 | include ':react-native-code-push' 3 | project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app') 4 | 5 | include ':app' 6 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CodePushDemoApp", 3 | "displayName": "CodePushDemoApp" 4 | } -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/images/laptop_phone_howitworks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/Examples/CodePushDemoApp/images/laptop_phone_howitworks.png -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/index.js: -------------------------------------------------------------------------------- 1 | import { AppRegistry } from 'react-native'; 2 | import App from './App'; 3 | 4 | AppRegistry.registerComponent('CodePushDemoApp', () => App); 5 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/ios/CodePushDemoApp-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/ios/CodePushDemoApp-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/ios/CodePushDemoApp/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/ios/CodePushDemoApp/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | #import 12 | 13 | #import 14 | #import 15 | 16 | @implementation AppDelegate 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 19 | { 20 | NSURL *jsCodeLocation; 21 | 22 | 23 | #ifdef DEBUG 24 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 25 | #else 26 | jsCodeLocation = [CodePush bundleURL]; 27 | #endif 28 | 29 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 30 | moduleName:@"CodePushDemoApp" 31 | initialProperties:nil 32 | launchOptions:launchOptions]; 33 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 34 | 35 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 36 | UIViewController *rootViewController = [UIViewController new]; 37 | rootViewController.view = rootView; 38 | self.window.rootViewController = rootViewController; 39 | [self.window makeKeyAndVisible]; 40 | return YES; 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/ios/CodePushDemoApp/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/ios/CodePushDemoApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | CodePushDemoApp 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UIViewControllerBasedStatusBarAppearance 40 | 41 | NSLocationWhenInUseUsageDescription 42 | 43 | NSAppTransportSecurity 44 | 45 | NSExceptionDomains 46 | 47 | localhost 48 | 49 | NSExceptionAllowsInsecureHTTPLoads 50 | 51 | 52 | 53 | 54 | CodePushDeploymentKey 55 | deployment-key-here 56 | 57 | 58 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/ios/CodePushDemoApp/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/ios/CodePushDemoAppTests/CodePushDemoAppTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import 14 | #import 15 | 16 | #define TIMEOUT_SECONDS 600 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface CodePushDemoAppTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation CodePushDemoAppTests 24 | 25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 26 | { 27 | if (test(view)) { 28 | return YES; 29 | } 30 | for (UIView *subview in [view subviews]) { 31 | if ([self findSubviewInView:subview matching:test]) { 32 | return YES; 33 | } 34 | } 35 | return NO; 36 | } 37 | 38 | - (void)testRendersWelcomeScreen 39 | { 40 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 42 | BOOL foundElement = NO; 43 | 44 | __block NSString *redboxError = nil; 45 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 46 | if (level >= RCTLogLevelError) { 47 | redboxError = message; 48 | } 49 | }); 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | RCTSetLogFunction(RCTDefaultLogFunction); 64 | 65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/ios/CodePushDemoAppTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Examples/CodePushDemoApp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CodePushDemoApp", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "react-native start", 7 | "test": "jest" 8 | }, 9 | "dependencies": { 10 | "react": "^17.0.2", 11 | "react-native": "^0.64.0", 12 | "react-native-code-push": "file:../../" 13 | }, 14 | "devDependencies": { 15 | "babel-jest": "^25.0.0", 16 | "babel-preset-react-native": "4.0.0", 17 | "jest": "^25.0.0", 18 | "react-test-renderer": "^17.0.2" 19 | }, 20 | "jest": { 21 | "preset": "react-native" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '@react-native-community', 4 | }; 5 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore polyfills 9 | node_modules/react-native/Libraries/polyfills/.* 10 | 11 | ; These should not be required directly 12 | ; require from fbjs/lib instead: require('fbjs/lib/warning') 13 | node_modules/warning/.* 14 | 15 | ; Flow doesn't support platforms 16 | .*/Libraries/Utilities/LoadingView.js 17 | 18 | [untyped] 19 | .*/node_modules/@react-native-community/cli/.*/.* 20 | 21 | [include] 22 | 23 | [libs] 24 | node_modules/react-native/interface.js 25 | node_modules/react-native/flow/ 26 | 27 | [options] 28 | emoji=true 29 | 30 | esproposal.optional_chaining=enable 31 | esproposal.nullish_coalescing=enable 32 | 33 | module.file_ext=.js 34 | module.file_ext=.json 35 | module.file_ext=.ios.js 36 | 37 | munge_underscores=true 38 | 39 | module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1' 40 | module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/node_modules/react-native/Libraries/Image/RelativeImageStub' 41 | 42 | suppress_type=$FlowIssue 43 | suppress_type=$FlowFixMe 44 | suppress_type=$FlowFixMeProps 45 | suppress_type=$FlowFixMeState 46 | 47 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\) 48 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+ 49 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 50 | 51 | [lints] 52 | sketchy-null-number=warn 53 | sketchy-null-mixed=warn 54 | sketchy-number=warn 55 | untyped-type-import=warn 56 | nonstrict-import=warn 57 | deprecated-type=warn 58 | unsafe-getters-setters=warn 59 | unnecessary-invariant=warn 60 | signature-verification-failure=warn 61 | deprecated-utility=error 62 | 63 | [strict] 64 | deprecated-type 65 | nonstrict-import 66 | sketchy-null 67 | unclear-type 68 | unsafe-getters-setters 69 | untyped-import 70 | untyped-type-import 71 | 72 | [version] 73 | ^0.122.0 74 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | 24 | # Android/IntelliJ 25 | # 26 | build/ 27 | .idea 28 | .gradle 29 | local.properties 30 | *.iml 31 | 32 | # Visual Studio Code 33 | # 34 | .vscode/ 35 | 36 | # node.js 37 | # 38 | node_modules/ 39 | npm-debug.log 40 | yarn-error.log 41 | 42 | # BUCK 43 | buck-out/ 44 | \.buckd/ 45 | *.keystore 46 | !debug.keystore 47 | 48 | # fastlane 49 | # 50 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 51 | # screenshots whenever they are needed. 52 | # For more information about the recommended setup visit: 53 | # https://docs.fastlane.tools/best-practices/source-control/ 54 | 55 | */fastlane/report.xml 56 | */fastlane/Preview.html 57 | */fastlane/screenshots 58 | 59 | # Bundle artifact 60 | *.jsbundle 61 | 62 | # CocoaPods 63 | /ios/Pods/ 64 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | bracketSpacing: false, 3 | jsxBracketSameLine: true, 4 | singleQuote: true, 5 | trailingComma: 'all', 6 | }; 7 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CodePushDemoAppCpp", 3 | "displayName": "CodePushDemoAppCpp" 4 | } 5 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/images/laptop_phone_howitworks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/Examples/CodePushDemoAppCpp/images/laptop_phone_howitworks.png -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import {AppRegistry} from 'react-native'; 6 | import App from './App'; 7 | import {name as appName} from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | const path = require('path'); 8 | const blacklist = require('metro-config/src/defaults/blacklist'); 9 | 10 | module.exports = { 11 | resolver: { 12 | blacklistRE: blacklist([ 13 | // This stops "react-native run-windows" from causing the metro server to crash if its already running 14 | new RegExp( 15 | `${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`, 16 | ), 17 | // This prevents "react-native run-windows" from hitting: EBUSY: resource busy or locked, open msbuild.ProjectImports.zip 18 | /.*\.ProjectImports\.zip/, 19 | ]), 20 | }, 21 | transformer: { 22 | getTransformOptions: async () => ({ 23 | transform: { 24 | experimentalImportSupport: false, 25 | inlineRequires: false, 26 | }, 27 | }), 28 | }, 29 | }; 30 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CodePushDemoAppCpp", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "react-native start", 7 | "test": "jest", 8 | "lint": "eslint .", 9 | "windows": "react-native run-windows" 10 | }, 11 | "dependencies": { 12 | "react": "^16.13.1", 13 | "react-native": "^0.64.0", 14 | "react-native-code-push": "^7.0.0", 15 | "react-native-windows": "^1.0.0" 16 | }, 17 | "devDependencies": { 18 | "@babel/core": "^7.8.4", 19 | "@babel/runtime": "^7.8.4", 20 | "@react-native-community/eslint-config": "^1.1.0", 21 | "appcenter-cli": "^2.7.2", 22 | "babel-jest": "^25.1.0", 23 | "eslint": "^6.5.1", 24 | "jest": "^25.1.0", 25 | "metro-react-native-babel-preset": "^0.59.0", 26 | "react-test-renderer": "16.13.1" 27 | }, 28 | "jest": { 29 | "preset": "react-native" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/.gitignore: -------------------------------------------------------------------------------- 1 | *AppPackages* 2 | *BundleArtifacts* 3 | 4 | #OS junk files 5 | [Tt]humbs.db 6 | *.DS_Store 7 | 8 | #Visual Studio files 9 | *.[Oo]bj 10 | *.user 11 | *.aps 12 | *.pch 13 | *.vspscc 14 | *.vssscc 15 | *_i.c 16 | *_p.c 17 | *.ncb 18 | *.suo 19 | *.tlb 20 | *.tlh 21 | *.bak 22 | *.[Cc]ache 23 | *.ilk 24 | *.log 25 | *.lib 26 | *.sbr 27 | *.sdf 28 | *.opensdf 29 | *.opendb 30 | *.unsuccessfulbuild 31 | ipch/ 32 | [Oo]bj/ 33 | [Bb]in 34 | [Dd]ebug*/ 35 | [Rr]elease*/ 36 | Ankh.NoLoad 37 | 38 | # Visual C++ cache files 39 | ipch/ 40 | *.aps 41 | *.ncb 42 | *.opendb 43 | *.opensdf 44 | *.sdf 45 | *.cachefile 46 | *.VC.db 47 | *.VC.VC.opendb 48 | 49 | #MonoDevelop 50 | *.pidb 51 | *.userprefs 52 | 53 | #Tooling 54 | _ReSharper*/ 55 | *.resharper 56 | [Tt]est[Rr]esult* 57 | *.sass-cache 58 | 59 | #Project files 60 | [Bb]uild/ 61 | 62 | #Subversion files 63 | .svn 64 | 65 | # Office Temp Files 66 | ~$* 67 | 68 | # vim Temp Files 69 | *~ 70 | 71 | #NuGet 72 | packages/ 73 | *.nupkg 74 | 75 | #ncrunch 76 | *ncrunch* 77 | *crunch*.local.xml 78 | 79 | # visual studio database projects 80 | *.dbmdl 81 | 82 | #Test files 83 | *.testsettings 84 | 85 | #Other files 86 | *.DotSettings 87 | .vs/ 88 | *project.lock.json 89 | 90 | #Files generated by the VS build 91 | **/Generated Files/** 92 | 93 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/.gitignore: -------------------------------------------------------------------------------- 1 | /Bundle 2 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/App.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "App.xaml.g.h" 4 | #include "winrt/Microsoft.ReactNative.h" 5 | 6 | namespace activation = winrt::Windows::ApplicationModel::Activation; 7 | 8 | namespace winrt::CodePushDemoAppCpp::implementation 9 | { 10 | struct App : AppT 11 | { 12 | App() noexcept; 13 | 14 | void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const&); 15 | void OnSuspending(IInspectable const&, Windows::ApplicationModel::SuspendingEventArgs const&); 16 | void OnNavigationFailed(IInspectable const&, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs const&); 17 | 18 | winrt::Microsoft::ReactNative::ReactNativeHost& Host() noexcept { return m_host; } 19 | private: 20 | winrt::Microsoft::ReactNative::ReactNativeHost m_host; 21 | }; 22 | } // namespace winrt::CodePushDemoAppCpp::implementation 23 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/App.idl: -------------------------------------------------------------------------------- 1 | namespace CodePushDemoAppCpp 2 | { 3 | } 4 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/Assets/StoreLogo.png -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/AutolinkedNativeModules.g.cpp: -------------------------------------------------------------------------------- 1 | // AutolinkedNativeModules.g.cpp contents generated by "react-native autolink-windows" 2 | // clang-format off 3 | #include "pch.h" 4 | #include "AutolinkedNativeModules.g.h" 5 | 6 | // Includes from react-native-code-push-windows 7 | #include "winrt/Microsoft.CodePush.ReactNative.h" 8 | 9 | namespace winrt::Microsoft::ReactNative 10 | { 11 | 12 | void RegisterAutolinkedNativeModulePackages(winrt::Windows::Foundation::Collections::IVector const& packageProviders) 13 | { 14 | // IReactPackageProviders from react-native-code-push-windows 15 | packageProviders.Append(winrt::Microsoft::CodePush::ReactNative::ReactPackageProvider()); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/AutolinkedNativeModules.g.h: -------------------------------------------------------------------------------- 1 | // AutolinkedNativeModules.g.h contents generated by "react-native autolink-windows" 2 | 3 | #pragma once 4 | 5 | namespace winrt::Microsoft::ReactNative 6 | { 7 | 8 | void RegisterAutolinkedNativeModulePackages(winrt::Windows::Foundation::Collections::IVector const& packageProviders); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/AutolinkedNativeModules.g.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/CodePushDemoAppCpp.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Assets 25 | 26 | 27 | Assets 28 | 29 | 30 | Assets 31 | 32 | 33 | Assets 34 | 35 | 36 | Assets 37 | 38 | 39 | Assets 40 | 41 | 42 | Assets 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | {e48dc53e-40b1-40cb-970a-f89935452892} 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/CodePushDemoAppCpp_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/CodePushDemoAppCpp_TemporaryKey.pfx -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/MainPage.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "MainPage.h" 3 | #if __has_include("MainPage.g.cpp") 4 | #include "MainPage.g.cpp" 5 | #endif 6 | 7 | #include "App.h" 8 | 9 | 10 | 11 | using namespace winrt; 12 | using namespace Windows::UI::Xaml; 13 | 14 | namespace winrt::CodePushDemoAppCpp::implementation 15 | { 16 | MainPage::MainPage() 17 | { 18 | InitializeComponent(); 19 | auto app = Application::Current().as(); 20 | ReactRootView().ReactNativeHost(app->Host()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/MainPage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "MainPage.g.h" 3 | #include 4 | 5 | 6 | namespace winrt::CodePushDemoAppCpp::implementation 7 | { 8 | struct MainPage : MainPageT 9 | { 10 | MainPage(); 11 | }; 12 | } 13 | 14 | namespace winrt::CodePushDemoAppCpp::factory_implementation 15 | { 16 | struct MainPage : MainPageT 17 | { 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/MainPage.idl: -------------------------------------------------------------------------------- 1 | namespace CodePushDemoAppCpp 2 | { 3 | [default_interface] 4 | runtimeclass MainPage : Windows.UI.Xaml.Controls.Page 5 | { 6 | MainPage(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/MainPage.xaml: -------------------------------------------------------------------------------- 1 | 11 | 16 | 17 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | CodePushDemoAppCpp 18 | Aleksey 19 | Assets\StoreLogo.png 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 35 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/PropertySheet.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/ReactPackageProvider.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "ReactPackageProvider.h" 3 | #include "NativeModules.h" 4 | 5 | 6 | using namespace winrt::Microsoft::ReactNative; 7 | 8 | namespace winrt::CodePushDemoAppCpp::implementation 9 | { 10 | 11 | void ReactPackageProvider::CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept 12 | { 13 | AddAttributedModules(packageBuilder); 14 | } 15 | 16 | } // namespace winrt::CodePushDemoAppCpp::implementation 17 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/ReactPackageProvider.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "winrt/Microsoft.ReactNative.h" 4 | 5 | namespace winrt::CodePushDemoAppCpp::implementation 6 | { 7 | struct ReactPackageProvider : winrt::implements 8 | { 9 | public: // IReactPackageProvider 10 | void CreatePackage(winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder) noexcept; 11 | }; 12 | } // namespace winrt::CodePushDemoAppCpp::implementation 13 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | -------------------------------------------------------------------------------- /Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define NOMINMAX 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Microsoft CodePush Plugin for React Native 2 | 3 | Copyright (c) Microsoft Corporation 4 | 5 | All rights reserved. 6 | 7 | MIT License 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Recipes/UpdateButton.ios.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var pkg = require('./package'); 4 | var React = require('react-native'); 5 | var { 6 | AppRegistry, 7 | StyleSheet, 8 | Text, 9 | View, 10 | } = React; 11 | var Button = require('react-native-button'); 12 | 13 | var CodePush = require('react-native-code-push'); 14 | 15 | var UpdateButton = React.createClass({ 16 | getInitialState: function() { 17 | return {}; 18 | }, 19 | componentDidMount: function() { 20 | CodePush.checkForUpdate().done((update) => { 21 | if (update && !update.downloadURL) { 22 | this.setState({ 23 | update: update 24 | }); 25 | } 26 | }); 27 | }, 28 | update: function() { 29 | this.state.update.download().done((newPackage) => { 30 | newPackage.install(); 31 | }); 32 | }, 33 | render: function() { 34 | var updateButton = null; 35 | if (this.state.update) { 36 | updateButton = ; 37 | } 38 | 39 | return ( 40 | 41 | 42 | Welcome to {pkg.name} {pkg.version}! 43 | 44 | {updateButton} 45 | 46 | ); 47 | } 48 | }); 49 | 50 | var styles = StyleSheet.create({ 51 | container: { 52 | flex: 1, 53 | justifyContent: 'center', 54 | alignItems: 'center', 55 | backgroundColor: '#F5FCFF', 56 | } 57 | }); 58 | 59 | AppRegistry.registerComponent('UpdateButton', () => UpdateButton); 60 | -------------------------------------------------------------------------------- /Recipes/UpdateOnStart.ios.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var pkg = require('./package'); 4 | var React = require('react-native'); 5 | var { 6 | AppRegistry, 7 | StyleSheet, 8 | Text, 9 | View, 10 | } = React; 11 | 12 | var CodePush = require('react-native-code-push'); 13 | 14 | var UpdateOnStart = React.createClass({ 15 | componentDidMount: function() { 16 | CodePush.checkForUpdate().done((update) => { 17 | if (update && update.downloadUrl) { 18 | update.download().done((newPackage) => { 19 | newPackage.install(); 20 | }); 21 | } 22 | }); 23 | }, 24 | render: function() { 25 | return ( 26 | 27 | 28 | Welcome to {pkg.name} {pkg.version}! 29 | 30 | 31 | ); 32 | } 33 | }); 34 | 35 | var styles = StyleSheet.create({ 36 | container: { 37 | flex: 1, 38 | justifyContent: 'center', 39 | alignItems: 'center', 40 | backgroundColor: '#F5FCFF', 41 | } 42 | }); 43 | 44 | AppRegistry.registerComponent('UpdateOnStart', () => UpdateOnStart); 45 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.library" 2 | 3 | def DEFAULT_COMPILE_SDK_VERSION = 26 4 | def DEFAULT_BUILD_TOOLS_VERSION = "26.0.3" 5 | def DEFAULT_TARGET_SDK_VERSION = 26 6 | def DEFAULT_MIN_SDK_VERSION = 16 7 | 8 | android { 9 | compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION 10 | buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION 11 | 12 | defaultConfig { 13 | minSdkVersion rootProject.hasProperty('minSdkVersion') ? rootProject.minSdkVersion : DEFAULT_MIN_SDK_VERSION 14 | targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION 15 | versionCode 1 16 | versionName "1.0" 17 | } 18 | 19 | lintOptions { 20 | abortOnError false 21 | } 22 | 23 | defaultConfig { 24 | consumerProguardFiles 'proguard-rules.pro' 25 | } 26 | } 27 | 28 | dependencies { 29 | implementation "com.facebook.react:react-native:+" 30 | implementation 'com.nimbusds:nimbus-jose-jwt:5.1' 31 | } 32 | -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Invoked via reflection, when setting js bundle. 20 | -keepclassmembers class com.facebook.react.ReactInstanceManager { 21 | private final ** mBundleLoader; 22 | } 23 | 24 | # Can't find referenced class org.bouncycastle.** 25 | -dontwarn com.nimbusds.jose.** 26 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.codepush.react; 2 | 3 | import android.content.Context; 4 | 5 | public class CodePushBuilder { 6 | private String mDeploymentKey; 7 | private Context mContext; 8 | 9 | private boolean mIsDebugMode; 10 | private String mServerUrl; 11 | private Integer mPublicKeyResourceDescriptor; 12 | 13 | public CodePushBuilder(String deploymentKey, Context context) { 14 | this.mDeploymentKey = deploymentKey; 15 | this.mContext = context; 16 | } 17 | 18 | public CodePushBuilder setIsDebugMode(boolean isDebugMode) { 19 | this.mIsDebugMode = isDebugMode; 20 | return this; 21 | } 22 | 23 | public CodePushBuilder setServerUrl(String serverUrl) { 24 | this.mServerUrl = serverUrl; 25 | return this; 26 | } 27 | 28 | public CodePushBuilder setPublicKeyResourceDescriptor(int publicKeyResourceDescriptor) { 29 | this.mPublicKeyResourceDescriptor = publicKeyResourceDescriptor; 30 | return this; 31 | } 32 | 33 | public CodePush build() { 34 | return new CodePush(this.mDeploymentKey, this.mContext, this.mIsDebugMode, this.mServerUrl, this.mPublicKeyResourceDescriptor); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.codepush.react; 2 | 3 | public class CodePushConstants { 4 | public static final String ASSETS_BUNDLE_PREFIX = "assets://"; 5 | public static final String BINARY_MODIFIED_TIME_KEY = "binaryModifiedTime"; 6 | public static final String CODE_PUSH_FOLDER_PREFIX = "CodePush"; 7 | public static final String CODE_PUSH_HASH_FILE_NAME = "CodePushHash"; 8 | public static final String CODE_PUSH_OLD_HASH_FILE_NAME = "CodePushHash.json"; 9 | public static final String CODE_PUSH_PREFERENCES = "CodePush"; 10 | public static final String CURRENT_PACKAGE_KEY = "currentPackage"; 11 | public static final String DEFAULT_JS_BUNDLE_NAME = "index.android.bundle"; 12 | public static final String DIFF_MANIFEST_FILE_NAME = "hotcodepush.json"; 13 | public static final int DOWNLOAD_BUFFER_SIZE = 1024 * 256; 14 | public static final String DOWNLOAD_FILE_NAME = "download.zip"; 15 | public static final String DOWNLOAD_PROGRESS_EVENT_NAME = "CodePushDownloadProgress"; 16 | public static final String DOWNLOAD_URL_KEY = "downloadUrl"; 17 | public static final String FAILED_UPDATES_KEY = "CODE_PUSH_FAILED_UPDATES"; 18 | public static final String PACKAGE_FILE_NAME = "app.json"; 19 | public static final String PACKAGE_HASH_KEY = "packageHash"; 20 | public static final String PENDING_UPDATE_HASH_KEY = "hash"; 21 | public static final String PENDING_UPDATE_IS_LOADING_KEY = "isLoading"; 22 | public static final String PENDING_UPDATE_KEY = "CODE_PUSH_PENDING_UPDATE"; 23 | public static final String PREVIOUS_PACKAGE_KEY = "previousPackage"; 24 | public static final String REACT_NATIVE_LOG_TAG = "ReactNative"; 25 | public static final String RELATIVE_BUNDLE_PATH_KEY = "bundlePath"; 26 | public static final String STATUS_FILE = "codepush.json"; 27 | public static final String UNZIPPED_FOLDER_NAME = "unzipped"; 28 | public static final String CODE_PUSH_APK_BUILD_TIME_KEY = "CODE_PUSH_APK_BUILD_TIME"; 29 | public static final String BUNDLE_JWT_FILE = ".codepushrelease"; 30 | public static final String LATEST_ROLLBACK_INFO_KEY = "LATEST_ROLLBACK_INFO"; 31 | public static final String LATEST_ROLLBACK_PACKAGE_HASH_KEY = "packageHash"; 32 | public static final String LATEST_ROLLBACK_TIME_KEY = "time"; 33 | public static final String LATEST_ROLLBACK_COUNT_KEY = "count"; 34 | } 35 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/microsoft/codepush/react/CodePushInstallMode.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.codepush.react; 2 | 3 | public enum CodePushInstallMode { 4 | IMMEDIATE(0), 5 | ON_NEXT_RESTART(1), 6 | ON_NEXT_RESUME(2), 7 | ON_NEXT_SUSPEND(3); 8 | 9 | private final int value; 10 | CodePushInstallMode(int value) { 11 | this.value = value; 12 | } 13 | public int getValue() { 14 | return this.value; 15 | } 16 | } -------------------------------------------------------------------------------- /android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.codepush.react; 2 | 3 | class CodePushInvalidPublicKeyException extends RuntimeException { 4 | 5 | public CodePushInvalidPublicKeyException(String message, Throwable cause) { 6 | super(message, cause); 7 | } 8 | 9 | public CodePushInvalidPublicKeyException(String message) { 10 | super(message); 11 | } 12 | } -------------------------------------------------------------------------------- /android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidUpdateException.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.codepush.react; 2 | 3 | public class CodePushInvalidUpdateException extends RuntimeException { 4 | public CodePushInvalidUpdateException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/microsoft/codepush/react/CodePushMalformedDataException.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.codepush.react; 2 | 3 | import java.net.MalformedURLException; 4 | 5 | public class CodePushMalformedDataException extends RuntimeException { 6 | public CodePushMalformedDataException(String path, Throwable cause) { 7 | super("Unable to parse contents of " + path + ", the file may be corrupted.", cause); 8 | } 9 | public CodePushMalformedDataException(String url, MalformedURLException cause) { 10 | super("The package has an invalid downloadUrl: " + url, cause); 11 | } 12 | } -------------------------------------------------------------------------------- /android/app/src/main/java/com/microsoft/codepush/react/CodePushNotInitializedException.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.codepush.react; 2 | 3 | public final class CodePushNotInitializedException extends RuntimeException { 4 | 5 | public CodePushNotInitializedException(String message, Throwable cause) { 6 | super(message, cause); 7 | } 8 | 9 | public CodePushNotInitializedException(String message) { 10 | super(message); 11 | } 12 | } -------------------------------------------------------------------------------- /android/app/src/main/java/com/microsoft/codepush/react/CodePushUnknownException.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.codepush.react; 2 | 3 | class CodePushUnknownException extends RuntimeException { 4 | 5 | public CodePushUnknownException(String message, Throwable cause) { 6 | super(message, cause); 7 | } 8 | 9 | public CodePushUnknownException(String message) { 10 | super(message); 11 | } 12 | } -------------------------------------------------------------------------------- /android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateState.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.codepush.react; 2 | 3 | public enum CodePushUpdateState { 4 | RUNNING(0), 5 | PENDING(1), 6 | LATEST(2); 7 | 8 | private final int value; 9 | CodePushUpdateState(int value) { 10 | this.value = value; 11 | } 12 | public int getValue() { 13 | return this.value; 14 | } 15 | } -------------------------------------------------------------------------------- /android/app/src/main/java/com/microsoft/codepush/react/DownloadProgress.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.codepush.react; 2 | 3 | import com.facebook.react.bridge.WritableMap; 4 | import com.facebook.react.bridge.WritableNativeMap; 5 | 6 | class DownloadProgress { 7 | private long mTotalBytes; 8 | private long mReceivedBytes; 9 | 10 | public DownloadProgress (long totalBytes, long receivedBytes){ 11 | mTotalBytes = totalBytes; 12 | mReceivedBytes = receivedBytes; 13 | } 14 | 15 | public WritableMap createWritableMap() { 16 | WritableMap map = new WritableNativeMap(); 17 | if (mTotalBytes < Integer.MAX_VALUE) { 18 | map.putInt("totalBytes", (int) mTotalBytes); 19 | map.putInt("receivedBytes", (int) mReceivedBytes); 20 | } else { 21 | map.putDouble("totalBytes", mTotalBytes); 22 | map.putDouble("receivedBytes", mReceivedBytes); 23 | } 24 | return map; 25 | } 26 | 27 | public boolean isCompleted() { 28 | return mTotalBytes == mReceivedBytes; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/microsoft/codepush/react/DownloadProgressCallback.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.codepush.react; 2 | 3 | interface DownloadProgressCallback { 4 | void call(DownloadProgress downloadProgress); 5 | } 6 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/microsoft/codepush/react/ReactInstanceHolder.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.codepush.react; 2 | 3 | import com.facebook.react.ReactInstanceManager; 4 | 5 | /** 6 | * Provides access to a {@link ReactInstanceManager}. 7 | * 8 | * ReactNativeHost already implements this interface, if you make use of that react-native 9 | * component (just add `implements ReactInstanceHolder`). 10 | */ 11 | public interface ReactInstanceHolder { 12 | 13 | /** 14 | * Get the current {@link ReactInstanceManager} instance. May return null. 15 | */ 16 | ReactInstanceManager getReactInstanceManager(); 17 | } 18 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/microsoft/codepush/react/TLSSocketFactory.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.codepush.react; 2 | 3 | import java.io.IOException; 4 | import java.net.InetAddress; 5 | import java.net.Socket; 6 | import java.net.UnknownHostException; 7 | import java.security.KeyManagementException; 8 | import java.security.NoSuchAlgorithmException; 9 | 10 | import javax.net.ssl.SSLContext; 11 | import javax.net.ssl.SSLSocket; 12 | import javax.net.ssl.SSLSocketFactory; 13 | 14 | public class TLSSocketFactory extends SSLSocketFactory { 15 | 16 | private SSLSocketFactory delegate; 17 | 18 | public TLSSocketFactory() throws KeyManagementException, NoSuchAlgorithmException { 19 | SSLContext context = SSLContext.getInstance("TLS"); 20 | context.init(null, null, null); 21 | delegate = context.getSocketFactory(); 22 | } 23 | 24 | @Override 25 | public String[] getDefaultCipherSuites() { 26 | return delegate.getDefaultCipherSuites(); 27 | } 28 | 29 | @Override 30 | public String[] getSupportedCipherSuites() { 31 | return delegate.getSupportedCipherSuites(); 32 | } 33 | 34 | @Override 35 | public Socket createSocket() throws IOException { 36 | return enableTLSOnSocket(delegate.createSocket()); 37 | } 38 | 39 | @Override 40 | public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException { 41 | return enableTLSOnSocket(delegate.createSocket(s, host, port, autoClose)); 42 | } 43 | 44 | @Override 45 | public Socket createSocket(String host, int port) throws IOException, UnknownHostException { 46 | return enableTLSOnSocket(delegate.createSocket(host, port)); 47 | } 48 | 49 | @Override 50 | public Socket createSocket(String host, int port, InetAddress localHost, int localPort) 51 | throws IOException, UnknownHostException { 52 | return enableTLSOnSocket(delegate.createSocket(host, port, localHost, localPort)); 53 | } 54 | 55 | @Override 56 | public Socket createSocket(InetAddress host, int port) throws IOException { 57 | return enableTLSOnSocket(delegate.createSocket(host, port)); 58 | } 59 | 60 | @Override 61 | public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) 62 | throws IOException { 63 | return enableTLSOnSocket(delegate.createSocket(address, port, localAddress, localPort)); 64 | } 65 | 66 | private Socket enableTLSOnSocket(Socket socket) { 67 | if (socket != null && (socket instanceof SSLSocket)) { 68 | ((SSLSocket) socket).setEnabledProtocols(new String[] { "TLSv1.1", "TLSv1.2" }); 69 | } 70 | return socket; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.3.0' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | mavenLocal() 18 | jcenter() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useDeprecatedNdk=true 21 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 6 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' -------------------------------------------------------------------------------- /code-push-plugin-testing-framework/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "code-push-plugin-testing-framework", 3 | "version": "0.0.1", 4 | "description": "Plugin Testing Framework for CodePush Plugins", 5 | "main": "script/index.js", 6 | "scripts": { 7 | "test": "gulp" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/microsoft/code-push.git" 12 | }, 13 | "author": { 14 | "name": "Microsoft Corporation" 15 | }, 16 | "license": "MIT", 17 | "homepage": "https://microsoft.github.io/code-push", 18 | "dependencies": { 19 | "@types/uuid": "^7.0.2", 20 | "base-64": "^0.1.0", 21 | "mocha": "latest", 22 | "mocha-junit-reporter": "latest", 23 | "q": "^1.5.1", 24 | "replace": "latest", 25 | "superagent": "^5.2.1", 26 | "superagent-proxy": "^2.0.0", 27 | "uuid": "^7.0.3" 28 | }, 29 | "bugs": { 30 | "url": "https://github.com/microsoft/code-push/issues" 31 | }, 32 | "readme": "ERROR: No README data found!", 33 | "_id": "code-push-plugin-testing-framework@0.0.1", 34 | "_shasum": "6ea33a661710628af266d714949fe95f88d71f0d", 35 | "_from": "../code-push/plugin-testing-framework/bin", 36 | "_resolved": "file:../code-push/plugin-testing-framework/bin" 37 | } 38 | -------------------------------------------------------------------------------- /code-push-plugin-testing-framework/script/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var Platform = require("./platform"); 3 | exports.Platform = Platform; 4 | var PluginTestingFramework = require("./test"); 5 | exports.PluginTestingFramework = PluginTestingFramework; 6 | var projectManager_1 = require("./projectManager"); 7 | exports.ProjectManager = projectManager_1.ProjectManager; 8 | exports.setupTestRunScenario = projectManager_1.setupTestRunScenario; 9 | exports.setupUpdateScenario = projectManager_1.setupUpdateScenario; 10 | var ServerUtil = require("./serverUtil"); 11 | exports.ServerUtil = ServerUtil; 12 | var testBuilder_1 = require("./testBuilder"); 13 | exports.TestBuilder = testBuilder_1.TestBuilder; 14 | var TestConfig = require("./testConfig"); 15 | exports.TestConfig = TestConfig; 16 | var testUtil_1 = require("./testUtil"); 17 | exports.TestUtil = testUtil_1.TestUtil; 18 | -------------------------------------------------------------------------------- /code-push-plugin-testing-framework/script/testConfig.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | // IMPORTS // 3 | var os = require("os"); 4 | var path = require("path"); 5 | var TestUtil_1 = require("./TestUtil"); 6 | ////////////////////////////////////////////////////////////////////////////////////////// 7 | // Configuration variables. 8 | // What plugin to use, what project directories to use, etc. 9 | // COMMAND LINE OPTION NAMES, FLAGS, AND DEFAULTS 10 | var DEFAULT_TEST_RUN_DIRECTORY = path.join(os.tmpdir(), TestUtil_1.TestUtil.getPluginName(), "test-run"); 11 | var DEFAULT_UPDATES_DIRECTORY = path.join(os.tmpdir(), TestUtil_1.TestUtil.getPluginName(), "updates"); 12 | var DEFAULT_PLUGIN_PATH = path.join(__dirname, "../.."); 13 | var NPM_PLUGIN_PATH = TestUtil_1.TestUtil.getPluginName(); 14 | var SETUP_FLAG_NAME = "--setup"; 15 | var DEFAULT_PLUGIN_TGZ_NAME = TestUtil_1.TestUtil.getPluginName() + "-" + TestUtil_1.TestUtil.getPluginVersion() + ".tgz"; 16 | // CONST VARIABLES 17 | exports.TestAppName = "TestCodePush"; 18 | exports.TestNamespace = "com.testcodepush"; 19 | exports.AcquisitionSDKPluginName = "code-push"; 20 | exports.templatePath = path.join(__dirname, "../../test/template"); 21 | exports.thisPluginInstallString = TestUtil_1.TestUtil.resolveBooleanVariables(process.env.NPM) ? `npm install ${NPM_PLUGIN_PATH}` : `npm pack ${DEFAULT_PLUGIN_PATH} && npm install ${DEFAULT_PLUGIN_TGZ_NAME}`; 22 | exports.testRunDirectory = process.env.RUN_DIR ? process.env.RUN_DIR: DEFAULT_TEST_RUN_DIRECTORY; 23 | exports.updatesDirectory = process.env.UPDATE_DIR ? process.env.UPDATE_DIR : DEFAULT_UPDATES_DIRECTORY; 24 | exports.onlyRunCoreTests = TestUtil_1.TestUtil.resolveBooleanVariables(process.env.CORE); 25 | exports.shouldSetup = TestUtil_1.TestUtil.readMochaCommandLineFlag(SETUP_FLAG_NAME); 26 | exports.restartEmulators = TestUtil_1.TestUtil.resolveBooleanVariables(process.env.CLEAN); 27 | -------------------------------------------------------------------------------- /docs/CodePush分包.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/docs/CodePush分包.png -------------------------------------------------------------------------------- /ios/CodePush.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/CodePush.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/CodePush/Base64/Base64/MF_Base64Additions.h: -------------------------------------------------------------------------------- 1 | // 2 | // MF_Base64Additions.h 3 | // Base64 -- RFC 4648 compatible implementation 4 | // see http://www.ietf.org/rfc/rfc4648.txt for more details 5 | // 6 | // Designed to be compiled with Automatic Reference Counting 7 | // 8 | // Created by Dave Poirier on 2012-06-14. 9 | // Public Domain 10 | // Hosted at https://github.com/ekscrypto/Base64 11 | // 12 | 13 | #import 14 | 15 | @interface NSString (Base64Addition) 16 | +(NSString *)stringFromBase64String:(NSString *)base64String; 17 | +(NSString *)stringFromBase64UrlEncodedString:(NSString *)base64UrlEncodedString; 18 | -(NSString *)base64String; 19 | -(NSString *)base64UrlEncodedString; 20 | @end 21 | 22 | @interface NSData (Base64Addition) 23 | +(NSData *)dataWithBase64String:(NSString *)base64String; 24 | +(NSData *)dataWithBase64UrlEncodedString:(NSString *)base64UrlEncodedString; 25 | -(NSString *)base64String; 26 | -(NSString *)base64UrlEncodedString; 27 | @end 28 | 29 | @interface MF_Base64Codec : NSObject 30 | +(NSData *)dataFromBase64String:(NSString *)base64String; 31 | +(NSString *)base64StringFromData:(NSData *)data; 32 | +(NSString *)base64UrlEncodedStringFromBase64String:(NSString *)base64String; 33 | +(NSString *)base64StringFromBase64UrlEncodedString:(NSString *)base64UrlEncodedString; 34 | @end 35 | -------------------------------------------------------------------------------- /ios/CodePush/Base64/README.md: -------------------------------------------------------------------------------- 1 | [![CI Status](https://travis-ci.org/ekscrypto/Base64.svg?branch=master)](https://github.com/ekscrypto/Base64) 2 | 3 | Base64 Additions for Objective-C on Mac OS X and iOS 4 | ======= 5 | 6 | 7 | Usage 8 | ---- 9 | Open the Xcode project file, and drag MF_Base64Additions.m/.h into your project. 10 | 11 | In files where you want to use Base64 encoding/decoding, simply include the header file and use one of the provided NSData or NSString additions. 12 | 13 | Example use: 14 | #import "MF_Base64Additions.h" 15 | 16 | NSString *helloWorld = @"Hello World"; 17 | NSString *helloInBase64 = [helloWorld base64String]; 18 | NSString *helloDecoded = [NSString stringFromBase64String:helloInBase64]; 19 | 20 | 21 | 22 | 23 | Performance 24 | ---- 25 | * Encoding: Approximately 4 to 5 times faster than using the equivalent SecTransform. 26 | * Encoding: 30% faster than https://github.com/l4u/NSData-Base64 27 | * Decoding: 5% faster than using the equivalent SecTransform. 28 | * Decoding: 5% faster than https://github.com/l4u/NSData-Base64 29 | 30 | 31 | 32 | Requirements 33 | ----- 34 | * Compile with Automatic Reference Counting 35 | * Compatible with Mac OSX 10.6+ and iOS 4.0+ 36 | 37 | 38 | 39 | Implementation 40 | ---- 41 | * Implemented as per RFC 4648, see http://www.ietf.org/rfc/rfc4648.txt for more details. 42 | 43 | 44 | 45 | Licensing 46 | ---- 47 | * Public Domain 48 | -------------------------------------------------------------------------------- /ios/CodePush/CodePushErrorUtils.m: -------------------------------------------------------------------------------- 1 | #import "CodePush.h" 2 | 3 | @implementation CodePushErrorUtils 4 | 5 | static NSString *const CodePushErrorDomain = @"CodePushError"; 6 | static const int CodePushErrorCode = -1; 7 | 8 | + (NSError *)errorWithMessage:(NSString *)errorMessage 9 | { 10 | return [NSError errorWithDomain:CodePushErrorDomain 11 | code:CodePushErrorCode 12 | userInfo:@{ NSLocalizedDescriptionKey: NSLocalizedString(errorMessage, nil) }]; 13 | } 14 | 15 | + (BOOL)isCodePushError:(NSError *)err 16 | { 17 | return err != nil && [CodePushErrorDomain isEqualToString:err.domain]; 18 | } 19 | 20 | @end -------------------------------------------------------------------------------- /ios/CodePush/CodePushUtils.m: -------------------------------------------------------------------------------- 1 | #import "CodePush.h" 2 | 3 | void CPLog(NSString *formatString, ...) { 4 | va_list args; 5 | va_start(args, formatString); 6 | NSString *prependedFormatString = [NSString stringWithFormat:@"\n[CodePush] %@", formatString]; 7 | NSLogv(prependedFormatString, args); 8 | va_end(args); 9 | } -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWTAlgorithmFactory.h 3 | // JWT 4 | // 5 | // Created by Lobanov Dmitry on 07.10.15. 6 | // Copyright © 2015 Karma. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JWTAlgorithm.h" 11 | @interface JWTAlgorithmFactory : NSObject 12 | 13 | + (NSArray *)algorithms; 14 | + (id)algorithmByName:(NSString *)name; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m: -------------------------------------------------------------------------------- 1 | // 2 | // JWTAlgorithmFactory.m 3 | // JWT 4 | // 5 | // Created by Lobanov Dmitry on 07.10.15. 6 | // Copyright © 2015 Karma. All rights reserved. 7 | // 8 | 9 | #import "JWTAlgorithmFactory.h" 10 | #import "JWTAlgorithmHSBase.h" 11 | #import "JWTAlgorithmRSBase.h" 12 | #import "JWTAlgorithmNone.h" 13 | 14 | // not implemented. 15 | NSString *const JWTAlgorithmNameES256 = @"ES256"; 16 | NSString *const JWTAlgorithmNameES384 = @"ES384"; 17 | NSString *const JWTAlgorithmNameES512 = @"ES512"; 18 | 19 | @implementation JWTAlgorithmFactory 20 | 21 | + (NSArray *)algorithms { 22 | return @[ 23 | [JWTAlgorithmNone new], 24 | [JWTAlgorithmHSBase algorithm256], 25 | [JWTAlgorithmHSBase algorithm384], 26 | [JWTAlgorithmHSBase algorithm512], 27 | [JWTAlgorithmRSBase algorithm256], 28 | [JWTAlgorithmRSBase algorithm384], 29 | [JWTAlgorithmRSBase algorithm512] 30 | ]; 31 | 32 | } 33 | 34 | + (id)algorithmByName:(NSString *)name { 35 | id algorithm = nil; 36 | 37 | NSString *algName = [name copy]; 38 | 39 | NSUInteger index = [[self algorithms] indexOfObjectPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) { 40 | // lowercase comparison 41 | return [obj.name.lowercaseString isEqualToString:algName.lowercaseString]; 42 | }]; 43 | 44 | if (index != NSNotFound) { 45 | algorithm = [self algorithms][index]; 46 | } 47 | 48 | return algorithm; 49 | } 50 | 51 | @end -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWTAlgorithmNone.h 3 | // JWT 4 | // 5 | // Created by Lobanov Dmitry on 16.10.15. 6 | // Copyright © 2015 Karma. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JWTAlgorithm.h" 11 | extern NSString *const JWTAlgorithmNameNone; 12 | 13 | @interface JWTAlgorithmNone : NSObject 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m: -------------------------------------------------------------------------------- 1 | // 2 | // JWTAlgorithmNone.m 3 | // JWT 4 | // 5 | // Created by Lobanov Dmitry on 16.10.15. 6 | // Copyright © 2015 Karma. All rights reserved. 7 | // 8 | 9 | #import "JWTAlgorithmNone.h" 10 | NSString *const JWTAlgorithmNameNone = @"none"; 11 | 12 | @implementation JWTAlgorithmNone 13 | 14 | - (NSString *)name { 15 | return JWTAlgorithmNameNone; 16 | } 17 | 18 | - (NSData *)signHash:(NSData *)hash key:(NSData *)key error:(NSError *__autoreleasing *)error { 19 | return [NSData data]; 20 | } 21 | 22 | - (BOOL)verifyHash:(NSData *)hash signature:(NSData *)signature key:(NSData *)key error:(NSError *__autoreleasing *)error { 23 | //if a secret is provided, this isn't the None algorithm 24 | if (key && key.length > 0) { 25 | return NO; 26 | } 27 | 28 | //If the signature isn't blank, this isn't the None algorithm 29 | if (signature && signature.length > 0) { 30 | return NO; 31 | } 32 | 33 | return YES; 34 | } 35 | 36 | - (NSData *)encodePayload:(NSString *)theString withSecret:(NSString *)theSecret { 37 | return [self encodePayloadData:[theSecret dataUsingEncoding:NSUTF8StringEncoding] withSecret:[theSecret dataUsingEncoding:NSUTF8StringEncoding]]; 38 | } 39 | 40 | - (NSData *)encodePayloadData:(NSData *)theStringData withSecret:(NSData *)theSecretData 41 | { 42 | return [self signHash:theStringData key:theSecretData error:nil]; 43 | } 44 | 45 | - (BOOL)verifySignedInput:(NSString *)input withSignature:(NSString *)signature verificationKey:(NSString *)verificationKey 46 | { 47 | return [self verifySignedInput:input withSignature:signature verificationKeyData:verificationKey]; 48 | } 49 | 50 | - (BOOL)verifySignedInput:(NSString *)input withSignature:(NSString *)signature verificationKeyData:(NSData *)verificationKeyData 51 | { 52 | return [self verifyHash:[input dataUsingEncoding:NSUTF8StringEncoding] signature:[signature dataUsingEncoding:NSUTF8StringEncoding] key:verificationKeyData error:nil]; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWTAlgorithmESBase.h 3 | // Pods 4 | // 5 | // Created by Lobanov Dmitry on 12.02.17. 6 | // 7 | // 8 | 9 | #import 10 | #import "JWTRSAlgorithm.h" 11 | extern NSString *const JWTAlgorithmNameES256; 12 | extern NSString *const JWTAlgorithmNameES384; 13 | extern NSString *const JWTAlgorithmNameES512; 14 | @interface JWTAlgorithmESBase : NSObject @end 15 | 16 | @interface JWTAlgorithmESBase (JWTAsymmetricKeysAlgorithm) @end 17 | 18 | @interface JWTAlgorithmESBase (Create) 19 | 20 | + (instancetype)algorithm256; 21 | + (instancetype)algorithm384; 22 | + (instancetype)algorithm512; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m: -------------------------------------------------------------------------------- 1 | // 2 | // JWTAlgorithmESBase.m 3 | // Pods 4 | // 5 | // Created by Lobanov Dmitry on 12.02.17. 6 | // 7 | // 8 | 9 | #import "JWTAlgorithmESBase.h" 10 | #import 11 | @interface JWTAlgorithmESBase () 12 | 13 | @end 14 | @implementation JWTAlgorithmESBase 15 | @synthesize keyExtractorType; 16 | @synthesize signKey; 17 | @synthesize verifyKey; 18 | @end 19 | 20 | // thanks! https://github.com/soyersoyer/SwCrypt 21 | @interface JWTAlgorithmESBase (ImportKeys) 22 | - (void)importKey; 23 | //importKey(publicKey, format: .importKeyBinary, keyType: .keyPublic) 24 | @end 25 | @implementation JWTAlgorithmESBase (ImportKeys) 26 | - (void)importKey { 27 | return; 28 | } 29 | @end 30 | 31 | @implementation JWTAlgorithmESBase (JWTAsymmetricKeysAlgorithm) 32 | - (NSString *)name { 33 | return @"ESBase"; 34 | } 35 | - (NSData *)signHash:(NSData *)hash key:(NSData *)key error:(NSError *__autoreleasing *)error { 36 | return nil; 37 | } 38 | - (BOOL)verifyHash:(NSData *)hash signature:(NSData *)signature key:(NSData *)key error:(NSError *__autoreleasing *)error { 39 | return NO; 40 | } 41 | @end 42 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWTAlgorithmHSBase.h 3 | // JWT 4 | // 5 | // Created by Lobanov Dmitry on 13.03.16. 6 | // Copyright © 2016 Karma. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JWTAlgorithm.h" 11 | extern NSString *const JWTAlgorithmNameHS256; 12 | extern NSString *const JWTAlgorithmNameHS384; 13 | extern NSString *const JWTAlgorithmNameHS512; 14 | 15 | @interface JWTAlgorithmHSBase : NSObject 16 | 17 | @property (assign, nonatomic, readonly) size_t ccSHANumberDigestLength; 18 | @property (assign, nonatomic, readonly) uint32_t ccHmacAlgSHANumber; 19 | 20 | @end 21 | 22 | @interface JWTAlgorithmHSBase (Create) 23 | 24 | + (instancetype)algorithm256; 25 | + (instancetype)algorithm384; 26 | + (instancetype)algorithm512; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWTAlgorithmDataHolderChain.h 3 | // JWT 4 | // 5 | // Created by Lobanov Dmitry on 02.10.16. 6 | // Copyright © 2016 Karma. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JWTAlgorithmDataHolder.h" 11 | 12 | @interface JWTAlgorithmDataHolderChain : NSObject 13 | 14 | @property (strong, nonatomic, readonly) NSArray *holders; 15 | 16 | #pragma mark - Initialization 17 | - (instancetype)initWithHolders:(NSArray *)holders; 18 | - (instancetype)initWithHolder:(id)holder; 19 | 20 | #pragma mark - Appending 21 | - (instancetype)chainByAppendingChain:(JWTAlgorithmDataHolderChain *)chain; 22 | - (instancetype)chainByAppendingHolders:(NSArray *)holders; 23 | - (instancetype)chainByAppendingHolder:(id)holder; 24 | 25 | #pragma mark - Create 26 | + (instancetype)chainWithHolders:(NSArray *)holders; 27 | + (instancetype)chainWithHolder:(id)holder; 28 | @end 29 | 30 | @interface JWTAlgorithmDataHolderChain (HoldersPopulation) 31 | - (NSArray *)singleAlgorithm:(id)algorithm withManySecretData:(NSArray *)secretsData; 32 | - (NSArray *)singleSecretData:(NSData *)secretData withManyAlgorithms:(NSArray *)algorithms; 33 | 34 | - (instancetype)chainByPopulatingAlgorithm:(id)algorithm withManySecretData:(NSArray *)secretsData; 35 | - (instancetype)chainByPopulatingSecretData:(NSData *)secretData withManyAlgorithms:(NSArray *)algorithms; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWTAlgorithmRSBase.h 3 | // JWT 4 | // 5 | // Created by Lobanov Dmitry on 13.03.16. 6 | // Copyright © 2016 Karma. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JWTRSAlgorithm.h" 11 | extern NSString *const JWTAlgorithmNameRS256; 12 | extern NSString *const JWTAlgorithmNameRS384; 13 | extern NSString *const JWTAlgorithmNameRS512; 14 | 15 | @interface JWTAlgorithmRSBase : NSObject 16 | 17 | @property (assign, nonatomic, readonly) size_t ccSHANumberDigestLength; 18 | @property (assign, nonatomic, readonly) uint32_t secPaddingPKCS1SHANumber; 19 | - (unsigned char *)CC_SHANumberWithData:(const void *)data withLength:(uint32_t)len withHashBytes:(unsigned char *)hashBytes; 20 | 21 | @end 22 | 23 | @interface JWTAlgorithmRSBase (Create) 24 | 25 | + (instancetype)algorithm256; 26 | + (instancetype)algorithm384; 27 | + (instancetype)algorithm512; 28 | + (instancetype)mutableAlgorithm __deprecated; 29 | 30 | @end 31 | 32 | /* 33 | // when you can't live without mutability, uncomment. 34 | @class JWTAlgorithmRSFamilyMemberMutable; 35 | */ -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Marcelo Schroeder on 12/03/2016. 3 | // Copyright (c) 2016 Karma. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "JWTAlgorithm.h" 8 | @protocol JWTCryptoKeyProtocol; 9 | 10 | @protocol JWTAsymmetricKeysAlgorithm 11 | 12 | @optional 13 | @property(nonatomic, readwrite, copy) NSString *keyExtractorType; 14 | @property(nonatomic, readwrite, strong) id signKey; 15 | @property(nonatomic, readwrite, strong) id verifyKey; 16 | 17 | @end 18 | 19 | @protocol JWTRSAlgorithm 20 | 21 | @required 22 | @property(nonatomic, readwrite, copy) NSString *privateKeyCertificatePassphrase; 23 | @end 24 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWTCryptoKey.h 3 | // JWT 4 | // 5 | // Created by Lobanov Dmitry on 04.02.17. 6 | // Copyright © 2017 JWTIO. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @protocol JWTCryptoKeyProtocol 13 | @property (copy, nonatomic, readonly) NSString *tag; 14 | @property (assign, nonatomic, readonly) SecKeyRef key; 15 | @property (copy, nonatomic, readonly) NSData *rawKey; 16 | @end 17 | 18 | @interface JWTCryptoKeyBuilder : NSObject 19 | @property (assign, nonatomic, readonly) NSString *keyType; 20 | - (instancetype)keyTypeRSA; 21 | - (instancetype)keyTypeEC; 22 | @end 23 | 24 | @interface JWTCryptoKey : NSObject 25 | - (instancetype)initWithData:(NSData *)data parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; //NS_DESIGNATED_INITIALIZER 26 | - (instancetype)initWithBase64String:(NSString *)base64String parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; 27 | - (instancetype)initWithPemEncoded:(NSString *)encoded parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; 28 | - (instancetype)initWithPemAtURL:(NSURL *)url parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; 29 | @end 30 | 31 | @interface JWTCryptoKey (Parameters) 32 | + (NSString *)parametersKeyBuilder; 33 | @end 34 | 35 | @interface JWTCryptoKeyPublic : JWTCryptoKey 36 | - (instancetype)initWithCertificateData:(NSData *)certificateData parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; //NS_DESIGNATED_INITIALIZER; 37 | - (instancetype)initWithCertificateBase64String:(NSString *)certificateString parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; 38 | @end 39 | 40 | @interface JWTCryptoKeyPrivate : JWTCryptoKey 41 | - (instancetype)initWithP12Data:(NSData *)p12Data withPassphrase:(NSString *)passphrase parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; //NS_DESIGNATED_INITIALIZER; 42 | - (instancetype)initWithP12AtURL:(NSURL *)url withPassphrase:(NSString *)passphrase parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; 43 | @end 44 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWTCryptoKeyExtractor.h 3 | // JWT 4 | // 5 | // Created by Lobanov Dmitry on 04.02.17. 6 | // Copyright © 2017 JWTIO. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @protocol JWTCryptoKeyProtocol; 13 | @protocol JWTCryptoKeyExtractorProtocol 14 | @optional 15 | - (id)keyFromString:(NSString *)string parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; 16 | - (id)keyFromData:(NSData *)data parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; 17 | @end 18 | 19 | @interface JWTCryptoKeyExtractor : NSObject 20 | @property (copy, nonatomic, readonly) NSString *type; 21 | + (NSString *)type; 22 | + (NSString *)parametersKeyCertificatePassphrase; 23 | @end 24 | 25 | @interface JWTCryptoKeyExtractor (ClassCluster) 26 | + (instancetype)publicKeyWithCertificate; 27 | + (instancetype)privateKeyInP12; 28 | + (instancetype)publicKeyWithPEMBase64; 29 | + (instancetype)privateKeyWithPEMBase64; 30 | + (instancetype)createWithType:(NSString *)type; 31 | @end 32 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWTCryptoSecurity.h 3 | // JWT 4 | // 5 | // Created by Lobanov Dmitry on 04.02.17. 6 | // Copyright © 2017 JWTIO. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | // Thanks for https://github.com/TakeScoop/SwiftyRSA! 12 | @interface JWTCryptoSecurity : NSObject 13 | + (NSString *)keyTypeRSA; 14 | + (NSString *)keyTypeEC; 15 | + (SecKeyRef)addKeyWithData:(NSData *)data asPublic:(BOOL)public tag:(NSString *)tag type:(NSString *)type error:(NSError *__autoreleasing*)error; 16 | + (SecKeyRef)addKeyWithData:(NSData *)data asPublic:(BOOL)public tag:(NSString *)tag error:(NSError *__autoreleasing*)error; 17 | + (SecKeyRef)keyByTag:(NSString *)tag error:(NSError *__autoreleasing*)error; 18 | + (void)removeKeyByTag:(NSString *)tag error:(NSError *__autoreleasing*)error; 19 | @end 20 | 21 | @interface JWTCryptoSecurity (Certificates) 22 | + (OSStatus)extractIdentityAndTrustFromPKCS12:(CFDataRef)inPKCS12Data password:(CFStringRef)password identity:(SecIdentityRef *)outIdentity trust:(SecTrustRef *)outTrust; 23 | + (SecKeyRef)publicKeyFromCertificate:(NSData *)certificateData; 24 | @end 25 | 26 | @interface JWTCryptoSecurity (Pem) 27 | + (NSString *)certificateFromPemFileContent:(NSString *)content; 28 | + (NSString *)keyFromPemFileContent:(NSString *)content; 29 | + (NSArray *)itemsFromPemFileContent:(NSString *)content byRegex:(NSRegularExpression *)expression; 30 | + (NSString *)certificateFromPemFileWithName:(NSString *)name; 31 | + (NSString *)keyFromPemFileWithName:(NSString *)name; 32 | + (NSArray *)itemsFromPemFileWithName:(NSString *)name byRegex:(NSRegularExpression *)expression; 33 | + (NSString *)stringByRemovingPemHeadersFromString:(NSString *)string; 34 | @end 35 | 36 | @interface JWTCryptoSecurity (PublicKey) 37 | + (NSData *)dataByRemovingPublicKeyHeader:(NSData *)data error:(NSError *__autoreleasing*)error; 38 | @end 39 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWTClaim.h 3 | // JWT 4 | // 5 | // Created by Lobanov Dmitry on 13.02.16. 6 | // Copyright © 2016 Karma. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JWTClaim : NSObject 12 | 13 | + (NSString *)name; 14 | + (instancetype)claimByName:(NSString *)name; 15 | + (BOOL)verifyValue:(NSObject *)value withTrustedValue:(NSObject *)trustedValue; 16 | - (BOOL)verifyValue:(NSObject *)value withTrustedValue:(NSObject *)trustedValue; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWTClaimsSet.h 3 | // JWT 4 | // 5 | // Created by Klaas Pieter Annema on 31-05-13. 6 | // Copyright (c) 2013 Karma. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface JWTClaimsSet : NSObject 12 | 13 | @property (nonatomic, readwrite, copy) NSString *issuer; 14 | @property (nonatomic, readwrite, copy) NSString *subject; 15 | @property (nonatomic, readwrite, copy) NSString *audience; 16 | @property (nonatomic, readwrite, copy) NSDate *expirationDate; 17 | @property (nonatomic, readwrite, copy) NSDate *notBeforeDate; 18 | @property (nonatomic, readwrite, copy) NSDate *issuedAt; 19 | @property (nonatomic, readwrite, copy) NSString *identifier; 20 | @property (nonatomic, readwrite, copy) NSString *type; 21 | @property (nonatomic, readwrite, copy) NSString *scope; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m: -------------------------------------------------------------------------------- 1 | // 2 | // JWTClaimsSet.m 3 | // JWT 4 | // 5 | // Created by Klaas Pieter Annema on 31-05-13. 6 | // Copyright (c) 2013 Karma. All rights reserved. 7 | // 8 | 9 | #import "JWTClaimsSet.h" 10 | 11 | @implementation JWTClaimsSet 12 | 13 | - (id)copyWithZone:(NSZone *)zone { 14 | JWTClaimsSet *newClaimsSet = [[self.class alloc] init]; 15 | 16 | newClaimsSet.issuer = self.issuer; 17 | newClaimsSet.subject = self.subject; 18 | newClaimsSet.audience = self.audience; 19 | newClaimsSet.expirationDate = self.expirationDate; 20 | newClaimsSet.notBeforeDate = self.notBeforeDate; 21 | newClaimsSet.issuedAt = self.issuedAt; 22 | newClaimsSet.identifier = self.identifier; 23 | newClaimsSet.type = self.type; 24 | newClaimsSet.scope = self.scope; 25 | 26 | return newClaimsSet; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWTClaimsSetSerializer.h 3 | // JWT 4 | // 5 | // Created by Klaas Pieter Annema on 31-05-13. 6 | // Copyright (c) 2013 Karma. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "JWTClaimsSet.h" 12 | 13 | @interface JWTClaimsSetSerializer : NSObject 14 | 15 | + (NSArray *)claimsSetKeys; 16 | + (NSDictionary *)dictionaryWithClaimsSet:(JWTClaimsSet *)theClaimsSet; 17 | + (JWTClaimsSet *)claimsSetWithDictionary:(NSDictionary *)theDictionary; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWTClaimsSetVerifier.h 3 | // JWT 4 | // 5 | // Created by Lobanov Dmitry on 13.02.16. 6 | // Copyright © 2016 Karma. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JWTClaimsSet.h" 11 | 12 | @interface JWTClaimsSetVerifier : NSObject 13 | 14 | + (BOOL)verifyClaimsSet:(JWTClaimsSet *)theClaimsSet withTrustedClaimsSet:(JWTClaimsSet *)trustedClaimsSet; 15 | 16 | + (BOOL)verifyClaimsSetDictionary:(NSDictionary *)theClaimsSetDictionary withTrustedClaimsSet:(JWTClaimsSet *)trustedClaimsSet; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m: -------------------------------------------------------------------------------- 1 | // 2 | // JWTClaimsSetVerifier.m 3 | // JWT 4 | // 5 | // Created by Lobanov Dmitry on 13.02.16. 6 | // Copyright © 2016 Karma. All rights reserved. 7 | // 8 | 9 | #import "JWTClaimsSetVerifier.h" 10 | #import "JWTClaimsSetSerializer.h" 11 | #import "JWTClaim.h" 12 | 13 | @implementation JWTClaimsSetVerifier 14 | 15 | + (BOOL)verifyDictionary:(NSDictionary *)dictionary withTrustedDictionary:(NSDictionary *)trustedDictionary byKey:(NSString *)key { 16 | NSObject *value = dictionary[key]; 17 | NSObject *trustedValue = trustedDictionary[key]; 18 | 19 | BOOL result = YES; 20 | 21 | if (trustedValue) { 22 | result = [[JWTClaim claimByName:key] verifyValue:value withTrustedValue:trustedValue]; 23 | } 24 | 25 | return result; 26 | } 27 | 28 | + (BOOL)verifyClaimsSetDictionary:(NSDictionary *)theClaimsSetDictionary withTrustedClaimsSetDictionary:(NSDictionary *)trustedClaimsSetDictionary { 29 | 30 | NSArray *claimsSets = [JWTClaimsSetSerializer claimsSetKeys]; 31 | 32 | if (!trustedClaimsSetDictionary) { 33 | return YES; 34 | } 35 | 36 | if (!theClaimsSetDictionary) { 37 | return NO; 38 | } 39 | 40 | BOOL result = YES; 41 | 42 | for (NSString *key in claimsSets) { 43 | result = result && [self verifyDictionary:theClaimsSetDictionary withTrustedDictionary:trustedClaimsSetDictionary byKey:key]; 44 | } 45 | 46 | return result; 47 | } 48 | 49 | 50 | + (BOOL)verifyClaimsSet:(JWTClaimsSet *)theClaimsSet withTrustedClaimsSet:(JWTClaimsSet *)trustedClaimsSet { 51 | 52 | NSDictionary *dictionary = [JWTClaimsSetSerializer dictionaryWithClaimsSet:theClaimsSet]; 53 | 54 | NSDictionary *trustedDictionary = [JWTClaimsSetSerializer dictionaryWithClaimsSet:trustedClaimsSet]; 55 | 56 | NSArray *claimsSets = [JWTClaimsSetSerializer claimsSetKeys]; 57 | 58 | BOOL result = YES; 59 | for (NSString *key in claimsSets) { 60 | result = result && [self verifyDictionary:dictionary withTrustedDictionary:trustedDictionary byKey:key]; 61 | } 62 | 63 | return result; 64 | } 65 | 66 | + (BOOL)verifyClaimsSetDictionary:(NSDictionary *)theClaimsSetDictionary withTrustedClaimsSet:(JWTClaimsSet *)trustedClaimsSet { 67 | NSDictionary *trustedDictionary = [JWTClaimsSetSerializer dictionaryWithClaimsSet:trustedClaimsSet]; 68 | 69 | return [self verifyClaimsSetDictionary:theClaimsSetDictionary withTrustedClaimsSetDictionary:trustedDictionary]; 70 | } 71 | 72 | @end -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWTCoding+ResultTypes.h 3 | // JWT 4 | // 5 | // Created by Lobanov Dmitry on 30.11.16. 6 | // Copyright © 2016 JWTIO. All rights reserved. 7 | // 8 | 9 | #import 10 | @class JWTClaimsSet; 11 | 12 | extern NSString *JWTCodingResultHeaders; 13 | extern NSString *JWTCodingResultPayload; 14 | 15 | @interface JWT (ResultTypes) @end 16 | 17 | /* 18 | ResultType 19 | /\ 20 | / \ 21 | / \ 22 | Success Error 23 | 24 | Protocols: Mutable and Immutable (?!?) 25 | */ 26 | 27 | // Public 28 | @protocol JWTCodingResultTypeSuccessEncodedProtocol 29 | @property (copy, nonatomic, readonly) NSString *encoded; 30 | - (instancetype)initWithEncoded:(NSString *)encoded; 31 | @property (copy, nonatomic, readonly) NSString *token; 32 | - (instancetype)initWithToken:(NSString *)token; 33 | @end 34 | 35 | // Public 36 | @protocol JWTCodingResultTypeSuccessDecodedProtocol 37 | @property (copy, nonatomic, readonly) NSDictionary *headers; 38 | @property (copy, nonatomic, readonly) NSDictionary *payload; 39 | 40 | // dictionary @{ 41 | // JWTCodingResultHeaders : self.headers, 42 | // JWTCodingResultPayload : self.payload 43 | //} 44 | @property (copy, nonatomic, readonly) NSDictionary *headerAndPayloadDictionary; 45 | 46 | @property (nonatomic, readonly) JWTClaimsSet *claimsSet; 47 | - (instancetype)initWithHeaders:(NSDictionary *)headers withPayload:(NSDictionary *)payload; 48 | - (instancetype)initWithClaimsSet:(JWTClaimsSet *)claimsSet; 49 | @end 50 | 51 | // Public 52 | @interface JWTCodingResultTypeSuccess : NSObject @end 53 | 54 | // Public 55 | @protocol JWTCodingResultTypeErrorProtocol 56 | @property (copy, nonatomic, readonly) NSError *error; 57 | - (instancetype)initWithError:(NSError *)error; 58 | @end 59 | 60 | @interface JWTCodingResultTypeError : NSObject @end 61 | 62 | @interface JWTCodingResultType : NSObject 63 | - (instancetype)initWithSuccessResult:(JWTCodingResultTypeSuccess *)success; 64 | - (instancetype)initWithErrorResult:(JWTCodingResultTypeError *)error; 65 | @property (strong, nonatomic, readonly) JWTCodingResultTypeSuccess *successResult; 66 | @property (strong, nonatomic, readonly) JWTCodingResultTypeError *errorResult; 67 | @end 68 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Coding/JWTCoding.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWT.h 3 | // JWT 4 | // 5 | // Created by Klaas Pieter Annema on 31-05-13. 6 | // Copyright (c) 2013 Karma. All rights reserved. 7 | // 8 | 9 | #import 10 | /** 11 | @discussion JWT is a general interface for decoding and encoding. 12 | Now it is to complex and fat to support. 13 | Possible solution: split interface into several pieces. 14 | 15 | JWT_1_0 -> JWT with plain old functions. 16 | JWT_2_0 -> JWT with builder usage. 17 | JWT_3_0 -> JWT with splitted apart algorithm data and payload data. 18 | */ 19 | @interface JWT : NSObject @end 20 | 21 | typedef NS_OPTIONS(NSInteger, JWTCodingDecodingOptions) { 22 | JWTCodingDecodingOptionsNone = 0, 23 | JWTCodingDecodingOptionsSkipVerification = 1 24 | }; 25 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Coding/JWTCoding.m: -------------------------------------------------------------------------------- 1 | // 2 | // JWT.m 3 | // JWT 4 | // 5 | // Created by Klaas Pieter Annema on 31-05-13. 6 | // Copyright (c) 2013 Karma. All rights reserved. 7 | // 8 | 9 | #import "JWTCoding.h" 10 | 11 | @implementation JWT @end 12 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWT.h 3 | // JWT 4 | // 5 | // Created by Lobanov Dmitry on 23.10.16. 6 | // Copyright © 2016 Karma. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for JWT. 12 | FOUNDATION_EXPORT double JWTVersionNumber; 13 | 14 | //! Project version string for JWT. 15 | FOUNDATION_EXPORT const unsigned char JWTVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | // Coding 20 | #import 21 | #import 22 | #import 23 | #import 24 | #import 25 | 26 | // Algorithms 27 | #import 28 | #import 29 | #import 30 | #import 31 | #import 32 | #import 33 | 34 | // Holders 35 | #import 36 | #import 37 | 38 | // Claims 39 | #import 40 | #import 41 | #import 42 | #import 43 | 44 | // Supplement 45 | #import 46 | #import 47 | #import 48 | 49 | // Crypto 50 | #import 51 | #import 52 | #import 53 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap: -------------------------------------------------------------------------------- 1 | framework module JWT { 2 | umbrella header "JWT.h" 3 | export * 4 | module * { export * } 5 | } -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWTBase64Coder.h 3 | // Pods 4 | // 5 | // Created by Lobanov Dmitry on 05.10.16. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @protocol JWTStringCoder__Protocol 12 | - (NSString *)stringWithData:(NSData *)data; 13 | - (NSData *)dataWithString:(NSString *)string; 14 | @end 15 | 16 | @interface JWTBase64Coder : NSObject 17 | + (NSString *)base64UrlEncodedStringWithData:(NSData *)data; 18 | + (NSData *)dataWithBase64UrlEncodedString:(NSString *)urlEncodedString; 19 | @end 20 | 21 | @interface JWTBase64Coder (JWTStringCoder__Protocol) @end 22 | 23 | 24 | @interface JWTStringCoder__For__Encoding : NSObject 25 | @property (assign, nonatomic, readwrite) NSStringEncoding stringEncoding; 26 | + (instancetype)utf8Encoding; 27 | @end 28 | @interface JWTStringCoder__For__Encoding (JWTStringCoder__Protocol) @end 29 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m: -------------------------------------------------------------------------------- 1 | // 2 | // JWTBase64Coder.m 3 | // Pods 4 | // 5 | // Created by Lobanov Dmitry on 05.10.16. 6 | // 7 | // 8 | 9 | #import "JWTBase64Coder.h" 10 | 11 | @interface JWTBase64Coder (ConditionLinking) 12 | + (BOOL)isBase64AddtionsAvailable; 13 | @end 14 | 15 | @implementation JWTBase64Coder (ConditionLinking) 16 | + (BOOL)isBase64AddtionsAvailable { 17 | return [[NSData class] respondsToSelector:@selector(dataWithBase64UrlEncodedString:)]; 18 | } 19 | @end 20 | 21 | #if __has_include("MF_Base64Additions.h") 22 | #import 23 | #endif 24 | 25 | @implementation JWTBase64Coder 26 | 27 | + (NSString *)base64UrlEncodedStringWithData:(NSData *)data { 28 | if ([self isBase64AddtionsAvailable] && [data respondsToSelector:@selector(base64UrlEncodedString)]) { 29 | return [data performSelector:@selector(base64UrlEncodedString)]; 30 | } 31 | else { 32 | return [data base64EncodedStringWithOptions:0]; 33 | } 34 | } 35 | 36 | + (NSData *)dataWithBase64UrlEncodedString:(NSString *)urlEncodedString { 37 | if ([self isBase64AddtionsAvailable] && [[NSData class] respondsToSelector:@selector(dataWithBase64UrlEncodedString:)]) { 38 | return [[NSData class] performSelector:@selector(dataWithBase64UrlEncodedString:) withObject:urlEncodedString]; 39 | } 40 | else { 41 | return [[NSData alloc] initWithBase64EncodedString:urlEncodedString options:0]; 42 | } 43 | } 44 | 45 | @end 46 | 47 | @implementation JWTBase64Coder (JWTStringCoder__Protocol) 48 | - (NSString *)stringWithData:(NSData *)data { 49 | return [self.class base64UrlEncodedStringWithData:data]; 50 | } 51 | - (NSData *)dataWithString:(NSString *)string { 52 | return [self.class dataWithBase64UrlEncodedString:string]; 53 | } 54 | @end 55 | 56 | @implementation JWTStringCoder__For__Encoding 57 | + (instancetype)utf8Encoding { 58 | JWTStringCoder__For__Encoding *coding = [self new]; 59 | coding.stringEncoding = NSUTF8StringEncoding; 60 | return coding; 61 | } 62 | @end 63 | @implementation JWTStringCoder__For__Encoding (JWTStringCoder__Protocol) 64 | - (NSString *)stringWithData:(NSData *)data { 65 | return [[NSString alloc] initWithData:data encoding:self.stringEncoding]; 66 | } 67 | - (NSData *)dataWithString:(NSString *)string { 68 | return [string dataUsingEncoding:self.stringEncoding]; 69 | } 70 | @end 71 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWTDeprecations.h 3 | // JWT 4 | // 5 | // Created by Lobanov Dmitry on 31.08.16. 6 | // Copyright © 2016 Karma. All rights reserved. 7 | // 8 | 9 | #ifndef JWTDeprecations_h 10 | #define JWTDeprecations_h 11 | 12 | #define STR(str) #str 13 | #define JWTVersion_2_1_0 2.1 14 | #define JWTVersion_2_2_0 2.2 15 | #define JWTVersion_3_0_0 3.0 16 | #define __first_deprecated_in_release_version(version) __deprecated_msg("first deprecated in release version: " STR(version)) 17 | #define __deprecated_and_will_be_removed_in_release_version(version) __deprecated_msg("deprecated. will be removed in release version: "STR(version)) 18 | #define __available_in_release_version(version) __deprecated_msg("will be introduced in release version: " STR(version)) 19 | 20 | #define __jwt_technical_debt(debt) __deprecated_msg("Don't forget to inspect it later." STR(debt)) 21 | 22 | #endif /* JWTDeprecations_h */ 23 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h: -------------------------------------------------------------------------------- 1 | // 2 | // JWTErrorDescription.h 3 | // JWT 4 | // 5 | // Created by Lobanov Dmitry on 27.11.16. 6 | // Copyright © 2016 JWTIO. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | extern NSString *JWTErrorDomain; 12 | 13 | typedef NS_ENUM(NSInteger, JWTError) { 14 | JWTInvalidFormatError = -100, 15 | JWTUnsupportedAlgorithmError, 16 | JWTAlgorithmNameMismatchError, 17 | JWTInvalidSignatureError, 18 | JWTNoPayloadError, 19 | JWTNoHeaderError, 20 | JWTEncodingHeaderError, 21 | JWTEncodingPayloadError, 22 | JWTEncodingSigningError, 23 | JWTClaimsSetVerificationFailed, 24 | JWTInvalidSegmentSerializationError, 25 | JWTUnspecifiedAlgorithmError, 26 | JWTBlacklistedAlgorithmError, 27 | JWTDecodingHeaderError, 28 | JWTDecodingPayloadError, 29 | JWTDecodingHoldersChainEmptyError 30 | }; 31 | 32 | @interface JWTErrorDescription : NSObject 33 | + (NSError *)errorWithCode:(JWTError)code; 34 | @end 35 | -------------------------------------------------------------------------------- /ios/CodePush/JWT/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Karma Mobility, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /ios/CodePush/RCTConvert+CodePushInstallMode.m: -------------------------------------------------------------------------------- 1 | #import "CodePush.h" 2 | 3 | #if __has_include() 4 | #import 5 | #else 6 | #import "RCTConvert.h" 7 | #endif 8 | 9 | // Extending the RCTConvert class allows the React Native 10 | // bridge to handle args of type "CodePushInstallMode" 11 | @implementation RCTConvert (CodePushInstallMode) 12 | 13 | RCT_ENUM_CONVERTER(CodePushInstallMode, (@{ @"codePushInstallModeImmediate": @(CodePushInstallModeImmediate), 14 | @"codePushInstallModeOnNextRestart": @(CodePushInstallModeOnNextRestart), 15 | @"codePushInstallModeOnNextResume": @(CodePushInstallModeOnNextResume), 16 | @"codePushInstallModeOnNextSuspend": @(CodePushInstallModeOnNextSuspend) }), 17 | CodePushInstallModeImmediate, // Default enum value 18 | integerValue) 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ios/CodePush/RCTConvert+CodePushUpdateState.m: -------------------------------------------------------------------------------- 1 | #import "CodePush.h" 2 | 3 | #if __has_include() 4 | #import 5 | #else 6 | #import "RCTConvert.h" 7 | #endif 8 | 9 | // Extending the RCTConvert class allows the React Native 10 | // bridge to handle args of type "CodePushUpdateState" 11 | @implementation RCTConvert (CodePushUpdateState) 12 | 13 | RCT_ENUM_CONVERTER(CodePushUpdateState, (@{ @"codePushUpdateStateRunning": @(CodePushUpdateStateRunning), 14 | @"codePushUpdateStatePending": @(CodePushUpdateStatePending), 15 | @"codePushUpdateStateLatest": @(CodePushUpdateStateLatest) 16 | }), 17 | CodePushUpdateStateRunning, // Default enum value 18 | integerValue) 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ios/CodePush/SSZipArchive/README.md: -------------------------------------------------------------------------------- 1 | The source code in this folder is taken from [https://github.com/ZipArchive/ZipArchive/tree/35fe9b6af48527cde0b5db52287474ed3a32d75f/SSZipArchive](https://github.com/ZipArchive/ZipArchive/tree/35fe9b6af48527cde0b5db52287474ed3a32d75f/SSZipArchive) which is [MIT licensed](https://github.com/ZipArchive/ZipArchive/blob/35fe9b6af48527cde0b5db52287474ed3a32d75f/LICENSE.txt). -------------------------------------------------------------------------------- /ios/CodePush/SSZipArchive/aes/entropy.c: -------------------------------------------------------------------------------- 1 | #ifdef _WIN32 2 | #include 3 | #else 4 | #include 5 | #include 6 | #include 7 | #endif 8 | 9 | #if defined(__cplusplus) 10 | extern "C" 11 | { 12 | #endif 13 | 14 | #ifdef _WIN32 15 | int entropy_fun(unsigned char buf[], unsigned int len) 16 | { 17 | HCRYPTPROV provider; 18 | unsigned __int64 pentium_tsc[1]; 19 | unsigned int i; 20 | int result = 0; 21 | 22 | 23 | if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) 24 | { 25 | result = CryptGenRandom(provider, len, buf); 26 | CryptReleaseContext(provider, 0); 27 | if (result) 28 | return len; 29 | } 30 | 31 | QueryPerformanceCounter((LARGE_INTEGER *)pentium_tsc); 32 | 33 | for(i = 0; i < 8 && i < len; ++i) 34 | buf[i] = ((unsigned char*)pentium_tsc)[i]; 35 | 36 | return i; 37 | } 38 | #else 39 | int entropy_fun(unsigned char buf[], unsigned int len) 40 | { 41 | int frand = open("/dev/random", O_RDONLY); 42 | int rlen = 0; 43 | if (frand != -1) 44 | { 45 | rlen = (int)read(frand, buf, len); 46 | close(frand); 47 | } 48 | return rlen; 49 | } 50 | #endif 51 | 52 | #if defined(__cplusplus) 53 | } 54 | #endif 55 | -------------------------------------------------------------------------------- /ios/CodePush/SSZipArchive/aes/entropy.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _ENTROPY_FUN_H 3 | #define _ENTROPY_FUN_H 4 | 5 | #if defined(__cplusplus) 6 | extern "C" 7 | { 8 | #endif 9 | 10 | int entropy_fun(unsigned char buf[], unsigned int len); 11 | 12 | #if defined(__cplusplus) 13 | } 14 | #endif 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /ios/CodePush/SSZipArchive/aes/pwd2key.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. 4 | 5 | LICENSE TERMS 6 | 7 | The free distribution and use of this software in both source and binary 8 | form is allowed (with or without changes) provided that: 9 | 10 | 1. distributions of this source code include the above copyright 11 | notice, this list of conditions and the following disclaimer; 12 | 13 | 2. distributions in binary form include the above copyright 14 | notice, this list of conditions and the following disclaimer 15 | in the documentation and/or other associated materials; 16 | 17 | 3. the copyright holder's name is not used to endorse products 18 | built using this software without specific written permission. 19 | 20 | ALTERNATIVELY, provided that this notice is retained in full, this product 21 | may be distributed under the terms of the GNU General Public License (GPL), 22 | in which case the provisions of the GPL apply INSTEAD OF those given above. 23 | 24 | DISCLAIMER 25 | 26 | This software is provided 'as is' with no explicit or implied warranties 27 | in respect of its properties, including, but not limited to, correctness 28 | and/or fitness for purpose. 29 | --------------------------------------------------------------------------- 30 | Issue Date: 26/08/2003 31 | 32 | This is an implementation of RFC2898, which specifies key derivation from 33 | a password and a salt value. 34 | */ 35 | 36 | #ifndef PWD2KEY_H 37 | #define PWD2KEY_H 38 | 39 | #if defined(__cplusplus) 40 | extern "C" 41 | { 42 | #endif 43 | 44 | void derive_key( 45 | const unsigned char pwd[], /* the PASSWORD, and */ 46 | unsigned int pwd_len, /* its length */ 47 | const unsigned char salt[], /* the SALT and its */ 48 | unsigned int salt_len, /* length */ 49 | unsigned int iter, /* the number of iterations */ 50 | unsigned char key[], /* space for the output key */ 51 | unsigned int key_len); /* and its required length */ 52 | 53 | #if defined(__cplusplus) 54 | } 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /ios/CodePush/SSZipArchive/aes/sha1.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. 4 | 5 | LICENSE TERMS 6 | 7 | The free distribution and use of this software in both source and binary 8 | form is allowed (with or without changes) provided that: 9 | 10 | 1. distributions of this source code include the above copyright 11 | notice, this list of conditions and the following disclaimer; 12 | 13 | 2. distributions in binary form include the above copyright 14 | notice, this list of conditions and the following disclaimer 15 | in the documentation and/or other associated materials; 16 | 17 | 3. the copyright holder's name is not used to endorse products 18 | built using this software without specific written permission. 19 | 20 | ALTERNATIVELY, provided that this notice is retained in full, this product 21 | may be distributed under the terms of the GNU General Public License (GPL), 22 | in which case the provisions of the GPL apply INSTEAD OF those given above. 23 | 24 | DISCLAIMER 25 | 26 | This software is provided 'as is' with no explicit or implied warranties 27 | in respect of its properties, including, but not limited to, correctness 28 | and/or fitness for purpose. 29 | --------------------------------------------------------------------------- 30 | Issue Date: 01/08/2005 31 | */ 32 | 33 | #ifndef _SHA1_H 34 | #define _SHA1_H 35 | 36 | #include 37 | #include "brg_types.h" 38 | 39 | #define SHA1_BLOCK_SIZE 64 40 | #define SHA1_DIGEST_SIZE 20 41 | 42 | #if defined(__cplusplus) 43 | extern "C" 44 | { 45 | #endif 46 | 47 | /* type to hold the SHA256 context */ 48 | 49 | typedef struct 50 | { uint_32t count[2]; 51 | uint_32t hash[5]; 52 | uint_32t wbuf[16]; 53 | } sha1_ctx; 54 | 55 | /* Note that these prototypes are the same for both bit and */ 56 | /* byte oriented implementations. However the length fields */ 57 | /* are in bytes or bits as appropriate for the version used */ 58 | /* and bit sequences are input as arrays of bytes in which */ 59 | /* bit sequences run from the most to the least significant */ 60 | /* end of each byte */ 61 | 62 | VOID_RETURN sha1_compile(sha1_ctx ctx[1]); 63 | 64 | VOID_RETURN sha1_begin(sha1_ctx ctx[1]); 65 | VOID_RETURN sha1_hash(const unsigned char data[], unsigned long len, sha1_ctx ctx[1]); 66 | VOID_RETURN sha1_end(unsigned char hval[], sha1_ctx ctx[1]); 67 | VOID_RETURN sha1(unsigned char hval[], const unsigned char data[], unsigned long len); 68 | 69 | #if defined(__cplusplus) 70 | } 71 | #endif 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /ios/CodePush/SSZipArchive/minizip/mztools.h: -------------------------------------------------------------------------------- 1 | /* 2 | Additional tools for Minizip 3 | Code: Xavier Roche '2004 4 | License: Same as ZLIB (www.gzip.org) 5 | */ 6 | 7 | #ifndef _zip_tools_H 8 | #define _zip_tools_H 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #ifndef _ZLIB_H 15 | #include "zlib.h" 16 | #endif 17 | 18 | #include "unzip.h" 19 | 20 | /* Repair a ZIP file (missing central directory) 21 | file: file to recover 22 | fileOut: output file after recovery 23 | fileOutTmp: temporary file name used for recovery 24 | */ 25 | extern int ZEXPORT unzRepair(const char* file, 26 | const char* fileOut, 27 | const char* fileOutTmp, 28 | uLong* nRecovered, 29 | uLong* bytesRecovered); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /logging.js: -------------------------------------------------------------------------------- 1 | /* Logs messages to console with the [CodePush] prefix */ 2 | function log(message) { 3 | console.log(`[CodePush] ${message}`); 4 | } 5 | 6 | module.exports = log; 7 | -------------------------------------------------------------------------------- /react-native.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | dependency: { 3 | platforms: { 4 | android: { 5 | packageInstance: 6 | "new CodePush(getResources().getString(R.string.CodePushDeploymentKey), getApplicationContext(), BuildConfig.DEBUG)" 7 | } 8 | } 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /request-fetch-adapter.js: -------------------------------------------------------------------------------- 1 | const packageJson = require("./package.json"); 2 | 3 | module.exports = { 4 | async request(verb, url, requestBody, callback) { 5 | if (typeof requestBody === "function") { 6 | callback = requestBody; 7 | requestBody = null; 8 | } 9 | 10 | const headers = { 11 | "Accept": "application/json", 12 | "Content-Type": "application/json", 13 | "X-CodePush-Plugin-Name": packageJson.name, 14 | "X-CodePush-Plugin-Version": packageJson.version, 15 | "X-CodePush-SDK-Version": packageJson.dependencies["code-push"] 16 | }; 17 | 18 | if (requestBody && typeof requestBody === "object") { 19 | requestBody = JSON.stringify(requestBody); 20 | } 21 | 22 | try { 23 | const response = await fetch(url, { 24 | method: getHttpMethodName(verb), 25 | headers: headers, 26 | body: requestBody 27 | }); 28 | 29 | const statusCode = response.status; 30 | const body = await response.text(); 31 | callback(null, { statusCode, body }); 32 | } catch (err) { 33 | callback(err); 34 | } 35 | } 36 | }; 37 | 38 | function getHttpMethodName(verb) { 39 | // Note: This should stay in sync with the enum definition in 40 | // https://github.com/microsoft/code-push/blob/master/sdk/script/acquisition-sdk.ts#L6 41 | return [ 42 | "GET", 43 | "HEAD", 44 | "POST", 45 | "PUT", 46 | "DELETE", 47 | "TRACE", 48 | "OPTIONS", 49 | "CONNECT", 50 | "PATCH" 51 | ][verb]; 52 | } -------------------------------------------------------------------------------- /scripts/getFilesInFolder.js: -------------------------------------------------------------------------------- 1 | var fs = require("fs"); 2 | var path = require("path"); 3 | 4 | // Utility function that collects the stats of every file in a directory 5 | // as well as in its subdirectories. 6 | function getFilesInFolder(folderName, fileList) { 7 | var folderFiles = fs.readdirSync(folderName); 8 | folderFiles.forEach(function(file) { 9 | var fileStats = fs.statSync(path.join(folderName, file)); 10 | if (fileStats.isDirectory()) { 11 | getFilesInFolder(path.join(folderName, file), fileList); 12 | } else { 13 | fileStats.path = path.join(folderName, file); 14 | fileList.push(fileStats); 15 | } 16 | }); 17 | } 18 | 19 | module.exports = getFilesInFolder; -------------------------------------------------------------------------------- /scripts/postlink/run.js: -------------------------------------------------------------------------------- 1 | var postlinks = [ 2 | require("./android/postlink"), 3 | require("./ios/postlink") 4 | ]; 5 | 6 | //run them sequentially 7 | postlinks 8 | .reduce((p, fn) => p.then(fn), Promise.resolve()) 9 | .catch((err) => { 10 | console.error(err.message); 11 | }); -------------------------------------------------------------------------------- /scripts/postunlink/run.js: -------------------------------------------------------------------------------- 1 | var postunlinks = [ 2 | require("./ios/postunlink"), 3 | require("./android/postunlink") 4 | ]; 5 | 6 | //run them sequentially 7 | postunlinks 8 | .reduce((p, fn) => p.then(fn), Promise.resolve()) 9 | .catch((err) => { 10 | console.error(err.message); 11 | }); 12 | -------------------------------------------------------------------------------- /scripts/recordFilesBeforeBundleCommand.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This script creates a snapshot of the contents in the resource directory 3 | * by creating a map with the modified time of all the files in the directory 4 | * and saving it to a temp file. This snapshot is later referenced in 5 | * "generatePackageHash.js" to figure out which files have changed or were 6 | * newly generated by the "react-native bundle" command. 7 | */ 8 | 9 | var fs = require("fs"); 10 | var path = require("path"); 11 | 12 | var getFilesInFolder = require("./getFilesInFolder"); 13 | 14 | 15 | var resourcesDir = process.argv[2]; 16 | var tempFileName = process.argv[3]; 17 | 18 | var tempFileLocalPath = path.join(require("os").tmpdir(), tempFileName); 19 | var resourceFiles = []; 20 | 21 | try { 22 | getFilesInFolder(resourcesDir, resourceFiles); 23 | } catch(error) { 24 | var targetPathNotFoundExceptionMessage = "\nResources directory path does not exist.\n"; 25 | targetPathNotFoundExceptionMessage += "Unable to find '" + resourcesDir; 26 | targetPathNotFoundExceptionMessage += "' directory. Please check version of Android Plugin for Gradle."; 27 | error.message += targetPathNotFoundExceptionMessage; 28 | throw error; 29 | } 30 | 31 | var fileToModifiedTimeMap = {}; 32 | 33 | resourceFiles.forEach(function(resourceFile) { 34 | fileToModifiedTimeMap[resourceFile.path.substring(resourcesDir.length)] = resourceFile.mtime.getTime(); 35 | }); 36 | 37 | fs.writeFile(tempFileLocalPath, JSON.stringify(fileToModifiedTimeMap), function(err) { 38 | if (err) { 39 | throw err; 40 | } 41 | }); -------------------------------------------------------------------------------- /scripts/tools/linkToolsAndroid.js: -------------------------------------------------------------------------------- 1 | var fs = require("fs"); 2 | var glob = require("glob"); 3 | var path = require("path"); 4 | 5 | var ignoreFolders = { ignore: ["node_modules/**", "**/build/**"] }; 6 | var manifestPath = glob.sync("**/AndroidManifest.xml", ignoreFolders)[0]; 7 | 8 | exports.getJSBundleFileOverride = ` 9 | @Override 10 | protected String getJSBundleFile(){ 11 | return CodePush.getJSBundleFile(); 12 | } 13 | `; 14 | exports.reactNativeHostInstantiation = "new ReactNativeHost(this) {"; 15 | exports.mainActivityClassDeclaration = "public class MainActivity extends ReactActivity {"; 16 | exports.codePushGradleLink = `\napply from: "../../node_modules/react-native-code-push/android/codepush.gradle"`; 17 | exports.deploymentKeyName = "CodePushDeploymentKey"; 18 | 19 | exports.getMainApplicationLocation = function () { 20 | return findMainApplication() || glob.sync("**/MainApplication.java", ignoreFolders)[0]; 21 | } 22 | 23 | exports.getMainActivityPath = function () { 24 | return glob.sync("**/MainActivity.java", ignoreFolders)[0] 25 | } 26 | 27 | exports.getStringsResourcesPath = function () { 28 | return glob.sync("**/strings.xml", ignoreFolders)[0]; 29 | } 30 | 31 | exports.getBuildGradlePath = function () { 32 | return path.join("android", "app", "build.gradle"); 33 | } 34 | 35 | exports.isJsBundleOverridden = function (codeContents) { 36 | return /@Override\s*\n\s*protected String getJSBundleFile\(\)\s*\{[\s\S]*?\}/.test(codeContents); 37 | } 38 | 39 | function findMainApplication() { 40 | if (!manifestPath) { 41 | return null; 42 | } 43 | 44 | var manifest = fs.readFileSync(manifestPath, "utf8"); 45 | 46 | // Android manifest must include single 'application' element 47 | var matchResult = manifest.match(/application\s+android:name\s*=\s*"(.*?)"/); 48 | if (matchResult) { 49 | var appName = matchResult[1]; 50 | } else { 51 | return null; 52 | } 53 | 54 | var nameParts = appName.split('.'); 55 | var searchPath = glob.sync("**/" + nameParts[nameParts.length - 1] + ".java", ignoreFolders)[0]; 56 | return searchPath; 57 | } 58 | -------------------------------------------------------------------------------- /test/template/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | TestCodePush 3 | CODE_PUSH_ANDROID_DEPLOYMENT_KEY 4 | CODE_PUSH_SERVER_URL 5 | 6 | -------------------------------------------------------------------------------- /test/template/index.android.js: -------------------------------------------------------------------------------- 1 | import "./index.js"; -------------------------------------------------------------------------------- /test/template/index.ios.js: -------------------------------------------------------------------------------- 1 | import "./index.js"; -------------------------------------------------------------------------------- /test/template/ios/TestCodePush/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | 5 | #import 6 | #import 7 | #import 8 | 9 | @implementation AppDelegate 10 | 11 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 12 | { 13 | 14 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 15 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 16 | moduleName:@"CODE_PUSH_TEST_APP_NAME" 17 | initialProperties:nil]; 18 | 19 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 20 | 21 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 22 | UIViewController *rootViewController = [UIViewController new]; 23 | rootViewController.view = rootView; 24 | self.window.rootViewController = rootViewController; 25 | [self.window makeKeyAndVisible]; 26 | return YES; 27 | } 28 | 29 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 30 | { 31 | return [CodePush bundleURL]; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /test/template/scenarios/scenarioCheckForUpdate.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | 3 | module.exports = { 4 | startTest: function (testApp) { 5 | CodePushWrapper.checkForUpdate(testApp); 6 | }, 7 | 8 | getScenarioName: function () { 9 | return "Check for Update"; 10 | } 11 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioCheckForUpdateCustomKey.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | 3 | module.exports = { 4 | startTest: function (testApp) { 5 | CodePushWrapper.checkForUpdate(testApp, undefined, undefined, "CUSTOM-DEPLOYMENT-KEY"); 6 | }, 7 | 8 | getScenarioName: function () { 9 | return "Check for Update Custom Key"; 10 | } 11 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioDisallowRestartImmediate.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePush.disallowRestart(); 7 | CodePushWrapper.checkAndInstall(testApp, 8 | () => { 9 | CodePush.allowRestart(); 10 | }, 11 | undefined, 12 | CodePush.InstallMode.IMMEDIATE, 13 | undefined, 14 | true 15 | ); 16 | }, 17 | 18 | getScenarioName: function () { 19 | return "disallowRestart"; 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /test/template/scenarios/scenarioDisallowRestartOnResume.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePush.disallowRestart(); 7 | CodePushWrapper.checkAndInstall(testApp, 8 | undefined, 9 | undefined, 10 | CodePush.InstallMode.ON_NEXT_RESUME, 11 | undefined, 12 | true 13 | ); 14 | }, 15 | 16 | getScenarioName: function () { 17 | return "disallowRestart"; 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /test/template/scenarios/scenarioDisallowRestartOnSuspend.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePush.disallowRestart(); 7 | CodePushWrapper.checkAndInstall(testApp, 8 | undefined, 9 | undefined, 10 | CodePush.InstallMode.ON_NEXT_SUSPEND, 11 | undefined, 12 | true 13 | ); 14 | }, 15 | 16 | getScenarioName: function () { 17 | return "disallowRestart"; 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /test/template/scenarios/scenarioDownloadUpdate.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | 3 | module.exports = { 4 | startTest: function (testApp) { 5 | CodePushWrapper.checkForUpdate(testApp, 6 | CodePushWrapper.download.bind(undefined, testApp, undefined, undefined)); 7 | }, 8 | 9 | getScenarioName: function () { 10 | return "Download Update"; 11 | } 12 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioInstall.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePushWrapper.checkAndInstall(testApp, undefined, undefined, CodePush.InstallMode.IMMEDIATE); 7 | }, 8 | 9 | getScenarioName: function () { 10 | return "Install"; 11 | } 12 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioInstallOnRestartWithRevert.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePushWrapper.checkAndInstall(testApp, undefined, undefined, CodePush.InstallMode.ON_NEXT_RESTART); 7 | }, 8 | 9 | getScenarioName: function () { 10 | return "Install on Restart with Revert"; 11 | } 12 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioInstallOnResumeWithRevert.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePushWrapper.checkAndInstall(testApp, undefined, undefined, CodePush.InstallMode.ON_NEXT_RESUME); 7 | }, 8 | 9 | getScenarioName: function () { 10 | return "Install on Resume with Revert"; 11 | } 12 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioInstallOnSuspendWithRevert.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePushWrapper.checkAndInstall(testApp, undefined, undefined, CodePush.InstallMode.ON_NEXT_SUSPEND); 7 | }, 8 | 9 | getScenarioName: function () { 10 | return "Install on Suspend with Revert"; 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /test/template/scenarios/scenarioInstallRestart2x.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePushWrapper.checkAndInstall(testApp, 7 | () => { 8 | CodePush.restartApp(); 9 | CodePush.restartApp(); 10 | } 11 | ); 12 | }, 13 | 14 | getScenarioName: function () { 15 | return "Install and Restart 2x"; 16 | } 17 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioInstallWithRevert.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePushWrapper.checkAndInstall(testApp, undefined, undefined, CodePush.InstallMode.IMMEDIATE); 7 | }, 8 | 9 | getScenarioName: function () { 10 | return "Install with Revert"; 11 | } 12 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioRestart.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | testApp.sendCurrentAndPendingPackage() 7 | .then(() => { 8 | CodePushWrapper.sync(testApp, (status) => { 9 | if (status === CodePush.SyncStatus.UPDATE_INSTALLED) { 10 | testApp.sendCurrentAndPendingPackage().then(CodePush.restartApp); 11 | } 12 | }, undefined, { installMode: CodePush.InstallMode.ON_NEXT_RESTART }); 13 | }); 14 | }, 15 | 16 | getScenarioName: function () { 17 | return "Restart"; 18 | } 19 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioRestart2x.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePush.restartApp(true); 7 | CodePushWrapper.checkAndInstall(testApp, 8 | () => { 9 | CodePush.restartApp(true); 10 | } 11 | ); 12 | }, 13 | 14 | getScenarioName: function () { 15 | return "Restart2x"; 16 | } 17 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioSync.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePushWrapper.sync(testApp, undefined, undefined, { installMode: CodePush.InstallMode.IMMEDIATE }); 7 | }, 8 | 9 | getScenarioName: function () { 10 | return "Sync"; 11 | } 12 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioSync2x.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePushWrapper.sync(testApp, undefined, undefined, { installMode: CodePush.InstallMode.IMMEDIATE }); 7 | CodePushWrapper.sync(testApp, undefined, undefined, { installMode: CodePush.InstallMode.IMMEDIATE }); 8 | }, 9 | 10 | getScenarioName: function () { 11 | return "Sync 2x"; 12 | } 13 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioSyncMandatoryDefault.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePushWrapper.sync(testApp, undefined, undefined, { installMode: CodePush.InstallMode.ON_NEXT_RESTART }); 7 | }, 8 | 9 | getScenarioName: function () { 10 | return "Sync Mandatory Default"; 11 | } 12 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioSyncMandatoryRestart.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePushWrapper.sync(testApp, undefined, undefined, 7 | { 8 | installMode: CodePush.InstallMode.IMMEDIATE, 9 | mandatoryInstallMode: CodePush.InstallMode.ON_NEXT_RESTART 10 | }); 11 | }, 12 | 13 | getScenarioName: function () { 14 | return "Sync Mandatory Restart"; 15 | } 16 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioSyncMandatoryResume.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePushWrapper.sync(testApp, undefined, undefined, 7 | { 8 | installMode: CodePush.InstallMode.ON_NEXT_RESTART, 9 | mandatoryInstallMode: CodePush.InstallMode.ON_NEXT_RESUME 10 | }); 11 | }, 12 | 13 | getScenarioName: function () { 14 | return "Sync Mandatory Resume"; 15 | } 16 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioSyncMandatorySuspend.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePushWrapper.sync(testApp, undefined, undefined, 7 | { 8 | installMode: CodePush.InstallMode.IMMEDIATE, 9 | mandatoryInstallMode: CodePush.InstallMode.ON_NEXT_SUSPEND 10 | }); 11 | }, 12 | 13 | getScenarioName: function () { 14 | return "Sync Mandatory Suspend"; 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /test/template/scenarios/scenarioSyncRestartDelay.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePushWrapper.sync(testApp, undefined, undefined, 7 | { 8 | installMode: CodePush.InstallMode.ON_NEXT_RESTART, 9 | minimumBackgroundDuration: 15 10 | }); 11 | }, 12 | 13 | getScenarioName: function () { 14 | return "Sync Restart Delay"; 15 | } 16 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioSyncResume.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePushWrapper.sync(testApp, undefined, undefined, 7 | { installMode: CodePush.InstallMode.ON_NEXT_RESUME }); 8 | }, 9 | 10 | getScenarioName: function () { 11 | return "Sync Resume"; 12 | } 13 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioSyncResumeDelay.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePushWrapper.sync(testApp, undefined, undefined, 7 | { 8 | installMode: CodePush.InstallMode.ON_NEXT_RESUME, 9 | minimumBackgroundDuration: 5 10 | }); 11 | }, 12 | 13 | getScenarioName: function () { 14 | return "Sync Resume Delay"; 15 | } 16 | }; -------------------------------------------------------------------------------- /test/template/scenarios/scenarioSyncSuspend.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePushWrapper.sync(testApp, undefined, undefined, 7 | { installMode: CodePush.InstallMode.ON_NEXT_SUSPEND }); 8 | }, 9 | 10 | getScenarioName: function () { 11 | return "Sync Suspend"; 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /test/template/scenarios/scenarioSyncSuspendDelay.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | CodePushWrapper.sync(testApp, undefined, undefined, 7 | { 8 | installMode: CodePush.InstallMode.ON_NEXT_SUSPEND, 9 | minimumBackgroundDuration: 5 10 | }); 11 | }, 12 | 13 | getScenarioName: function () { 14 | return "Sync Suspend Delay"; 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /test/template/scenarios/updateDeviceReady.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | 3 | module.exports = { 4 | startTest: function (testApp) { 5 | testApp.readyAfterUpdate(); 6 | }, 7 | 8 | getScenarioName: function () { 9 | return "Bad Update"; 10 | } 11 | }; -------------------------------------------------------------------------------- /test/template/scenarios/updateNARConditional.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | testApp.readyAfterUpdate((responseBody) => { 7 | if (responseBody !== "SKIP_NOTIFY_APPLICATION_READY") { 8 | CodePush.notifyAppReady(); 9 | CodePushWrapper.checkAndInstall(testApp, undefined, undefined, CodePush.InstallMode.ON_NEXT_RESTART); 10 | } else { 11 | testApp.setStateAndSendMessage("Skipping notifyApplicationReady!", "SKIPPED_NOTIFY_APPLICATION_READY"); 12 | } 13 | }); 14 | }, 15 | 16 | getScenarioName: function () { 17 | return "Conditional Update"; 18 | } 19 | }; -------------------------------------------------------------------------------- /test/template/scenarios/updateNotifyApplicationReady.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | import CodePush from "react-native-code-push"; 3 | 4 | module.exports = { 5 | startTest: function (testApp) { 6 | testApp.readyAfterUpdate(); 7 | CodePush.notifyAppReady(); 8 | }, 9 | 10 | getScenarioName: function () { 11 | return "Good Update"; 12 | } 13 | }; -------------------------------------------------------------------------------- /test/template/scenarios/updateSync.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | 3 | module.exports = { 4 | startTest: function (testApp) { 5 | testApp.readyAfterUpdate(); 6 | CodePushWrapper.sync(testApp); 7 | }, 8 | 9 | getScenarioName: function () { 10 | return "Good Update (w/ Sync)"; 11 | } 12 | }; -------------------------------------------------------------------------------- /test/template/scenarios/updateSync2x.js: -------------------------------------------------------------------------------- 1 | var CodePushWrapper = require("../codePushWrapper.js"); 2 | 3 | module.exports = { 4 | startTest: function (testApp) { 5 | testApp.readyAfterUpdate(); 6 | CodePushWrapper.sync(testApp); 7 | CodePushWrapper.sync(testApp); 8 | }, 9 | 10 | getScenarioName: function () { 11 | return "Good Update (w/ Sync 2x)"; 12 | } 13 | }; -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES5", 4 | "module": "commonjs", 5 | "lib": ["es6"], 6 | "noImplicitAny": true, 7 | "noEmitOnError": true, 8 | "moduleResolution": "node", 9 | "sourceMap": true, 10 | "rootDir": "test", 11 | "outDir": "bin", 12 | "removeComments": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "rules": { 4 | "class-name": true, 5 | "comment-format": [true, 6 | "check-space" 7 | ], 8 | "indent": [true, 9 | "spaces" 10 | ], 11 | "one-line": [true, 12 | "check-open-brace" 13 | ], 14 | "quotemark": [true, 15 | "double" 16 | ], 17 | "semicolon": true, 18 | "whitespace": [true, 19 | "check-branch", 20 | "check-operator", 21 | "check-separator", 22 | "check-type" 23 | ], 24 | "typedef-whitespace": [true, { 25 | "call-signature": "nospace", 26 | "index-signature": "nospace", 27 | "parameter": "nospace", 28 | "property-declaration": "nospace", 29 | "variable-declaration": "nospace" 30 | }] 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /windows-legacy/.gitignore: -------------------------------------------------------------------------------- 1 | *AppPackages* 2 | *BundleArtifacts* 3 | *ReactAssets* 4 | 5 | #OS junk files 6 | [Tt]humbs.db 7 | *.DS_Store 8 | 9 | #Visual Studio files 10 | *.[Oo]bj 11 | *.user 12 | *.aps 13 | *.pch 14 | *.vspscc 15 | *.vssscc 16 | *_i.c 17 | *_p.c 18 | *.ncb 19 | *.suo 20 | *.tlb 21 | *.tlh 22 | *.bak 23 | *.[Cc]ache 24 | *.ilk 25 | *.log 26 | *.lib 27 | *.sbr 28 | *.sdf 29 | *.opensdf 30 | *.opendb 31 | *.unsuccessfulbuild 32 | ipch/ 33 | [Oo]bj/ 34 | [Bb]in 35 | [Dd]ebug*/ 36 | [Rr]elease*/ 37 | Ankh.NoLoad 38 | 39 | #MonoDevelop 40 | *.pidb 41 | *.userprefs 42 | 43 | #Tooling 44 | _ReSharper*/ 45 | *.resharper 46 | [Tt]est[Rr]esult* 47 | *.sass-cache 48 | 49 | #Project files 50 | [Bb]uild/ 51 | 52 | #Subversion files 53 | .svn 54 | 55 | # Office Temp Files 56 | ~$* 57 | 58 | # vim Temp Files 59 | *~ 60 | 61 | #NuGet 62 | packages/ 63 | *.nupkg 64 | 65 | #ncrunch 66 | *ncrunch* 67 | *crunch*.local.xml 68 | 69 | # visual studio database projects 70 | *.dbmdl 71 | 72 | #Test files 73 | *.testsettings 74 | 75 | #Other files 76 | *.DotSettings 77 | .vs/ 78 | *project.lock.json 79 | -------------------------------------------------------------------------------- /windows-legacy/.npmignore: -------------------------------------------------------------------------------- 1 | # Make sure we don't publish build artifacts to NPM 2 | ARM/ 3 | Debug/ 4 | x64/ 5 | x86/ 6 | bin/ 7 | obj/ 8 | .vs/ 9 | -------------------------------------------------------------------------------- /windows-legacy/CodePush.Net46.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CodePush.Net46.Test")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CodePush.Net46.Test")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("bbb48f0b-af6f-4a14-afa4-306d3fb0b7cf")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /windows-legacy/CodePush.Net46.Test/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /windows-legacy/CodePush.Net46.Test/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /windows-legacy/CodePush.Net46/Adapters/Http/HttpProgress.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CodePush.Net46.Adapters.Http 4 | { 5 | public enum HttpProgressStage 6 | { 7 | None = 0, 8 | DetectingProxy = 10, 9 | ResolvingName = 20, 10 | ConnectingToServer = 30, 11 | NegotiatingSsl = 40, 12 | SendingHeaders = 50, 13 | SendingContent = 60, 14 | WaitingForResponse = 70, 15 | ReceivingHeaders = 80, 16 | ReceivingContent = 90 17 | } 18 | 19 | public struct HttpProgress 20 | { 21 | public UInt64 BytesReceived; 22 | public UInt64 BytesSent; 23 | public UInt32 Retries; 24 | public HttpProgressStage Stage; 25 | public UInt64? TotalBytesToReceive; 26 | public UInt64? TotalBytesToSend; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /windows-legacy/CodePush.Net46/FileUtils.cs: -------------------------------------------------------------------------------- 1 | using PCLStorage; 2 | using System; 3 | using System.IO; 4 | using System.Threading.Tasks; 5 | 6 | namespace CodePush.ReactNative 7 | { 8 | internal class FileUtils 9 | { 10 | internal async static Task MergeFoldersAsync(IFolder source, IFolder target) 11 | { 12 | foreach (IFile sourceFile in await source.GetFilesAsync().ConfigureAwait(false)) 13 | { 14 | await CopyFileAsync(sourceFile.Path, Path.Combine(target.Path, sourceFile.Name)).ConfigureAwait(false); 15 | } 16 | 17 | foreach (IFolder sourceDirectory in await source.GetFoldersAsync().ConfigureAwait(false)) 18 | { 19 | var nextTargetSubDir = await target.CreateFolderAsync(sourceDirectory.Name, CreationCollisionOption.OpenIfExists).ConfigureAwait(false); 20 | await MergeFoldersAsync(sourceDirectory, nextTargetSubDir).ConfigureAwait(false); 21 | } 22 | } 23 | 24 | internal async static Task ClearReactDevBundleCacheAsync() 25 | { 26 | 27 | if (await FileSystem.Current.LocalStorage.CheckExistsAsync(CodePushConstants.ReactDevBundleCacheFileName).ConfigureAwait(false) != ExistenceCheckResult.FileExists) 28 | return; 29 | 30 | var devBundleCacheFile = await FileSystem.Current.LocalStorage.GetFileAsync(CodePushConstants.ReactDevBundleCacheFileName).ConfigureAwait(false); 31 | await devBundleCacheFile.DeleteAsync().ConfigureAwait(false); 32 | } 33 | 34 | internal static Task GetBinaryResourcesModifiedTimeAsync(string fileName) 35 | { 36 | var pathToAssembly = CodePushUtils.GetAppFolder(); 37 | var pathToAssemblyResource = Path.Combine(pathToAssembly, CodePushConstants.AssetsBundlePrefix, fileName); 38 | var lastUpdateTime = File.GetCreationTime(pathToAssemblyResource); 39 | 40 | return Task.FromResult(new DateTimeOffset(lastUpdateTime).ToUnixTimeMilliseconds()); 41 | } 42 | 43 | internal async static Task CopyFileAsync(string sourcePath, string destinationPath) 44 | { 45 | using (var source = File.Open(sourcePath, FileMode.Open, System.IO.FileAccess.Read)) 46 | { 47 | using (var destination = File.Create(destinationPath)) // Replace if exists 48 | { 49 | await source.CopyToAsync(destination); 50 | } 51 | } 52 | } 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /windows-legacy/CodePush.Net46/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CodePush.Net46")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CodePush.Net46")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("4dfe3f9f-5e15-4f17-8fd4-33ff0519348e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /windows-legacy/CodePush.Net46/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /windows-legacy/CodePush.Shared/CodePush.Shared.projitems: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | 4ad4c826-cc26-4f1d-b60d-b97b22f52e90 7 | 8 | 9 | CodePush.Shared 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /windows-legacy/CodePush.Shared/CodePush.Shared.shproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 4ad4c826-cc26-4f1d-b60d-b97b22f52e90 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /windows-legacy/CodePush.Shared/CodePushConstants.cs: -------------------------------------------------------------------------------- 1 | namespace CodePush.ReactNative 2 | { 3 | internal class CodePushConstants 4 | { 5 | internal const string BinaryModifiedTimeKey = "binaryModifiedTime"; 6 | internal const string CodePushServerUrl = "https://codepush.appcenter.ms/"; 7 | internal const string CodePushFolderPrefix = "CodePush"; 8 | internal const string CodePushPreferences = "CodePush"; 9 | internal const string CurrentPackageKey = "currentPackage"; 10 | internal const string DefaultJsBundleName = "index.windows.bundle"; 11 | internal const string DiffManifestFileName = "hotcodepush.json"; 12 | internal const string DownloadFileName = "download.zip"; 13 | internal const string DownloadProgressEventName = "CodePushDownloadProgress"; 14 | internal const string DownloadUrlKey = "downloadUrl"; 15 | internal const string FailedUpdatesKey = "CODE_PUSH_FAILED_UPDATES"; 16 | internal const string PackageFileName = "app.json"; 17 | internal const string PackageHashKey = "packageHash"; 18 | internal const string PendingUpdateHashKey = "hash"; 19 | internal const string PendingUpdateKey = "CODE_PUSH_PENDING_UPDATE"; 20 | internal const string PendingUpdateIsLoadingKey = "isLoading"; 21 | internal const string PreviousPackageKey = "previousPackage"; 22 | // This needs to be kept in sync with https://github.com/ReactWindows/react-native-windows/blob/master/ReactWindows/ReactNative/DevSupport/DevSupportManager.cs#L22 23 | internal const string ReactDevBundleCacheFileName = "ReactNativeDevBundle.js"; 24 | internal const string ReactNativeLogCategory = "ReactNative"; 25 | internal const string RelativeBundlePathKey = "bundlePath"; 26 | internal const string StatusFileName = "codepush.json"; 27 | internal const string UnzippedFolderName = "unzipped"; 28 | #if WINDOWS_UWP 29 | internal const string AssetsBundlePrefix = "ms-appx:///ReactAssets/"; 30 | internal const string FileBundlePrefix = "ms-appdata:///local/"; 31 | #else 32 | internal const string AssetsBundlePrefix = "ReactAssets/"; 33 | #endif 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /windows-legacy/CodePush.Shared/CodePushUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Linq; 4 | using System.IO; 5 | #if WINDOWS_UWP 6 | using Windows.ApplicationModel; 7 | using Windows.Storage; 8 | #endif 9 | 10 | namespace CodePush.ReactNative 11 | { 12 | internal partial class CodePushUtils 13 | { 14 | internal static void Log(string message) 15 | { 16 | Debug.WriteLine("[CodePush] " + message, CodePushConstants.ReactNativeLogCategory); 17 | } 18 | 19 | internal static void LogBundleUrl(string path) 20 | { 21 | Log("Loading JS bundle from \"" + path + "\""); 22 | } 23 | 24 | static string _deviceId = String.Empty; 25 | 26 | internal static string GetDeviceId() 27 | { 28 | //It's quite long operation, cache it 29 | if (!String.IsNullOrEmpty(_deviceId)) 30 | return _deviceId; 31 | 32 | _deviceId = GetDeviceIdImpl(); 33 | return _deviceId; 34 | } 35 | 36 | internal static string GetAppVersion() 37 | { 38 | #if WINDOWS_UWP 39 | return Package.Current.Id.Version.Major + "." + Package.Current.Id.Version.Minor + "." + Package.Current.Id.Version.Build; 40 | #else 41 | return applicationInfo.Version; 42 | #endif 43 | } 44 | 45 | internal static string GetAppFolder() 46 | { 47 | #if WINDOWS_UWP 48 | return ApplicationData.Current.LocalFolder.Path; 49 | #else 50 | return AppDomain.CurrentDomain.BaseDirectory; 51 | #endif 52 | } 53 | 54 | internal static string GetAssetsBundlePrefix() 55 | { 56 | #if WINDOWS_UWP 57 | return CodePushConstants.AssetsBundlePrefix; 58 | #else 59 | return Path.Combine(GetAppFolder(), CodePushConstants.AssetsBundlePrefix); 60 | #endif 61 | } 62 | 63 | internal static string ExtractSubFolder(string fullPath) 64 | { 65 | var codePushSubPathArray = fullPath.Split(Path.DirectorySeparatorChar); 66 | return String.Join("/", codePushSubPathArray.SkipWhile((value, index) => codePushSubPathArray.Length - index > 4).ToArray()); 67 | } 68 | 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /windows-legacy/CodePush.Shared/InstallMode.cs: -------------------------------------------------------------------------------- 1 | namespace CodePush.ReactNative 2 | { 3 | enum InstallMode 4 | { 5 | Immediate, 6 | OnNextRestart, 7 | OnNextResume 8 | } 9 | } -------------------------------------------------------------------------------- /windows-legacy/CodePush.Shared/MinimumBackgroundListener.cs: -------------------------------------------------------------------------------- 1 | using ReactNative.Bridge; 2 | using System; 3 | 4 | namespace CodePush.ReactNative 5 | { 6 | internal class MinimumBackgroundListener : ILifecycleEventListener 7 | { 8 | private DateTimeOffset? _lastSuspendDate; 9 | private Action _resumeAction; 10 | 11 | internal int MinimumBackgroundDuration { get; set; } 12 | 13 | internal MinimumBackgroundListener(Action resumeAction, int minimumBackgroundDuration) 14 | { 15 | _resumeAction = resumeAction; 16 | MinimumBackgroundDuration = minimumBackgroundDuration; 17 | } 18 | 19 | public void OnDestroy() 20 | { 21 | } 22 | 23 | public void OnResume() 24 | { 25 | if (_lastSuspendDate != null) 26 | { 27 | // Determine how long the app was in the background and ensure 28 | // that it meets the minimum duration amount of time. 29 | double durationInBackground = (DateTimeOffset.Now - _lastSuspendDate.Value).TotalSeconds; 30 | if (durationInBackground >= MinimumBackgroundDuration) 31 | { 32 | _resumeAction.Invoke(); 33 | } 34 | } 35 | } 36 | 37 | public void OnSuspend() 38 | { 39 | // Save the current time so that when the app is later 40 | // resumed, we can detect how long it was in the background. 41 | _lastSuspendDate = DateTimeOffset.Now; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /windows-legacy/CodePush.Shared/UpdateState.cs: -------------------------------------------------------------------------------- 1 | namespace CodePush.ReactNative 2 | { 3 | enum UpdateState 4 | { 5 | Running, 6 | Pending, 7 | Latest 8 | } 9 | } -------------------------------------------------------------------------------- /windows-legacy/CodePush/CodePushUtils.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using System; 3 | using System.Threading.Tasks; 4 | using Windows.Storage; 5 | using Windows.Storage.Streams; 6 | using Windows.System.Profile; 7 | 8 | namespace CodePush.ReactNative 9 | { 10 | internal partial class CodePushUtils 11 | { 12 | internal static string GetFileBundlePrefix() 13 | { 14 | return CodePushConstants.FileBundlePrefix; 15 | } 16 | 17 | internal async static Task GetJObjectFromFileAsync(StorageFile file) 18 | { 19 | string jsonString = await FileIO.ReadTextAsync(file).AsTask().ConfigureAwait(false); 20 | if (jsonString.Length == 0) 21 | { 22 | return new JObject(); 23 | } 24 | 25 | try 26 | { 27 | return JObject.Parse(jsonString); 28 | } 29 | catch (Exception) 30 | { 31 | return null; 32 | } 33 | } 34 | 35 | static string GetDeviceIdImpl() 36 | { 37 | HardwareToken token = HardwareIdentification.GetPackageSpecificToken(null); 38 | IBuffer hardwareId = token.Id; 39 | var dataReader = DataReader.FromBuffer(hardwareId); 40 | 41 | var bytes = new byte[hardwareId.Length]; 42 | dataReader.ReadBytes(bytes); 43 | 44 | return BitConverter.ToString(bytes); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /windows-legacy/CodePush/FileUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Windows.Storage; 4 | 5 | namespace CodePush.ReactNative 6 | { 7 | internal class FileUtils 8 | { 9 | internal async static Task MergeFoldersAsync(StorageFolder source, StorageFolder target) 10 | { 11 | foreach (StorageFile sourceFile in await source.GetFilesAsync().AsTask().ConfigureAwait(false)) 12 | { 13 | await sourceFile.CopyAndReplaceAsync(await target.CreateFileAsync(sourceFile.Name, CreationCollisionOption.OpenIfExists).AsTask().ConfigureAwait(false)).AsTask().ConfigureAwait(false); 14 | } 15 | 16 | foreach (StorageFolder sourceDirectory in await source.GetFoldersAsync().AsTask().ConfigureAwait(false)) 17 | { 18 | StorageFolder nextTargetSubDir = await target.CreateFolderAsync(sourceDirectory.Name, CreationCollisionOption.OpenIfExists).AsTask().ConfigureAwait(false); 19 | await MergeFoldersAsync(sourceDirectory, nextTargetSubDir).ConfigureAwait(false); 20 | } 21 | } 22 | 23 | internal async static Task ClearReactDevBundleCacheAsync() 24 | { 25 | var devBundleCacheFile = (StorageFile)await ApplicationData.Current.LocalFolder.TryGetItemAsync(CodePushConstants.ReactDevBundleCacheFileName).AsTask().ConfigureAwait(false); 26 | if (devBundleCacheFile != null) 27 | { 28 | await devBundleCacheFile.DeleteAsync().AsTask().ConfigureAwait(false); 29 | } 30 | } 31 | 32 | internal async static Task GetBinaryResourcesModifiedTimeAsync(string fileName) 33 | { 34 | var assetJSBundleFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri(CodePushConstants.AssetsBundlePrefix + fileName)).AsTask().ConfigureAwait(false); 35 | var fileProperties = await assetJSBundleFile.GetBasicPropertiesAsync().AsTask().ConfigureAwait(false); 36 | return fileProperties.DateModified.ToUnixTimeMilliseconds(); 37 | } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /windows-legacy/CodePush/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CodePush")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CodePush")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /windows-legacy/CodePush/Properties/CodePush.rd.xml: -------------------------------------------------------------------------------- 1 | 2 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /windows-legacy/CodePush/UpdateUtils.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using System; 3 | using System.IO; 4 | using System.Threading.Tasks; 5 | using Windows.Storage; 6 | 7 | namespace CodePush.ReactNative 8 | { 9 | internal class UpdateUtils 10 | { 11 | internal async static Task CopyNecessaryFilesFromCurrentPackageAsync(StorageFile diffManifestFile, StorageFolder currentPackageFolder, StorageFolder newPackageFolder) 12 | { 13 | await FileUtils.MergeFoldersAsync(currentPackageFolder, newPackageFolder).ConfigureAwait(false); 14 | JObject diffManifest = await CodePushUtils.GetJObjectFromFileAsync(diffManifestFile).ConfigureAwait(false); 15 | var deletedFiles = (JArray)diffManifest["deletedFiles"]; 16 | foreach (string fileNameToDelete in deletedFiles) 17 | { 18 | StorageFile fileToDelete = await newPackageFolder.GetFileAsync(fileNameToDelete.Replace("/", "\\")).AsTask().ConfigureAwait(false); 19 | await fileToDelete.DeleteAsync().AsTask().ConfigureAwait(false); 20 | } 21 | } 22 | 23 | internal async static Task FindJSBundleInUpdateContentsAsync(StorageFolder updateFolder, string expectedFileName) 24 | { 25 | foreach (StorageFile file in await updateFolder.GetFilesAsync().AsTask().ConfigureAwait(false)) 26 | { 27 | string fileName = file.Name; 28 | if (fileName.Equals(expectedFileName)) 29 | { 30 | return fileName; 31 | } 32 | } 33 | 34 | foreach (StorageFolder folder in await updateFolder.GetFoldersAsync().AsTask().ConfigureAwait(false)) 35 | { 36 | string mainBundlePathInSubFolder = await FindJSBundleInUpdateContentsAsync(folder, expectedFileName).ConfigureAwait(false); 37 | if (mainBundlePathInSubFolder != null) 38 | { 39 | return Path.Combine(folder.Name, mainBundlePathInSubFolder); 40 | } 41 | } 42 | 43 | return null; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /windows/.npmignore: -------------------------------------------------------------------------------- 1 | # Make sure we don't publish build artifacts to NPM 2 | ARM/ 3 | Debug/ 4 | x64/ 5 | x86/ 6 | bin/ 7 | obj/ 8 | .vs/ 9 | 10 | # Don't publish settings used for developement 11 | Directory.Build.props 12 | -------------------------------------------------------------------------------- /windows/CodePush/.npmignore: -------------------------------------------------------------------------------- 1 | # Make sure we don't publish build artifacts to NPM 2 | .vs/ 3 | ARM/ 4 | ARM64/ 5 | x64/ 6 | x86/ 7 | Debug/ 8 | Release/ 9 | bin/ 10 | obj/ 11 | Generated Files/ 12 | -------------------------------------------------------------------------------- /windows/CodePush/CodePush.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE 3 | DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE 4 | -------------------------------------------------------------------------------- /windows/CodePush/CodePushConfig.idl: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Microsoft.CodePush.ReactNative 5 | { 6 | [webhosthidden] 7 | [default_interface] 8 | runtimeclass CodePushConfig { 9 | static void Init(IMap configMap); 10 | static void SetHost(Microsoft.ReactNative.ReactNativeHost host); 11 | }; 12 | } // namespace CppModule 13 | -------------------------------------------------------------------------------- /windows/CodePush/CodePushDownloadHandler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | #include "winrt/Windows.Storage.h" 7 | #include "winrt/Windows.Foundation.h" 8 | #include "winrt/Windows.Data.Json.h" 9 | #include 10 | #include 11 | 12 | namespace Microsoft::CodePush::ReactNative 13 | { 14 | struct CodePushDownloadHandler 15 | { 16 | winrt::Windows::Storage::StorageFile downloadFile; 17 | int64_t expectedContentLength; 18 | int64_t receivedContentLength; 19 | std::function progressCallback; 20 | std::wstring_view downloadUrl; 21 | 22 | CodePushDownloadHandler( 23 | winrt::Windows::Storage::StorageFile downloadFile, 24 | std::function progressCallback); 25 | 26 | // Returns true if the downloaded file is a zip file 27 | winrt::Windows::Foundation::IAsyncOperation Download(std::wstring_view url); 28 | 29 | private: 30 | static constexpr uint32_t BufferSize{ 256 * 1024 }; 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /windows/CodePush/CodePushNativeModule.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/windows/CodePush/CodePushNativeModule.cpp -------------------------------------------------------------------------------- /windows/CodePush/CodePushNativeModule.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HSL5430/react-native-code-push/f4ac741840fb146e465bbadda80cfd0351d379e0/windows/CodePush/CodePushNativeModule.h -------------------------------------------------------------------------------- /windows/CodePush/CodePushTelemetryManager.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | #include "winrt/Windows.Data.Json.h" 7 | #include 8 | 9 | namespace Microsoft::CodePush::ReactNative 10 | { 11 | struct CodePushTelemetryManager 12 | { 13 | static winrt::Windows::Data::Json::JsonObject GetBinaryUpdateReport(std::wstring_view appVersion); 14 | static winrt::Windows::Data::Json::JsonObject GetRetryStatusReport(); 15 | static winrt::Windows::Data::Json::JsonObject GetRollbackReport(const winrt::Windows::Data::Json::JsonObject& lastFailedPackage); 16 | static winrt::Windows::Data::Json::JsonObject GetUpdateReport(const winrt::Windows::Data::Json::JsonObject& currentPackage); 17 | static void RecordStatusReported(const winrt::Windows::Data::Json::JsonObject& statusReport); 18 | static void SaveStatusReportForRetry(const winrt::Windows::Data::Json::JsonObject& statusReport); 19 | 20 | private: 21 | static void ClearRetryStatusReport(); 22 | static std::wstring_view GetDeploymentKeyFromStatusReportIdentifier(std::wstring_view statusReportIdentifier); 23 | static winrt::hstring GetPackageStatusReportIdentifier(const winrt::Windows::Data::Json::JsonObject& package); 24 | static winrt::hstring GetPreviousStatusReportIdentifier(); 25 | static std::wstring_view GetVersionLabelFromStatusReportIdentifier(std::wstring_view statusReportIdentifier); 26 | static bool IsStatusReportIdentifierCodePushLabel(std::wstring_view statusReportIdentifier); 27 | static void SaveStatusReportedForIdentifier(std::wstring_view appVersionOrPackageIdentifier); 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /windows/CodePush/CodePushUpdateUtils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "winrt/Windows.Data.Json.h" 4 | #include "winrt/Windows.Foundation.h" 5 | #include "winrt/Windows.Storage.h" 6 | 7 | // Copyright (c) Microsoft Corporation. 8 | // Licensed under the MIT License. 9 | 10 | #include 11 | 12 | namespace Microsoft::CodePush::ReactNative 13 | { 14 | struct CodePushUpdateUtils 15 | { 16 | static constexpr std::wstring_view AssetsFolderName{ L"assets" }; 17 | static constexpr std::wstring_view BinaryHashKey{ L"CodePushBinaryHash" }; 18 | static constexpr std::wstring_view ManifestFolderPrefix{ L"CodePush" }; 19 | static constexpr std::wstring_view BundleJWTFile{ L".codepushrelease" }; 20 | 21 | static winrt::Windows::Foundation::IAsyncOperation CopyEntriesInFolderAsync( 22 | winrt::Windows::Storage::StorageFolder& sourceFolder, 23 | winrt::Windows::Storage::StorageFolder& destFolder); 24 | 25 | static winrt::Windows::Foundation::IAsyncOperation ModifiedDateStringOfFileAsync(const winrt::Windows::Storage::StorageFile& file); 26 | 27 | static winrt::Windows::Foundation::IAsyncOperation GetSignatureFileAsync( 28 | const winrt::Windows::Storage::StorageFolder& rootFolder); 29 | 30 | private: 31 | /* 32 | Ignore list for hashing 33 | */ 34 | static constexpr std::wstring_view IgnoreMacOSX{ L"__MACOSX/" }; 35 | static constexpr std::wstring_view IgnoreDSStore{ L".DS_Store" }; 36 | static constexpr std::wstring_view IgnoreCodePushMetadata{ L".codepushrelease" }; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /windows/CodePush/CodePushUtils.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | #include "pch.h" 5 | #include "CodePushUtils.h" 6 | 7 | namespace Microsoft::CodePush::ReactNative 8 | { 9 | using namespace winrt::Windows::Storage; 10 | 11 | /*static*/ void CodePushUtils::Log(winrt::hstring message) 12 | { 13 | OutputDebugStringW(L"[CodePush] "); 14 | OutputDebugStringW(message.c_str()); 15 | OutputDebugStringW(L"\n"); 16 | } 17 | 18 | /*static*/ void CodePushUtils::Log(const winrt::hresult_error& ex) 19 | { 20 | OutputDebugStringW(L"[CodePush] Exception "); 21 | OutputDebugStringW(ex.message().c_str()); 22 | OutputDebugStringW(L"\n"); 23 | } 24 | 25 | /*static*/ void CodePushUtils::LogBundleUrl(const IStorageFile& bundle) 26 | { 27 | CodePushUtils::Log(L"Loading JS bundle from \"" + bundle.Path() + L"\""); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /windows/CodePush/CodePushUtils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | #include "winrt/base.h" 7 | #include "winrt/Windows.Storage.h" 8 | #include 9 | 10 | namespace Microsoft::CodePush::ReactNative 11 | { 12 | struct CodePushUtils 13 | { 14 | static void Log(winrt::hstring message); 15 | static void Log(const winrt::hresult_error& ex); 16 | static void LogBundleUrl(const winrt::Windows::Storage::IStorageFile& bundle); 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /windows/CodePush/FileUtils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | #include "winrt/Windows.Storage.h" 7 | #include "winrt/Windows.Foundation.h" 8 | 9 | #include 10 | #include 11 | 12 | namespace Microsoft::CodePush::ReactNative 13 | { 14 | struct FileUtils 15 | { 16 | static winrt::Windows::Foundation::IAsyncOperation CreateFileFromPathAsync( 17 | winrt::Windows::Storage::StorageFolder rootFolder, 18 | const std::filesystem::path& relativePath); 19 | 20 | static winrt::Windows::Foundation::IAsyncOperation FindFilePathAsync( 21 | const winrt::Windows::Storage::StorageFolder& rootFolder, 22 | std::wstring_view fileName); 23 | 24 | static winrt::Windows::Foundation::IAsyncAction UnzipAsync( 25 | const winrt::Windows::Storage::StorageFile& zipFile, 26 | const winrt::Windows::Storage::StorageFolder& destination); 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /windows/CodePush/PropertySheet.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /windows/CodePush/ReactPackageProvider.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "ReactPackageProvider.h" 3 | #include "ReactPackageProvider.g.cpp" 4 | 5 | #include "CodePushNativeModule.h" 6 | 7 | using namespace winrt::Microsoft::ReactNative; 8 | 9 | namespace winrt::Microsoft::CodePush::ReactNative::implementation { 10 | 11 | void ReactPackageProvider::CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept { 12 | AddAttributedModules(packageBuilder); 13 | } 14 | 15 | } // namespace winrt::Microsoft::CodePush::ReactNative::implementation 16 | -------------------------------------------------------------------------------- /windows/CodePush/ReactPackageProvider.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "winrt/Microsoft.CodePush.ReactNative.h" 3 | 4 | #include "ReactPackageProvider.g.h" 5 | 6 | using namespace winrt::Microsoft::ReactNative; 7 | 8 | namespace winrt::Microsoft::CodePush::ReactNative::implementation { 9 | 10 | struct ReactPackageProvider : ReactPackageProviderT { 11 | ReactPackageProvider() = default; 12 | 13 | void CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept; 14 | }; 15 | 16 | } // namespace winrt::RNFS::implementation 17 | 18 | namespace winrt::Microsoft::CodePush::ReactNative::factory_implementation { 19 | 20 | struct ReactPackageProvider : ReactPackageProviderT {}; 21 | 22 | } // namespace winrt::RNFS::factory_implementation 23 | -------------------------------------------------------------------------------- /windows/CodePush/ReactPackageProvider.idl: -------------------------------------------------------------------------------- 1 | namespace Microsoft.CodePush.ReactNative 2 | { 3 | [webhosthidden] 4 | [default_interface] 5 | runtimeclass ReactPackageProvider 6 | : Microsoft.ReactNative.IReactPackageProvider { 7 | ReactPackageProvider(); 8 | }; 9 | } // namespace CppModule 10 | -------------------------------------------------------------------------------- /windows/CodePush/miniz/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2013-2014 RAD Game Tools and Valve Software 2 | Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC 3 | 4 | All Rights Reserved. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /windows/CodePush/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /windows/CodePush/pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | -------------------------------------------------------------------------------- /windows/CodePush/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | -------------------------------------------------------------------------------- /windows/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $([MSBuild]::NormalizeDirectory('$(SolutionDir)\..\node_modules\react-native-windows\')) 6 | 7 | 8 | --------------------------------------------------------------------------------