Prompt user for debug logs with slow notifications.

This commit is contained in:
Clark
2023-08-09 12:18:25 -04:00
committed by Alex Hart
parent b51ec53e33
commit bb83ddfe28
11 changed files with 372 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ import org.thoughtcrime.securesms.groups.SelectionLimits;
import org.thoughtcrime.securesms.jobs.RemoteConfigRefreshJob;
import org.thoughtcrime.securesms.keyvalue.SignalStore;
import org.thoughtcrime.securesms.messageprocessingalarm.MessageProcessReceiver;
import org.thoughtcrime.securesms.notifications.Configuration;
import org.whispersystems.signalservice.api.RemoteConfigResult;
import java.io.IOException;
@@ -109,6 +110,8 @@ public final class FeatureFlags {
private static final String CDS_DISABLE_COMPAT_MODE = "cds.disableCompatibilityMode";
private static final String FCM_MAY_HAVE_MESSAGES_KILL_SWITCH = "android.fcmNotificationFallbackKillSwitch";
private static final String SAFETY_NUMBER_ACI = "global.safetyNumberAci";
public static final String PROMPT_FOR_NOTIFICATION_LOGS = "android.logs.promptNotifications";
private static final String PROMPT_FOR_NOTIFICATION_CONFIG = "android.logs.promptNotificationsConfig";
/**
* We will only store remote values for flags in this set. If you want a flag to be controllable
@@ -169,7 +172,9 @@ public final class FeatureFlags {
SVR2_KILLSWITCH,
CDS_DISABLE_COMPAT_MODE,
SAFETY_NUMBER_ACI,
FCM_MAY_HAVE_MESSAGES_KILL_SWITCH
FCM_MAY_HAVE_MESSAGES_KILL_SWITCH,
PROMPT_FOR_NOTIFICATION_LOGS,
PROMPT_FOR_NOTIFICATION_CONFIG
);
@VisibleForTesting
@@ -236,7 +241,9 @@ public final class FeatureFlags {
SVR2_KILLSWITCH,
CDS_DISABLE_COMPAT_MODE,
SAFETY_NUMBER_ACI,
FCM_MAY_HAVE_MESSAGES_KILL_SWITCH
FCM_MAY_HAVE_MESSAGES_KILL_SWITCH,
PROMPT_FOR_NOTIFICATION_LOGS,
PROMPT_FOR_NOTIFICATION_CONFIG
);
/**
@@ -618,6 +625,13 @@ public final class FeatureFlags {
}
}
public static String promptForDelayedNotificationLogs() {
return getString(PROMPT_FOR_NOTIFICATION_LOGS, "*");
}
public static String delayedNotificationsPromptConfig() {
return getString(PROMPT_FOR_NOTIFICATION_CONFIG, "");
}
/** Only for rendering debug info. */
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
return new TreeMap<>(REMOTE_VALUES);

View File

@@ -65,6 +65,9 @@ public final class LocaleFeatureFlags {
return isEnabled(FeatureFlags.PAYPAL_DISABLED_REGIONS, FeatureFlags.paypalDisabledRegions());
}
public static boolean isDelayedNotificationPromptEnabled() {
return isEnabled(FeatureFlags.PROMPT_FOR_NOTIFICATION_LOGS, FeatureFlags.promptForDelayedNotificationLogs());
}
/**
* Parses a comma-separated list of country codes colon-separated from how many buckets out of 1 million
* should be enabled to see this megaphone in that country code. At the end of the list, an optional

View File

@@ -33,6 +33,11 @@ public final class NetworkUtil {
return info != null && info.isConnected() && info.isRoaming() && info.getType() == ConnectivityManager.TYPE_MOBILE;
}
public static boolean isConnected(@NonNull Context context) {
final NetworkInfo info = getNetworkInfo(context);
return info != null && info.isConnected();
}
public static @NonNull CallManager.DataMode getCallingDataMode(@NonNull Context context) {
return getCallingDataMode(context, PeerConnection.AdapterType.UNKNOWN);
}