From ca9302cd584a68485ccd2560c3a587343cd9aff2 Mon Sep 17 00:00:00 2001 From: Distopico Vegan Date: Tue, 30 Oct 2018 17:23:45 -0500 Subject: [PATCH] remove unnecessarily menus and helpers --- .../java/org/dystopia/email/ActivityMain.java | 5 -- .../java/org/dystopia/email/ActivityView.java | 56 +-------------- .../org/dystopia/email/ApplicationEx.java | 3 - .../main/java/org/dystopia/email/Helper.java | 70 +------------------ app/src/main/res/values/strings.xml | 1 - 5 files changed, 3 insertions(+), 132 deletions(-) diff --git a/app/src/main/java/org/dystopia/email/ActivityMain.java b/app/src/main/java/org/dystopia/email/ActivityMain.java index 84d1a650..007babcc 100644 --- a/app/src/main/java/org/dystopia/email/ActivityMain.java +++ b/app/src/main/java/org/dystopia/email/ActivityMain.java @@ -41,11 +41,6 @@ public class ActivityMain extends AppCompatActivity implements FragmentManager.O SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.registerOnSharedPreferenceChangeListener(this); - if (!Helper.isPlayStoreInstall(this)) { - Log.i(Helper.TAG, "Third party install"); - prefs.edit().putBoolean("play_store", false).apply(); - } - if (prefs.getBoolean("eula", false)) { super.onCreate(savedInstanceState); DB.getInstance(this).account().liveAccounts(true).observe(this, new Observer>() { diff --git a/app/src/main/java/org/dystopia/email/ActivityView.java b/app/src/main/java/org/dystopia/email/ActivityView.java index 04c56f44..db18e119 100644 --- a/app/src/main/java/org/dystopia/email/ActivityView.java +++ b/app/src/main/java/org/dystopia/email/ActivityView.java @@ -178,15 +178,9 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack case R.string.menu_about: onMenuAbout(); break; - case R.string.menu_rate: - onMenuRate(); - break; case R.string.menu_invite: onMenuInvite(); break; - case R.string.menu_other: - onMenuOtherApps(); - break; } drawerLayout.closeDrawer(drawerList); @@ -241,12 +235,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack if (getIntentInvite().resolveActivity(getPackageManager()) != null) drawerArray.add(new DrawerItem(ActivityView.this, R.layout.item_drawer, R.drawable.baseline_people_24, R.string.menu_invite)); - if (getIntentRate().resolveActivity(getPackageManager()) != null) - drawerArray.add(new DrawerItem(ActivityView.this, R.layout.item_drawer, R.drawable.baseline_star_24, R.string.menu_rate)); - - if (getIntentOtherApps().resolveActivity(getPackageManager()) != null) - drawerArray.add(new DrawerItem(ActivityView.this, R.layout.item_drawer, R.drawable.baseline_get_app_24, R.string.menu_other)); - drawerList.setAdapter(drawerArray); } }); @@ -268,8 +256,8 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack checkFirst(); checkCrash(); - if (!Helper.isPlayStoreInstall(this)) - checkUpdate(); + // TODO: check update from menu + // checkUpdate(); pgpService = new OpenPgpServiceConnection(this, "org.sufficientlysecure.keychain"); pgpService.bindToService(); @@ -636,13 +624,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack return intent; } - private Intent getIntentRate() { - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + BuildConfig.APPLICATION_ID)); - if (intent.resolveActivity(getPackageManager()) == null) - intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID)); - return intent; - } - private Intent getIntentInvite() { Intent intent = new Intent("com.google.android.gms.appinvite.ACTION_APP_INVITE"); intent.setPackage("com.google.android.gms"); @@ -653,12 +634,6 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack return intent; } - private Intent getIntentOtherApps() { - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setData(Uri.parse("https://play.google.com/store/apps/dev?id=8420080860664580239")); - return intent; - } - private void onMenuFolders(long account) { getSupportFragmentManager().popBackStack("unified", 0); @@ -709,37 +684,10 @@ public class ActivityView extends ActivityBase implements FragmentManager.OnBack fragmentTransaction.commit(); } - private void onMenuRate() { - Intent faq = getIntentFAQ(); - if (faq.resolveActivity(getPackageManager()) == null) - Helper.view(this, getIntentRate()); - else { - new DialogBuilderLifecycle(this, this) - .setMessage(R.string.title_issue) - .setPositiveButton(R.string.title_yes, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Helper.view(ActivityView.this, getIntentFAQ()); - } - }) - .setNegativeButton(R.string.title_no, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Helper.view(ActivityView.this, getIntentRate()); - } - }) - .show(); - } - } - private void onMenuInvite() { startActivityForResult(getIntentInvite(), REQUEST_INVITE); } - private void onMenuOtherApps() { - Helper.view(this, getIntentOtherApps()); - } - private class DrawerItem { private int layout; private int id; diff --git a/app/src/main/java/org/dystopia/email/ApplicationEx.java b/app/src/main/java/org/dystopia/email/ApplicationEx.java index 938b01fc..066e8f73 100644 --- a/app/src/main/java/org/dystopia/email/ApplicationEx.java +++ b/app/src/main/java/org/dystopia/email/ApplicationEx.java @@ -88,9 +88,6 @@ public class ApplicationEx extends Application { } public boolean ownFault(Throwable ex) { - //if (!Helper.isPlayStoreInstall(this)) - // return true; - if (ex instanceof OutOfMemoryError) return false; diff --git a/app/src/main/java/org/dystopia/email/Helper.java b/app/src/main/java/org/dystopia/email/Helper.java index 1879da94..27b3d2ed 100644 --- a/app/src/main/java/org/dystopia/email/Helper.java +++ b/app/src/main/java/org/dystopia/email/Helper.java @@ -185,7 +185,7 @@ public class Helper { } static Address myAddress() throws UnsupportedEncodingException { - return new InternetAddress("marcel+fairemail@faircode.eu", "FairCode"); + return new InternetAddress("distopico@riseup.net", "Distopico"); } static String canonicalAddress(String address) { @@ -258,17 +258,6 @@ public class Helper { return null; } - static boolean isPlayStoreInstall(Context context) { - if (false && BuildConfig.DEBUG) - return true; - try { - return "com.android.vending".equals(context.getPackageManager().getInstallerPackageName(context.getPackageName())); - } catch (Throwable ex) { - Log.e(TAG, Log.getStackTraceString(ex)); - return false; - } - } - static String sha256(String data) throws NoSuchAlgorithmException { return sha256(data.getBytes()); } @@ -281,57 +270,6 @@ public class Helper { return sb.toString(); } - static String getBillingResponseText(@BillingClient.BillingResponse int responseCode) { - switch (responseCode) { - case BillingClient.BillingResponse.BILLING_UNAVAILABLE: - // Billing API version is not supported for the type requested - return "BILLING_UNAVAILABLE"; - - case BillingClient.BillingResponse.DEVELOPER_ERROR: - // Invalid arguments provided to the API. - return "DEVELOPER_ERROR"; - - case BillingClient.BillingResponse.ERROR: - // Fatal error during the API action - return "ERROR"; - - case BillingClient.BillingResponse.FEATURE_NOT_SUPPORTED: - // Requested feature is not supported by Play Store on the current device. - return "FEATURE_NOT_SUPPORTED"; - - case BillingClient.BillingResponse.ITEM_ALREADY_OWNED: - // Failure to purchase since item is already owned - return "ITEM_ALREADY_OWNED"; - - case BillingClient.BillingResponse.ITEM_NOT_OWNED: - // Failure to consume since item is not owned - return "ITEM_NOT_OWNED"; - - case BillingClient.BillingResponse.ITEM_UNAVAILABLE: - // Requested product is not available for purchase - return "ITEM_UNAVAILABLE"; - - case BillingClient.BillingResponse.OK: - // Success - return "OK"; - - case BillingClient.BillingResponse.SERVICE_DISCONNECTED: - // Play Store service is not connected now - potentially transient state. - return "SERVICE_DISCONNECTED"; - - case BillingClient.BillingResponse.SERVICE_UNAVAILABLE: - // Network connection is down - return "SERVICE_UNAVAILABLE"; - - case BillingClient.BillingResponse.USER_CANCELED: - // User pressed back or canceled a dialog - return "USER_CANCELED"; - - default: - return Integer.toString(responseCode); - } - } - public static String getFingerprint(Context context) { try { PackageManager pm = context.getPackageManager(); @@ -356,12 +294,6 @@ public class Helper { return (signed != null && signed.equals(expected)); } - static boolean isPro(Context context) { - if (false && BuildConfig.DEBUG) - return true; - return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("pro", false); - } - static long[] toLongArray(List list) { long[] result = new long[list.size()]; for (int i = 0; i < list.size(); i++) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 491363b4..0ae60351 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -39,7 +39,6 @@ Operations Legend FAQ/support - Pro features Privacy About Invite