Review GitHub release

pull/198/head
M66B 3 years ago
parent 476667ee3a
commit 54985562f1

@ -83,6 +83,8 @@
<action android:name="android.provider.MediaStore.RECORD_SOUND" />
</intent>
<package android:name="com.android.vending" />
<package android:name="org.sufficientlysecure.keychain" />
<package android:name="org.sufficientlysecure.keychain.debug" />

@ -4009,7 +4009,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (viewType != AdapterMessage.ViewType.UNIFIED)
return false;
if (!Helper.isPlayStoreInstall() && !BuildConfig.DEBUG)
if (!Helper.isPlayStoreInstall() &&
!(Helper.hasPlayStore(getContext()) &&
(Helper.hasValidFingerprint(getContext()) || BuildConfig.DEBUG)))
return false;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());

@ -143,6 +143,9 @@ import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
import static androidx.browser.customtabs.CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION;
public class Helper {
private static Boolean hasPlayStore = null;
private static Boolean hasValidFingerprint = null;
static final int NOTIFICATION_SYNCHRONIZE = 1;
static final int NOTIFICATION_SEND = 2;
static final int NOTIFICATION_EXTERNAL = 3;
@ -468,6 +471,19 @@ public class Helper {
return BuildConfig.PLAY_STORE_RELEASE;
}
static boolean hasPlayStore(Context context) {
if (hasPlayStore == null)
try {
PackageManager pm = context.getPackageManager();
pm.getPackageInfo("com.android.vending", 0);
hasPlayStore = true;
} catch (Throwable ex) {
Log.w(ex);
hasPlayStore = false;
}
return hasPlayStore;
}
static boolean isSecure(Context context) {
try {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
@ -1427,9 +1443,12 @@ public class Helper {
}
static boolean hasValidFingerprint(Context context) {
String signed = getFingerprint(context);
String expected = context.getString(R.string.fingerprint);
return Objects.equals(signed, expected);
if (hasValidFingerprint == null) {
String signed = getFingerprint(context);
String expected = context.getString(R.string.fingerprint);
hasValidFingerprint = Objects.equals(signed, expected);
}
return hasValidFingerprint;
}
static boolean canAuthenticate(Context context) {

@ -1501,13 +1501,14 @@ public class Log {
// Get version info
String installer = context.getPackageManager().getInstallerPackageName(BuildConfig.APPLICATION_ID);
sb.append(String.format("%s: %s/%s %s/%s%s%s%s\r\n",
sb.append(String.format("%s: %s/%s %s/%s%s%s%s%s\r\n",
context.getString(R.string.app_name),
BuildConfig.APPLICATION_ID,
installer,
BuildConfig.VERSION_NAME,
Helper.hasValidFingerprint(context) ? "1" : "3",
BuildConfig.PLAY_STORE_RELEASE ? "p" : "",
Helper.hasPlayStore(context) ? "s" : "",
BuildConfig.DEBUG ? "d" : "",
ActivityBilling.isPro(context) ? "+" : ""));
sb.append(String.format("Android: %s (SDK %d)\r\n", Build.VERSION.RELEASE, Build.VERSION.SDK_INT));

Loading…
Cancel
Save