Rename home view.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent fd4f00fa4d
commit 928525c31e

@ -70,7 +70,7 @@
34B3F8911E8DF1710035BE1A /* ShowGroupMembersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F86B1E8DF1700035BE1A /* ShowGroupMembersViewController.m */; };
34B3F8921E8DF1710035BE1A /* SignalAttachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F86C1E8DF1700035BE1A /* SignalAttachment.swift */; };
34B3F8931E8DF1710035BE1A /* SignalsNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F86E1E8DF1700035BE1A /* SignalsNavigationController.m */; };
34B3F8941E8DF1710035BE1A /* SignalsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F8701E8DF1700035BE1A /* SignalsViewController.m */; };
34B3F8941E8DF1710035BE1A /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F8701E8DF1700035BE1A /* HomeViewController.m */; };
34B3F8991E8DF1B90035BE1A /* TSMessageAdapterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F8981E8DF1B90035BE1A /* TSMessageAdapterTest.m */; };
34B3F89C1E8DF3270035BE1A /* BlockListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F89B1E8DF3270035BE1A /* BlockListViewController.m */; };
34B3F89F1E8DF5490035BE1A /* OWSTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F89E1E8DF5490035BE1A /* OWSTableViewController.m */; };
@ -510,8 +510,8 @@
34B3F86C1E8DF1700035BE1A /* SignalAttachment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignalAttachment.swift; sourceTree = "<group>"; };
34B3F86D1E8DF1700035BE1A /* SignalsNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SignalsNavigationController.h; sourceTree = "<group>"; };
34B3F86E1E8DF1700035BE1A /* SignalsNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SignalsNavigationController.m; sourceTree = "<group>"; };
34B3F86F1E8DF1700035BE1A /* SignalsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SignalsViewController.h; sourceTree = "<group>"; };
34B3F8701E8DF1700035BE1A /* SignalsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SignalsViewController.m; sourceTree = "<group>"; };
34B3F86F1E8DF1700035BE1A /* HomeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeViewController.h; sourceTree = "<group>"; };
34B3F8701E8DF1700035BE1A /* HomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeViewController.m; sourceTree = "<group>"; };
34B3F8981E8DF1B90035BE1A /* TSMessageAdapterTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSMessageAdapterTest.m; sourceTree = "<group>"; };
34B3F89A1E8DF3270035BE1A /* BlockListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlockListViewController.h; sourceTree = "<group>"; };
34B3F89B1E8DF3270035BE1A /* BlockListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlockListViewController.m; sourceTree = "<group>"; };
@ -1022,6 +1022,8 @@
34E8BF371EE9E2FD00F5F4CA /* FingerprintViewScanController.m */,
34B3F8471E8DF1700035BE1A /* FullImageViewController.h */,
34B3F8481E8DF1700035BE1A /* FullImageViewController.m */,
34B3F86F1E8DF1700035BE1A /* HomeViewController.h */,
34B3F8701E8DF1700035BE1A /* HomeViewController.m */,
34B3F8491E8DF1700035BE1A /* InboxTableViewCell.h */,
34B3F84A1E8DF1700035BE1A /* InboxTableViewCell.m */,
34B3F84C1E8DF1700035BE1A /* InviteFlow.swift */,
@ -1078,8 +1080,6 @@
34B3F86C1E8DF1700035BE1A /* SignalAttachment.swift */,
34B3F86D1E8DF1700035BE1A /* SignalsNavigationController.h */,
34B3F86E1E8DF1700035BE1A /* SignalsNavigationController.m */,
34B3F86F1E8DF1700035BE1A /* SignalsViewController.h */,
34B3F8701E8DF1700035BE1A /* SignalsViewController.m */,
3400C7971EAFB772008A8584 /* ThreadViewHelper.h */,
3400C7981EAFB772008A8584 /* ThreadViewHelper.m */,
340CB2251EAC25820001CAA1 /* UpdateGroupViewController.h */,
@ -2388,7 +2388,7 @@
4579431E1E7C8CE9008ED0C0 /* Pastelog.m in Sources */,
34D99C941F2937CC00D284D6 /* OWSSwiftUtils.swift in Sources */,
34C42D661F4734ED0072EC04 /* OWSContactOffersInteraction.m in Sources */,
34B3F8941E8DF1710035BE1A /* SignalsViewController.m in Sources */,
34B3F8941E8DF1710035BE1A /* HomeViewController.m in Sources */,
34E8BF381EE9E2FD00F5F4CA /* FingerprintViewScanController.m in Sources */,
346B66311F4E29B200E5122F /* CropScaleImageViewController.swift in Sources */,
76EB058818170B33006006FC /* PropertyListPreferences.m in Sources */,

