|
|
@ -345,7 +345,10 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
|
|
|
|
[self createFirstConversationCueView];
|
|
|
|
[self createFirstConversationCueView];
|
|
|
|
[self.view addSubview:self.firstConversationCueView];
|
|
|
|
[self.view addSubview:self.firstConversationCueView];
|
|
|
|
[self.firstConversationCueView autoPinToTopLayoutGuideOfViewController:self withInset:0.f];
|
|
|
|
[self.firstConversationCueView autoPinToTopLayoutGuideOfViewController:self withInset:0.f];
|
|
|
|
[self.firstConversationCueView autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:10];
|
|
|
|
// This inset bakes in assumptions about UINavigationBar layout, but I'm not sure
|
|
|
|
|
|
|
|
// there's a better way to do it, since it isn't safe to use iOS auto layout with
|
|
|
|
|
|
|
|
// UINavigationBar contents.
|
|
|
|
|
|
|
|
[self.firstConversationCueView autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:6.f];
|
|
|
|
[self.firstConversationCueView autoPinEdgeToSuperviewEdge:ALEdgeLeading
|
|
|
|
[self.firstConversationCueView autoPinEdgeToSuperviewEdge:ALEdgeLeading
|
|
|
|
withInset:10
|
|
|
|
withInset:10
|
|
|
|
relation:NSLayoutRelationGreaterThanOrEqual];
|
|
|
|
relation:NSLayoutRelationGreaterThanOrEqual];
|
|
|
@ -410,9 +413,9 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
|
|
|
|
label.lineBreakMode = NSLineBreakByWordWrapping;
|
|
|
|
label.lineBreakMode = NSLineBreakByWordWrapping;
|
|
|
|
|
|
|
|
|
|
|
|
OWSLayerView *layerView = [OWSLayerView new];
|
|
|
|
OWSLayerView *layerView = [OWSLayerView new];
|
|
|
|
layerView.layoutMargins = UIEdgeInsetsMake(11 + kTailHeight, 16, 7, 16);
|
|
|
|
layerView.layoutMargins = UIEdgeInsetsMake(11 + kTailHeight, 16, 11, 16);
|
|
|
|
CAShapeLayer *shapeLayer = [CAShapeLayer new];
|
|
|
|
CAShapeLayer *shapeLayer = [CAShapeLayer new];
|
|
|
|
shapeLayer.fillColor = [OWSConversationColor ows_wintergreenColor].CGColor;
|
|
|
|
shapeLayer.fillColor = UIColor.ows_signalBlueColor.CGColor;
|
|
|
|
[layerView.layer addSublayer:shapeLayer];
|
|
|
|
[layerView.layer addSublayer:shapeLayer];
|
|
|
|
layerView.layoutCallback = ^(UIView *view) {
|
|
|
|
layerView.layoutCallback = ^(UIView *view) {
|
|
|
|
UIBezierPath *bezierPath = [UIBezierPath new];
|
|
|
|
UIBezierPath *bezierPath = [UIBezierPath new];
|
|
|
@ -443,10 +446,24 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
|
|
|
|
[layerView addSubview:label];
|
|
|
|
[layerView addSubview:label];
|
|
|
|
[label ows_autoPinToSuperviewMargins];
|
|
|
|
[label ows_autoPinToSuperviewMargins];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
layerView.userInteractionEnabled = YES;
|
|
|
|
|
|
|
|
[layerView
|
|
|
|
|
|
|
|
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self
|
|
|
|
|
|
|
|
action:@selector(firstConversationCueWasTapped:)]];
|
|
|
|
|
|
|
|
|
|
|
|
self.firstConversationCueView = layerView;
|
|
|
|
self.firstConversationCueView = layerView;
|
|
|
|
self.firstConversationLabel = label;
|
|
|
|
self.firstConversationLabel = label;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)firstConversationCueWasTapped:(UITapGestureRecognizer *)gestureRecognizer
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
OWSLogInfo(@"");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AppPreferences.hasDimissedFirstConversationCue = YES;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[self updateViewState];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)updateFirstConversationLabel
|
|
|
|
- (void)updateFirstConversationLabel
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NSArray<SignalAccount *> *signalAccounts = self.contactsManager.signalAccounts;
|
|
|
|
NSArray<SignalAccount *> *signalAccounts = self.contactsManager.signalAccounts;
|
|
|
@ -1453,7 +1470,7 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
|
|
|
|
[self updateReminderViews];
|
|
|
|
[self updateReminderViews];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark Database delegates
|
|
|
|
#pragma mark - Database delegates
|
|
|
|
|
|
|
|
|
|
|
|
- (YapDatabaseConnection *)uiDatabaseConnection
|
|
|
|
- (YapDatabaseConnection *)uiDatabaseConnection
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1614,10 +1631,7 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
|
|
|
|
|
|
|
|
|
|
|
|
- (void)updateViewState
|
|
|
|
- (void)updateViewState
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NSUInteger inboxCount = self.numberOfInboxThreads;
|
|
|
|
if (self.shouldShowFirstConversationCue) {
|
|
|
|
NSUInteger archiveCount = self.numberOfArchivedThreads;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (self.homeViewMode == HomeViewMode_Inbox && inboxCount == 0 && archiveCount == 0) {
|
|
|
|
|
|
|
|
[_tableView setHidden:YES];
|
|
|
|
[_tableView setHidden:YES];
|
|
|
|
[self.emptyInboxView setHidden:NO];
|
|
|
|
[self.emptyInboxView setHidden:NO];
|
|
|
|
[self.firstConversationCueView setHidden:NO];
|
|
|
|
[self.firstConversationCueView setHidden:NO];
|
|
|
@ -1629,6 +1643,13 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (BOOL)shouldShowFirstConversationCue
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (self.homeViewMode == HomeViewMode_Inbox && self.numberOfInboxThreads == 0
|
|
|
|
|
|
|
|
&& self.numberOfArchivedThreads == 0 && !AppPreferences.hasDimissedFirstConversationCue
|
|
|
|
|
|
|
|
&& !SSKPreferences.hasSavedThread);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// We want to delay asking for a review until an opportune time.
|
|
|
|
// We want to delay asking for a review until an opportune time.
|
|
|
|
// If the user has *just* launched Signal they intend to do something, we don't want to interrupt them.
|
|
|
|
// If the user has *just* launched Signal they intend to do something, we don't want to interrupt them.
|
|
|
|
// If the user hasn't sent a message, we don't want to ask them for a review yet.
|
|
|
|
// If the user hasn't sent a message, we don't want to ask them for a review yet.
|
|
|
|