Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHORE] Build official apps on CI #2701

Merged
merged 54 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
a4b3be5
Duplicated target and changed Bridging Header
diegolmello Dec 7, 2020
014dc97
Display name
diegolmello Dec 7, 2020
18eaa7b
Unnecessary dumb swift file removed
diegolmello Dec 7, 2020
2bc844a
Buildable name
diegolmello Dec 7, 2020
24ec287
Reorder Info.plist
diegolmello Dec 7, 2020
0b415e1
Rename Official target's bundle id
diegolmello Dec 7, 2020
372e77d
Ignore .mobileprovision
diegolmello Dec 7, 2020
7d269fd
Fix provisioning of official app
diegolmello Dec 7, 2020
26b6cd4
Starting signing
diegolmello Dec 7, 2020
be431c2
stash fastfile
diegolmello Dec 8, 2020
dcf904e
starting official ci iOS
diegolmello Dec 8, 2020
6b1f898
Uncomment Fastfile keychain
diegolmello Dec 8, 2020
857491d
Fix CI config
diegolmello Dec 8, 2020
ad3d54b
allowProvisioningUpdates
diegolmello Dec 8, 2020
ae4ff4b
Changing AppIcon and Splash Screen
diegolmello Dec 8, 2020
5dd0482
Remove unnecessary folder inside of Images.xcassets
diegolmello Dec 8, 2020
c326fd5
Reorder notificationservice and shareextension plists
diegolmello Dec 8, 2020
bb608de
Fix signing
diegolmello Dec 8, 2020
e46d657
Manual signing style for official
diegolmello Dec 8, 2020
cb8e577
Split official signing
diegolmello Dec 8, 2020
a507af7
Update project provisioning
diegolmello Dec 8, 2020
414fe0d
Use ENV as profile
diegolmello Dec 8, 2020
290c9f8
Output match
diegolmello Dec 8, 2020
81c9b8b
Keys
diegolmello Dec 9, 2020
d1780cd
TestFlight refactor
diegolmello Dec 9, 2020
97936e6
Setting up android
diegolmello Dec 9, 2020
60c4a17
android-official-play-build job
diegolmello Dec 10, 2020
0e32f39
Start removing unnecessary fastlane tasks on Android
diegolmello Dec 10, 2020
df02a89
Trying to refactor Android jobs
diegolmello Dec 10, 2020
aebe82f
android-env
diegolmello Dec 10, 2020
6a709f4
Remove foss build for now
diegolmello Dec 10, 2020
72a8c6d
Fork
diegolmello Dec 10, 2020
59ada2a
Fix if conditions
diegolmello Dec 10, 2020
2c4a0a2
Fix push
diegolmello Dec 10, 2020
e4644c1
ios-build command
diegolmello Dec 10, 2020
244b691
Rename Android builds
diegolmello Dec 10, 2020
6fc16b6
Upload dSYMs
diegolmello Dec 10, 2020
b72664b
Refactoring workflow
diegolmello Dec 10, 2020
e92e6dd
Reorder upload-to-testflight
diegolmello Dec 10, 2020
d017782
upload-to-google-play-beta command
diegolmello Dec 10, 2020
5824bc3
Fix ci
diegolmello Dec 10, 2020
49083d3
Fix android fork build
diegolmello Dec 10, 2020
08f4b3d
Fix keystore
diegolmello Dec 10, 2020
9a34dc6
Fix options on fastlane android
diegolmello Dec 10, 2020
d207cd6
Fix keystore
diegolmello Dec 10, 2020
f772151
Check isOfficial on iOS
diegolmello Dec 11, 2020
d277e8b
Check isOfficial on db
diegolmello Dec 11, 2020
19f9929
Remove unused imports
diegolmello Dec 11, 2020
293892d
Database names on Android
diegolmello Dec 11, 2020
cfe0e66
Tag fix
diegolmello Dec 11, 2020
25ba706
Minor fixes
diegolmello Dec 11, 2020
5c741ea
Set IS_OFFICIAL on CI
diegolmello Dec 11, 2020
fedcc3c
Fix detox
diegolmello Dec 14, 2020
096ecc9
follow review suggestions
djorkaeffalexandre Dec 14, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
448 changes: 249 additions & 199 deletions .circleci/config.yml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ DerivedData
*.ipa
*.xcuserstate
project.xcworkspace
*.mobileprovision

