Remove old donate megaphone and replace with sustainer megaphone.

fork-5.53.8
Alex Hart 2021-11-18 14:02:55 -04:00 zatwierdzone przez GitHub
rodzic 843ed24bbb
commit 686219d473
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 9 dodań i 51 usunięć

Wyświetl plik

@ -13,6 +13,7 @@ import com.annimon.stream.Stream;
import org.signal.core.util.TranslationDetection;
import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.badges.models.Badge;
import org.thoughtcrime.securesms.components.settings.app.AppSettingsActivity;
import org.thoughtcrime.securesms.conversationlist.ConversationListFragment;
import org.thoughtcrime.securesms.database.model.MegaphoneRecord;
@ -102,13 +103,12 @@ public final class Megaphones {
put(Event.LINK_PREVIEWS, shouldShowLinkPreviewsMegaphone(context) ? ALWAYS : NEVER);
put(Event.CLIENT_DEPRECATED, SignalStore.misc().isClientDeprecated() ? ALWAYS : NEVER);
put(Event.RESEARCH, shouldShowResearchMegaphone(context) ? ShowForDurationSchedule.showForDays(7) : NEVER);
put(Event.DONATE, shouldShowDonateMegaphone(context) ? ShowForDurationSchedule.showForDays(7) : NEVER);
put(Event.GROUP_CALLING, shouldShowGroupCallingMegaphone() ? ALWAYS : NEVER);
put(Event.ONBOARDING, shouldShowOnboardingMegaphone(context) ? ALWAYS : NEVER);
put(Event.NOTIFICATIONS, shouldShowNotificationsMegaphone(context) ? RecurringSchedule.every(TimeUnit.DAYS.toMillis(30)) : NEVER);
put(Event.CHAT_COLORS, ALWAYS);
put(Event.ADD_A_PROFILE_PHOTO, shouldShowAddAProfilePhotoMegaphone(context) ? ALWAYS : NEVER);
put(Event.BECOME_A_SUSTAINER, shouldShowBecomeASustainerMegaphone() ? ALWAYS : NEVER);
put(Event.BECOME_A_SUSTAINER, shouldShowDonateMegaphone(context) ? ShowForDurationSchedule.showForDays(7) : NEVER);
}};
}
@ -128,8 +128,6 @@ public final class Megaphones {
return buildClientDeprecatedMegaphone(context);
case RESEARCH:
return buildResearchMegaphone(context);
case DONATE:
return buildDonateMegaphone(context);
case GROUP_CALLING:
return buildGroupCallingMegaphone(context);
case ONBOARDING:
@ -253,21 +251,6 @@ public final class Megaphones {
.build();
}
private static @NonNull Megaphone buildDonateMegaphone(@NonNull Context context) {
return new Megaphone.Builder(Event.DONATE, Megaphone.Style.BASIC)
.disableSnooze()
.setTitle(R.string.DonateMegaphone_donate_to_signal)
.setBody(R.string.DonateMegaphone_Signal_is_powered_by_people_like_you_show_your_support_today)
.setImage(R.drawable.ic_donate_megaphone)
.setActionButton(R.string.DonateMegaphone_donate, (megaphone, controller) -> {
controller.onMegaphoneCompleted(megaphone.getEvent());
CommunicationActions.openBrowserLink(controller.getMegaphoneActivity(), context.getString(R.string.donate_url));
})
.setSecondaryButton(R.string.DonateMegaphone_no_thanks, (megaphone, controller) -> controller.onMegaphoneCompleted(megaphone.getEvent()))
.setPriority(Megaphone.Priority.DEFAULT)
.build();
}
private static @NonNull Megaphone buildGroupCallingMegaphone(@NonNull Context context) {
return new Megaphone.Builder(Event.GROUP_CALLING, Megaphone.Style.BASIC)
.disableSnooze()
@ -368,7 +351,12 @@ public final class Megaphones {
}
private static boolean shouldShowDonateMegaphone(@NonNull Context context) {
return VersionTracker.getDaysSinceFirstInstalled(context) > 7 && LocaleFeatureFlags.isInDonateMegaphone();
return VersionTracker.getDaysSinceFirstInstalled(context) > 7 && LocaleFeatureFlags.isInDonateMegaphone() &&
Recipient.self()
.getBadges()
.stream()
.filter(Objects::nonNull)
.noneMatch(badge -> badge.getCategory() == Badge.Category.Donor);
}
private static boolean shouldShowLinkPreviewsMegaphone(@NonNull Context context) {
@ -383,10 +371,6 @@ public final class Megaphones {
return SignalStore.onboarding().hasOnboarding(context);
}
private static boolean shouldShowBecomeASustainerMegaphone() {
return FeatureFlags.donorBadgesMegaphone();
}
private static boolean shouldShowNotificationsMegaphone(@NonNull Context context) {
boolean shouldShow = !SignalStore.settings().isMessageNotificationsEnabled() ||
!NotificationChannels.isMessageChannelEnabled(context) ||
@ -428,7 +412,6 @@ public final class Megaphones {
LINK_PREVIEWS("link_previews"),
CLIENT_DEPRECATED("client_deprecated"),
RESEARCH("research"),
DONATE("donate"),
GROUP_CALLING("group_calling"),
ONBOARDING("onboarding"),
NOTIFICATIONS("notifications"),

Wyświetl plik

@ -61,7 +61,7 @@ public final class FeatureFlags {
private static final String VERIFY_V2 = "android.verifyV2";
private static final String PHONE_NUMBER_PRIVACY_VERSION = "android.phoneNumberPrivacyVersion";
private static final String CLIENT_EXPIRATION = "android.clientExpiration";
public static final String DONATE_MEGAPHONE = "android.donate";
public static final String DONATE_MEGAPHONE = "android.donate.2";
private static final String CUSTOM_VIDEO_MUXER = "android.customVideoMuxer";
private static final String CDS_REFRESH_INTERVAL = "cds.syncInterval.seconds";
private static final String AUTOMATIC_SESSION_RESET = "android.automaticSessionReset.2";
@ -85,7 +85,6 @@ public final class FeatureFlags {
private static final String GROUP_CALL_RINGING = "android.calling.groupCallRinging";
private static final String CHANGE_NUMBER_ENABLED = "android.changeNumber";
private static final String DONOR_BADGES = "android.donorBadges.6";
private static final String DONOR_BADGES_MEGAPHONE = "android.donorBadges.megaphone.3";
private static final String DONOR_BADGES_DISPLAY = "android.donorBadges.display.4";
private static final String CDSH = "android.cdsh";
@ -127,7 +126,6 @@ public final class FeatureFlags {
CDSH,
SENDER_KEY_MAX_AGE,
DONOR_BADGES,
DONOR_BADGES_MEGAPHONE,
DONOR_BADGES_DISPLAY
);
@ -419,10 +417,6 @@ public final class FeatureFlags {
}
}
public static boolean donorBadgesMegaphone() {
return getBoolean(DONOR_BADGES_MEGAPHONE, false);
}
/**
* Whether or not donor badges should be displayed throughout the app.
*/

Wyświetl plik

@ -1,12 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="64"
android:viewportHeight="64">
<path
android:pathData="M32,0L32,0A32,32 0,0 1,64 32L64,32A32,32 0,0 1,32 64L32,64A32,32 0,0 1,0 32L0,32A32,32 0,0 1,32 0z"
android:fillColor="#F9F9F9"/>
<path
android:pathData="M22.1523,45.341C20.9919,44.105 19.8347,42.7715 18.7433,41.3631L20.2926,40.241C21.3746,41.6331 22.4879,42.9211 23.5762,44.0595L23.6263,44.1115L22.1523,45.341ZM28.5502,48.8017C27.4117,47.8259 26.1479,46.655 24.8526,45.3605L23.4852,46.7038C24.7805,48.0048 26.0506,49.1725 27.1953,50.1742L28.5502,48.8017ZM40.5085,46.7363L39.1411,45.393C37.8427,46.694 36.5757,47.8487 35.4404,48.8342L36.7953,50.2035C37.9274,49.205 39.1944,48.0406 40.496,46.7363H40.5085ZM19.2764,38.8652C18.2917,37.5112 17.4078,36.0814 16.6326,34.5881L14.9579,35.4923C15.7412,37.0154 16.6333,38.4755 17.6268,39.8604L19.2764,38.8652ZM12.5556,26.0599L14.4373,26.0827C14.5018,24.337 15.001,22.6383 15.8862,21.1519L14.2961,20.1533C13.2281,21.9306 12.628,23.9671 12.5556,26.0599ZM47.3454,34.6271C46.5727,36.1187 45.692,37.5474 44.711,38.9009L46.345,39.8962C47.339,38.5115 48.2332,37.0526 49.0202,35.5313L47.3454,34.6271ZM15.8956,33.0009C15.1768,31.3724 14.708,29.6373 14.5063,27.8586L12.6246,27.9854C12.8372,29.9852 13.3548,31.9372 14.1582,33.7685L15.8956,33.0009ZM43.6792,40.2735C42.6066,41.6493 41.4839,42.9243 40.4238,44.053L40.3392,44.1408L41.8163,45.367C42.9767,44.1343 44.1371,42.8007 45.2285,41.3924L43.6792,40.2735ZM16.8772,19.7826C17.9591,18.5078 19.324,17.5255 20.8539,16.9203L20.2643,15.0794C18.3752,15.8248 16.6956,17.0479 15.3781,18.6377L16.8772,19.7826ZM22.4377,16.4585C22.9547,16.3564 23.4796,16.3041 24.0058,16.3023C25.1357,16.2823 26.26,16.4695 27.3271,16.8553L28.1111,15.0729C26.7963,14.5715 25.4034,14.3267 24.0027,14.3508C23.3403,14.3531 22.6797,14.4217 22.03,14.5557L22.4377,16.4585ZM49.4906,27.8944C49.2836,29.6767 48.8106,31.4148 48.0887,33.0464L49.8262,33.8075C50.6319,31.9719 51.1526,30.0157 51.3692,28.0115L49.4906,27.8944ZM34.1232,49.9466C33.2764,50.6458 32.5551,51.2183 32.0094,51.6314C31.4606,51.2118 30.7204,50.6296 29.858,49.9173L28.6223,51.3939C30.6295,53.056 32,54.0317 32,54.0317C32,54.0317 33.3548,53.0787 35.3526,51.4297L34.1232,49.9466ZM28.8168,17.6034C29.5097,18.0438 30.1654,18.5443 30.7769,19.0995L32,20.1729L33.2231,19.0865C33.8295,18.5513 34.4898,18.0857 35.1927,17.6977L34.2518,16.0096C33.4498,16.4582 32.6951,16.9924 32,17.6034C31.3032,16.9692 30.5539,16.4 29.7608,15.9023L28.8168,17.6034ZM48.2612,21.0836C49.0835,22.6283 49.5302,24.3576 49.5627,26.1217L51.4445,26.099C51.4084,23.9836 50.8698,21.9102 49.8764,20.0623L48.2612,21.0836ZM36.7043,16.9919C37.7807,16.5599 38.9217,16.3265 40.0757,16.3023C40.5679,16.3018 41.0594,16.3377 41.5466,16.4097L41.9574,14.5004C41.3348,14.4009 40.7057,14.3509 40.0757,14.3508C38.6464,14.3755 37.2331,14.6687 35.9046,15.216L36.7043,16.9919ZM43.1774,16.7935C44.5502,17.2395 45.7998,18.0202 46.8217,19.0703C46.9973,19.2556 47.1604,19.4475 47.3203,19.6427L48.8445,18.4881C47.5141,16.8215 45.7476,15.5892 43.7576,14.9395L43.1774,16.7935ZM39.7621,18.2539C36.7043,18.2539 33.2545,20.7421 32,23.4579C30.7455,20.7421 27.2957,18.2539 24.2379,18.2539C22.129,18.2702 20.112,19.1518 18.6281,20.7061C17.1442,22.2603 16.314,24.3606 16.319,26.5478C16.319,37.5251 32,49.1529 32,49.1529C32,49.1529 47.681,37.5251 47.681,26.5478C47.686,24.3606 46.8558,22.2603 45.3719,20.7061C43.888,19.1518 41.871,18.2702 39.7621,18.2539Z"
android:fillColor="#CC163D"/>
</vector>

Wyświetl plik

@ -505,13 +505,6 @@
<!-- DocumentView -->
<string name="DocumentView_unnamed_file">Unnamed file</string>
<!-- DonateMegaphone -->
<string name="DonateMegaphone_donate_to_signal">Donate to Signal</string>
<string name="DonateMegaphone_Signal_is_powered_by_people_like_you_show_your_support_today">Signal is powered by people like you. Show your support today!</string>
<string name="DonateMegaphone_donate">Donate</string>
<string name="DonateMegaphone_no_thanks">No Thanks</string>
<!-- GroupCallingMegaphone -->
<string name="GroupCallingMegaphone__introducing_group_calls">Introducing Group Calls</string>
<string name="GroupCallingMegaphone__open_a_new_group_to_start">Open a New Group to start a free encrypted group call</string>