Skip to content

Commit

Permalink
Update profile name megaphone.
Browse files Browse the repository at this point in the history
  • Loading branch information
greyson-signal committed Feb 14, 2020
1 parent 5aa6464 commit f79d308
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,20 +199,21 @@ public void onReminderCompleted(boolean includedFailure) {
.enableSnooze(null)
.setImage(R.drawable.profile_megaphone);

Megaphone.EventListener eventListener = (megaphone, listener) -> {
listener.onMegaphoneSnooze(Event.PROFILE_NAMES_FOR_ALL);
listener.onMegaphoneNavigationRequested(new Intent(context, EditProfileActivity.class));
};

if (TextSecurePreferences.getProfileName(ApplicationDependencies.getApplication()) == ProfileName.EMPTY) {
return builder.setTitle(R.string.ProfileNamesMegaphone__add_a_profile_name)
.setBody(R.string.ProfileNamesMegaphone__this_will_be_displayed_when_you_start)
.setActionButton(R.string.ProfileNamesMegaphone__add_profile_name, eventListener)
.setActionButton(R.string.ProfileNamesMegaphone__add_profile_name, (megaphone, listener) -> {
listener.onMegaphoneSnooze(Event.PROFILE_NAMES_FOR_ALL);
listener.onMegaphoneNavigationRequested(new Intent(context, EditProfileActivity.class));
})
.build();
} else {
return builder.setTitle(R.string.ProfileNamesMegaphone__confirm_your_profile_name)
.setBody(R.string.ProfileNamesMegaphone__your_profile_can_now_include)
.setActionButton(R.string.ProfileNamesMegaphone__confirm_name, eventListener)
.setActionButton(R.string.ProfileNamesMegaphone__confirm_name, (megaphone, listener) -> {
listener.onMegaphoneCompleted(Event.PROFILE_NAMES_FOR_ALL);
listener.onMegaphoneNavigationRequested(new Intent(context, EditProfileActivity.class));
})
.build();
}
}
Expand Down
22 changes: 11 additions & 11 deletions app/src/main/java/org/thoughtcrime/securesms/util/FeatureFlags.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ public final class FeatureFlags {
private static final String PREFIX = "android.";
private static final long FETCH_INTERVAL = TimeUnit.HOURS.toMillis(2);

private static final String UUIDS = generateKey("uuids");
private static final String PROFILE_DISPLAY = generateKey("profileDisplay");
private static final String MESSAGE_REQUESTS = generateKey("messageRequests");
private static final String USERNAMES = generateKey("usernames");
private static final String STORAGE_SERVICE = generateKey("storageService");
private static final String PINS_FOR_ALL = generateKey("pinsForAll");
private static final String PINS_MEGAPHONE_KILL_SWITCH = generateKey("pinsMegaphoneKillSwitch");
private static final String PROFILE_NAMES_MEGAPHONE_ENABLED = generateKey("profileNamesMegaphoneEnabled");
private static final String VIDEO_TRIMMING = generateKey("videoTrimming");
private static final String UUIDS = generateKey("uuids");
private static final String PROFILE_DISPLAY = generateKey("profileDisplay");
private static final String MESSAGE_REQUESTS = generateKey("messageRequests");
private static final String USERNAMES = generateKey("usernames");
private static final String STORAGE_SERVICE = generateKey("storageService");
private static final String PINS_FOR_ALL = generateKey("pinsForAll");
private static final String PINS_MEGAPHONE_KILL_SWITCH = generateKey("pinsMegaphoneKillSwitch");
private static final String PROFILE_NAMES_MEGAPHONE = generateKey("profileNamesMegaphone");
private static final String VIDEO_TRIMMING = generateKey("videoTrimming");

/**
* We will only store remote values for flags in this set. If you want a flag to be controllable
Expand All @@ -65,7 +65,7 @@ public final class FeatureFlags {
VIDEO_TRIMMING,
PINS_FOR_ALL,
PINS_MEGAPHONE_KILL_SWITCH,
PROFILE_NAMES_MEGAPHONE_ENABLED
PROFILE_NAMES_MEGAPHONE
);

/**
Expand Down Expand Up @@ -173,7 +173,7 @@ public static boolean pinsForAllMegaphoneKillSwitch() {

/** Safety switch for disabling profile names megaphone */
public static boolean profileNamesMegaphoneEnabled() {
return getValue(PROFILE_NAMES_MEGAPHONE_ENABLED, false) &&
return getValue(PROFILE_NAMES_MEGAPHONE, false) &&
TextSecurePreferences.getFirstInstallVersion(ApplicationDependencies.getApplication()) < 600;
}

Expand Down

0 comments on commit f79d308

Please sign in to comment.