Skip to content

Commit

Permalink
[#171875582] Change app ID and publisher [Android] (#1599)
Browse files Browse the repository at this point in the history
* [#171875582] change publisher and app id in android platform

* update

* [#171875582] update

* [#171875582] restore circleci config

* [#171875582] remove useless files

* [#171875582] remove useless files

* [#171875582] update firebase sender ID

* [#171875582] restore config.ts

* [#171875582] test android alpha release on circleci

* [#171875582] change api prefix endpoint
upgrade backend models definitions

* [#171875582] restore circleci config
  • Loading branch information
Undermaken authored Mar 26, 2020
1 parent e9f2035 commit 0e9b74f
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 47 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Example .env file. Do 'cp .env.example .env' and insert appropriate data.

ENVIRONMENT=DEV
API_URL_PREFIX='https://app-backend.k8s.test.cd.teamdigitale.it'
API_URL_PREFIX='https://app-backend.io.italia.it'
# pagoPA RESTful API
PAGOPA_API_URL_PREFIX='https://wisp2.pagopa.gov.it/pp-restapi-CD'
PAGOPA_API_URL_PREFIX_TEST='https://acardste.vaservices.eu:443/pp-restapi-CD'
MIXPANEL_TOKEN='0cb505dace6f4b3ceb9e17c7fcd7c66f'
ENABLE_TEST_IDP=YES
GCM_SENDER_ID='317157111831'
GCM_SENDER_ID='260468725946'
# If enabled the App allows authentication with CIE.
CIE_AUTHENTICATION_ENABLED=NO
# If enabled the App shows an Alert with the push notification message details.
Expand Down
4 changes: 2 additions & 2 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# This enviroment file is choosen by the build process when using the 'release' variant/scheme

ENVIRONMENT=PROD
API_URL_PREFIX='https://app-backend.k8s.test.cd.teamdigitale.it'
API_URL_PREFIX='https://app-backend.io.italia.it'
# pagoPA RESTful API
PAGOPA_API_URL_PREFIX='https://wisp2.pagopa.gov.it/pp-restapi-CD'
PAGOPA_API_URL_PREFIX_TEST='https://acardste.vaservices.eu:443/pp-restapi-CD'
MIXPANEL_TOKEN='0cb505dace6f4b3ceb9e17c7fcd7c66f'
ENABLE_TEST_IDP=YES
GCM_SENDER_ID='317157111831'
GCM_SENDER_ID='260468725946'
CIE_AUTHENTICATION_ENABLED=NO
DEBUG_REMOTE_PUSH_NOTIFICATION=NO
DEBUG_BIOMETRIC_IDENTIFICATION=NO
Expand Down
4 changes: 2 additions & 2 deletions android/app/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ android_library(

android_build_config(
name = "build_config",
package = "it.teamdigitale.app.italiaapp",
package = "it.pagopa.io.app",
)

android_resource(
name = "res",
package = "it.teamdigitale.app.italiaapp",
package = "it.pagopa.io.app",
res = "src/main/res",
)

Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ android {
}

defaultConfig {
applicationId "it.teamdigitale.app.italiaapp"
applicationId "it.pagopa.io.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode System.getenv('CIRCLE_BUILD_NUM') ? ("100" + System.getenv('CIRCLE_BUILD_NUM')).toInteger() : 1
Expand Down
2 changes: 1 addition & 1 deletion android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
-dontwarn com.kevinejohn.RNMixpanel.**

# React Native Config must referencing to BuildConfig
-keep class it.teamdigitale.app.italiaapp.BuildConfig { *; }
-keep class it.pagopa.io.app.BuildConfig { *; }

# React-native svg
-keep public class com.horcrux.svg.** {*;}
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="it.teamdigitale.app.italiaapp"
package="it.pagopa.io.app"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="auto">

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package it.teamdigitale.app.italiaapp;
package it.pagopa.io.app;

import android.content.pm.ActivityInfo;
import android.os.Build;
Expand All @@ -19,31 +19,32 @@
public class MainActivity extends ReactActivity {

private Boolean isRootedDeviceFlag = null;

/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
* Returns the name of the main component registered from JavaScript. This is
* used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "ItaliaApp";
}

// see https://github.com/crazycodeboy/react-native-splash-screen#third-stepplugin-configuration
// see
// https://github.com/crazycodeboy/react-native-splash-screen#third-stepplugin-configuration
@Override
protected void onCreate(Bundle savedInstanceState) {
/*
When the app starts, a check is made on the "isTablet" flag in the bools.xml file.
The value changes automatically depending on the device dp.
Starting from 600dp it is set to true.
*/
* When the app starts, a check is made on the "isTablet" flag in the bools.xml
* file. The value changes automatically depending on the device dp. Starting
* from 600dp it is set to true.
*/
if (getResources().getBoolean(R.bool.isTablet)) {
super.onCreate(savedInstanceState);
showAlertDialog(getString(R.string.dialog_attention),
getString(R.string.tablet_not_supported));
showAlertDialog(getString(R.string.dialog_attention), getString(R.string.tablet_not_supported));
} else {
if (!isEmulator() && isDeviceRooted()) {
super.onCreate(savedInstanceState);
//on rooted device show message ant stop app
// on rooted device show message ant stop app
showAlertDialog(getString(R.string.alert_device_rooted_title),
getString(R.string.alert_device_rooted_desc));
} else {
Expand Down Expand Up @@ -75,13 +76,12 @@ protected ReactRootView createRootView() {

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
CalendarEventsPackage.onRequestPermissionsResult(requestCode, permissions, grantResults);
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
CalendarEventsPackage.onRequestPermissionsResult(requestCode, permissions, grantResults);
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}

/**
* Check rooted device
* https://stackoverflow.com/a/8097801/2470948
* Check rooted device https://stackoverflow.com/a/8097801/2470948
*/
private boolean isDeviceRooted() {
// check only once
Expand All @@ -92,17 +92,20 @@ private boolean isDeviceRooted() {
}

private boolean checkRootMethod1() {
//check 1: get from build info, test-keys means it was signed with a custom key generated by a third-party developer
// check 1: get from build info, test-keys means it was signed with a custom key
// generated by a third-party developer
String buildTags = android.os.Build.TAGS;
return buildTags != null && buildTags.contains("test-keys");
}

private boolean checkRootMethod2() {
// check 2: if /system/app/Superuser.apk or its directories are present
String[] paths = {"/system/app/Superuser.apk", "/sbin/su", "/system/bin/su", "/system/xbin/su", "/data/local/xbin/su", "/data/local/bin/su", "/system/sd/xbin/su",
"/system/bin/failsafe/su", "/data/local/su", "/su/bin/su"};
String[] paths = { "/system/app/Superuser.apk", "/sbin/su", "/system/bin/su", "/system/xbin/su",
"/data/local/xbin/su", "/data/local/bin/su", "/system/sd/xbin/su", "/system/bin/failsafe/su",
"/data/local/su", "/su/bin/su" };
for (String path : paths) {
if (new File(path).exists()) return true;
if (new File(path).exists())
return true;
}
return false;
}
Expand All @@ -111,14 +114,16 @@ private boolean checkRootMethod3() {
Process process = null;
try {
// check 3: try executing a command, this operation requires root privileges
process = Runtime.getRuntime().exec(new String[]{"/system/xbin/which", "su"});
process = Runtime.getRuntime().exec(new String[] { "/system/xbin/which", "su" });
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
if (in.readLine() != null) return true;
if (in.readLine() != null)
return true;
return false;
} catch (Throwable t) {
return false;
} finally {
if (process != null) process.destroy();
if (process != null)
process.destroy();
}
}

Expand All @@ -127,22 +132,16 @@ private boolean checkRootMethod3() {
* https://stackoverflow.com/a/21505193/2470948
*/
private boolean isEmulator() {
return Build.FINGERPRINT.startsWith("generic")
|| Build.FINGERPRINT.startsWith("unknown")
|| Build.MODEL.contains("google_sdk")
|| Build.MODEL.contains("Emulator")
|| Build.MODEL.contains("Android SDK built for x86")
|| Build.MANUFACTURER.contains("Genymotion")
return Build.FINGERPRINT.startsWith("generic") || Build.FINGERPRINT.startsWith("unknown")
|| Build.MODEL.contains("google_sdk") || Build.MODEL.contains("Emulator")
|| Build.MODEL.contains("Android SDK built for x86") || Build.MANUFACTURER.contains("Genymotion")
|| (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"))
|| "google_sdk".equals(Build.PRODUCT);
}

private void showAlertDialog(String title, String message) {
new AlertDialog.Builder(MainActivity.this)
.setTitle(title)
.setMessage(message)
.setPositiveButton(getString(android.R.string.ok), (dialog, which) -> finish())
.setCancelable(false)
new AlertDialog.Builder(MainActivity.this).setTitle(title).setMessage(message)
.setPositiveButton(getString(android.R.string.ok), (dialog, which) -> finish()).setCancelable(false)
.show();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package it.teamdigitale.app.italiaapp;
package it.pagopa.io.app;

import androidx.multidex.MultiDexApplication;

Expand Down
2 changes: 1 addition & 1 deletion android/fastlane/Appfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
json_key_file "/tmp/json-key.json" # Path to the json secret file - Follow https://github.com/fastlane/supply#setup to get one
package_name "it.teamdigitale.app.italiaapp" # e.g. com.krausefx.app
package_name "it.pagopa.io.app" # e.g. com.krausefx.app
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"lint-autofix": "tslint -p . -c tslint.json -t verbose --fix",
"generate:pagopa-api-definitions": "rimraf definitions/pagopa && mkdir -p definitions/pagopa && gen-api-models --api-spec https://wisp2.pagopa.gov.it/pp-restapi-CD/v2/api-docs --out-dir ./definitions/pagopa --no-strict --request-types --response-decoders --default-error-type undefined",
"generate:mock-google-services-json": "cp mock-google-services.json ./android/app/google-services.json",
"generate:api-definitions": "rimraf definitions/backend && mkdir -p definitions/backend && gen-api-models --api-spec https://raw.githubusercontent.com/pagopa/io-backend/v2.5.2/api_backend.yaml --out-dir ./definitions/backend --no-strict --request-types --response-decoders && gen-api-models --api-spec https://raw.githubusercontent.com/pagopa/io-backend/v2.5.2/api_public.yaml --out-dir ./definitions/backend",
"generate:api-definitions": "rimraf definitions/backend && mkdir -p definitions/backend && gen-api-models --api-spec https://raw.githubusercontent.com/pagopa/io-backend/v5.3.1/api_backend.yaml --out-dir ./definitions/backend --no-strict --request-types --response-decoders && gen-api-models --api-spec https://raw.githubusercontent.com/pagopa/io-backend/v5.3.1/api_public.yaml --out-dir ./definitions/backend",
"bundle:android-release": "node node_modules/react-native/local-cli/cli.js bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/",
"generate:locales": "ts-node --skip-project -O '{\"lib\":[\"es2015\"]}' scripts/make-locales.ts",
"generate:content-definitions": "rimraf definitions/content && mkdir -p definitions/content && gen-api-models --api-spec https://raw.githubusercontent.com/pagopa/io-services-metadata/master/definitions.yml --out-dir ./definitions/content",
Expand Down
2 changes: 1 addition & 1 deletion scripts/google-services-json-file-setup.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

echo $ENCODED_GOOGLE_SERVICES_JSON_FILE | base64 --decode > $1/google-services.json
echo $ENCODED_IOAPP_GOOGLE_SERVICES_JSON_FILE | base64 --decode > $1/google-services.json
2 changes: 1 addition & 1 deletion scripts/json-key-file-setup.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

echo $ENCODED_ITALIAAPP_JSON_KEY_FILE | base64 --decode > /tmp/json-key.json
echo $ENCODED_IOAPP_JSON_KEY_FILE | base64 --decode > /tmp/json-key.json

0 comments on commit 0e9b74f

Please sign in to comment.