@revopush/react-native-code-push 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/.azurepipelines/build-rn-code-push-1es.yml +104 -0
  2. package/.azurepipelines/test-rn-code-push.yml +94 -0
  3. package/.config/CredScanSuppressions.json +14 -0
  4. package/.node-version +1 -0
  5. package/AlertAdapter.js +24 -0
  6. package/CONTRIBUTING.md +134 -0
  7. package/CodePush.js +671 -0
  8. package/CodePush.podspec +28 -0
  9. package/LICENSE.md +13 -0
  10. package/README.md +413 -0
  11. package/SECURITY.md +41 -0
  12. package/android/app/build.gradle +48 -0
  13. package/android/app/proguard-rules.pro +25 -0
  14. package/android/app/src/main/AndroidManifest.xml +5 -0
  15. package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +444 -0
  16. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +35 -0
  17. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushDialog.java +102 -0
  18. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInstallMode.java +16 -0
  19. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java +12 -0
  20. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidUpdateException.java +7 -0
  21. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushMalformedDataException.java +12 -0
  22. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +848 -0
  23. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNotInitializedException.java +12 -0
  24. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushTelemetryManager.java +175 -0
  25. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUnknownException.java +12 -0
  26. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +383 -0
  27. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateState.java +15 -0
  28. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +275 -0
  29. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUtils.java +238 -0
  30. package/android/app/src/main/java/com/microsoft/codepush/react/DownloadProgress.java +30 -0
  31. package/android/app/src/main/java/com/microsoft/codepush/react/DownloadProgressCallback.java +5 -0
  32. package/android/app/src/main/java/com/microsoft/codepush/react/FileUtils.java +203 -0
  33. package/android/app/src/main/java/com/microsoft/codepush/react/ReactHostHolder.java +11 -0
  34. package/android/app/src/main/java/com/microsoft/codepush/react/ReactInstanceHolder.java +17 -0
  35. package/android/app/src/main/java/com/microsoft/codepush/react/SettingsManager.java +173 -0
  36. package/android/app/src/main/java/com/microsoft/codepush/react/TLSSocketFactory.java +72 -0
  37. package/android/build.gradle +24 -0
  38. package/android/codepush.gradle +162 -0
  39. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  40. package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  41. package/android/gradle.properties +20 -0
  42. package/android/gradlew +164 -0
  43. package/android/gradlew.bat +90 -0
  44. package/android/settings.gradle +1 -0
  45. package/docs/api-android.md +52 -0
  46. package/docs/api-ios.md +31 -0
  47. package/docs/api-js.md +592 -0
  48. package/docs/multi-deployment-testing-android.md +55 -0
  49. package/docs/multi-deployment-testing-ios.md +59 -0
  50. package/docs/setup-android.md +92 -0
  51. package/docs/setup-ios.md +137 -0
  52. package/ios/CodePush/Base64/Base64/MF_Base64Additions.h +34 -0
  53. package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +252 -0
  54. package/ios/CodePush/Base64/README.md +47 -0
  55. package/ios/CodePush/CodePush.h +235 -0
  56. package/ios/CodePush/CodePush.m +1122 -0
  57. package/ios/CodePush/CodePushConfig.m +116 -0
  58. package/ios/CodePush/CodePushDownloadHandler.m +130 -0
  59. package/ios/CodePush/CodePushErrorUtils.m +20 -0
  60. package/ios/CodePush/CodePushPackage.m +602 -0
  61. package/ios/CodePush/CodePushTelemetryManager.m +175 -0
  62. package/ios/CodePush/CodePushUpdateUtils.m +376 -0
  63. package/ios/CodePush/CodePushUtils.m +9 -0
  64. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +69 -0
  65. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +16 -0
  66. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +51 -0
  67. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +15 -0
  68. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +55 -0
  69. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +24 -0
  70. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +41 -0
  71. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +28 -0
  72. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +205 -0
  73. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +103 -0
  74. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +322 -0
  75. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +37 -0
  76. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +145 -0
  77. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +35 -0
  78. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +551 -0
  79. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +23 -0
  80. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +43 -0
  81. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +230 -0
  82. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +31 -0
  83. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +113 -0
  84. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +38 -0
  85. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +500 -0
  86. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +18 -0
  87. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +214 -0
  88. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +23 -0
  89. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +29 -0
  90. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +19 -0
  91. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +68 -0
  92. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +18 -0
  93. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +72 -0
  94. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +67 -0
  95. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +111 -0
  96. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +119 -0
  97. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +307 -0
  98. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +94 -0
  99. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +619 -0
  100. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +164 -0
  101. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +514 -0
  102. package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +24 -0
  103. package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +11 -0
  104. package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +52 -0
  105. package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +5 -0
  106. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +28 -0
  107. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +70 -0
  108. package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +22 -0
  109. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +34 -0
  110. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +73 -0
  111. package/ios/CodePush/JWT/LICENSE +19 -0
  112. package/ios/CodePush/JWT/README.md +489 -0
  113. package/ios/CodePush/RCTConvert+CodePushInstallMode.m +20 -0
  114. package/ios/CodePush/RCTConvert+CodePushUpdateState.m +20 -0
  115. package/ios/CodePush/SSZipArchive/Info.plist +26 -0
  116. package/ios/CodePush/SSZipArchive/README.md +1 -0
  117. package/ios/CodePush/SSZipArchive/SSZipArchive.h +178 -0
  118. package/ios/CodePush/SSZipArchive/SSZipArchive.m +1496 -0
  119. package/ios/CodePush/SSZipArchive/SSZipCommon.h +71 -0
  120. package/ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy +23 -0
  121. package/ios/CodePush/SSZipArchive/include/ZipArchive.h +25 -0
  122. package/ios/CodePush/SSZipArchive/minizip/LICENSE +17 -0
  123. package/ios/CodePush/SSZipArchive/minizip/mz.h +273 -0
  124. package/ios/CodePush/SSZipArchive/minizip/mz_compat.c +1306 -0
  125. package/ios/CodePush/SSZipArchive/minizip/mz_compat.h +346 -0
  126. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.c +187 -0
  127. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.h +65 -0
  128. package/ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c +526 -0
  129. package/ios/CodePush/SSZipArchive/minizip/mz_os.c +348 -0
  130. package/ios/CodePush/SSZipArchive/minizip/mz_os.h +176 -0
  131. package/ios/CodePush/SSZipArchive/minizip/mz_os_posix.c +350 -0
  132. package/ios/CodePush/SSZipArchive/minizip/mz_strm.c +556 -0
  133. package/ios/CodePush/SSZipArchive/minizip/mz_strm.h +132 -0
  134. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c +383 -0
  135. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h +42 -0
  136. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c +269 -0
  137. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h +48 -0
  138. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os.h +40 -0
  139. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c +203 -0
  140. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c +334 -0
  141. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h +46 -0
  142. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.c +429 -0
  143. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.h +43 -0
  144. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c +360 -0
  145. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h +46 -0
  146. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c +389 -0
  147. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h +43 -0
  148. package/ios/CodePush/SSZipArchive/minizip/mz_zip.c +2782 -0
  149. package/ios/CodePush/SSZipArchive/minizip/mz_zip.h +262 -0
  150. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c +1942 -0
  151. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h +285 -0
  152. package/ios/CodePush.xcodeproj/project.pbxproj +1052 -0
  153. package/ios/CodePush.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  154. package/ios/CodePush.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  155. package/ios/PrivacyInfo.xcprivacy +31 -0
  156. package/logging.js +6 -0
  157. package/package-mixins.js +68 -0
  158. package/package.json +82 -0
  159. package/react-native.config.js +11 -0
  160. package/request-fetch-adapter.js +52 -0
  161. package/scripts/generateBundledResourcesHash.js +125 -0
  162. package/scripts/getFilesInFolder.js +19 -0
  163. package/scripts/postlink/android/postlink.js +87 -0
  164. package/scripts/postlink/ios/postlink.js +116 -0
  165. package/scripts/postlink/run.js +11 -0
  166. package/scripts/postunlink/android/postunlink.js +74 -0
  167. package/scripts/postunlink/ios/postunlink.js +87 -0
  168. package/scripts/postunlink/run.js +11 -0
  169. package/scripts/recordFilesBeforeBundleCommand.js +41 -0
  170. package/scripts/tools/linkToolsAndroid.js +57 -0
  171. package/scripts/tools/linkToolsIos.js +130 -0
  172. package/tsconfig.json +17 -0
  173. package/tslint.json +32 -0
  174. package/typings/react-native-code-push.d.ts +455 -0
