Show de-registration nag view.

pull/1/head
Matthew Chen 8 years ago
parent b0646e8bff
commit 6331fbb22a

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

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

@ -659,7 +659,7 @@
/* table cell label in conversation settings */ /* table cell label in conversation settings */
"DISAPPEARING_MESSAGES" = "Disappearing Messages"; "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 %@."; "DISAPPEARING_MESSAGES_CONFIGURATION_GROUP_EXISTING_FORMAT" = "Messages in this conversation will disappear after %@.";
/* subheading in conversation settings */ /* subheading in conversation settings */
@ -1022,6 +1022,9 @@
/* Label reminding the user that they are in archive mode. */ /* 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."; "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 */ /* 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."; "INBOX_VIEW_MISSING_CONTACTS_PERMISSION" = "To see the names of your contacts, update your system settings to allow contact access.";

Loading…
Cancel
Save