Skip to content

Commit 1871dec

Browse files
committed
Rename CodePushPublicKey to CodePushSigningPublicKey for clarity
1 parent 5760f01 commit 1871dec

File tree

6 files changed

+23
-12
lines changed

6 files changed

+23
-12
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,14 @@ If you are less in a hurry, you can migrate to `@appzung/react-native-code-push`
9898
#### Change your iOS setup
9999

100100
1. Run `bundle exec pod install`
101+
2. (optional) If you already use code signing, rename `CodePushPublicKey` to `CodePushSigningPublicKey` in your `Info.plist`
101102

102103
#### Change your Android setup
103104

104105
1. In `android/settings.gradle` change the lines about CodePush : `include ':appzung_react-native-code-push'` and `project(':appzung_react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/@appzung/react-native-code-push/android/app')`
105106
2. In `android/app/build.gradle` change the line about CodePush: `apply from: "../../node_modules/@appzung/react-native-code-push/android/codepush.gradle"`
106107
3. In your Android files (eg. `MainApplication.kt`), rename every `com.microsoft.codepush` prefix imports with `com.appzung.codepush`
108+
4. (optional) If you already use code signing, rename `CodePushPublicKey` to `CodePushSigningPublicKey` in your strings resources
107109

108110
### Migrating to AppZung CLI
109111

android/app/src/main/java/com/microsoft/codepush/react/CodePush.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,11 @@ public CodePush(String deploymentKey, Context context, boolean isDebugMode) {
7878

7979
mCurrentInstance = this;
8080

81-
String publicKeyFromStrings = getCustomPropertyFromStringsIfExist("PublicKey");
82-
if (publicKeyFromStrings != null) mPublicKey = publicKeyFromStrings;
81+
String publicKeyFromStrings = getCustomPropertyFromStringsIfExist("SigningPublicKey");
82+
if (publicKeyFromStrings != null) {
83+
CodePushUtils.log("Executing CodePush with a signing public key.");
84+
mPublicKey = publicKeyFromStrings;
85+
}
8386

8487
String serverUrlFromStrings = getCustomPropertyFromStringsIfExist("ServerUrl");
8588
if (serverUrlFromStrings != null) mServerUrl = serverUrlFromStrings;
@@ -124,6 +127,9 @@ private String getPublicKeyByResourceDescriptor(int publicKeyResourceDescriptor)
124127
if (publicKey.isEmpty()) {
125128
throw new CodePushInvalidPublicKeyException("Specified public key is empty");
126129
}
130+
131+
CodePushUtils.log("Executing CodePush with a signing public key.");
132+
127133
return publicKey;
128134
}
129135

docs/api-android.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ You can customize CodePush by placing these values in string resources.
88
```
99

1010
* __Public Key__ - used for bundle verification in the Code Signing Feature. Please refer to [Code Signing](setup-android.md#code-signing-setup) section for more details about the Code Signing Feature.
11-
To set the public key, you should add the content of the public key to `strings.xml` with name `CodePushPublicKey`. CodePush automatically gets this property and enables the Code Signing feature. For example:
11+
To set the public key, you should add the content of the public key to `strings.xml` with name `CodePushSigningPublicKey`. CodePush automatically gets this property and enables the Code Signing feature. For example:
1212
```xml
13-
<string moduleConfig="true" name="CodePushPublicKey">your-public-key</string>
13+
<string moduleConfig="true" name="CodePushSigningPublicKey">your-public-key</string>
1414
```
1515

1616
* __Server Url__ - used for specifying CodePush Server Url (as an Enterprise customer we may setup a custom infra for your needs).

docs/setup-android.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@
9090
9191
You can self sign bundles during release and verify its signature before installation of update. In order to use Public Key for Code Signing you need to do following steps:
9292
93-
Add the `CodePushPublicKey` string resource in `/android/app/src/main/res/values/strings.xml`. It may looks like this:
93+
Add the `CodePushSigningPublicKey` string resource in `/android/app/src/main/res/values/strings.xml`. It may looks like this:
9494
9595
```xml
9696
<resources>
9797
<string name="app_name">my_app</string>
98-
<string name="CodePushPublicKey">-----BEGIN PUBLIC KEY-----
98+
<string name="CodePushSigningPublicKey">-----BEGIN PUBLIC KEY-----
9999
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtPSR9lkGzZ4FR0lxF+ZA
100100
P6jJ8+Xi5L601BPN4QESoRVSrJM08roOCVrs4qoYqYJy3Of2cQWvNBEh8ti3FhHu
101101
tiuLFpNdfzM4DjAw0Ti5hOTfTixqVBXTJPYpSjDh7K6tUvp9MV0l5q/Ps3se1vud

docs/setup-ios.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@
5555
5656
You can self sign bundles during release and verify its signature before installation of update.
5757
58-
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:
58+
In order to configure Public Key for bundle verification you need to add record in `Info.plist` with name `CodePushSigningPublicKey` and string value of public key content. Example:
5959
6060
```xml
6161
<plist version="1.0">
6262
<dict>
6363
<!-- ...other configs... -->
6464
65-
<key>CodePushPublicKey</key>
65+
<key>CodePushSigningPublicKey</key>
6666
<string>-----BEGIN PUBLIC KEY-----
6767
MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANkWYydPuyOumR/sn2agNBVDnzyRpM16NAUpYPGxNgjSEp0etkDNgzzdzyvyl+OsAGBYF3jCxYOXozum+uV5hQECAwEAAQ==
6868
-----END PUBLIC KEY-----</string>

ios/CodePush/CodePushConfig.m

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ - (instancetype)init
3535
NSString *buildVersion = [infoDictionary objectForKey:(NSString *)kCFBundleVersionKey];
3636
NSString *deploymentKey = [infoDictionary objectForKey:@"CodePushDeploymentKey"];
3737
NSString *serverURL = [infoDictionary objectForKey:@"CodePushServerURL"];
38-
NSString *publicKey = [infoDictionary objectForKey:@"CodePushPublicKey"];
39-
38+
NSString *publicKey = [infoDictionary objectForKey:@"CodePushSigningPublicKey"];
39+
4040
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
4141
NSString *clientUniqueId = [userDefaults stringForKey:ClientUniqueIDConfigKey];
4242
if (clientUniqueId == nil) {
@@ -56,7 +56,10 @@ - (instancetype)init
5656
if (serverURL) [_configDictionary setObject:serverURL forKey:ServerURLConfigKey];
5757
if (clientUniqueId) [_configDictionary setObject:clientUniqueId forKey:ClientUniqueIDConfigKey];
5858
if (deploymentKey) [_configDictionary setObject:deploymentKey forKey:DeploymentKeyConfigKey];
59-
if (publicKey) [_configDictionary setObject:publicKey forKey:PublicKeyKey];
59+
if (publicKey) {
60+
CPLog(@"Executing CodePush with a signing public key.");
61+
[_configDictionary setObject:publicKey forKey:PublicKeyKey];
62+
}
6063

6164
return self;
6265
}
@@ -111,6 +114,6 @@ - (void)setServerURL:(NSString *)serverURL
111114
[_configDictionary setValue:serverURL forKey:ServerURLConfigKey];
112115
}
113116

114-
//no setter for PublicKey, because it's need to be hard coded within Info.plist for safety
117+
//no setter for SigningPublicKey, because it's need to be hard coded within Info.plist for safety
115118

116119
@end

0 commit comments

Comments
 (0)