Show de-registration nag view.

This commit is contained in:
Matthew Chen 2018-06-15 13:39:35 -04:00
parent b0646e8bff
commit 6331fbb22a
3 changed files with 27 additions and 5 deletions

View File

@ -74,6 +74,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
// Views
@property (nonatomic) NSLayoutConstraint *hideDeregisteredViewConstraint;
@property (nonatomic) NSLayoutConstraint *hideArchiveReminderViewConstraint;
@property (nonatomic) NSLayoutConstraint *hideMissingContactsPermissionViewConstraint;
@ -193,7 +194,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
{
OWSAssertIsOnMainThread();
[self reloadTableViewData];
[self updateReminderViews];
}
#pragma mark - View Life Cycle
@ -209,12 +210,24 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
[SignalApp.sharedApp setHomeViewController:self];
}
ReminderView *deregisteredView =
[ReminderView nagWithText:NSLocalizedString(@"INBOX_VIEW_DEREGISTRATION_WARNING",
@"Label warning the user that they have been de-registered.")
tapAction:^{
// TODO:
}];
[self.view addSubview:deregisteredView];
[deregisteredView autoPinWidthToSuperview];
[deregisteredView autoPinToTopLayoutGuideOfViewController:self withInset:0];
self.hideDeregisteredViewConstraint = [deregisteredView autoSetDimension:ALDimensionHeight toSize:0];
self.hideDeregisteredViewConstraint.priority = UILayoutPriorityRequired;
ReminderView *archiveReminderView =
[ReminderView explanationWithText:NSLocalizedString(@"INBOX_VIEW_ARCHIVE_MODE_REMINDER",
@"Label reminding the user that they are in archive mode.")];
[self.view addSubview:archiveReminderView];
[archiveReminderView autoPinWidthToSuperview];
[archiveReminderView autoPinToTopLayoutGuideOfViewController:self withInset:0];
[archiveReminderView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:deregisteredView];
self.hideArchiveReminderViewConstraint = [archiveReminderView autoSetDimension:ALDimensionHeight toSize:0];
self.hideArchiveReminderViewConstraint.priority = UILayoutPriorityRequired;
@ -270,12 +283,18 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
{
BOOL shouldHideArchiveReminderView = self.homeViewMode != HomeViewMode_Archive;
BOOL shouldHideMissingContactsPermissionView = !self.shouldShowMissingContactsPermissionView;
BOOL shouldHideDeregisteredView = !TSAccountManager.sharedInstance.isDeregistered;
if (self.hideArchiveReminderViewConstraint.active == shouldHideArchiveReminderView
&& self.hideMissingContactsPermissionViewConstraint.active == shouldHideMissingContactsPermissionView) {
&& self.hideMissingContactsPermissionViewConstraint.active == shouldHideMissingContactsPermissionView
&& self.hideDeregisteredViewConstraint.active == shouldHideDeregisteredView) {
return;
}
self.hideArchiveReminderViewConstraint.active = shouldHideArchiveReminderView;
self.hideMissingContactsPermissionViewConstraint.active = shouldHideMissingContactsPermissionView;
self.hideDeregisteredViewConstraint.active = shouldHideDeregisteredView;
[self.view setNeedsLayout];
[self.view layoutSubviews];
}

View File

@ -91,7 +91,7 @@ class ReminderView: UIView {
// Label
switch (mode) {
case .nag:
label.font = UIFont.ows_regularFont(withSize: 14)
label.font = UIFont.ows_dynamicTypeFootnote
case .explanation:
label.font = UIFont.ows_dynamicTypeSubheadline
}

View File

@ -659,7 +659,7 @@
/* table cell label in conversation settings */
"DISAPPEARING_MESSAGES" = "Disappearing Messages";
/* Info Message when added to {{group name}} which has enabled message expiration after {{time amount}}, see the *_TIME_AMOUNT strings for context. */
/* Info Message when added to a group which has enabled disappearing messages. Embeds {{time amount}} before messages disappear, see the *_TIME_AMOUNT strings for context. */
"DISAPPEARING_MESSAGES_CONFIGURATION_GROUP_EXISTING_FORMAT" = "Messages in this conversation will disappear after %@.";
/* subheading in conversation settings */
@ -1022,6 +1022,9 @@
/* Label reminding the user that they are in archive mode. */
"INBOX_VIEW_ARCHIVE_MODE_REMINDER" = "These conversations are archived. They will appear in the inbox if new messages are received.";
/* Label warning the user that they have been de-registered. */
"INBOX_VIEW_DEREGISTRATION_WARNING" = "You are not logged in. Another device may have been registered with your phone number.";
/* Multi-line label explaining how to show names instead of phone numbers in your inbox */
"INBOX_VIEW_MISSING_CONTACTS_PERMISSION" = "To see the names of your contacts, update your system settings to allow contact access.";