diff --git a/CHANGES.rst b/CHANGES.rst index 87be3bf7f..7b88de174 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,7 +8,8 @@ Changes to be released in next version * 🐛 Bugfix - * + * RoomVC: Avoid navigation to integration management using integration popup with settings set to integration disabled (#4261). + * RiotSettings: Logging out resets RiotSettings (#4259). ⚠️ API Changes * diff --git a/Riot/Managers/Settings/RiotSettings.swift b/Riot/Managers/Settings/RiotSettings.swift index c78f2ae68..5522b605e 100644 --- a/Riot/Managers/Settings/RiotSettings.swift +++ b/Riot/Managers/Settings/RiotSettings.swift @@ -85,36 +85,6 @@ final class RiotSettings: NSObject { return userDefaults }() - // MARK: - Public - - func reset() { - defaults.removeObject(forKey: UserDefaultsKeys.settingsScreenShowChangePassword) - defaults.removeObject(forKey: UserDefaultsKeys.settingsScreenShowInviteFriends) - defaults.removeObject(forKey: UserDefaultsKeys.settingsScreenShowEnableStunServerFallback) - defaults.removeObject(forKey: UserDefaultsKeys.settingsSecurityScreenShowSessions) - defaults.removeObject(forKey: UserDefaultsKeys.settingsSecurityScreenShowSetupBackup) - defaults.removeObject(forKey: UserDefaultsKeys.settingsSecurityScreenShowRestoreBackup) - defaults.removeObject(forKey: UserDefaultsKeys.settingsSecurityScreenShowDeleteBackup) - defaults.removeObject(forKey: UserDefaultsKeys.settingsSecurityScreenShowCryptographyInfo) - defaults.removeObject(forKey: UserDefaultsKeys.settingsSecurityScreenShowCryptographyExport) - defaults.removeObject(forKey: UserDefaultsKeys.settingsSecurityScreenShowAdvancedUnverifiedDevices) - defaults.removeObject(forKey: UserDefaultsKeys.roomCreationScreenAllowEncryptionConfiguration) - defaults.removeObject(forKey: UserDefaultsKeys.roomCreationScreenRoomIsEncrypted) - defaults.removeObject(forKey: UserDefaultsKeys.roomCreationScreenAllowRoomTypeConfiguration) - defaults.removeObject(forKey: UserDefaultsKeys.roomCreationScreenRoomIsPublic) - defaults.removeObject(forKey: UserDefaultsKeys.allowInviteExernalUsers) - defaults.removeObject(forKey: UserDefaultsKeys.roomSettingsScreenShowLowPriorityOption) - defaults.removeObject(forKey: UserDefaultsKeys.roomSettingsScreenShowDirectChatOption) - defaults.removeObject(forKey: UserDefaultsKeys.roomSettingsScreenAllowChangingAccessSettings) - defaults.removeObject(forKey: UserDefaultsKeys.roomSettingsScreenAllowChangingHistorySettings) - defaults.removeObject(forKey: UserDefaultsKeys.roomSettingsScreenShowAddressSettings) - defaults.removeObject(forKey: UserDefaultsKeys.roomSettingsScreenShowFlairSettings) - defaults.removeObject(forKey: UserDefaultsKeys.roomSettingsScreenShowAdvancedSettings) - defaults.removeObject(forKey: UserDefaultsKeys.roomSettingsScreenAdvancedShowEncryptToVerifiedOption) - defaults.removeObject(forKey: UserDefaultsKeys.allowInviteExernalUsers) - defaults.removeObject(forKey: UserDefaultsKeys.roomsAllowToJoinPublicRooms) - } - // MARK: Servers var homeserverUrlString: String { diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index f300e8206..ece6aad63 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -2136,10 +2136,6 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni [self logoutSendingRequestServer:YES completion:^(BOOL isLoggedOut) { if (completion) { - if (isLoggedOut) - { - [RiotSettings.shared reset]; - } completion (YES); } }]; diff --git a/Riot/Modules/Integrations/WidgetPicker/WidgetPickerViewController.m b/Riot/Modules/Integrations/WidgetPicker/WidgetPickerViewController.m index 014cb45e1..ad4e35e82 100644 --- a/Riot/Modules/Integrations/WidgetPicker/WidgetPickerViewController.m +++ b/Riot/Modules/Integrations/WidgetPicker/WidgetPickerViewController.m @@ -78,18 +78,21 @@ } // Link to the integration manager - alertAction = [UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"widget_picker_manage_integrations", @"Vector", nil) - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * _Nonnull action) - { - IntegrationManagerViewController *modularVC = [[IntegrationManagerViewController alloc] initForMXSession:self->mxSession - inRoom:self->roomId - screen:kIntegrationManagerMainScreen - widgetId:nil]; + if (RiotSettings.shared.roomInfoScreenShowIntegrations) + { + alertAction = [UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"widget_picker_manage_integrations", @"Vector", nil) + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * _Nonnull action) + { + IntegrationManagerViewController *modularVC = [[IntegrationManagerViewController alloc] initForMXSession:self->mxSession + inRoom:self->roomId + screen:kIntegrationManagerMainScreen + widgetId:nil]; - [mxkViewController presentViewController:modularVC animated:NO completion:nil]; - }]; - [self.alertController addAction:alertAction]; + [mxkViewController presentViewController:modularVC animated:NO completion:nil]; + }]; + [self.alertController addAction:alertAction]; + } // Cancel alertAction = [UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] diff --git a/Riot/Modules/TabBar/MasterTabBarController.m b/Riot/Modules/TabBar/MasterTabBarController.m index dd7a3e9f2..81583532d 100644 --- a/Riot/Modules/TabBar/MasterTabBarController.m +++ b/Riot/Modules/TabBar/MasterTabBarController.m @@ -64,6 +64,9 @@ // The groups data source GroupsDataSource *groupsDataSource; + + // All tabs deinfed in the storyboard + NSArray *initalTabs; } @property(nonatomic,getter=isHidden) BOOL hidden; @@ -131,7 +134,7 @@ }]; [self userInterfaceThemeDidChange]; - [self updateTabs]; + initalTabs = [NSArray arrayWithArray:self.viewControllers]; } - (void)userInterfaceThemeDidChange @@ -161,6 +164,8 @@ // Show the tab bar view controller content only when a user is logged in. self.hidden = ([MXKAccountManager sharedManager].accounts.count == 0); + + [self updateTabs]; } - (void)viewDidAppear:(BOOL)animated @@ -884,13 +889,7 @@ - (void)updateTabs { - if (RiotSettings.shared.homeScreenShowCommunitiesTab && RiotSettings.shared.homeScreenShowRoomsTab - && RiotSettings.shared.homeScreenShowPeopleTab && RiotSettings.shared.homeScreenShowFavouritesTab) - { - return; - } - - NSMutableArray *newTabs = [NSMutableArray arrayWithArray:self.viewControllers]; + NSMutableArray *newTabs = [NSMutableArray arrayWithArray:initalTabs]; if (!RiotSettings.shared.homeScreenShowCommunitiesTab) { [newTabs removeObjectAtIndex:TABBAR_GROUPS_INDEX];