Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Warn user about deprecated flavor
Browse files Browse the repository at this point in the history
  • Loading branch information
p1gp1g committed Nov 22, 2024
1 parent 1f17e29 commit da7dd35
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;

Expand Down Expand Up @@ -115,6 +116,7 @@ private static Map<Event, MegaphoneSchedule> buildDisplayOrder(@NonNull Context
return new LinkedHashMap<>() {{
put(Event.PINS_FOR_ALL, new PinsForAllSchedule());
put(Event.CLIENT_DEPRECATED, SignalStore.misc().isClientDeprecated() ? ALWAYS : NEVER);
put(Event.FLAVOR_DEPRECATED, ALWAYS);
put(Event.NOTIFICATIONS, shouldShowNotificationsMegaphone(context) ? RecurringSchedule.every(TimeUnit.DAYS.toMillis(30)) : NEVER);
put(Event.GRANT_FULL_SCREEN_INTENT, shouldShowGrantFullScreenIntentPermission(context) ? RecurringSchedule.every(TimeUnit.DAYS.toMillis(3)) : NEVER);
put(Event.BACKUP_SCHEDULE_PERMISSION, shouldShowBackupSchedulePermissionMegaphone(context) ? RecurringSchedule.every(TimeUnit.DAYS.toMillis(3)) : NEVER);
Expand Down Expand Up @@ -155,6 +157,8 @@ private static boolean shouldShowLinkedDeviceInactiveMegaphone() {
return buildClientDeprecatedMegaphone(context);
case ONBOARDING:
return buildOnboardingMegaphone();
case FLAVOR_DEPRECATED:
return buildFlavorDeprecatedMegaphone(context);
case NOTIFICATIONS:
return buildNotificationsMegaphone(context);
case ADD_A_PROFILE_PHOTO:
Expand Down Expand Up @@ -274,6 +278,17 @@ public void onReminderCompleted(@NonNull String pin, boolean includedFailure) {
.build();
}

private static @NonNull Megaphone buildFlavorDeprecatedMegaphone(@NonNull Context context) {
return new Megaphone.Builder(Event.FLAVOR_DEPRECATED, Megaphone.Style.BASIC)
.setTitle(R.string.ClientDeprecatedActivity_warning)
.setBody(R.string.this_version_of_molly_is_deprecated)
.setImage(R.drawable.ic_connectivity_warning)
.setActionButton(R.string.StickerPackPreviewActivity_install, (megaphone, controller) ->
controller.onMegaphoneNavigationRequested(new Intent(Intent.ACTION_VIEW, Uri.parse(context.getString(R.string.install_url)))))
.setSecondaryButton(R.string.NotificationsMegaphone_not_now, (megaphone, controller) -> controller.onMegaphoneSnooze(Event.FLAVOR_DEPRECATED))
.build();
}

private static @NonNull Megaphone buildNotificationsMegaphone(@NonNull Context context) {
return new Megaphone.Builder(Event.NOTIFICATIONS, Megaphone.Style.BASIC)
.setTitle(R.string.NotificationsMegaphone_turn_on_notifications)
Expand Down Expand Up @@ -568,6 +583,7 @@ public enum Event {
PINS_FOR_ALL("pins_for_all"),
PIN_REMINDER("pin_reminder"),
CLIENT_DEPRECATED("client_deprecated"),
FLAVOR_DEPRECATED("flavor_deprecated"),
ONBOARDING("onboarding"),
NOTIFICATIONS("notifications"),
ADD_A_PROFILE_PHOTO("add_a_profile_photo"),
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,5 @@
<string name="NotificationMethod__label_unifiedpush">UnifiedPush</string>
<string name="NotificationMethod__label_fcm">Google Services</string>
<string name="NotificationMethod__label_websocket">WebSocket</string>
<string name="this_version_of_molly_is_deprecated">This version of Molly is deprecated: UnifiedPush support has been merged into the main app. Please do a backup of your chats and install Molly or Molly-FOSS.</string>
</resources>

0 comments on commit da7dd35

Please sign in to comment.