mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-24 19:00:26 +01:00
Don't show the full-screen PIN megaphone.
This commit is contained in:
@@ -77,7 +77,7 @@ public class BasicMegaphoneView extends FrameLayout {
|
||||
bodyText.setVisibility(GONE);
|
||||
}
|
||||
|
||||
if (megaphone.getButtonText() != 0) {
|
||||
if (megaphone.hasButton()) {
|
||||
actionButton.setVisibility(VISIBLE);
|
||||
actionButton.setText(megaphone.getButtonText());
|
||||
actionButton.setOnClickListener(v -> {
|
||||
@@ -99,7 +99,7 @@ public class BasicMegaphoneView extends FrameLayout {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
actionButton.setVisibility(GONE);
|
||||
snoozeButton.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,10 @@ public class Megaphone {
|
||||
return buttonTextRes;
|
||||
}
|
||||
|
||||
public boolean hasButton() {
|
||||
return buttonTextRes != 0;
|
||||
}
|
||||
|
||||
public @Nullable EventListener getButtonClickListener() {
|
||||
return buttonListener;
|
||||
}
|
||||
|
||||
@@ -115,13 +115,9 @@ public final class Megaphones {
|
||||
long daysRemaining = PinsForAllSchedule.getDaysRemaining(record.getFirstVisible(), System.currentTimeMillis());
|
||||
|
||||
if (PinUtil.userHasPin(ApplicationDependencies.getApplication())) {
|
||||
return buildPinsForAllMegaphoneForUserWithPin(
|
||||
builder.enableSnooze((megaphone, listener) -> listener.onMegaphoneToastRequested(context.getString(R.string.KbsMegaphone__well_remind_you_later_confirming_your_pin, daysRemaining)))
|
||||
);
|
||||
return buildPinsForAllMegaphoneForUserWithPin(builder.enableSnooze(null));
|
||||
} else {
|
||||
return buildPinsForAllMegaphoneForUserWithoutPin(
|
||||
builder.enableSnooze((megaphone, listener) -> listener.onMegaphoneToastRequested(context.getString(R.string.KbsMegaphone__well_remind_you_later_creating_a_pin, daysRemaining)))
|
||||
);
|
||||
return buildPinsForAllMegaphoneForUserWithoutPin(builder.enableSnooze(null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package org.thoughtcrime.securesms.megaphone;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
import org.thoughtcrime.securesms.push.SignalServiceNetworkAccess;
|
||||
import org.thoughtcrime.securesms.util.CensorshipUtil;
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
@@ -21,15 +25,17 @@ class PinsForAllSchedule implements MegaphoneSchedule {
|
||||
private final MegaphoneSchedule schedule = new RecurringSchedule(TimeUnit.DAYS.toMillis(2));
|
||||
|
||||
static boolean shouldDisplayFullScreen(long firstVisible, long currentTime) {
|
||||
if (pinCreationFailedDuringRegistration()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (firstVisible == 0L) {
|
||||
return false;
|
||||
} else {
|
||||
return currentTime - firstVisible >= TimeUnit.DAYS.toMillis(DAYS_UNTIL_FULLSCREEN);
|
||||
}
|
||||
return false;
|
||||
// TODO [greyson]
|
||||
// if (pinCreationFailedDuringRegistration()) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// if (firstVisible == 0L) {
|
||||
// return false;
|
||||
// } else {
|
||||
// return currentTime - firstVisible >= TimeUnit.DAYS.toMillis(DAYS_UNTIL_FULLSCREEN);
|
||||
// }
|
||||
}
|
||||
|
||||
static long getDaysRemaining(long firstVisible, long currentTime) {
|
||||
@@ -52,6 +58,10 @@ class PinsForAllSchedule implements MegaphoneSchedule {
|
||||
}
|
||||
|
||||
private static boolean isEnabled() {
|
||||
if (CensorshipUtil.isCensored(ApplicationDependencies.getApplication())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (FeatureFlags.pinsForAllMegaphoneKillSwitch()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user