mirror of
https://codeberg.org/monocles/monocles_chat.git
synced 2025-02-23 12:23:02 +01:00
fix orbot detection (iNPUTmice)
This commit is contained in:
parent
b0c220040b
commit
ad107601de
2 changed files with 21 additions and 16 deletions
src/main
|
@ -61,12 +61,14 @@
|
|||
<action android:name="android.intent.action.GET_CONTENT" />
|
||||
</intent>
|
||||
<!-- OpenKeyChain -->
|
||||
<package android:name="org.sufficientlysecure.keychain"/>
|
||||
<package android:name="org.sufficientlysecure.keychain" />
|
||||
<package android:name="org.torproject.android" />
|
||||
|
||||
<intent>
|
||||
<action android:name="eu.siacs.conversations.location.request"/>
|
||||
<action android:name="eu.siacs.conversations.location.request" />
|
||||
</intent>
|
||||
<intent>
|
||||
<action android:name="eu.siacs.conversations.location.show"/>
|
||||
<action android:name="eu.siacs.conversations.location.show" />
|
||||
</intent>
|
||||
</queries>
|
||||
|
||||
|
@ -74,15 +76,15 @@
|
|||
<application
|
||||
android:name="androidx.multidex.MultiDexApplication"
|
||||
android:allowBackup="true"
|
||||
android:fullBackupContent="@xml/backup_content"
|
||||
android:appCategory="social"
|
||||
android:fullBackupContent="@xml/backup_content"
|
||||
android:hardwareAccelerated="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:largeHeap="true"
|
||||
android:networkSecurityConfig="@xml/network_security_configuration"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:preserveLegacyExternalStorage="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/ConversationsTheme"
|
||||
tools:ignore="GoogleAppIndexingWarning"
|
||||
|
|
|
@ -6,27 +6,28 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.widget.Toast;
|
||||
|
||||
import eu.siacs.conversations.R;
|
||||
import me.drakeet.support.toast.ToastCompat;
|
||||
|
||||
public class TorServiceUtils {
|
||||
|
||||
private final static String URI_ORBOT = "org.torproject.android";
|
||||
private static final String URI_ORBOT = "org.torproject.android";
|
||||
private static final Uri ORBOT_PLAYSTORE_URI = Uri.parse("market://details?id=" + URI_ORBOT);
|
||||
private final static String ACTION_START_TOR = "org.torproject.android.START_TOR";
|
||||
private static final String ACTION_START_TOR = "org.torproject.android.START_TOR";
|
||||
|
||||
public static final Intent INSTALL_INTENT = new Intent(Intent.ACTION_VIEW, ORBOT_PLAYSTORE_URI);
|
||||
public static final Intent LAUNCH_INTENT = new Intent(ACTION_START_TOR);
|
||||
|
||||
public final static String ACTION_STATUS = "org.torproject.android.intent.action.STATUS";
|
||||
public final static String EXTRA_STATUS = "org.torproject.android.intent.extra.STATUS";
|
||||
public static final String ACTION_STATUS = "org.torproject.android.intent.action.STATUS";
|
||||
public static final String EXTRA_STATUS = "org.torproject.android.intent.extra.STATUS";
|
||||
|
||||
public static boolean isOrbotInstalled(Context context) {
|
||||
public static boolean isOrbotInstalled(final Context context) {
|
||||
try {
|
||||
context.getPackageManager().getPackageInfo(URI_ORBOT, PackageManager.GET_ACTIVITIES);
|
||||
return true;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
} catch (final PackageManager.NameNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -35,16 +36,18 @@ public class TorServiceUtils {
|
|||
public static void downloadOrbot(Activity activity, int requestCode) {
|
||||
try {
|
||||
activity.startActivityForResult(INSTALL_INTENT, requestCode);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
ToastCompat.makeText(activity, R.string.no_market_app_installed, ToastCompat.LENGTH_SHORT).show();
|
||||
} catch (final ActivityNotFoundException e) {
|
||||
ToastCompat.makeText(
|
||||
activity, R.string.no_market_app_installed, ToastCompat.LENGTH_SHORT)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
public static void startOrbot(Activity activity, int requestCode) {
|
||||
public static void startOrbot(final Activity activity, final int requestCode) {
|
||||
try {
|
||||
activity.startActivityForResult(LAUNCH_INTENT, requestCode);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
ToastCompat.makeText(activity, R.string.orbot_not_found, ToastCompat.LENGTH_SHORT).show();
|
||||
} catch (final ActivityNotFoundException e) {
|
||||
Toast.makeText(activity, R.string.install_orbot, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue