Skip to content

Commit

Permalink
Merge branch 'master' into 164896228-same-height-messages
Browse files Browse the repository at this point in the history
  • Loading branch information
francescopersico authored May 20, 2019
2 parents ebfdd26 + b04228a commit 156fb5a
Show file tree
Hide file tree
Showing 91 changed files with 1,168 additions and 254 deletions.
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ENVIRONMENT=PROD
API_URL_PREFIX='https://app-backend.k8s.test.cd.teamdigitale.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='b5c28d653684157f831d6b604d5e1956'
ENABLE_TEST_IDP=YES
GCM_SENDER_ID='317157111831'
Expand Down
8 changes: 2 additions & 6 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# see https://help.github.com/en/articles/about-code-owners#example-of-a-codeowners-file

* @cloudify
* @cloudify @fpersico @undermaken

/ts/ @cloudify @fpersico @undermaken
/ios/ @cloudify @fpersico @undermaken
/android/ @cloudify @fpersico @undermaken

/locales/ @cloudify @matteodesanti
/locales/ @cloudify @matteodesanti @fpersico @undermaken
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@
import android.content.pm.ActivityInfo;
import android.os.Build;
import android.os.Bundle;
import android.view.WindowManager;
import android.support.v7.app.AlertDialog;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
import com.calendarevents.CalendarEventsPackage;
import org.devio.rn.splashscreen.SplashScreen;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;

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.
Expand All @@ -25,28 +29,103 @@ protected String getMainComponentName() {
// see https://github.com/crazycodeboy/react-native-splash-screen#third-stepplugin-configuration
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this, R.style.SplashScreenTheme);
super.onCreate(savedInstanceState);
if (!isEmulator() && isDeviceRooted()) {
super.onCreate(savedInstanceState);
//on rooted device show message ant stop app
AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create();
alertDialog.setTitle("Device rooted");
alertDialog.setMessage("This device is rooted, you can't use this app");
alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK",
(dialog, which) -> finish());
alertDialog.setCancelable(false);
alertDialog.show();
} else {
SplashScreen.show(this, R.style.SplashScreenTheme);
super.onCreate(savedInstanceState);
}
// Fix the problem described here:
// https://stackoverflow.com/questions/48072438/java-lang-illegalstateexception-only-fullscreen-opaque-activities-can-request-o
// https://stackoverflow.com/questions/48072438/java-lang-illegalstateexception-only-fullscreen-opaque-activities-can-request-o
if (android.os.Build.VERSION.SDK_INT != Build.VERSION_CODES.O) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
}

@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
if (!isEmulator() && isDeviceRooted()) {
// on rooted device not attach main component
return new ReactActivityDelegate(this, null);
} else {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}
}

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

/**
* Check rooted device
* https://stackoverflow.com/a/8097801/2470948
*/
private boolean isDeviceRooted() {
// check only once
if (isRootedDeviceFlag == null) {
isRootedDeviceFlag = (checkRootMethod1() || checkRootMethod2() || checkRootMethod3());
}
return isRootedDeviceFlag;
}

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
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"};
for (String path : paths) {
if (new File(path).exists()) return true;
}
return false;
}

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"});
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
if (in.readLine() != null) return true;
return false;
} catch (Throwable t) {
return false;
} finally {
if (process != null) process.destroy();
}
}

/**
* Detect when running on the emulator
* 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")
|| (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"))
|| "google_sdk".equals(Build.PRODUCT);
}
}
Binary file added img/wallet/errors/domain-unknown-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions img/wallet/errors/domain-unknown-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wallet/errors/domain-unknown-icon@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wallet/errors/domain-unknown-icon@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/wallet/errors/generic-error-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 156fb5a

Please sign in to comment.