Skip to content

Commit

Permalink
refactor: Use mobilestack references in android builds (#6039)
Browse files Browse the repository at this point in the history
### Description

Makes the Android builds more brand agnostic. Replaces the existing
keystore android keystore containing the upload key by:
* Renaming the private key alias within the keystore from
`celo-release-key` to `mobilestack-release-key`
* Using the same password for both the store as well as the private key
within

### Test plan

<!-- Demonstrate the change is solid, or why it doesn't need testing.
Example: add any manual testing steps or scenarios (if not obvious),
screenshots / videos if the pull request changes the user interface.
-->

### Related issues

- Fixes #[issue number here]

### Backwards compatibility

<!-- Brief explanation of why these changes are/are not backwards
compatible. -->

### Network scalability

If a new NetworkId and/or Network are added in the future, the changes
in this PR will:

- [ ] Continue to work without code changes, OR trigger a compilation
error (guaranteeing we find it when a new network is added)
  • Loading branch information
jophish authored Nov 4, 2024
1 parent f788797 commit 7e74af3
Show file tree
Hide file tree
Showing 23 changed files with 43 additions and 44 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/release-fastlane-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ jobs:
uses: google-github-actions/get-secretmanager-secrets@v2
with:
secrets: |-
ANDROID_RELEASE_KEYSTORE:projects/1027349420744/secrets/ANDROID_RELEASE_KEYSTORE
CELO_RELEASE_KEY_PASSWORD:projects/1027349420744/secrets/CELO_RELEASE_KEY_PASSWORD
CELO_RELEASE_STORE_PASSWORD:projects/1027349420744/secrets/CELO_RELEASE_STORE_PASSWORD
ANDROID_RELEASE_KEYSTORE:projects/1027349420744/secrets/VALORA_RELEASE_KEYSTORE_V2
RELEASE_STORE_PASSWORD:projects/1027349420744/secrets/VALORA_RELEASE_STORE_PASSWORD
SLACK_WEBHOOK_URL:projects/1027349420744/secrets/SLACK_WEBHOOK_URL
BOT_SSH_KEY:projects/1027349420744/secrets/BOT_SSH_PRIVATE_KEY
GOOGLE_PLAY_SERVICE_ACCOUNT_KEY_JSON:projects/1027349420744/secrets/GOOGLE_PLAY_SERVICE_ACCOUNT_KEY_JSON
Expand Down Expand Up @@ -95,11 +94,10 @@ jobs:
# TODO: use ram disk
- name: Write secrets
run: |
echo '${{ steps.google-secrets.outputs.ANDROID_RELEASE_KEYSTORE }}' | base64 -d > android/app/celo-release-key.keystore
echo '${{ steps.google-secrets.outputs.ANDROID_RELEASE_KEYSTORE }}' | base64 -d > android/app/release-key.keystore
echo '${{ steps.google-secrets.outputs.GOOGLE_PLAY_SERVICE_ACCOUNT_KEY_JSON }}' > fastlane/google-play-service-account.json
- env:
CELO_RELEASE_STORE_PASSWORD: ${{ steps.google-secrets.outputs.CELO_RELEASE_STORE_PASSWORD }}
CELO_RELEASE_KEY_PASSWORD: ${{ steps.google-secrets.outputs.CELO_RELEASE_KEY_PASSWORD }}
RELEASE_STORE_PASSWORD: ${{ steps.google-secrets.outputs.RELEASE_STORE_PASSWORD }}
EMERGE_API_TOKEN: ${{ steps.google-secrets.outputs.EMERGE_API_TOKEN }}
SUPPLY_UPLOAD_MAX_RETRIES: 5
RUBYOPT: '-rostruct' # TODO: Remove when https://github.com/fastlane/fastlane/pull/21950 gets released
Expand Down
5 changes: 2 additions & 3 deletions WALLET.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,8 @@ If you have not yet created a keystore, one will be required to generate a relea

```sh
cd android/app
keytool -genkey -v -keystore celo-release-key.keystore -alias celo-key-alias -storepass celoFakeReleaseStorePass -keypass celoFakeReleaseKeyPass -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Android Debug,O=Android,C=US"
export CELO_RELEASE_STORE_PASSWORD=celoFakeReleaseStorePass
export CELO_RELEASE_KEY_PASSWORD=celoFakeReleaseKeyPass
keytool -genkey -v -keystore mobilestack-release-key.keystore -alias mobilestack-key-alias -storepass fakeReleaseStorePass -keypass fakeReleaseStorePass -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Android Debug,O=Android,C=US"
export RELEASE_STORE_PASSWORD=fakeReleaseStorePass
```

### Building an APK or Bundle
Expand Down
4 changes: 2 additions & 2 deletions android/.project
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>celo</name>
<comment>Project celo created by Buildship.</comment>
<name>mobilestack</name>
<comment>Project mobilestack created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
Expand Down
2 changes: 1 addition & 1 deletion android/app/.project
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>app</name>
<comment>Project app created by Buildship.</comment>
<comment>Project mobilestack created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
Expand Down
14 changes: 7 additions & 7 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def secrets = loadProjectSecrets(project.env.get("DEFAULT_TESTNET"))

android {
compileSdkVersion rootProject.ext.compileSdkVersion
namespace "org.celo.mobile"
namespace "xyz.mobilestack"

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
Expand All @@ -155,8 +155,8 @@ android {
testBuildType System.getProperty('testBuildType', 'debug')
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
resValue "string", "app_name", project.env.get("APP_DISPLAY_NAME")
resValue "string", "build_config_package", "org.celo.mobile"
resValue "string", "deep_link_url_scheme", project.env.get("DEEP_LINK_URL_SCHEME")
resValue "string", "build_config_package", "xyz.mobilestack"
missingDimensionStrategy 'react-native-camera', 'general'
vectorDrawables.useSupportLibrary = true
resValue "bool", "is_profiling_build", System.getenv("IS_PROFILING_BUILD") ?: "false"
Expand All @@ -178,11 +178,11 @@ android {
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
} else if (project.hasProperty('CELO_RELEASE_STORE_FILE')) {
storeFile file(CELO_RELEASE_STORE_FILE)
storePassword System.getenv("CELO_RELEASE_STORE_PASSWORD")
keyAlias CELO_RELEASE_KEY_ALIAS
keyPassword System.getenv("CELO_RELEASE_KEY_PASSWORD")
} else if (project.hasProperty('RELEASE_STORE_FILE')) {
storeFile file(RELEASE_STORE_FILE)
storePassword System.getenv("RELEASE_STORE_PASSWORD")
keyAlias RELEASE_KEY_ALIAS
keyPassword System.getenv("RELEASE_STORE_PASSWORD")
}
}

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-keep class com.segment.analytics.** { *; }
-keep class androidx.lifecycle.DefaultLifecycleObserver

-keep class org.celo.mobile.BuildConfig { *; }
-keep class xyz.mobilestack.BuildConfig { *; }
-keep public class com.horcrux.svg.** {*;}
-keep class com.rt2zz.reactnativecontacts.** {*;}
-keepclassmembers class com.rt2zz.reactnativecontacts.** {*;}
Expand Down
4 changes: 2 additions & 2 deletions android/app/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" package="org.celo.mobile" android:versionCode="1" android:versionName="1.0">
xmlns:tools="http://schemas.android.com/tools" package="xyz.mobilestack" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="27" tools:overrideLibrary="com.wix.detox, android.support.test.uiautomator.v18" />
</manifest>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.celo.mobile;
package xyz.mobilestack;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
Expand All @@ -25,7 +25,7 @@ public void runDetoxTests() {
DetoxConfig detoxConfig = new DetoxConfig();
detoxConfig.idlePolicyConfig.masterTimeoutSec = 90;
detoxConfig.idlePolicyConfig.idleResourceTimeoutSec = 60;
detoxConfig.rnContextLoadTimeoutSec = (org.celo.mobile.BuildConfig.DEBUG ? 180 : 60);
detoxConfig.rnContextLoadTimeoutSec = (xyz.mobilestack.BuildConfig.DEBUG ? 180 : 60);

Detox.runTests(mActivityRule, detoxConfig);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package org.celo.mobile;
package xyz.mobilestack;

import android.content.Context;
import com.facebook.react.ReactInstanceManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package org.celo.mobile;
package xyz.mobilestack;

import android.content.Context;
import com.facebook.flipper.android.AndroidFlipperClient;
Expand Down
4 changes: 2 additions & 2 deletions android/app/src/debug/res/xml/network_security_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- This allows unencrypted communication to these domains, which the bundler needs when running on an emulator -->
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">localhost</domain>
<!-- For Valora hooks preview mode with a local server -->
<!-- For MS hooks preview mode with a local server -->
<domain includeSubdomains="true">sslip.io</domain>
<domain includeSubdomains="true">10.0.1.1</domain>
<domain includeSubdomains="true">10.0.2.2</domain>
Expand All @@ -15,4 +15,4 @@
<certificates src="user" />
</trust-anchors>
</debug-overrides>
</network-security-config>
</network-security-config>
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<!-- Set custom default icon. This is used when no icon is set for incoming notification messages.
See README(https://goo.gl/l4GJaQ) for more. -->
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_notification_small" />
<meta-data tools:replace="android:resource" android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/celo_notification" />
<meta-data tools:replace="android:resource" android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/mobilestack_notification" />

<meta-data android:name="CLEVERTAP_BACKGROUND_SYNC" android:value="1"/>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.celo.mobile;
package xyz.mobilestack;

import android.os.Bundle;
import android.util.Log;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.celo.mobile;
package xyz.mobilestack;

import android.content.Intent;
import android.graphics.Color;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.celo.mobile;
package xyz.mobilestack;

import android.util.Log;
import androidx.multidex.MultiDexApplication;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.celo.mobile;
package xyz.mobilestack;

import android.content.Context;
import com.facebook.react.modules.network.OkHttpClientFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.celo.mobile;
package xyz.mobilestack;

import android.os.Build;
import java.io.IOException;
Expand Down
6 changes: 3 additions & 3 deletions android/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="celo_background">#45CD85</color>
<color name="celo_notification">#42D689</color>
<color name="mobilestack_background">#45CD85</color>
<color name="mobilestack_notification">#42D689</color>
<color name="primary_dark">#000000</color>
</resources>
</resources>
2 changes: 1 addition & 1 deletion android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="persona_inquiry_start_title">Valora would like to verify your identity</string>
<string name="persona_inquiry_start_title">This app would like to verify your identity</string>
<string name="persona_inquiry_start_body">Please have a government issued ID ready to continue.</string>
<string name="persona_inquiry_start_button">Begin Verification</string>
</resources>
6 changes: 3 additions & 3 deletions android/app/src/main/res/xml/backup_rules.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- See https://developer.android.com/guide/topics/data/autobackup on how to modify this file -->
<full-backup-content>
<include domain="file" path=".integration/celoandroid"/>
<include domain="file" path=".alfajoresstaging/celoandroid"/>
</full-backup-content>
<include domain="file" path=".integration/mobilestackandroid"/>
<include domain="file" path=".alfajoresstaging/mobilestackandroid"/>
</full-backup-content>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package org.celo.mobile;
package xyz.mobilestack;

import android.content.Context;
import com.facebook.react.ReactInstanceManager;
Expand Down
6 changes: 4 additions & 2 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ org.gradle.jvmargs=-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true

CELO_RELEASE_STORE_FILE=celo-release-key.keystore
CELO_RELEASE_KEY_ALIAS=celo-key-alias
# Note that the key alias lacks Mobile Stack naming, since updating this would
# require regenerating the keystore.
RELEASE_STORE_FILE=release-key.keystore
RELEASE_KEY_ALIAS=mobilestack-key-alias

# Setting this manually based on version number until we have this deploying via Cloud Build
# Example: v1.5.1 deployment number 1 = 1005001001 (1 005 001 001)
Expand Down

0 comments on commit 7e74af3

Please sign in to comment.