@@ -0,0 +1,55 @@
1
+ ### Android
2
+
3
+ > NOTE
4
+ >
5
+ > Complete demo configured with "multi-deployment testing" feature is [here](https://github.com/microsoft/react-native-code-push/files/1314118/rncp1004.zip).
6
+
7
+ The [Android Gradle plugin](https://google.github.io/android-gradle-dsl/current/index.html) allows you to define custom config settings for each "build type" (like debug, release). This mechanism allows you to easily configure your debug builds to use your CodePush staging deployment key and your release builds to use your CodePush production deployment key.
8
+
9
+ *NOTE: As a reminder, you can retrieve these keys by running `appcenter codepush deployment list -a <ownerName>/<appName> -k` from your terminal.*
10
+
11
+ To set this up, perform the following steps:
12
+
13
+ **For React Native >= v0.76**
14
+
15
+ 1. Open the project's app level `build.gradle` file (for example `android/app/build.gradle` in standard React Native projects)
16
+
17
+ 2. Find the `android { buildTypes {} }` section and define `resValue` entries for both your `debug` and `release` build types, which reference your `Staging` and `Production` deployment keys respectively.
18
+
19
+ ```groovy
20
+ android {
21
+ ...
22
+ buildTypes {
23
+ debug {
24
+ ...
25
+ // Note: CodePush updates should not be tested in Debug mode as they are overriden by the RN packager. However, because CodePush checks for updates in all modes, we must supply a key.
26
+ resValue "string", "CodePushDeploymentKey", '""'
27
+ ...
28
+ }
29
+
30
+ releaseStaging {
31
+ ...
32
+ resValue "string", "CodePushDeploymentKey", '"<INSERT_STAGING_KEY>"'
33
+
34
+ // Note: It is a good idea to provide matchingFallbacks for the new buildType you create to prevent build issues
35
+ // Add the following line if not already there
36
+ matchingFallbacks = ['release']
37
+ ...
38
+ }
39
+
40
+ release {
41
+ ...
42
+ resValue "string", "CodePushDeploymentKey", '"<INSERT_PRODUCTION_KEY>"'
43
+ ...
44
+ }
45
+ }
46
+ ...
47
+ }
48
+ ```
49
+
50
+ *NOTE: Remember to remove the key from `strings.xml` if you are configuring the deployment key in the build process*
51
+
52
+ *NOTE: The naming convention for `releaseStaging` is significant due to [this line](https://github.com/facebook/react-native/blob/e083f9a139b3f8c5552528f8f8018529ef3193b9/react.gradle#L79).*
53
+
54
+
55
+ And that's it! View [here](http://tools.android.com/tech-docs/new-build-system/resource-merging) for more details on how resource merging works in Android.
@@ -0,0 +1,59 @@
1
+ ### iOS
2
+
3
+ > NOTE
4
+ >
5
+ > Complete demos configured with "multi-deployment testing" feature are [here]:
6
+ > * **without using cocoa pods**: [link](https://github.com/microsoft/react-native-code-push/files/1259957/rncp976.copy.zip)
7
+ > * **using cocoa pods**: [link](https://github.com/microsoft/react-native-code-push/files/1172217/rncp893.copy.zip)
8
+
9
+ Xcode allows you to define custom build settings for each "configuration" (like debug, release), which can then be referenced as the value of keys within the `Info.plist` file (like the `CodePushDeploymentKey` setting). This mechanism allows you to easily configure your builds to produce binaries, which are configured to synchronize with different CodePush deployments.
10
+
11
+ To set this up, perform the following steps:
12
+
13
+ 1. Open up your Xcode project and select your project in the `Project navigator` window
14
+
15
+ 2. Ensure the project node is selected, as opposed to one of your targets
16
+
17
+ 3. Select the `Info` tab
18
+
19
+ 4. Click the `+` button within the `Configurations` section and select `Duplicate "Release" Configuration`
20
+
21
+ ![Configuration](https://cloud.githubusercontent.com/assets/116461/16101597/088714c0-331c-11e6-9504-5469d9a59d74.png)
22
+
23
+ 5. Name the new configuration `Staging` (or whatever you prefer)
24
+
25
+ 6. Select the `Build Settings` tab
26
+
27
+ 7. Click the `+` button on the toolbar and select `Add User-Defined Setting`
28
+
29
+ ![Setting](https://cloud.githubusercontent.com/assets/116461/15764165/a16dbe30-28dd-11e6-94f2-fa3b7eb0c7de.png)
30
+
31
+ Name this new setting something like `Multi_Deployment_Config`. Go to the setting and add value `$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)` for Release. After that add value `$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)` for Staging
32
+
33
+ ![MultiDeploymentConfig](https://user-images.githubusercontent.com/48414875/87178636-1d6a6500-c2e6-11ea-890d-b7773f07e503.png)
34
+
35
+ *NOTE: For Xcode 10 and lower version: Go to Build Location -> Per-configuration Build Products Path -> Staging and change Staging value from $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to $(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)*
36
+
37
+ ![BuildFilesPath1](https://cloud.githubusercontent.com/assets/4928157/22645377/b1d7df0e-ec77-11e6-83c6-291a27bcdb17.png)
38
+
39
+ *NOTE: Due to https://github.com/facebook/react-native/issues/11813, we have to do this step to make it possible to use other configurations than Debug or Release on RN 0.40.0 or higher.*
40
+
41
+ 8. Click the `+` button again on the toolbar and select `Add User-Defined Setting`
42
+
43
+ Name this new setting something like `CODEPUSH_KEY`, expand it, and specify your `Staging` deployment key for the `Staging` config and your `Production` deployment key for the `Release` config.
44
+
45
+ ![Setting Keys](https://cloud.githubusercontent.com/assets/8598682/16821919/fc1eac4a-490d-11e6-9b11-128129c24b80.png)
46
+
47
+ *NOTE: As a reminder, you can retrieve these keys by running `appcenter codepush deployment list -a <ownerName>/<appName> -k` from your terminal.*
48
+
49
+ 9. Open your project's `Info.plist` file and change the value of your `CodePushDeploymentKey` entry to `$(CODEPUSH_KEY)`
50
+
51
+ ![Infoplist](https://cloud.githubusercontent.com/assets/116461/15764252/3ac8aed2-28de-11e6-8c19-2270ae9857a7.png)
52
+
53
+ And that's it! Now when you run or build your app, your staging builds will automatically be configured to sync with your `Staging` deployment, and your release builds will be configured to sync with your `Production` deployment.
54
+
55
+ *NOTE: CocoaPods users may need to run `pod install` before building with their new release configuration.*
56
+
57
+ *Note: If you encounter the error message `ld: library not found for ...`, please consult [this issue](https://github.com/microsoft/react-native-code-push/issues/426) for a possible solution.*
58
+
59
+ Additionally, if you want to give them seperate names and/or icons, you can modify the `Product Bundle Identifier`, `Product Name` and `Asset Catalog App Icon Set Name` build settings, which will allow your staging builds to be distinguishable from release builds when installed on the same device.
@@ -0,0 +1,92 @@
1
+ ## Android Setup
2
+
3
+ * [Plugin Installation and Configuration for React Native 0.76 version and above](#plugin-installation-and-configuration-for-react-native-060-version-and-above-android)
4
+ * [Code Signing setup](#code-signing-setup)
5
+
6
+ In order to integrate CodePush into your Android project, please perform the following steps:
7
+
8
+ ### Plugin Installation and Configuration for React Native 0.76 version and above (Android)
9
+
10
+
11
+ 1. In your `android/app/build.gradle` file, add the `codepush.gradle` file as an additional build task definition to the end of the file:
12
+
13
+ ```gradle
14
+ ...
15
+ apply from: "../../node_modules/@revopush/react-native-code-push/android/codepush.gradle"
16
+ ...
17
+ ```
18
+
19
+ 2. Update the `MainApplication` file to use CodePush via the following changes:
20
+
21
+ For React Native 0.76 and above: update the `MainApplication.kt`
22
+
23
+ **Important! : PackageList must be instantiated only one in application lifetime.**
24
+
25
+ ```kotlin
26
+ ...
27
+ // 1. Import the plugin class.
28
+ import com.microsoft.codepush.react.CodePush
29
+
30
+ class MainApplication : Application(), ReactApplication {
31
+ override val reactNativeHost: ReactNativeHost =
32
+ object : DefaultReactNativeHost(this) {
33
+ override fun getPackages(): List<ReactPackage> = PackageList(this).packages.apply {
34
+ // Packages that cannot be autolinked yet can be added manually here, for example:
35
+ // add(MyReactNativePackage())
36
+ }
37
+
38
+ // 2. Override the getJSBundleFile method in order to let
39
+ // the CodePush runtime determine where to get the JS
40
+ // bundle location from on each app start
41
+ override fun getJSBundleFile(): String {
42
+ return CodePush.getJSBundleFile()
43
+ }
44
+ };
45
+ }
46
+ ```
47
+
48
+
49
+ 3. Add the Deployment key to `strings.xml`:
50
+
51
+ To let the CodePush runtime know which deployment it should query for updates, open your app's `strings.xml` file and add a new string named `CodePushDeploymentKey`, whose value is the key of the deployment you want to configure this app against (like the key for the `Staging` deployment for the `FooBar` app). You can retrieve this value by running `appcenter codepush deployment list -a <ownerName>/<appName> -k` in the CodePush CLI (the `-k` flag is necessary since keys aren't displayed by default) and copying the value of the `Key` column which corresponds to the deployment you want to use (see below). Note that using the deployment's name (like Staging) will not work. The "friendly name" is intended only for authenticated management usage from the CLI, and not for public consumption within your app.
52
+
53
+ ![Deployment list](https://cloud.githubusercontent.com/assets/116461/11601733/13011d5e-9a8a-11e5-9ce2-b100498ffb34.png)
54
+
55
+ In order to effectively make use of the `Staging` and `Production` deployments that were created along with your CodePush app, refer to the [multi-deployment testing](../README.md#multi-deployment-testing) docs below before actually moving your app's usage of CodePush into production.
56
+
57
+ Your `strings.xml` should looks like this:
58
+
59
+ ```xml
60
+ <resources>
61
+ <string name="app_name">AppName</string>
62
+ <string moduleConfig="true" name="CodePushDeploymentKey">DeploymentKey</string>
63
+ </resources>
64
+ ```
65
+
66
+ *Note: If you need to dynamically use a different deployment, you can also override your deployment key in JS code using [Code-Push options](./api-js.md#CodePushOptions)*
67
+
68
+
69
+ In order to effectively make use of the `Staging` and `Production` deployments that were created along with your CodePush app, refer to the [multi-deployment testing](../README.md#multi-deployment-testing) docs below before actually moving your app's usage of CodePush into production.
70
+
71
+
72
+
73
+ ### Code Signing setup
74
+
75
+ Starting with CLI version **2.1.0** you can self sign bundles during release and verify its signature before installation of update. For more info about Code Signing please refer to [relevant code-push documentation section](https://github.com/microsoft/code-push/tree/v3.0.1/cli#code-signing). In order to use Public Key for Code Signing you need to do following steps:
76
+
77
+ Add `CodePushPublicKey` string item to `/path_to_your_app/android/app/src/main/res/values/strings.xml`. It may looks like this:
78
+
79
+ ```xml
80
+ <resources>
81
+ <string name="app_name">my_app</string>
82
+ <string name="CodePushPublicKey">-----BEGIN PUBLIC KEY-----
83
+ MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtPSR9lkGzZ4FR0lxF+ZA
84
+ P6jJ8+Xi5L601BPN4QESoRVSrJM08roOCVrs4qoYqYJy3Of2cQWvNBEh8ti3FhHu
85
+ tiuLFpNdfzM4DjAw0Ti5hOTfTixqVBXTJPYpSjDh7K6tUvp9MV0l5q/Ps3se1vud
86
+ M1/X6g54lIX/QoEXTdMgR+SKXvlUIC13T7GkDHT6Z4RlwxkWkOmf2tGguRcEBL6j
87
+ ww7w/3g0kWILz7nNPtXyDhIB9WLH7MKSJWdVCZm+cAqabUfpCFo7sHiyHLnUxcVY
88
+ OTw3sz9ceaci7z2r8SZdsfjyjiDJrq69eWtvKVUpredy9HtyALtNuLjDITahdh8A
89
+ zwIDAQAB
90
+ -----END PUBLIC KEY-----</string>
91
+ </resources>
92
+ ```
@@ -0,0 +1,137 @@
1
+ ## iOS Setup
2
+
3
+ Once you've acquired the CodePush plugin, you need to integrate it into the Xcode project of your React Native app and configure it correctly. To do this, take the following steps:
4
+
5
+ ### Plugin Installation and Configuration for React Native 0.76 version and above (iOS)
6
+
7
+ 1. Run `cd ios && pod install && cd ..` to install all the necessary CocoaPods dependencies.
8
+
9
+ 2. Change bundleUrl on AppDelegate file.
10
+
11
+ **If you're using objective-c:**
12
+ 1. Open up the `AppDelegate.m` file, and add an import statement for the CodePush headers:
13
+
14
+ ```objective-c
15
+ #import <CodePush/CodePush.h>
16
+ ```
17
+
18
+ 2. Find the following line of code, which sets the source URL for bridge for production releases:
19
+
20
+ ```objective-c
21
+ return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
22
+ ```
23
+
24
+ 3. Replace it with this line:
25
+
26
+ ```objective-c
27
+ return [CodePush bundleURL];
28
+ ```
29
+ This change configures your app to always load the most recent version of your app's JS bundle. On the first launch, this will correspond to the file that was compiled with the app. However, after an update has been pushed via CodePush, this will return the location of the most recently installed update.
30
+
31
+ *NOTE: The `bundleURL` method assumes your app's JS bundle is named `main.jsbundle`. If you have configured your app to use a different file name, simply call the `bundleURLForResource:` method (which assumes you're using the `.jsbundle` extension) or `bundleURLForResource:withExtension:` method instead, in order to overwrite that default behavior*
32
+
33
+ Typically, you're only going to want to use CodePush to resolve your JS bundle location within release builds, and therefore, we recommend using the `DEBUG` pre-processor macro to dynamically switch between using the packager server and CodePush, depending on whether you are debugging or not. This will make it much simpler to ensure you get the right behavior you want in production, while still being able to use the Chrome Dev Tools, live reload, etc. at debug-time.
34
+
35
+ Your `sourceURLForBridge` method should look like this:
36
+
37
+ ```objective-c
38
+ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
39
+ {
40
+ #if DEBUG
41
+ return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
42
+ #else
43
+ return [CodePush bundleURL];
44
+ #endif
45
+ }
46
+ ```
47
+
48
+ **If you're using Swift:**
49
+ 1. Open up the `AppDelegate.swift` file, and add an import statement for the CodePush headers:
50
+ ```swift
51
+ import CodePush
52
+ ```
53
+
54
+ 2. Find the following line of code, which sets the source URL for bridge for production release:
55
+ ```swift
56
+ Bundle.main.url(forResource: "main", withExtension: "jsbundle")
57
+ ```
58
+ 3. Replace it with this line:
59
+ ```swift
60
+ CodePush.bundleURL()
61
+ ```
62
+
63
+ Your `bundleUrl` method should look like this:
64
+ ```swift
65
+ override func bundleURL() -> URL? {
66
+ #if DEBUG
67
+ RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
68
+ #else
69
+ CodePush.bundleURL()
70
+ #endif
71
+ }
72
+ ```
73
+
74
+ 4. Add the Deployment key to `Info.plist`:
75
+
76
+ To let the CodePush runtime know which deployment it should query for updates against, open your app's `Info.plist` file and add a new entry named `CodePushDeploymentKey`, whose value is the key of the deployment you want to configure this app against (like the key for the `Staging` deployment for the `FooBar` app). You can retrieve this value by running `appcenter codepush deployment list -a <ownerName>/<appName> -k` in the AppCenter CLI (the `-k` flag is necessary since keys aren't displayed by default) and copying the value of the `Key` column which corresponds to the deployment you want to use (see below). Note that using the deployment's name (like Staging) will not work. That "friendly name" is intended only for authenticated management usage from the CLI, and not for public consumption within your app.
77
+
78
+ ![Deployment list](https://cloud.githubusercontent.com/assets/116461/11601733/13011d5e-9a8a-11e5-9ce2-b100498ffb34.png)
79
+
80
+ In order to effectively make use of the `Staging` and `Production` deployments that were created along with your CodePush app, refer to the [multi-deployment testing](../README.md#multi-deployment-testing) docs below before actually moving your app's usage of CodePush into production.
81
+
82
+ *Note: If you need to dynamically use a different deployment, you can also override your deployment key in JS code using [Code-Push options](./api-js.md#CodePushOptions)*
83
+
84
+
85
+ ### HTTP exception domains configuration (iOS)
86
+
87
+ CodePush plugin makes HTTPS requests to the following domains:
88
+
89
+ - api.revopush.org
90
+ - blob.revopush.org
91
+
92
+ If you want to change the default HTTP security configuration for any of these domains, you have to define the [`NSAppTransportSecurity` (ATS)][ats] configuration inside your __Info.plist__ file:
93
+
94
+ ```xml
95
+ <plist version="1.0">
96
+ <dict>
97
+ <!-- ...other configs... -->
98
+
99
+ <key>NSAppTransportSecurity</key>
100
+ <dict>
101
+ <key>NSExceptionDomains</key>
102
+ <dict>
103
+ <key>api.revopush.org</key>
104
+ <dict><!-- read the ATS Apple Docs for available options --></dict>
105
+ </dict>
106
+ </dict>
107
+
108
+ <!-- ...other configs... -->
109
+ </dict>
110
+ </plist>
111
+ ```
112
+
113
+ Before doing anything, please [read the docs][ats] first.
114
+
115
+ [ats]: https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW33
116
+
117
+ ### Code Signing setup
118
+
119
+ Starting with CLI version **2.1.0** you can self sign bundles during release and verify its signature before installation of update. For more info about Code Signing please refer to [relevant code-push documentation section](https://github.com/microsoft/code-push/tree/v3.0.1/cli#code-signing).
120
+
121
+ In order to configure Public Key for bundle verification you need to add record in `Info.plist` with name `CodePushPublicKey` and string value of public key content. Example:
122
+
123
+ ```xml
124
+ <plist version="1.0">
125
+ <dict>
126
+ <!-- ...other configs... -->
127
+
128
+ <key>CodePushPublicKey</key>
129
+ <string>-----BEGIN PUBLIC KEY-----
130
+ MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANkWYydPuyOumR/sn2agNBVDnzyRpM16NAUpYPGxNgjSEp0etkDNgzzdzyvyl+OsAGBYF3jCxYOXozum+uV5hQECAwEAAQ==
131
+ -----END PUBLIC KEY-----</string>
132
+
133
+ <!-- ...other configs... -->
134
+ </dict>
135
+ </plist>
136
+ ```
137
+
@@ -0,0 +1,34 @@
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 <Foundation/Foundation.h>
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
@@ -0,0 +1,252 @@
1
+ //
2
+ // MF_Base64Additions.m
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 "MF_Base64Additions.h"
14
+
15
+ @implementation MF_Base64Codec
16
+
17
+ +(NSString *)base64StringFromBase64UrlEncodedString:(NSString *)base64UrlEncodedString
18
+ {
19
+ NSString *s = base64UrlEncodedString;
20
+ s = [s stringByReplacingOccurrencesOfString:@"-" withString:@"+"];
21
+ s = [s stringByReplacingOccurrencesOfString:@"_" withString:@"/"];
22
+ switch (s.length % 4) {
23
+ case 2:
24
+ s = [s stringByAppendingString:@"=="];
25
+ break;
26
+ case 3:
27
+ s = [s stringByAppendingString:@"="];
28
+ break;
29
+ default:
30
+ break;
31
+ }
32
+ return s;
33
+ }
34
+
35
+ +(NSString *)base64UrlEncodedStringFromBase64String:(NSString *)base64String
36
+ {
37
+ NSString *s = base64String;
38
+ s = [s stringByReplacingOccurrencesOfString:@"=" withString:@""];
39
+ s = [s stringByReplacingOccurrencesOfString:@"+" withString:@"-"];
40
+ s = [s stringByReplacingOccurrencesOfString:@"/" withString:@"_"];
41
+ return s;
42
+ }
43
+
44
+ +(NSData *)dataFromBase64String:(NSString *)encoding
45
+ {
46
+ NSData *data = nil;
47
+ unsigned char *decodedBytes = NULL;
48
+ @try {
49
+ #define __ 255
50
+ static char decodingTable[256] = {
51
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0x00 - 0x0F
52
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0x10 - 0x1F
53
+ __,__,__,__, __,__,__,__, __,__,__,62, __,__,__,63, // 0x20 - 0x2F
54
+ 52,53,54,55, 56,57,58,59, 60,61,__,__, __, 0,__,__, // 0x30 - 0x3F
55
+ __, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, // 0x40 - 0x4F
56
+ 15,16,17,18, 19,20,21,22, 23,24,25,__, __,__,__,__, // 0x50 - 0x5F
57
+ __,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, // 0x60 - 0x6F
58
+ 41,42,43,44, 45,46,47,48, 49,50,51,__, __,__,__,__, // 0x70 - 0x7F
59
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0x80 - 0x8F
60
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0x90 - 0x9F
61
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xA0 - 0xAF
62
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xB0 - 0xBF
63
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xC0 - 0xCF
64
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xD0 - 0xDF
65
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xE0 - 0xEF
66
+ __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xF0 - 0xFF
67
+ };
68
+ encoding = [encoding stringByReplacingOccurrencesOfString:@"=" withString:@""];
69
+ NSData *encodedData = [encoding dataUsingEncoding:NSASCIIStringEncoding];
70
+ unsigned char *encodedBytes = (unsigned char *)[encodedData bytes];
71
+
72
+ NSUInteger encodedLength = [encodedData length];
73
+ if( encodedLength >= (NSUIntegerMax - 3) ) return nil; // NSUInteger overflow check
74
+ NSUInteger encodedBlocks = (encodedLength+3) >> 2;
75
+ NSUInteger expectedDataLength = encodedBlocks * 3;
76
+
77
+ unsigned char decodingBlock[4];
78
+
79
+ decodedBytes = malloc(expectedDataLength);
80
+ if( decodedBytes != NULL ) {
81
+
82
+ NSUInteger i = 0;
83
+ NSUInteger j = 0;
84
+ NSUInteger k = 0;
85
+ unsigned char c;
86
+ while( i < encodedLength ) {
87
+ c = decodingTable[encodedBytes[i]];
88
+ i++;
89
+ if( c != __ ) {
90
+ decodingBlock[j] = c;
91
+ j++;
92
+ if( j == 4 ) {
93
+ decodedBytes[k] = (decodingBlock[0] << 2) | (decodingBlock[1] >> 4);
94
+ decodedBytes[k+1] = (decodingBlock[1] << 4) | (decodingBlock[2] >> 2);
95
+ decodedBytes[k+2] = (decodingBlock[2] << 6) | (decodingBlock[3]);
96
+ j = 0;
97
+ k += 3;
98
+ }
99
+ }
100
+ }
101
+
102
+ // Process left over bytes, if any
103
+ if( j == 3 ) {
104
+ decodedBytes[k] = (decodingBlock[0] << 2) | (decodingBlock[1] >> 4);
105
+ decodedBytes[k+1] = (decodingBlock[1] << 4) | (decodingBlock[2] >> 2);
106
+ k += 2;
107
+ } else if( j == 2 ) {
108
+ decodedBytes[k] = (decodingBlock[0] << 2) | (decodingBlock[1] >> 4);
109
+ k += 1;
110
+ }
111
+ data = [[NSData alloc] initWithBytes:decodedBytes length:k];
112
+ }
113
+ }
114
+ @catch (NSException *exception) {
115
+ data = nil;
116
+ NSLog(@"WARNING: error occured while decoding base 32 string: %@", exception);
117
+ }
118
+ @finally {
119
+ if( decodedBytes != NULL ) {
120
+ free( decodedBytes );
121
+ }
122
+ }
123
+ return data;
124
+ }
125
+ +(NSString *)base64StringFromData:(NSData *)data
126
+ {
127
+ NSString *encoding = nil;
128
+ unsigned char *encodingBytes = NULL;
129
+ @try {
130
+ static char encodingTable[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
131
+ static NSUInteger paddingTable[] = {0,2,1};
132
+ // Table 1: The Base 64 Alphabet
133
+ //
134
+ // Value Encoding Value Encoding Value Encoding Value Encoding
135
+ // 0 A 17 R 34 i 51 z
136
+ // 1 B 18 S 35 j 52 0
137
+ // 2 C 19 T 36 k 53 1
138
+ // 3 D 20 U 37 l 54 2
139
+ // 4 E 21 V 38 m 55 3
140
+ // 5 F 22 W 39 n 56 4
141
+ // 6 G 23 X 40 o 57 5
142
+ // 7 H 24 Y 41 p 58 6
143
+ // 8 I 25 Z 42 q 59 7
144
+ // 9 J 26 a 43 r 60 8
145
+ // 10 K 27 b 44 s 61 9
146
+ // 11 L 28 c 45 t 62 +
147
+ // 12 M 29 d 46 u 63 /
148
+ // 13 N 30 e 47 v
149
+ // 14 O 31 f 48 w (pad) =
150
+ // 15 P 32 g 49 x
151
+ // 16 Q 33 h 50 y
152
+
153
+ NSUInteger dataLength = [data length];
154
+ NSUInteger encodedBlocks = dataLength / 3;
155
+ if( (encodedBlocks + 1) >= (NSUIntegerMax / 4) ) return nil; // NSUInteger overflow check
156
+ NSUInteger padding = paddingTable[dataLength % 3];
157
+ if( padding > 0 ) encodedBlocks++;
158
+ NSUInteger encodedLength = encodedBlocks * 4;
159
+
160
+ encodingBytes = malloc(encodedLength);
161
+ if( encodingBytes != NULL ) {
162
+ NSUInteger rawBytesToProcess = dataLength;
163
+ NSUInteger rawBaseIndex = 0;
164
+ NSUInteger encodingBaseIndex = 0;
165
+ unsigned char *rawBytes = (unsigned char *)[data bytes];
166
+ unsigned char rawByte1, rawByte2, rawByte3;
167
+ while( rawBytesToProcess >= 3 ) {
168
+ rawByte1 = rawBytes[rawBaseIndex];
169
+ rawByte2 = rawBytes[rawBaseIndex+1];
170
+ rawByte3 = rawBytes[rawBaseIndex+2];
171
+ encodingBytes[encodingBaseIndex] = encodingTable[((rawByte1 >> 2) & 0x3F)];
172
+ encodingBytes[encodingBaseIndex+1] = encodingTable[((rawByte1 << 4) & 0x30) | ((rawByte2 >> 4) & 0x0F) ];
173
+ encodingBytes[encodingBaseIndex+2] = encodingTable[((rawByte2 << 2) & 0x3C) | ((rawByte3 >> 6) & 0x03) ];
174
+ encodingBytes[encodingBaseIndex+3] = encodingTable[(rawByte3 & 0x3F)];
175
+
176
+ rawBaseIndex += 3;
177
+ encodingBaseIndex += 4;
178
+ rawBytesToProcess -= 3;
179
+ }
180
+ rawByte2 = 0;
181
+ switch (dataLength-rawBaseIndex) {
182
+ case 2:
183
+ rawByte2 = rawBytes[rawBaseIndex+1];
184
+ case 1:
185
+ rawByte1 = rawBytes[rawBaseIndex];
186
+ encodingBytes[encodingBaseIndex] = encodingTable[((rawByte1 >> 2) & 0x3F)];
187
+ encodingBytes[encodingBaseIndex+1] = encodingTable[((rawByte1 << 4) & 0x30) | ((rawByte2 >> 4) & 0x0F) ];
188
+ encodingBytes[encodingBaseIndex+2] = encodingTable[((rawByte2 << 2) & 0x3C) ];
189
+ // we can skip rawByte3 since we have a partial block it would always be 0
190
+ break;
191
+ }
192
+ // compute location from where to begin inserting padding, it may overwrite some bytes from the partial block encoding
193
+ // if their value was 0 (cases 1-2).
194
+ encodingBaseIndex = encodedLength - padding;
195
+ while( padding-- > 0 ) {
196
+ encodingBytes[encodingBaseIndex++] = '=';
197
+ }
198
+ encoding = [[NSString alloc] initWithBytes:encodingBytes length:encodedLength encoding:NSASCIIStringEncoding];
199
+ }
200
+ }
201
+ @catch (NSException *exception) {
202
+ encoding = nil;
203
+ NSLog(@"WARNING: error occured while tring to encode base 32 data: %@", exception);
204
+ }
205
+ @finally {
206
+ if( encodingBytes != NULL ) {
207
+ free( encodingBytes );
208
+ }
209
+ }
210
+ return encoding;
211
+ }
212
+ @end
213
+
214
+ @implementation NSString (Base64Addition)
215
+ -(NSString *)base64String
216
+ {
217
+ NSData *utf8encoding = [self dataUsingEncoding:NSUTF8StringEncoding];
218
+ return [MF_Base64Codec base64StringFromData:utf8encoding];
219
+ }
220
+ -(NSString *)base64UrlEncodedString
221
+ {
222
+ return [MF_Base64Codec base64UrlEncodedStringFromBase64String:[self base64String]];
223
+ }
224
+ +(NSString *)stringFromBase64String:(NSString *)base64String
225
+ {
226
+ NSData *utf8encoding = [MF_Base64Codec dataFromBase64String:base64String];
227
+ return [[NSString alloc] initWithData:utf8encoding encoding:NSUTF8StringEncoding];
228
+ }
229
+ +(NSString *)stringFromBase64UrlEncodedString:(NSString *)base64UrlEncodedString
230
+ {
231
+ return [self stringFromBase64String:[MF_Base64Codec base64StringFromBase64UrlEncodedString:base64UrlEncodedString]];
232
+ }
233
+ @end
234
+
235
+ @implementation NSData (Base64Addition)
236
+ +(NSData *)dataWithBase64String:(NSString *)base64String
237
+ {
238
+ return [MF_Base64Codec dataFromBase64String:base64String];
239
+ }
240
+ +(NSData *)dataWithBase64UrlEncodedString:(NSString *)base64UrlEncodedString
241
+ {
242
+ return [self dataWithBase64String:[MF_Base64Codec base64StringFromBase64UrlEncodedString:base64UrlEncodedString]];
243
+ }
244
+ -(NSString *)base64String
245
+ {
246
+ return [MF_Base64Codec base64StringFromData:self];
247
+ }
248
+ -(NSString *)base64UrlEncodedString
249
+ {
250
+ return [MF_Base64Codec base64UrlEncodedStringFromBase64String:[self base64String]];
251
+ }
252
+ @end