@ -4,7 +4,7 @@
#import <UIKit/UIKit.h>
#import "SignalsViewController.h"
#import "HomeViewController.h"
extern NSString *const AppDelegateStoryboardMain;

@ -801,7 +801,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
DDLogInfo(@"Presenting initial root view controller");
if ([TSAccountManager isRegistered]) {
SignalsViewController *homeView = [SignalsViewController new];
HomeViewController *homeView = [HomeViewController new];
SignalsNavigationController *navigationController =
[[SignalsNavigationController alloc] initWithRootViewController:homeView];
self.window.rootViewController = navigationController;

@ -10,6 +10,7 @@
#import "Environment.h"
#import "FLAnimatedImage.h"
#import "FingerprintViewController.h"
#import "HomeViewController.h"
#import "NotificationsManager.h"
#import "OWSAnyTouchGestureRecognizer.h"
#import "OWSAudioAttachmentPlayer.h"
@ -29,7 +30,6 @@
#import "PropertyListPreferences.h"
#import "PushManager.h"
#import "Release.h"
#import "SignalsViewController.h"
#import "TSMessageAdapter.h"
#import "UIColor+OWS.h"
#import "UIFont+OWS.h"

@ -1,65 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--MessagesVC-->
<scene sceneID="QqV-z2-xRW">
<objects>
<viewController storyboardIdentifier="MessagesViewController" title="MessagesVC" hidesBottomBarWhenPushed="YES" id="DtA-8O-wrT" customClass="MessagesViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="0di-ZU-w1m"/>
<viewControllerLayoutGuide type="bottom" id="stV-ob-KSQ"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="5r3-kq-bbI">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<navigationItem key="navigationItem" title="Title" id="mLN-DG-4IU">
<barButtonItem key="backBarButtonItem" title=" " id="wnY-V7-zmi"/>
<barButtonItem key="rightBarButtonItem" image="contact-options-action" id="662-pN-RLf">
<inset key="imageInsets" minX="17" minY="10" maxX="0.0" maxY="5"/>
<color key="tintColor" red="0.99987119436264038" green="0.99998223781585693" blue="0.99984109401702881" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</barButtonItem>
</navigationItem>
<connections>
<outlet property="inputToolbar" destination="BdJ-vY-dHA" id="EfK-zI-nSM"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="yXZ-iE-5va" userLabel="First Responder" sceneMemberID="firstResponder"/>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="BdJ-vY-dHA" customClass="OWSMessagesInputToolbar">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<items>
<barButtonItem title="Item" id="4F3-az-L9s"/>
</items>
</toolbar>
<view contentMode="scaleToFill" id="X6H-b7-xZK" customClass="OWSMessagesToolbarContentView">
<rect key="frame" x="0.0" y="0.0" width="240" height="128"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<connections>
<outlet property="textView" destination="XUl-oy-JS1" id="kzd-TM-IJT"/>
</connections>
</view>
<view contentMode="scaleToFill" id="XUl-oy-JS1" customClass="JSQMessagesComposerTextView">
<rect key="frame" x="0.0" y="0.0" width="240" height="128"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</objects>
<point key="canvasLocation" x="-2287" y="-1516"/>
</scene>
<!--Linked Devices-->
<scene sceneID="R59-ey-Ucx">
<objects>
@ -262,7 +214,6 @@
</scene>
</scenes>
<resources>
<image name="contact-options-action" width="44" height="44"/>
<image name="ic_devices_ios" width="180" height="119"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">

@ -669,7 +669,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
[self startExpirationTimerAnimations];
// We should have already requested contact access at this point, so this should be a no-op
// unless it ever becomes possible to load this VC without going via the SignalsViewController.
// unless it ever becomes possible to load this VC without going via the HomeViewController.
[self.contactsManager requestSystemContactsOnce];
OWSDisappearingMessagesConfiguration *configuration =

@ -83,7 +83,7 @@ private class IntroductingProfilesExperienceUpgradeViewController: ExperienceUpg
// dismiss the modally presented view controller, then proceed.
experienceUpgradesPageViewController.dismiss(animated: true) {
guard let fromViewController = UIApplication.shared.frontmostViewController as? SignalsViewController else {
guard let fromViewController = UIApplication.shared.frontmostViewController as? HomeViewController else {
owsFail("unexpected frontmostViewController: \(String(describing: UIApplication.shared.frontmostViewController))")
return
}

@ -7,7 +7,7 @@
@class TSThread;
@interface SignalsViewController : OWSViewController
@interface HomeViewController : OWSViewController
// TODO: Remove this property.
@property (nonatomic) BOOL newlyRegisteredUser;

@ -2,7 +2,7 @@
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "SignalsViewController.h"
#import "HomeViewController.h"
#import "AppDelegate.h"
#import "AppSettingsViewController.h"
#import "InboxTableViewCell.h"
@ -34,7 +34,7 @@
typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
@interface SignalsViewController () <UITableViewDelegate, UITableViewDataSource, UIViewControllerPreviewingDelegate>
@interface HomeViewController () <UITableViewDelegate, UITableViewDataSource, UIViewControllerPreviewingDelegate>
@property (nonatomic) UITableView *tableView;
@property (nonatomic) UILabel *emptyBoxLabel;
@ -74,7 +74,7 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
#pragma mark -
@implementation SignalsViewController
@implementation HomeViewController
#pragma mark - Init
@ -169,7 +169,7 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
self.view.backgroundColor = [UIColor whiteColor];
// TODO: Remove this.
[[Environment getCurrent] setSignalsViewController:self];
[[Environment getCurrent] setHomeViewController:self];
self.navigationItem.rightBarButtonItem =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose
@ -179,7 +179,7 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
ReminderView *archiveReminderView = [ReminderView new];
archiveReminderView.text = NSLocalizedString(
@"INBOX_VIEW_ARCHIVE_MODE_REMINDER", @"Label reminding the user that they are in archive mode.");
__weak SignalsViewController *weakSelf = self;
__weak HomeViewController *weakSelf = self;
archiveReminderView.tapAction = ^{
[weakSelf showInboxGrouping];
};
@ -236,7 +236,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
[self.view layoutSubviews];
}
- (void)viewDidLoad {
- (void)viewDidLoad
{
[super viewDidLoad];
[self.navigationController.navigationBar setTranslucent:NO];
@ -263,18 +264,19 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
UINavigationItem *navigationItem = self.navigationItem;
navigationItem.titleView = self.segmentedControl;
[self.segmentedControl setSelectedSegmentIndex:0];
navigationItem.leftBarButtonItem.accessibilityLabel = NSLocalizedString(
@"SETTINGS_BUTTON_ACCESSIBILITY", @"Accessibility hint for the settings button");
navigationItem.leftBarButtonItem.accessibilityLabel
= NSLocalizedString(@"SETTINGS_BUTTON_ACCESSIBILITY", @"Accessibility hint for the settings button");
if ([self.traitCollection respondsToSelector:@selector(forceTouchCapability)] &&
(self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable)) {
if ([self.traitCollection respondsToSelector:@selector(forceTouchCapability)]
&& (self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable)) {
[self registerForPreviewingWithDelegate:self sourceView:self.tableView];
}
[self updateBarButtonItems];
}
- (void)updateBarButtonItems {
- (void)updateBarButtonItems
{
const CGFloat kBarButtonSize = 44;
// We use UIButtons with [UIBarButtonItem initWithCustomView:...] instead of
// UIBarButtonItem in order to ensure that these buttons are spaced tightly.
@ -309,21 +311,23 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
}
- (void)settingsButtonPressed:(id)sender {
- (void)settingsButtonPressed:(id)sender
{
AppSettingsViewController *vc = [AppSettingsViewController new];
OWSNavigationController *navigationController = [[OWSNavigationController alloc] initWithRootViewController:vc];
[self presentViewController:navigationController animated:YES completion:nil];
}
- (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext
viewControllerForLocation:(CGPoint)location {
viewControllerForLocation:(CGPoint)location
{
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:location];
if (indexPath) {
[previewingContext setSourceRect:[self.tableView rectForRowAtIndexPath:indexPath]];
MessagesViewController *vc = [MessagesViewController new];
TSThread *thread = [self threadForIndexPath:indexPath];
TSThread *thread = [self threadForIndexPath:indexPath];
self.lastThread = thread;
[vc configureForThread:thread keyboardOnViewAppearing:NO callOnViewAppearing:NO];
[vc peekSetup];
@ -335,7 +339,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
}
- (void)previewingContext:(id<UIViewControllerPreviewing>)previewingContext
commitViewController:(UIViewController *)viewControllerToCommit {
commitViewController:(UIViewController *)viewControllerToCommit
{
MessagesViewController *vc = (MessagesViewController *)viewControllerToCommit;
[vc popped];
@ -361,7 +366,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
}];
}
- (void)swappedSegmentedControl {
- (void)swappedSegmentedControl
{
if (self.segmentedControl.selectedSegmentIndex == 0) {
[self showInboxGrouping];
} else {
@ -369,7 +375,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
}
}
- (void)viewWillAppear:(BOOL)animated {
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
if ([TSThread numberOfKeysInCollection] > 0) {
[self.contactsManager requestSystemContactsOnceWithCompletion:^(NSError *_Nullable error) {
@ -482,11 +489,12 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
self.isAppInBackground = YES;
}
- (void)viewDidAppear:(BOOL)animated {
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
if (self.newlyRegisteredUser) {
[self.editingDbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction * _Nonnull transaction) {
[self.editingDbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
[self.experienceUpgradeFinder markAllAsSeenWithTransaction:transaction];
}];
// Start running the disappearing messages job in case the newly registered user
@ -528,7 +536,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
NSArray<ExperienceUpgrade *> *unseenUpgrades = [self unseenUpgradeExperiences];
if (unseenUpgrades.count > 0) {
ExperienceUpgradesPageViewController *experienceUpgradeViewController = [[ExperienceUpgradesPageViewController alloc] initWithExperienceUpgrades:unseenUpgrades];
ExperienceUpgradesPageViewController *experienceUpgradeViewController =
[[ExperienceUpgradesPageViewController alloc] initWithExperienceUpgrades:unseenUpgrades];
[self presentViewController:experienceUpgradeViewController
animated:YES
completion:^{
@ -541,7 +550,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
self.hasBeenPresented = YES;
}
- (void)tableViewSetUp {
- (void)tableViewSetUp
{
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
}
@ -561,7 +571,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
return (NSInteger)[self.threadMappings numberOfSections];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return (NSInteger)[self.threadMappings numberOfItemsInSection:(NSUInteger)section];
}
@ -582,17 +593,19 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
return cell;
}
- (TSThread *)threadForIndexPath:(NSIndexPath *)indexPath {
- (TSThread *)threadForIndexPath:(NSIndexPath *)indexPath
{
__block TSThread *thread = nil;
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
thread = [[transaction extension:TSThreadDatabaseViewExtensionName] objectAtIndexPath:indexPath
withMappings:self.threadMappings];
thread = [[transaction extension:TSThreadDatabaseViewExtensionName] objectAtIndexPath:indexPath
withMappings:self.threadMappings];
}];
return thread;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return InboxTableViewCell.rowHeight;
}
@ -600,35 +613,39 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
- (void)tableView:(UITableView *)tableView
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath {
forRowAtIndexPath:(NSIndexPath *)indexPath
{
return;
}
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewRowAction *deleteAction =
[UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault
title:NSLocalizedString(@"TXT_DELETE_TITLE", nil)
handler:^(UITableViewRowAction *action, NSIndexPath *swipedIndexPath) {
[self tableViewCellTappedDelete:swipedIndexPath];
[self tableViewCellTappedDelete:swipedIndexPath];
}];
UITableViewRowAction *archiveAction;
if (self.viewingThreadsIn == kInboxState) {
archiveAction = [UITableViewRowAction
rowActionWithStyle:UITableViewRowActionStyleNormal
title:NSLocalizedString(@"ARCHIVE_ACTION", @"Pressing this button moves a thread from the inbox to the archive")
title:NSLocalizedString(@"ARCHIVE_ACTION",
@"Pressing this button moves a thread from the inbox to the archive")
handler:^(UITableViewRowAction *_Nonnull action, NSIndexPath *_Nonnull tappedIndexPath) {
[self archiveIndexPath:tappedIndexPath];
[Environment.preferences setHasArchivedAMessage:YES];
[self archiveIndexPath:tappedIndexPath];
[Environment.preferences setHasArchivedAMessage:YES];
}];
} else {
archiveAction = [UITableViewRowAction
rowActionWithStyle:UITableViewRowActionStyleNormal
title:NSLocalizedString(@"UNARCHIVE_ACTION", @"Pressing this button moves an archived thread from the archive back to the inbox")
title:NSLocalizedString(@"UNARCHIVE_ACTION",
@"Pressing this button moves an archived thread from the archive back to the inbox")
handler:^(UITableViewRowAction *_Nonnull action, NSIndexPath *_Nonnull tappedIndexPath) {
[self archiveIndexPath:tappedIndexPath];
[self archiveIndexPath:tappedIndexPath];
}];
}
@ -636,23 +653,25 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
return @[ deleteAction, archiveAction ];
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
#pragma mark - HomeFeedTableViewCellDelegate
- (void)tableViewCellTappedDelete:(NSIndexPath *)indexPath {
- (void)tableViewCellTappedDelete:(NSIndexPath *)indexPath
{
TSThread *thread = [self threadForIndexPath:indexPath];
if ([thread isKindOfClass:[TSGroupThread class]]) {
TSGroupThread *gThread = (TSGroupThread *)thread;
if ([gThread.groupModel.groupMemberIds containsObject:[TSAccountManager localNumber]]) {
UIAlertController *removingFromGroup = [UIAlertController
alertControllerWithTitle:[NSString
stringWithFormat:NSLocalizedString(@"GROUP_REMOVING", nil), [thread name]]
message:nil
preferredStyle:UIAlertControllerStyleAlert];
alertControllerWithTitle:[NSString
stringWithFormat:NSLocalizedString(@"GROUP_REMOVING", nil), [thread name]]
message:nil
preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:removingFromGroup animated:YES completion:nil];
TSOutgoingMessage *message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
@ -683,22 +702,24 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
}
}
- (void)deleteThread:(TSThread *)thread {
- (void)deleteThread:(TSThread *)thread
{
[self.editingDbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[thread removeWithTransaction:transaction];
[thread removeWithTransaction:transaction];
}];
_inboxCount -= (self.viewingThreadsIn == kArchiveState) ? 1 : 0;
[self checkIfEmptyView];
}
- (void)archiveIndexPath:(NSIndexPath *)indexPath {
- (void)archiveIndexPath:(NSIndexPath *)indexPath
{
TSThread *thread = [self threadForIndexPath:indexPath];
BOOL viewingThreadsIn = self.viewingThreadsIn;
[self.editingDbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
viewingThreadsIn == kInboxState ? [thread archiveThreadWithTransaction:transaction]
: [thread unarchiveThreadWithTransaction:transaction];
viewingThreadsIn == kInboxState ? [thread archiveThreadWithTransaction:transaction]
: [thread unarchiveThreadWithTransaction:transaction];
}];
[self checkIfEmptyView];
@ -707,7 +728,7 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
- (void)updateInboxCountLabel
{
NSUInteger numberOfItems = [self.messagesManager unreadMessagesCount];
NSString *unreadString = NSLocalizedString(@"WHISPER_NAV_BAR_TITLE", nil);
NSString *unreadString = NSLocalizedString(@"WHISPER_NAV_BAR_TITLE", nil);
if (numberOfItems > 0) {
unreadString =
@ -719,7 +740,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
[_segmentedControl reloadInputViews];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
TSThread *thread = [self threadForIndexPath:indexPath];
[self presentThread:thread keyboardOnViewAppearing:NO callOnViewAppearing:NO];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
@ -736,8 +758,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
// We do this synchronously if we're already on the main thread.
DispatchMainThreadSafe(^{
MessagesViewController *mvc = [[MessagesViewController alloc] initWithNibName:@"MessagesViewController"
bundle:nil];
MessagesViewController *mvc =
[[MessagesViewController alloc] initWithNibName:@"MessagesViewController" bundle:nil];
[mvc configureForThread:thread
keyboardOnViewAppearing:keyboardOnViewAppearing
callOnViewAppearing:callOnViewAppearing];
@ -865,7 +887,8 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
#pragma mark Database delegates
- (YapDatabaseConnection *)uiDatabaseConnection {
- (YapDatabaseConnection *)uiDatabaseConnection
{
NSAssert([NSThread isMainThread], @"Must access uiDatabaseConnection on main thread!");
if (!_uiDatabaseConnection) {
YapDatabase *database = TSStorageManager.sharedManager.database;
@ -875,12 +898,13 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
return _uiDatabaseConnection;
}
- (void)yapDatabaseModified:(NSNotification *)notification {
- (void)yapDatabaseModified:(NSNotification *)notification
{
if (!self.shouldObserveDBModifications) {
return;
}
NSArray *notifications = [self.uiDatabaseConnection beginLongLivedReadTransaction];
NSArray *notifications = [self.uiDatabaseConnection beginLongLivedReadTransaction];
if (![[self.uiDatabaseConnection ext:TSThreadDatabaseViewExtensionName] hasChangesForGroup:self.currentGrouping
inNotifications:notifications]) {
@ -964,14 +988,15 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
[self.tableView endUpdates];
}
- (void)checkIfEmptyView {
- (void)checkIfEmptyView
{
[_tableView setHidden:NO];
[_emptyBoxLabel setHidden:NO];
if (self.viewingThreadsIn == kInboxState && [self.threadMappings numberOfItemsInGroup:TSInboxGroup] == 0) {
[self setEmptyBoxText];
[_tableView setHidden:YES];
} else if (self.viewingThreadsIn == kArchiveState &&
[self.threadMappings numberOfItemsInGroup:TSArchiveGroup] == 0) {
[self.threadMappings numberOfItemsInGroup:TSArchiveGroup] == 0) {
[self setEmptyBoxText];
[_tableView setHidden:YES];
} else {
@ -979,31 +1004,32 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
}
}
- (void)setEmptyBoxText {
_emptyBoxLabel.textColor = [UIColor grayColor];
_emptyBoxLabel.font = [UIFont ows_regularFontWithSize:18.f];
- (void)setEmptyBoxText
{
_emptyBoxLabel.textColor = [UIColor grayColor];
_emptyBoxLabel.font = [UIFont ows_regularFontWithSize:18.f];
_emptyBoxLabel.textAlignment = NSTextAlignmentCenter;
_emptyBoxLabel.numberOfLines = 4;
NSString *firstLine = @"";
NSString *firstLine = @"";
NSString *secondLine = @"";
if (self.viewingThreadsIn == kInboxState) {
if ([Environment.preferences getHasSentAMessage]) {
firstLine = NSLocalizedString(@"EMPTY_INBOX_FIRST_TITLE", @"");
firstLine = NSLocalizedString(@"EMPTY_INBOX_FIRST_TITLE", @"");
secondLine = NSLocalizedString(@"EMPTY_INBOX_FIRST_TEXT", @"");
} else {
// FIXME This looks wrong. Shouldn't we be showing inbox_title/text here?
firstLine = NSLocalizedString(@"EMPTY_ARCHIVE_FIRST_TITLE", @"");
firstLine = NSLocalizedString(@"EMPTY_ARCHIVE_FIRST_TITLE", @"");
secondLine = NSLocalizedString(@"EMPTY_ARCHIVE_FIRST_TEXT", @"");
}
} else {
if ([Environment.preferences getHasArchivedAMessage]) {
// FIXME This looks wrong. Shouldn't we be showing first_archive_title/text here?
firstLine = NSLocalizedString(@"EMPTY_INBOX_TITLE", @"");
firstLine = NSLocalizedString(@"EMPTY_INBOX_TITLE", @"");
secondLine = NSLocalizedString(@"EMPTY_INBOX_TEXT", @"");
} else {
firstLine = NSLocalizedString(@"EMPTY_ARCHIVE_TITLE", @"");
firstLine = NSLocalizedString(@"EMPTY_ARCHIVE_TITLE", @"");
secondLine = NSLocalizedString(@"EMPTY_ARCHIVE_TEXT", @"");
}
}

@ -4,7 +4,7 @@
NS_ASSUME_NONNULL_BEGIN
@class SignalsViewController;
@class HomeViewController;
@interface ProfileViewController : UIViewController
@ -14,8 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)presentForAppSettings:(UINavigationController *)navigationController;
+ (void)presentForRegistration:(UINavigationController *)navigationController;
+ (void)presentForUpgradeOrNag:(SignalsViewController *)presentingController
NS_SWIFT_NAME(presentForUpgradeOrNag(from:));
+ (void)presentForUpgradeOrNag:(HomeViewController *)presentingController NS_SWIFT_NAME(presentForUpgradeOrNag(from:));
@end

@ -5,11 +5,11 @@
#import "ProfileViewController.h"
#import "AppDelegate.h"
#import "AvatarViewHelper.h"
#import "HomeViewController.h"
#import "OWSNavigationController.h"
#import "OWSProfileManager.h"
#import "Signal-Swift.h"
#import "SignalsNavigationController.h"
#import "SignalsViewController.h"
#import "UIColor+OWS.h"
#import "UIFont+OWS.h"
#import "UIView+OWS.h"
@ -434,13 +434,13 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
- (void)showHomeView
{
SignalsViewController *homeView = [SignalsViewController new];
HomeViewController *homeView = [HomeViewController new];
homeView.newlyRegisteredUser = YES;
SignalsNavigationController *navigationController =
[[SignalsNavigationController alloc] initWithRootViewController:homeView];
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
appDelegate.window.rootViewController = navigationController;
OWSAssert([navigationController.topViewController isKindOfClass:[SignalsViewController class]]);
OWSAssert([navigationController.topViewController isKindOfClass:[HomeViewController class]]);
}
#pragma mark - UITextFieldDelegate
@ -554,7 +554,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
[navigationController pushViewController:vc animated:YES];
}
+ (void)presentForUpgradeOrNag:(SignalsViewController *)presentingController
+ (void)presentForUpgradeOrNag:(HomeViewController *)presentingController
{
OWSAssert(presentingController);

@ -7,8 +7,8 @@
#import "ContactTableViewCell.h"
#import "ContactsViewHelper.h"
#import "Environment.h"
#import "HomeViewController.h"
#import "OWSContactsManager.h"
#import "SignalsViewController.h"
#import "Signal-Swift.h"
#import "UIUtil.h"
#import "ViewControllerUtils.h"

@ -4,9 +4,9 @@
#import "ViewControllerUtils.h"
#import "Environment.h"
#import "HomeViewController.h"
#import "PhoneNumber.h"
#import "Signal-Swift.h"
#import "SignalsViewController.h"
#import "StringUtil.h"
#import <AVFoundation/AVFoundation.h>
#import <SignalServiceKit/PhoneNumberUtil.h>

@ -18,7 +18,7 @@
@class UINavigationController;
@class OWSContactsManager;
@class OutboundCallInitiator;
@class SignalsViewController;
@class HomeViewController;
@class TSGroupThread;
@class ContactsUpdater;
@class TSNetworkManager;
@ -49,7 +49,7 @@
@property (nonatomic, readonly) PropertyListPreferences *preferences;
@property (nonatomic, readonly) SignalsViewController *signalsViewController;
@property (nonatomic, readonly) HomeViewController *signalsViewController;
@property (nonatomic, readonly, weak) UINavigationController *signUpFlowNavigationController;
+ (Environment *)getCurrent;
@ -59,7 +59,7 @@
+ (void)resetAppData;
- (void)setSignalsViewController:(SignalsViewController *)signalsViewController;
- (void)setHomeViewController:(HomeViewController *)signalsViewController;
- (void)setSignUpFlowNavigationController:(UINavigationController *)signUpFlowNavigationController;
+ (void)messageThreadId:(NSString *)threadId;

@ -5,10 +5,10 @@
#import "Environment.h"
#import "DebugLogger.h"
#import "FunctionalUtil.h"
#import "HomeViewController.h"
#import "MessagesViewController.h"
#import "Signal-Swift.h"
#import "SignalKeyingStorage.h"
#import "SignalsViewController.h"
#import "TSContactThread.h"
#import "TSGroupThread.h"
#import <SignalServiceKit/ContactsUpdater.h>
@ -171,7 +171,8 @@ static Environment *environment = nil;
return _preferences;
}
- (void)setSignalsViewController:(SignalsViewController *)signalsViewController {
- (void)setHomeViewController:(HomeViewController *)signalsViewController
{
_signalsViewController = signalsViewController;
}
@ -191,7 +192,7 @@ static Environment *environment = nil;
[self messageGroup:(TSGroupThread *)thread];
} else {
Environment *env = [self getCurrent];
SignalsViewController *vc = env.signalsViewController;
HomeViewController *vc = env.signalsViewController;
UIViewController *topvc = vc.navigationController.topViewController;
if ([topvc isKindOfClass:[MessagesViewController class]]) {
@ -207,7 +208,7 @@ static Environment *environment = nil;
+ (void)messageIdentifier:(NSString *)identifier withCompose:(BOOL)compose {
Environment *env = [self getCurrent];
SignalsViewController *vc = env.signalsViewController;
HomeViewController *vc = env.signalsViewController;
[[TSStorageManager sharedManager].dbReadWriteConnection
asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
@ -219,7 +220,7 @@ static Environment *environment = nil;
+ (void)callUserWithIdentifier:(NSString *)identifier
{
Environment *env = [self getCurrent];
SignalsViewController *vc = env.signalsViewController;
HomeViewController *vc = env.signalsViewController;
[[TSStorageManager sharedManager].dbReadWriteConnection
asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
@ -230,7 +231,7 @@ static Environment *environment = nil;
+ (void)messageGroup:(TSGroupThread *)groupThread {
Environment *env = [self getCurrent];
SignalsViewController *vc = env.signalsViewController;
HomeViewController *vc = env.signalsViewController;
[vc presentThread:groupThread keyboardOnViewAppearing:YES callOnViewAppearing:NO];
}

@ -63,8 +63,8 @@ NSString *const TSStorageManagerAppUpgradeNagDate = @"TSStorageManagerAppUpgrade
UIViewController *frontmostViewController =
[UIApplication sharedApplication].frontmostViewController;
OWSAssert(frontmostViewController);
BOOL canPresent = ([frontmostViewController isKindOfClass:[SignalsViewController class]] ||
[frontmostViewController isKindOfClass:[RegistrationViewController class]]);
BOOL canPresent = ([frontmostViewController isKindOfClass:[HomeViewController class]] ||
[frontmostViewController isKindOfClass:[RegistrationViewController class]]);
if (!canPresent) {
return;
}

@ -2,7 +2,7 @@
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "SignalsViewController.h"
#import "HomeViewController.h"
NS_ASSUME_NONNULL_BEGIN

Loading…
Cancel
Save