@revopush/react-native-code-push 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +3 -1
  2. package/android/build.gradle +45 -8
  3. package/android/{app/src → src}/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +17 -3
  4. package/package.json +1 -1
  5. package/react-native.config.js +1 -1
  6. package/revopush-react-native-code-push-1.4.0-rc1.tgz +0 -0
  7. package/scripts/tools/linkToolsAndroid.js +1 -1
  8. package/.azurepipelines/build-rn-code-push-1es.yml +0 -104
  9. package/.azurepipelines/test-rn-code-push.yml +0 -94
  10. package/.config/CredScanSuppressions.json +0 -14
  11. package/android/app/build.gradle +0 -48
  12. package/android/settings.gradle +0 -1
  13. /package/android/{app/proguard-rules.pro → proguard-rules.pro} +0 -0
  14. /package/android/{app/src → src}/main/AndroidManifest.xml +0 -0
  15. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/CodePush.java +0 -0
  16. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/CodePushConstants.java +0 -0
  17. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/CodePushDialog.java +0 -0
  18. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/CodePushInstallMode.java +0 -0
  19. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java +0 -0
  20. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/CodePushInvalidUpdateException.java +0 -0
  21. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/CodePushMalformedDataException.java +0 -0
  22. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/CodePushNotInitializedException.java +0 -0
  23. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/CodePushTelemetryManager.java +0 -0
  24. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/CodePushUnknownException.java +0 -0
  25. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +0 -0
  26. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/CodePushUpdateState.java +0 -0
  27. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +0 -0
  28. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/CodePushUtils.java +0 -0
  29. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/DownloadProgress.java +0 -0
  30. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/DownloadProgressCallback.java +0 -0
  31. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/FileUtils.java +0 -0
  32. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/ReactHostHolder.java +0 -0
  33. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/ReactInstanceHolder.java +0 -0
  34. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/SettingsManager.java +0 -0
  35. /package/android/{app/src → src}/main/java/com/microsoft/codepush/react/TLSSocketFactory.java +0 -0
package/README.md CHANGED
@@ -50,7 +50,9 @@ We try our best to maintain backwards compatibility of our plugin with previous
50
50
  | React Native version(s) | Supporting CodePush version(s) |
51
51
  |-------------------------|---------------------------------------------------------------------------------------------|
