diff --git a/Vector.xcodeproj/project.pbxproj b/Vector.xcodeproj/project.pbxproj index 70704af44..cf0c2de9c 100644 --- a/Vector.xcodeproj/project.pbxproj +++ b/Vector.xcodeproj/project.pbxproj @@ -183,9 +183,7 @@ F094AA2B1B78E42600B1FBBF /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = F094AA0B1B78E42600B1FBBF /* Localizable.strings */; }; F094AA2C1B78E42600B1FBBF /* Vector.strings in Resources */ = {isa = PBXBuildFile; fileRef = F094AA0D1B78E42600B1FBBF /* Vector.strings */; }; F094AA2E1B78E42600B1FBBF /* countryCodes.plist in Resources */ = {isa = PBXBuildFile; fileRef = F094AA141B78E42600B1FBBF /* countryCodes.plist */; }; - F094AA2F1B78E42600B1FBBF /* AccountDetailsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F094AA171B78E42600B1FBBF /* AccountDetailsViewController.m */; }; F094AA301B78E42600B1FBBF /* AuthenticationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F094AA191B78E42600B1FBBF /* AuthenticationViewController.m */; }; - F094AA321B78E42600B1FBBF /* GlobalNotificationSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F094AA1D1B78E42600B1FBBF /* GlobalNotificationSettingsViewController.m */; }; F094AA351B78E42600B1FBBF /* RecentsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F094AA231B78E42600B1FBBF /* RecentsViewController.m */; }; F094AA371B78E42600B1FBBF /* RoomViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F094AA271B78E42600B1FBBF /* RoomViewController.m */; }; F094AA381B78E42600B1FBBF /* SettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F094AA291B78E42600B1FBBF /* SettingsViewController.m */; }; @@ -484,12 +482,8 @@ F094AA0C1B78E42600B1FBBF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; F094AA0E1B78E42600B1FBBF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Vector.strings; sourceTree = ""; }; F094AA141B78E42600B1FBBF /* countryCodes.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = countryCodes.plist; sourceTree = ""; }; - F094AA161B78E42600B1FBBF /* AccountDetailsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccountDetailsViewController.h; sourceTree = ""; }; - F094AA171B78E42600B1FBBF /* AccountDetailsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AccountDetailsViewController.m; sourceTree = ""; }; F094AA181B78E42600B1FBBF /* AuthenticationViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationViewController.h; sourceTree = ""; }; F094AA191B78E42600B1FBBF /* AuthenticationViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AuthenticationViewController.m; sourceTree = ""; }; - F094AA1C1B78E42600B1FBBF /* GlobalNotificationSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlobalNotificationSettingsViewController.h; sourceTree = ""; }; - F094AA1D1B78E42600B1FBBF /* GlobalNotificationSettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GlobalNotificationSettingsViewController.m; sourceTree = ""; }; F094AA221B78E42600B1FBBF /* RecentsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecentsViewController.h; sourceTree = ""; }; F094AA231B78E42600B1FBBF /* RecentsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RecentsViewController.m; sourceTree = ""; }; F094AA261B78E42600B1FBBF /* RoomViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoomViewController.h; sourceTree = ""; }; @@ -964,15 +958,11 @@ F0BE3DEE1C6CE17200AC3111 /* RoomMemberDetailsViewController.h */, F0BE3DEF1C6CE17200AC3111 /* RoomMemberDetailsViewController.m */, F0BE3DF11C6CE28300AC3111 /* RoomMemberDetailsViewController.xib */, - F094AA161B78E42600B1FBBF /* AccountDetailsViewController.h */, - F094AA171B78E42600B1FBBF /* AccountDetailsViewController.m */, F094AA181B78E42600B1FBBF /* AuthenticationViewController.h */, F094AA191B78E42600B1FBBF /* AuthenticationViewController.m */, F047DBB41C576F2200952DA2 /* AuthenticationViewController.xib */, 325F6A371C21810E00C12F51 /* DirectoryViewController.h */, 325F6A381C21810E00C12F51 /* DirectoryViewController.m */, - F094AA1C1B78E42600B1FBBF /* GlobalNotificationSettingsViewController.h */, - F094AA1D1B78E42600B1FBBF /* GlobalNotificationSettingsViewController.m */, 3235CD831C341FAA0084EA40 /* HomeSearchViewController.h */, 3235CD841C341FAA0084EA40 /* HomeSearchViewController.m */, 32D200861C16C2B100A4E396 /* HomeViewController.h */, @@ -1462,7 +1452,6 @@ 323A520B1C3183CC00010773 /* UIViewController+VectorSearch.m in Sources */, 717928491C03852C00407D96 /* TableViewCellWithLabelAndTextField.m in Sources */, 32A887211C89B9580037DC17 /* SimpleRoomTitleView.m in Sources */, - F094AA2F1B78E42600B1FBBF /* AccountDetailsViewController.m in Sources */, F056417B1C7C9FD7002276ED /* TableViewCellWithButton.m in Sources */, F0CC4DC01C4E26FA003BBE45 /* MediaAlbumTableCell.m in Sources */, F022285B1C64D529000AF23C /* ExpandedRoomTitleView.m in Sources */, @@ -1488,7 +1477,6 @@ F09E24ED1C6DE24900D39503 /* RoomMemberTitleView.m in Sources */, 325F6A391C21810E00C12F51 /* DirectoryViewController.m in Sources */, 3235CD8D1C34309E0084EA40 /* HomeSearchCellData.m in Sources */, - F094AA321B78E42600B1FBBF /* GlobalNotificationSettingsViewController.m in Sources */, F094A9A81B78D8F000B1FBBF /* main.m in Sources */, 71B2A3C01C203C7100472061 /* TableViewCellWithLabelAndSwitch.m in Sources */, F00C47861BFF77C800DBABC9 /* RecentTableViewCell.m in Sources */, diff --git a/Vector/Base.lproj/Main.storyboard b/Vector/Base.lproj/Main.storyboard index e49873652..6acfec2dc 100644 --- a/Vector/Base.lproj/Main.storyboard +++ b/Vector/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -144,34 +144,11 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Vector/ViewController/AccountDetailsViewController.h b/Vector/ViewController/AccountDetailsViewController.h deleted file mode 100644 index c21d6aff5..000000000 --- a/Vector/ViewController/AccountDetailsViewController.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - Copyright 2015 OpenMarket Ltd - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -#import - -@interface AccountDetailsViewController : MXKAccountDetailsViewController - -@end - diff --git a/Vector/ViewController/AccountDetailsViewController.m b/Vector/ViewController/AccountDetailsViewController.m deleted file mode 100644 index e279ed45d..000000000 --- a/Vector/ViewController/AccountDetailsViewController.m +++ /dev/null @@ -1,123 +0,0 @@ -/* - Copyright 2015 OpenMarket Ltd - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -#import "AccountDetailsViewController.h" - -#import "VectorDesignValues.h" - -#import "RageShakeManager.h" - -@interface AccountDetailsViewController() -{ - NSInteger globalNotificationSettingsRowIndex; - - // The "Global Notification Settings" button - UIButton *globalNotifSettingsButton; -} -@end - -@implementation AccountDetailsViewController - -- (void)viewDidLoad -{ - [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. - - // Setup `MXKViewControllerHandling` properties - self.defaultBarTintColor = kVectorNavBarTintColor; - self.enableBarTintColorStatusChange = NO; - self.rageShakeManager = [RageShakeManager sharedManager]; -} - -- (void)destroy -{ - [super destroy]; - - globalNotifSettingsButton = nil; -} - -#pragma mark - TableView data source - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - NSInteger count = [super tableView:tableView numberOfRowsInSection:section]; - - // Add one button in notification section to edit global notification settings - if (section == notificationsSection) - { - globalNotificationSettingsRowIndex = count++; - } - - return count; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ - UITableViewCell *cell; - - if (indexPath.section == notificationsSection && indexPath.row == globalNotificationSettingsRowIndex) - { - MXKTableViewCellWithButton *globalNotifSettingsBtnCell = [tableView dequeueReusableCellWithIdentifier:[MXKTableViewCellWithButton defaultReuseIdentifier]]; - if (!globalNotifSettingsBtnCell) - { - globalNotifSettingsBtnCell = [[MXKTableViewCellWithButton alloc] init]; - } - [globalNotifSettingsBtnCell.mxkButton setTitle:NSLocalizedStringFromTable(@"notification_settings_global_notification_settings", @"Vector", nil) forState:UIControlStateNormal]; - [globalNotifSettingsBtnCell.mxkButton setTitle:NSLocalizedStringFromTable(@"notification_settings_global_notification_settings", @"Vector", nil) forState:UIControlStateHighlighted]; - [globalNotifSettingsBtnCell.mxkButton addTarget:self action:@selector(onButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; - - globalNotifSettingsButton = globalNotifSettingsBtnCell.mxkButton; - - cell = globalNotifSettingsBtnCell; - } - else - { - cell = [super tableView:tableView cellForRowAtIndexPath:indexPath]; - } - - return cell; -} - - -#pragma mark - TableView delegate - -- (void)onButtonPressed:(id)sender -{ - if (sender == globalNotifSettingsButton) - { - [self performSegueWithIdentifier:@"showGlobalNotificationSettings" sender:self]; - } - else - { - [super onButtonPressed:sender]; - } -} - -#pragma mark - Segues - -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender -{ - // Keep ref on destinationViewController - [super prepareForSegue:segue sender:sender]; - - if ([[segue identifier] isEqualToString:@"showGlobalNotificationSettings"]) - { - MXKNotificationSettingsViewController *notifSettingsViewController = segue.destinationViewController; - notifSettingsViewController.mxAccount = self.mxAccount; - } -} - -@end diff --git a/Vector/ViewController/GlobalNotificationSettingsViewController.h b/Vector/ViewController/GlobalNotificationSettingsViewController.h deleted file mode 100644 index b4bcd0e6d..000000000 --- a/Vector/ViewController/GlobalNotificationSettingsViewController.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - Copyright 2015 OpenMarket Ltd - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -#import - -@interface GlobalNotificationSettingsViewController : MXKNotificationSettingsViewController - -@end - diff --git a/Vector/ViewController/GlobalNotificationSettingsViewController.m b/Vector/ViewController/GlobalNotificationSettingsViewController.m deleted file mode 100644 index cd284a261..000000000 --- a/Vector/ViewController/GlobalNotificationSettingsViewController.m +++ /dev/null @@ -1,35 +0,0 @@ -/* - Copyright 2015 OpenMarket Ltd - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -#import "GlobalNotificationSettingsViewController.h" - -#import "VectorDesignValues.h" - -#import "RageShakeManager.h" - -@implementation GlobalNotificationSettingsViewController - -- (void)viewDidLoad -{ - [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. - - // Setup `MXKViewControllerHandling` properties - self.defaultBarTintColor = kVectorNavBarTintColor; - self.enableBarTintColorStatusChange = NO; - self.rageShakeManager = [RageShakeManager sharedManager]; -} -@end diff --git a/Vector/ViewController/SettingsViewController.m b/Vector/ViewController/SettingsViewController.m index 4ff1277da..ef243ea11 100644 --- a/Vector/ViewController/SettingsViewController.m +++ b/Vector/ViewController/SettingsViewController.m @@ -125,30 +125,9 @@ // Add observer to handle removed accounts removedAccountObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXKAccountManagerDidRemoveAccountNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) { - MXKAccount *account = notif.object; - if (account) - { - if (self.childViewControllers.count) - { - for (id viewController in self.childViewControllers) - { - // Check whether details of this account was displayed - if ([viewController isKindOfClass:[MXKAccountDetailsViewController class]]) - { - MXKAccountDetailsViewController *accountDetailsViewController = viewController; - if ([accountDetailsViewController.mxAccount.mxCredentials.userId isEqualToString:account.mxCredentials.userId]) - { - // pop the account details view controller - [self.navigationController popToRootViewControllerAnimated:YES]; - break; - } - } - } - } - } - // Refresh table to remove this account [self.tableView reloadData]; + }]; // Add observer to handle accounts update @@ -156,6 +135,7 @@ [self stopActivityIndicator]; [self.tableView reloadData]; + }]; // Add observer to apns @@ -163,6 +143,7 @@ [self stopActivityIndicator]; [self.tableView reloadData]; + }];