# Android/IntelliJ
#
Expand Down
34 changes: 25 additions & 9 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
def taskRequests = getGradle().getStartParameter().getTaskRequests().toString().toLowerCase()
def isPlay = !taskRequests.contains("foss")
def isFoss = taskRequests.contains("foss")

apply plugin: "com.android.application"
apply plugin: 'kotlin-android'

if (isPlay) {
if (!isFoss) {
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.bugsnag.android.gradle'
}
Expand Down Expand Up @@ -146,7 +146,7 @@ android {
versionCode VERSIONCODE as Integer
versionName "4.13.0"
vectorDrawables.useSupportLibrary = true
if (isPlay) {
if (!isFoss) {
manifestPlaceholders = [BugsnagAPIKey: BugsnagAPIKey as String]
missingDimensionStrategy "RNNotifications.reactNativeVersion", "reactNative60" // See note below!
}
Expand Down Expand Up @@ -176,7 +176,7 @@ android {
minifyEnabled enableProguardInReleaseBuilds
setProguardFiles([getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'])
signingConfig signingConfigs.release
if (isPlay) {
if (!isFoss) {
firebaseCrashlytics {
nativeSymbolUploadEnabled true
}
Expand All @@ -193,10 +193,17 @@ android {

// applicationVariants are e.g. debug, release

flavorDimensions "type"
flavorDimensions "app", "type"
productFlavors {
official {
dimension = "app"
buildConfigField "boolean", "IS_OFFICIAL", "true"
}
experimental {
dimension = "app"
buildConfigField "boolean", "IS_OFFICIAL", "false"
}
foss {
applicationId APPLICATION_ID
dimension = "type"
buildConfigField "boolean", "FDROID_BUILD", "true"
}
Expand All @@ -206,11 +213,20 @@ android {
}
}
sourceSets {
playDebug {
// TODO: refactor making sure notifications are working properly both on debug and release
experimentalPlayDebug {
java.srcDirs = ['src/main/java', 'src/play/java']
manifest.srcFile 'src/play/AndroidManifest.xml'
}
experimentalPlayRelease {
java.srcDirs = ['src/main/java', 'src/play/java']
manifest.srcFile 'src/play/AndroidManifest.xml'
}
officialPlayDebug {
java.srcDirs = ['src/main/java', 'src/play/java']
manifest.srcFile 'src/play/AndroidManifest.xml'
}
playRelease {
officialPlayRelease {
java.srcDirs = ['src/main/java', 'src/play/java']
manifest.srcFile 'src/play/AndroidManifest.xml'
}
Expand Down Expand Up @@ -287,6 +303,6 @@ task copyDownloadableDepsToLibs(type: Copy) {
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
if (isPlay) {
if (!isFoss) {
apply plugin: 'com.google.gms.google-services'
}
83 changes: 83 additions & 0 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"project_info": {
"project_number": "115198584049",
"firebase_url": "https://rocketchat-reactnative-test.firebaseio.com",
"project_id": "rocketchat-reactnative-test",
"storage_bucket": "rocketchat-reactnative-test.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:115198584049:android:a79216ae48935d2c9ab550",
"android_client_info": {
"package_name": "chat.rocket.android"
}
},
"oauth_client": [
{
"client_id": "115198584049-ack609b1338b827fta26s9rd2ab1aad5.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAWwowhAfACHBw3YxmDOXY3QyakgjhJLqc"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "115198584049-ack609b1338b827fta26s9rd2ab1aad5.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "115198584049-0efgfvm0oh9ap55g7epmqnjm27mq3j4e.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "chat.rocket.reactnative"
}
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:115198584049:android:8be27b1f7c42a2ed",
"android_client_info": {
"package_name": "chat.rocket.reactnative"
}
},
"oauth_client": [
{
"client_id": "115198584049-ack609b1338b827fta26s9rd2ab1aad5.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAWwowhAfACHBw3YxmDOXY3QyakgjhJLqc"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "115198584049-ack609b1338b827fta26s9rd2ab1aad5.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "115198584049-0efgfvm0oh9ap55g7epmqnjm27mq3j4e.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "chat.rocket.reactnative"
}
}
]
}
}
}
],
"configuration_version": "1"
}
4 changes: 0 additions & 4 deletions android/app/src/foss/res/values-night/colors.xml

This file was deleted.

28 changes: 0 additions & 28 deletions android/app/src/foss/res/values/styles.xml

This file was deleted.

3 changes: 1 addition & 2 deletions android/app/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="splashBackground" type="color">#000000</item>
<item name="notification_text" type="color">#1D74F5</item>
</resources>
</resources>
40 changes: 0 additions & 40 deletions android/app/src/play/google-services.json

This file was deleted.

50 changes: 30 additions & 20 deletions android/app/src/play/java/chat/rocket/reactnative/Encryption.java
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
package chat.rocket.reactnative;

import android.util.Log;
import android.util.Base64;
import android.database.Cursor;
import android.util.Base64;
import android.util.Log;

import com.pedrouid.crypto.RSA;
import com.pedrouid.crypto.RCTAes;
import com.pedrouid.crypto.RCTRsaUtils;
import com.pedrouid.crypto.Util;

import com.google.gson.Gson;

import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;

import com.facebook.react.bridge.WritableMap;
import com.google.gson.Gson;
import com.nozbe.watermelondb.Database;
import com.pedrouid.crypto.RCTAes;
import com.pedrouid.crypto.RCTRsaUtils;
import com.pedrouid.crypto.RSA;
import com.pedrouid.crypto.Util;

import java.util.Arrays;
import java.lang.reflect.Field;
import java.security.SecureRandom;
import java.util.Arrays;

class Message {
String _id;
Expand Down Expand Up @@ -69,8 +63,24 @@ class Encryption {
public static Encryption shared = new Encryption();
private ReactApplicationContext reactContext;

public Room readRoom(final Ejson ejson) {
Database database = new Database(ejson.serverURL().replace("https://", "") + "-experimental.db", reactContext);
public Room readRoom(final Ejson ejson) throws NoSuchFieldException {
int resId = reactContext.getResources().getIdentifier("rn_config_reader_custom_package", "string", reactContext.getPackageName());
String className = reactContext.getString(resId);
Class clazz = null;
Boolean isOfficial = false;
try {
clazz = Class.forName(className + ".BuildConfig");
Field IS_OFFICIAL = clazz.getField("IS_OFFICIAL");
isOfficial = (Boolean) IS_OFFICIAL.get(null);
} catch (ClassNotFoundException | IllegalAccessException e) {
e.printStackTrace();
}
String dbName = ejson.serverURL().replace("https://", "");
if (!isOfficial) {
dbName += "-experimental";
}
dbName += ".db";
Database database = new Database(dbName, reactContext);
String[] query = {ejson.rid};
Cursor cursor = database.rawQuery("select * from subscriptions where id == ? limit 1", query);

Expand Down Expand Up @@ -152,7 +162,7 @@ public String decryptMessage(final Ejson ejson, final ReactApplicationContext re

return m.text;
} catch (Exception e) {
Log.d("[ROCKETCHAT][ENCRYPTION]", Log.getStackTraceString(e));
Log.d("[ROCKETCHAT][E2E]", Log.getStackTraceString(e));
}

return null;
Expand Down Expand Up @@ -182,7 +192,7 @@ public String encryptMessage(final String message, final String id, final Ejson

return keyId + Base64.encodeToString(concat(bytes, data), Base64.NO_WRAP);
} catch (Exception e) {
Log.d("[ROCKETCHAT][ENCRYPTION]", Log.getStackTraceString(e));
Log.d("[ROCKETCHAT][E2E]", Log.getStackTraceString(e));
}

return message;
Expand Down
34 changes: 14 additions & 20 deletions android/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,20 @@
default_platform(:android)

platform :android do
desc "Play build for development"
lane :playBuild do
gradle(task: "assemblePlayDebug")
end

desc "Foss build for release"
lane :fossRelease do
gradle(task: "assembleFossRelease")
end

desc "Play build for release"
lane :playRelease do
gradle(task: "bundlePlayRelease")
end

desc "Upload App to Play Store Internal"
lane :beta do
upload_to_play_store(
track: 'internal',
aab: 'android/app/build/outputs/bundle/playRelease/app-play-release.aab'
)
lane :beta do |options|
if options[:official]
upload_to_play_store(
package_name: 'chat.rocket.android',
track: 'internal',
aab: 'android/app/build/outputs/bundle/officialPlayRelease/app-official-play-release.aab'
)
else
upload_to_play_store(
package_name: 'chat.rocket.reactnative',
track: 'internal',
aab: 'android/app/build/outputs/bundle/experimentalPlayRelease/app-experimental-play-release.aab'
)
end
end
end
2 changes: 2 additions & 0 deletions app/constants/environment.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import RNConfigReader from 'react-native-config-reader';

export const isFDroidBuild = RNConfigReader.FDROID_BUILD;

export const isOfficial = RNConfigReader.IS_OFFICIAL;
Loading