52
52
  | <v0.76 | Use [microsoft/code-push-react-native](https://github.com/microsoft/react-native-code-push) |
53
- | v0.76, v0.77, 0.78 | v1.0+ *(Support both New and Old Architectures)* |
53
+ | 0.76, 0.77, 0.78, 0.79 | v1.0+ *(Support both New and Old Architectures)* |
54
+ | v0.80 | v1.2 |
55
+ | Expo sdk 52 | v1.3 |
54
56
 
55
57
 
56
58
  We work hard to respond to new RN releases, but they do occasionally break us. We will update this chart with each RN release, so that users can check to see what our "official" support is.
@@ -1,5 +1,3 @@
1
- // Top-level build file where you can add configuration options common to all sub-projects/modules.
2
-
3
1
  buildscript {
4
2
  repositories {
5
3
  google()
@@ -13,12 +11,51 @@ buildscript {
13
11
  }
14
12
  }
15
13
 
16
- allprojects {
17
- android {
18
- namespace "com.microsoft.codepush.react"
14
+ apply plugin: "com.android.library"
15
+
16
+ def isNewArchitectureEnabled() {
17
+ // To opt-in for the New Architecture, you can either:
18
+ // - Set `newArchEnabled` to true inside the `gradle.properties` file
19
+ // - Invoke gradle with `-newArchEnabled=true`
20
+ // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
21
+ return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
22
+ }
23
+
24
+ def IS_NEW_ARCHITECTURE_ENABLED = isNewArchitectureEnabled()
25
+
26
+ if (IS_NEW_ARCHITECTURE_ENABLED) {
27
+ apply plugin: "com.facebook.react"
28
+ }
29
+
30
+ def DEFAULT_COMPILE_SDK_VERSION = 26
31
+ def DEFAULT_BUILD_TOOLS_VERSION = "26.0.3"
32
+ def DEFAULT_TARGET_SDK_VERSION = 26
33
+ def DEFAULT_MIN_SDK_VERSION = 16
34
+
35
+ android {
36
+ namespace "com.microsoft.codepush.react"
37
+
38
+ compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
39
+ buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
40
+
41
+ defaultConfig {
42
+ minSdkVersion rootProject.hasProperty('minSdkVersion') ? rootProject.minSdkVersion : DEFAULT_MIN_SDK_VERSION
43
+ targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
44
+ versionCode 1
45
+ versionName "1.0"
46
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", IS_NEW_ARCHITECTURE_ENABLED.toString()
19
47
  }
20
- repositories {
21
- mavenLocal()
22
- mavenCentral()
48
+
49
+ lintOptions {
50
+ abortOnError false
23
51
  }
52
+
53
+ defaultConfig {
54
+ consumerProguardFiles 'proguard-rules.pro'
55
+ }
56
+ }
57
+
58
+ dependencies {
59
+ implementation "com.facebook.react:react-native:+"
60
+ implementation 'com.nimbusds:nimbus-jose-jwt:9.37.3'
24
61
  }
@@ -152,7 +152,11 @@ public class CodePushNativeModule extends BaseJavaModule {
152
152
  Field bundleLoaderField = reactHostDelegate.getClass().getDeclaredField("jsBundleLoader");
153
153
  bundleLoaderField.setAccessible(true);
154
154
  bundleLoaderField.set(reactHostDelegate, latestJSBundleLoader);
155
- } catch (Exception e) {
155
+ }
156
+ catch (NoSuchFieldException noSuchFileFound) {
157
+ // Ignore this error for Expo
158
+ }
159
+ catch (Exception e) {
156
160
  CodePushUtils.log("Unable to set JSBundle of ReactHostDelegate - CodePush may not support this version of React Native");
157
161
  throw new IllegalAccessException("Could not setJSBundle");
158
162
  }
@@ -182,13 +186,23 @@ public class CodePushNativeModule extends BaseJavaModule {
182
186
  // logic to reload the current React context.
183
187
  final ReactHost reactHost = resolveReactHost();
184
188
  if (reactHost == null) {
189
+ loadBundleLegacy();
185
190
  return;
186
191
  }
187
192
 
188
193
  String latestJSBundleFile = mCodePush.getJSBundleFileInternal(mCodePush.getAssetsBundleFileName());
189
194
 
190
- // #2) Update the locally stored JS bundle file path
191
- setJSBundle(getReactHostDelegate((ReactHostImpl) reactHost), latestJSBundleFile);
195
+ try {
196
+ if (reactHost instanceof ReactHostImpl) {
197
+ ReactHostDelegate delegate = getReactHostDelegate((ReactHostImpl) reactHost);
198
+ if (delegate != null) {
199
+ // #2) Update the locally stored JS bundle file path
200
+ setJSBundle(delegate, latestJSBundleFile);
201
+ }
202
+ }
203
+ } catch (Exception e) {
204
+ CodePushUtils.log("Exception setJSBundle: " + e.getMessage());
205
+ }
192
206
 
193
207
  // #3) Get the context creation method
194
208
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revopush/react-native-code-push",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "React Native plugin for the CodePush service",
5
5
  "main": "CodePush.js",
6
6
  "typings": "typings/react-native-code-push.d.ts",
@@ -4,7 +4,7 @@ module.exports = {
4
4
  android: {
5
5
  packageInstance:
6
6
  "CodePush.getInstance(getResources().getString(R.string.CodePushDeploymentKey), getApplicationContext(), BuildConfig.DEBUG)",
7
- sourceDir: './android/app',
7
+ sourceDir: './android',
8
8
  }
9
9
  }
10
10
  }
@@ -29,7 +29,7 @@ exports.getStringsResourcesPath = function () {
29
29
  }
30
30
 
31
31
  exports.getBuildGradlePath = function () {
32
- return path.join("android", "app", "build.gradle");
32
+ return path.join("android", "build.gradle");
33
33
  }
34
34
 
35
35
  exports.isJsBundleOverridden = function (codeContents) {
@@ -1,104 +0,0 @@
1
- trigger:
2
- - master
3
-
4
- pr:
5
- - master
6
-
7
- resources:
8
- repositories:
9
- - repository: 1ESPipelineTemplates
10
- type: git
11
- name: 1ESPipelineTemplates/1ESPipelineTemplates
12
- ref: refs/tags/release
13
- name: $(Build.SourceBranchName)_$(date:yyyyMMdd)$(rev:.r)
14
-
15
- extends:
16
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}:
17
- template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
18
- ${{ else }}:
19
- template: v1/1ES.Unofficial.PipelineTemplate.yml@1ESPipelineTemplates
20
- parameters:
21
- pool:
22
- name: 1ES-PT-CBL-Mariner-2.0-Gen2
23
- os: linux
24
- customBuildTags:
25
- - ES365AIMigrationTooling-BulkMigrated
26
- sdl:
27
- sourceAnalysisPool: 1ES-PT-Windows-2022
28
- credscan:
29
- suppressionsFile: $(Build.SourcesDirectory)/.config/CredScanSuppressions.json
30
- stages:
31
- - stage: Stage
32
- jobs:
33
- - job: HostJob
34
- templateContext:
35
- outputs:
36
- - output: pipelineArtifact
37
- displayName: "Publish Artifact: artifacts"
38
- path: '$(Build.ArtifactStagingDirectory)/npm'
39
- artifactName: npm
40
-
41
- steps:
42
- - task: NodeTool@0
43
- inputs:
44
- versionSpec: '14.x'
45
- displayName: 'Install Node.js'
46
-
47
- - script: |
48
- npm pack
49
- npm install -g react-native-code-push*.tgz
50
- displayName: 'Package react-native-code-push'
51
- workingDirectory: $(Build.SourcesDirectory)
52
-
53
- - task: DeleteFiles@1
54
- inputs:
55
- contents: node_modules
56
- displayName: 'Delete node_modules'
57
-
58
- - task: ArchiveFiles@2
59
- inputs:
60
- rootFolderOrFile: '$(Build.SourcesDirectory)'
61
- includeRootFolder: false
62
- archiveType: 'tar'
63
- archiveFile: '$(Build.ArtifactStagingDirectory)/npm/$(Build.BuildId).tgz'
64
- replaceExistingArchive: true
65
- verbose: true
66
- displayName: 'Prepare npm artifact'
67
-
68
- - stage: APIScan
69
- dependsOn: Stage
70
- pool:
71
- name: 1ES-PT-Windows-2022
72
- os: windows
73
- variables:
74
- "agent.source.skip": true
75
- jobs:
76
- - job: APIScan
77
- steps:
78
- - task: DownloadPipelineArtifact@2
79
- displayName: Download Build Artifacts for APIScan
80
- inputs:
81
- artifactName: npm
82
- targetPath: '$(Agent.BuildDirectory)/npm'
83
- - task: ExtractFiles@1
84
- inputs:
85
- archiveFilePatterns: '$(Agent.BuildDirectory)/npm/*.tgz'
86
- destinationFolder: '$(Agent.BuildDirectory)/npm_extracted'
87
- - task: AzureKeyVault@2
88
- inputs:
89
- azureSubscription: 'AC - Dev Infra & Build Pool'
90
- KeyVaultName: 'mobile-center-sdk'
91
- SecretsFilter: 'appcenter-sdk-managed-identity-clientid'
92
- RunAsPreJob: false
93
- - task: APIScan@2
94
- displayName: 'Run APIScan'
95
- inputs:
96
- softwareFolder: '$(Agent.BuildDirectory)\npm_extracted'
97
- softwareName: 'react-native-code-push'
98
- softwareVersionNum: '$(Build.BuildId)'
99
- isLargeApp: false
100
- toolVersion: 'Latest'
101
- verbosityLevel: verbose
102
- condition: and(succeeded(), ne(variables['DisableAPIScan'], 'true'))
103
- env:
104
- AzureServicesAuthConnectionString: 'runAs=App;AppId=$(appcenter-sdk-managed-identity-clientid)'
@@ -1,94 +0,0 @@
1
- trigger:
2
- - master
3
-
4
- pr:
5
- - master
6
-
7
- variables:
8
- - name: api-level
9
- value: '27'
10
-
11
- pool:
12
- vmImage: 'macOS-12'
13
-
14
- stages:
15
- - stage: RunTests
16
- displayName: 'Run Android & IOS tests'
17
- jobs:
18
- - job: TestAndroid
19
- timeoutInMinutes: 120
20
- displayName: 'Test android'
21
- steps:
22
-
23
- - script: |
24
- adb devices
25
- displayName: 'Start adb server'
26
-
27
- - script: |
28
- $ANDROID_HOME/tools/bin/sdkmanager "system-images;android-$(api-level);google_apis;x86"
29
- displayName: 'Download system image'
30
-
31
- - script: |
32
- $ANDROID_HOME/tools/bin/avdmanager create avd --force --name TestEmulator --abi google_apis/x86 --package 'system-images;android-$(api-level);google_apis;x86' --device "Nexus 6P"
33
- displayName: 'Creating Android emulator'
34
-
35
- - script: |
36
- $ANDROID_HOME/emulator/emulator -avd TestEmulator -noaudio -no-window -no-snapshot-save -no-boot-anim -memory 6144 &
37
- displayName: 'Start Android emulator'
38
-
39
- - script: |
40
- $ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done'
41
- displayName: 'Wait for emulator to boot'
42
-
43
- - script: |
44
- adb shell settings put global window_animation_scale 0.0
45
- displayName: 'Disable animations and transitions'
46
-
47
- - script: |
48
- adb shell settings put global transition_animation_scale 0.0
49
- displayName: 'Disable animations and transitions'
50
-
51
- - script: |
52
- adb shell settings put global animator_duration_scale 0.0
53
- displayName: 'Disable animations and transitions'
54
-
55
-
56
- - task: JavaToolInstaller@0
57
- inputs:
58
- versionSpec: '11'
59
- jdkArchitectureOption: 'x64'
60
- jdkSourceOption: 'PreInstalled'
61
- displayName: 'Change Java version'
62
-
63
- - script: |
64
- npm install
65
- displayName: 'Package Installation'
66
-
67
- - script: |
68
- npm run build:tests && npm run test:setup:android
69
- displayName: 'Setup Android tests'
70
-
71
- - script: |
72
- npm run test:fast:android
73
- displayName: 'Run Android test'
74
-
75
- - job: TestIOS
76
- timeoutInMinutes: 120
77
- displayName: 'Test IOS'
78
- steps:
79
-
80
- - script: |
81
- npm install
82
- displayName: 'Install dependencies'
83
-
84
- - script: |
85
- npm run build:tests && npm run test:setup:ios
86
- displayName: 'Setup iOS tests'
87
-
88
- - script: |
89
- npm run test:fast:ios
90
- displayName: 'Run tests'
91
-
92
-
93
-
94
-
@@ -1,14 +0,0 @@
1
- {
2
- "tool": "Credential Scanner",
3
- "suppressions": [
4
- {
5
- "file": "/Examples/CodePushDemoApp/android/app/debug.keystore",
6
- "_justification": "Used only in DemoApp"
7
- },
8
- {
9
- "file": "/Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp/CodePushDemoAppCpp_TemporaryKey.pfx",
10
- "_justification": "Used only in DemoApp"
11
- }
12
- ]
13
- }
14
-
@@ -1,48 +0,0 @@
1
- apply plugin: "com.android.library"
2
-
3
- def isNewArchitectureEnabled() {
4
- // To opt-in for the New Architecture, you can either:
5
- // - Set `newArchEnabled` to true inside the `gradle.properties` file
6
- // - Invoke gradle with `-newArchEnabled=true`
7
- // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
8
- return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
9
- }
10
-
11
- def IS_NEW_ARCHITECTURE_ENABLED = isNewArchitectureEnabled()
12
-
13
- if (IS_NEW_ARCHITECTURE_ENABLED) {
14
- apply plugin: "com.facebook.react"
15
- }
16
-
17
- def DEFAULT_COMPILE_SDK_VERSION = 26
18
- def DEFAULT_BUILD_TOOLS_VERSION = "26.0.3"
19
- def DEFAULT_TARGET_SDK_VERSION = 26
20
- def DEFAULT_MIN_SDK_VERSION = 16
21
-
22
- android {
23
- namespace "com.microsoft.codepush.react"
24
-
25
- compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
26
- buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
27
-
28
- defaultConfig {
29
- minSdkVersion rootProject.hasProperty('minSdkVersion') ? rootProject.minSdkVersion : DEFAULT_MIN_SDK_VERSION
30
- targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
31
- versionCode 1
32
- versionName "1.0"
33
- buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", IS_NEW_ARCHITECTURE_ENABLED.toString()
34
- }
35
-
36
- lintOptions {
37
- abortOnError false
38
- }
39
-
40
- defaultConfig {
41
- consumerProguardFiles 'proguard-rules.pro'
42
- }
43
- }
44
-
45
- dependencies {
46
- implementation "com.facebook.react:react-native:+"
47
- implementation 'com.nimbusds:nimbus-jose-jwt:9.37.3'
48
- }
@@ -1 +0,0 @@
1
- include ':app'