From 14f2ed58f169e3d376eaf0c9e1ec44005be22636 Mon Sep 17 00:00:00 2001 From: manuroe Date: Tue, 25 Aug 2020 18:48:09 +0200 Subject: [PATCH] Code Quality: Make sonar happier by removing some code smells --- .gitignore | 1 + CHANGES.rst | 3 +- Riot/AppDelegate.h | 2 +- Riot/AppDelegate.m | 26 +--- Riot/Generated/Images.swift | 3 +- Riot/Generated/InfoPlist.swift | 6 +- Riot/Modules/Call/CallViewController.m | 7 +- .../Camera/CameraAccessAlertPresenter.swift | 3 +- .../Communities/GroupsViewController.m | 112 ------------------ .../Rooms/GroupRoomsViewController.m | 19 --- .../Favorites/FavouritesViewController.m | 5 - Riot/Modules/Home/HomeViewController.m | 5 - .../IntegrationManagerViewController.m | 2 +- .../Widgets/Jitsi/JitsiViewController.m | 2 + ...BackupRecoverFromPrivateKeyViewModel.swift | 2 - ...erificationScanConfirmationViewModel.swift | 3 - .../KeyVerificationVerifyBySASViewModel.swift | 3 - .../DeviceVerificationIncomingViewModel.swift | 5 +- ...VerificationSelfVerifyStartViewModel.swift | 3 - .../DeviceVerificationStartViewModel.swift | 3 - .../UserVerificationStartViewModel.swift | 3 - .../User/UserVerificationCoordinator.swift | 3 +- .../SingleImagePickerPresenter.swift | 3 +- Riot/Modules/Room/RoomViewController.m | 4 +- .../Views/InputToolbar/RoomInputToolbarView.m | 8 -- Riot/Modules/Rooms/RoomsViewController.m | 5 - .../ServiceTermsModalScreenViewModel.swift | 3 - .../ManageSessionViewController.m | 1 - .../Modules/Settings/SettingsViewController.m | 46 ------- 29 files changed, 20 insertions(+), 271 deletions(-) diff --git a/.gitignore b/.gitignore index f7533a2f5..01164a0af 100644 --- a/.gitignore +++ b/.gitignore @@ -34,5 +34,6 @@ fastlane/report.xml fastlane/Reports fastlane/README.md fastlane/Preview.html +fastlane/metadata/ provisioning_profiles/ diff --git a/CHANGES.rst b/CHANGES.rst index 857ec43f3..c28c5d244 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -24,7 +24,8 @@ Translations: * Others: - * Ignore fastlane/Preview.html + * Ignore fastlane/Preview.html + * SonarCloud: Fix some code smells. Build: * diff --git a/Riot/AppDelegate.h b/Riot/AppDelegate.h index 79326d060..9d68fbc0e 100644 --- a/Riot/AppDelegate.h +++ b/Riot/AppDelegate.h @@ -74,7 +74,7 @@ extern NSString *const AppDelegateUniversalLinkDidChangeNotification; /** Let the AppDelegate handle and display self verification requests. - Default is YES; + Default is YES. */ @property (nonatomic) BOOL handleSelfVerificationRequest; diff --git a/Riot/AppDelegate.m b/Riot/AppDelegate.m index 98fbc2734..bf9c2d2f4 100644 --- a/Riot/AppDelegate.m +++ b/Riot/AppDelegate.m @@ -413,23 +413,6 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni NSLog(@"[AppDelegate] didFinishLaunchingWithOptions"); #endif - // User credentials (in MXKAccount) are no more stored in NSUserDefaults but in a file - // as advised at https://forums.developer.apple.com/thread/15685#45849. - // So, there is no more need to loop (sometimes forever) until - // [application isProtectedDataAvailable] becomes YES. - // But, as we are not so sure, loop but no more than 10s. -// // TODO: Remove this loop. -// NSUInteger loopCount = 0; -// -// // Check whether the content protection is active before going further. -// // Should fix the spontaneous logout. -// while (![application isProtectedDataAvailable] && loopCount++ < 50) -// { -// // Wait for protected data. -// [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.2f]]; -// } -// -// NSLog(@"[AppDelegate] didFinishLaunchingWithOptions: isProtectedDataAvailable: %@ (%tu)", @([application isProtectedDataAvailable]), loopCount); NSLog(@"[AppDelegate] didFinishLaunchingWithOptions: isProtectedDataAvailable: %@", @([application isProtectedDataAvailable])); _configuration = [AppConfiguration new]; @@ -1995,14 +1978,6 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni // Use MXFileStore as MXStore to permanently store events. accountManager.storeClass = [MXFileStore class]; - - // Disable APNS use. -// if (accountManager.apnsDeviceToken) -// { -// // We use now Pushkit, unregister for all remote notifications received via Apple Push Notification service. -// [[UIApplication sharedApplication] unregisterForRemoteNotifications]; -// [accountManager setApnsDeviceToken:nil]; -// } // Observers have been defined, we can start a matrix session for each enabled accounts. NSLog(@"[AppDelegate] initMatrixSessions: prepareSessionForActiveAccounts (app state: %tu)", [[UIApplication sharedApplication] applicationState]); @@ -2432,6 +2407,7 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni // Stay in launching during the first server sync if the store is empty. isLaunching = (mainSession.rooms.count == 0 && launchAnimationContainerView); default: + isLaunching = NO; break; } diff --git a/Riot/Generated/Images.swift b/Riot/Generated/Images.swift index 460817ddc..fd1c6d03e 100644 --- a/Riot/Generated/Images.swift +++ b/Riot/Generated/Images.swift @@ -135,7 +135,8 @@ internal struct ImageAsset { #if os(iOS) || os(tvOS) let image = Image(named: name, in: bundle, compatibleWith: nil) #elseif os(macOS) - let image = bundle.image(forResource: NSImage.Name(name)) + let name = NSImage.Name(self.name) + let image = (bundle == .main) ? NSImage(named: name) : bundle.image(forResource: name) #elseif os(watchOS) let image = Image(named: name) #endif diff --git a/Riot/Generated/InfoPlist.swift b/Riot/Generated/InfoPlist.swift index 95bdbe12c..98f156199 100644 --- a/Riot/Generated/InfoPlist.swift +++ b/Riot/Generated/InfoPlist.swift @@ -52,8 +52,7 @@ internal enum InfoPlist { // MARK: - Implementation Details private func arrayFromPlist(at path: String) -> [T] { - let bundle = BundleToken.bundle - guard let url = bundle.url(forResource: path, withExtension: nil), + guard let url = BundleToken.bundle.url(forResource: path, withExtension: nil), let data = NSArray(contentsOf: url) as? [T] else { fatalError("Unable to load PLIST at path: \(path)") } @@ -64,8 +63,7 @@ private struct PlistDocument { let data: [String: Any] init(path: String) { - let bundle = BundleToken.bundle - guard let url = bundle.url(forResource: path, withExtension: nil), + guard let url = BundleToken.bundle.url(forResource: path, withExtension: nil), let data = NSDictionary(contentsOf: url) as? [String: Any] else { fatalError("Unable to load PLIST at path: \(path)") } diff --git a/Riot/Modules/Call/CallViewController.m b/Riot/Modules/Call/CallViewController.m index 0e4cc0951..011b4d46f 100644 --- a/Riot/Modules/Call/CallViewController.m +++ b/Riot/Modules/Call/CallViewController.m @@ -221,10 +221,6 @@ [super viewWillDisappear:animated]; } -- (void)dealloc -{ -} - #pragma mark - override MXKViewController - (void)destroy @@ -366,7 +362,7 @@ { // Detect if we should display the prompt to fallback to the STUN server defined // in the app plist if the homeserver does not provide STUN or TURN servers. - // We should if the call ends while we were in connecting state + // We should display it if the call ends while we were in connecting state if (!self.mainSession.callManager.turnServers && !self.mainSession.callManager.fallbackSTUNServer && !RiotSettings.shared.isAllowStunServerFallbackHasBeenSetOnce) @@ -388,6 +384,7 @@ } default: + // There is nothing to do for other states break; } } diff --git a/Riot/Modules/Camera/CameraAccessAlertPresenter.swift b/Riot/Modules/Camera/CameraAccessAlertPresenter.swift index 721e9f596..52d53f8af 100644 --- a/Riot/Modules/Camera/CameraAccessAlertPresenter.swift +++ b/Riot/Modules/Camera/CameraAccessAlertPresenter.swift @@ -30,8 +30,7 @@ final class CameraAccessAlertPresenter { let alert = UIAlertController(title: VectorL10n.camera, message: VectorL10n.cameraAccessNotGranted(appDisplayName), preferredStyle: .alert) let cancelActionTitle = Bundle.mxk_localizedString(forKey: "ok") - let cancelAction = UIAlertAction(title: cancelActionTitle, style: .cancel, handler: { _ in - }) + let cancelAction = UIAlertAction(title: cancelActionTitle, style: .cancel, handler: nil) let settingsActionTitle = Bundle.mxk_localizedString(forKey: "settings") let settingsAction = UIAlertAction(title: settingsActionTitle, style: .default, handler: { _ in diff --git a/Riot/Modules/Communities/GroupsViewController.m b/Riot/Modules/Communities/GroupsViewController.m index 7596397d1..94b4a47cd 100644 --- a/Riot/Modules/Communities/GroupsViewController.m +++ b/Riot/Modules/Communities/GroupsViewController.m @@ -615,48 +615,6 @@ currentAlert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; -// [currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"room_recents_start_chat_with", @"Vector", nil) -// style:UIAlertActionStyleDefault -// handler:^(UIAlertAction * action) { -// -// if (weakSelf) -// { -// typeof(self) self = weakSelf; -// self->currentAlert = nil; -// -// [self performSegueWithIdentifier:@"presentStartChat" sender:self]; -// } -// -// }]]; -// -// [currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"room_recents_create_empty_room", @"Vector", nil) -// style:UIAlertActionStyleDefault -// handler:^(UIAlertAction * action) { -// -// if (weakSelf) -// { -// typeof(self) self = weakSelf; -// self->currentAlert = nil; -// -// [self createAnEmptyRoom]; -// } -// -// }]]; -// -// [currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"room_recents_join_room", @"Vector", nil) -// style:UIAlertActionStyleDefault -// handler:^(UIAlertAction * action) { -// -// if (weakSelf) -// { -// typeof(self) self = weakSelf; -// self->currentAlert = nil; -// -// [self joinARoom]; -// } -// -// }]]; - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -676,76 +634,6 @@ [self presentViewController:currentAlert animated:YES completion:nil]; } -//- (void)joinARoom -//{ -// [currentAlert dismissViewControllerAnimated:NO completion:nil]; -// -// __weak typeof(self) weakSelf = self; -// -// // Prompt the user to type a room id or room alias -// currentAlert = [UIAlertController alertControllerWithTitle:NSLocalizedStringFromTable(@"room_recents_join_room_title", @"Vector", nil) -// message:NSLocalizedStringFromTable(@"room_recents_join_room_prompt", @"Vector", nil) -// preferredStyle:UIAlertControllerStyleAlert]; -// -// [currentAlert addTextFieldWithConfigurationHandler:^(UITextField *textField) { -// -// textField.secureTextEntry = NO; -// textField.placeholder = nil; -// textField.keyboardType = UIKeyboardTypeDefault; -// }]; -// -// [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] -// style:UIAlertActionStyleDefault -// handler:^(UIAlertAction * action) { -// -// if (weakSelf) -// { -// typeof(self) self = weakSelf; -// self->currentAlert = nil; -// } -// -// }]]; -// -// [currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"join", @"Vector", nil) -// style:UIAlertActionStyleDefault -// handler:^(UIAlertAction * action) { -// -// if (weakSelf) -// { -// typeof(self) self = weakSelf; -// -// NSString *roomAliasOrId = [self->currentAlert textFields].firstObject.text; -// -// self->currentAlert = nil; -// -// [self.activityIndicator startAnimating]; -// -// self->currentRequest = [self.mainSession joinRoom:roomAliasOrId success:^(MXRoom *room) { -// -// self->currentRequest = nil; -// [self.activityIndicator stopAnimating]; -// -// // Show the room -// [[AppDelegate theDelegate] showRoom:room.roomId andEventId:nil withMatrixSession:self.mainSession]; -// -// } failure:^(NSError *error) { -// -// NSLog(@"[RecentsViewController] Join joinARoom (%@) failed", roomAliasOrId); -// -// self->currentRequest = nil; -// [self.activityIndicator stopAnimating]; -// -// // Alert user -// [[AppDelegate theDelegate] showErrorAsAlert:error]; -// }]; -// } -// -// }]]; -// -// [currentAlert mxk_setAccessibilityIdentifier:@"RecentsVCJoinARoomAlert"]; -// [self presentViewController:currentAlert animated:YES completion:nil]; -//} - #pragma mark - Table view scrolling - (void)scrollToTop:(BOOL)animated diff --git a/Riot/Modules/Communities/Rooms/GroupRoomsViewController.m b/Riot/Modules/Communities/Rooms/GroupRoomsViewController.m index 4b017b6c7..4709fb3ed 100644 --- a/Riot/Modules/Communities/Rooms/GroupRoomsViewController.m +++ b/Riot/Modules/Communities/Rooms/GroupRoomsViewController.m @@ -577,25 +577,6 @@ [tableView deselectRowAtIndexPath:indexPath animated:YES]; } -//- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath -//{ -// NSMutableArray* actions; -// -// // @TODO Add the swipe to remove this room from the community if the current user is admin -// actions = [[NSMutableArray alloc] init]; -// -// // Patch: Force the width of the button by adding whitespace characters into the title string. -// UITableViewRowAction *leaveAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@" " handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){ -// -// // @TODO Remove the room -// -// }]; -// -// leaveAction.backgroundColor = [MXKTools convertImageToPatternColor:@"remove_icon_blue" backgroundColor:ThemeService.shared.theme.headerBackgroundColor patternSize:CGSizeMake(74, 74) resourceSize:CGSizeMake(24, 24)]; -// [actions insertObject:leaveAction atIndex:0]; -// -// return actions; -//} #pragma mark - UISearchBar delegate diff --git a/Riot/Modules/Favorites/FavouritesViewController.m b/Riot/Modules/Favorites/FavouritesViewController.m index 2d25a983f..24b499f6b 100644 --- a/Riot/Modules/Favorites/FavouritesViewController.m +++ b/Riot/Modules/Favorites/FavouritesViewController.m @@ -66,11 +66,6 @@ } } -- (void)dealloc -{ - -} - - (void)destroy { [super destroy]; diff --git a/Riot/Modules/Home/HomeViewController.m b/Riot/Modules/Home/HomeViewController.m index b304cb53e..8191800c4 100644 --- a/Riot/Modules/Home/HomeViewController.m +++ b/Riot/Modules/Home/HomeViewController.m @@ -114,11 +114,6 @@ [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; } -- (void)dealloc -{ - -} - - (void)destroy { [super destroy]; diff --git a/Riot/Modules/Integrations/IntegrationManagerViewController.m b/Riot/Modules/Integrations/IntegrationManagerViewController.m index ea29bdb7d..9f1af8d9c 100644 --- a/Riot/Modules/Integrations/IntegrationManagerViewController.m +++ b/Riot/Modules/Integrations/IntegrationManagerViewController.m @@ -349,7 +349,7 @@ NSString *const kIntegrationManagerAddIntegrationScreen = @"add_integ"; if (!widget_id) { - [self sendLocalisedError:@"widget_integration_unable_to_create" toRequest:requestId]; // new Error("Missing required widget fields.")); + [self sendLocalisedError:@"widget_integration_unable_to_create" toRequest:requestId]; return; } diff --git a/Riot/Modules/Integrations/Widgets/Jitsi/JitsiViewController.m b/Riot/Modules/Integrations/Widgets/Jitsi/JitsiViewController.m index 680db5638..3d5cee140 100644 --- a/Riot/Modules/Integrations/Widgets/Jitsi/JitsiViewController.m +++ b/Riot/Modules/Integrations/Widgets/Jitsi/JitsiViewController.m @@ -213,10 +213,12 @@ static const NSString *kJitsiDataErrorKey = @"error"; - (void)conferenceWillJoin:(NSDictionary *)data { + // Nothing to do } - (void)conferenceJoined:(NSDictionary *)data { + // Nothing to do } - (void)conferenceTerminated:(NSDictionary *)data diff --git a/Riot/Modules/KeyBackup/Recover/PrivateKey/KeyBackupRecoverFromPrivateKeyViewModel.swift b/Riot/Modules/KeyBackup/Recover/PrivateKey/KeyBackupRecoverFromPrivateKeyViewModel.swift index 408a404df..cef1d7c0c 100644 --- a/Riot/Modules/KeyBackup/Recover/PrivateKey/KeyBackupRecoverFromPrivateKeyViewModel.swift +++ b/Riot/Modules/KeyBackup/Recover/PrivateKey/KeyBackupRecoverFromPrivateKeyViewModel.swift @@ -40,8 +40,6 @@ final class KeyBackupRecoverFromPrivateKeyViewModel: KeyBackupRecoverFromPrivate self.keyBackupVersion = keyBackupVersion } - deinit { - } // MARK: - Public diff --git a/Riot/Modules/KeyVerification/Common/ScanConfirmation/KeyVerificationScanConfirmationViewModel.swift b/Riot/Modules/KeyVerification/Common/ScanConfirmation/KeyVerificationScanConfirmationViewModel.swift index 7407a0e2f..b0ad17441 100644 --- a/Riot/Modules/KeyVerification/Common/ScanConfirmation/KeyVerificationScanConfirmationViewModel.swift +++ b/Riot/Modules/KeyVerification/Common/ScanConfirmation/KeyVerificationScanConfirmationViewModel.swift @@ -53,9 +53,6 @@ final class KeyVerificationScanConfirmationViewModel: KeyVerificationScanConfirm self.verificationKind = verificationKind } - deinit { - } - // MARK: - Public func process(viewAction: KeyVerificationScanConfirmationViewAction) { diff --git a/Riot/Modules/KeyVerification/Common/Verify/SAS/KeyVerificationVerifyBySASViewModel.swift b/Riot/Modules/KeyVerification/Common/Verify/SAS/KeyVerificationVerifyBySASViewModel.swift index 3f066437e..7ab3c504e 100644 --- a/Riot/Modules/KeyVerification/Common/Verify/SAS/KeyVerificationVerifyBySASViewModel.swift +++ b/Riot/Modules/KeyVerification/Common/Verify/SAS/KeyVerificationVerifyBySASViewModel.swift @@ -46,9 +46,6 @@ final class KeyVerificationVerifyBySASViewModel: KeyVerificationVerifyBySASViewM self.verificationKind = verificationKind } - deinit { - } - // MARK: - Public func process(viewAction: KeyVerificationVerifyBySASViewAction) { diff --git a/Riot/Modules/KeyVerification/Device/Incoming/DeviceVerificationIncomingViewModel.swift b/Riot/Modules/KeyVerification/Device/Incoming/DeviceVerificationIncomingViewModel.swift index 3652fd29b..69a324221 100644 --- a/Riot/Modules/KeyVerification/Device/Incoming/DeviceVerificationIncomingViewModel.swift +++ b/Riot/Modules/KeyVerification/Device/Incoming/DeviceVerificationIncomingViewModel.swift @@ -51,10 +51,7 @@ final class DeviceVerificationIncomingViewModel: DeviceVerificationIncomingViewM self.mediaManager = session.mediaManager } - - deinit { - } - + // MARK: - Public func process(viewAction: DeviceVerificationIncomingViewAction) { diff --git a/Riot/Modules/KeyVerification/Device/SelfVerifyStart/KeyVerificationSelfVerifyStartViewModel.swift b/Riot/Modules/KeyVerification/Device/SelfVerifyStart/KeyVerificationSelfVerifyStartViewModel.swift index b4f3e63ac..07202d705 100644 --- a/Riot/Modules/KeyVerification/Device/SelfVerifyStart/KeyVerificationSelfVerifyStartViewModel.swift +++ b/Riot/Modules/KeyVerification/Device/SelfVerifyStart/KeyVerificationSelfVerifyStartViewModel.swift @@ -45,9 +45,6 @@ final class KeyVerificationSelfVerifyStartViewModel: KeyVerificationSelfVerifySt self.keyVerificationService = KeyVerificationService() } - deinit { - } - // MARK: - Public func process(viewAction: KeyVerificationSelfVerifyStartViewAction) { diff --git a/Riot/Modules/KeyVerification/Device/Start/DeviceVerificationStartViewModel.swift b/Riot/Modules/KeyVerification/Device/Start/DeviceVerificationStartViewModel.swift index 2b2d4aecf..694cb3474 100644 --- a/Riot/Modules/KeyVerification/Device/Start/DeviceVerificationStartViewModel.swift +++ b/Riot/Modules/KeyVerification/Device/Start/DeviceVerificationStartViewModel.swift @@ -45,9 +45,6 @@ final class DeviceVerificationStartViewModel: DeviceVerificationStartViewModelTy self.otherDevice = otherDevice } - deinit { - } - // MARK: - Public func process(viewAction: DeviceVerificationStartViewAction) { diff --git a/Riot/Modules/KeyVerification/User/Start/UserVerificationStartViewModel.swift b/Riot/Modules/KeyVerification/User/Start/UserVerificationStartViewModel.swift index 9b9c1b6ff..c49576c64 100644 --- a/Riot/Modules/KeyVerification/User/Start/UserVerificationStartViewModel.swift +++ b/Riot/Modules/KeyVerification/User/Start/UserVerificationStartViewModel.swift @@ -59,9 +59,6 @@ final class UserVerificationStartViewModel: UserVerificationStartViewModelType { self.keyVerificationService = KeyVerificationService() } - deinit { - } - // MARK: - Public func process(viewAction: UserVerificationStartViewAction) { diff --git a/Riot/Modules/KeyVerification/User/UserVerificationCoordinator.swift b/Riot/Modules/KeyVerification/User/UserVerificationCoordinator.swift index 38d2414d6..ea9b5679a 100644 --- a/Riot/Modules/KeyVerification/User/UserVerificationCoordinator.swift +++ b/Riot/Modules/KeyVerification/User/UserVerificationCoordinator.swift @@ -134,8 +134,7 @@ final class UserVerificationCoordinator: NSObject, UserVerificationCoordinatorTy message: VectorL10n.keyVerificationBootstrapNotSetupMessage, preferredStyle: .alert) - let cancelAction = UIAlertAction(title: Bundle.mxk_localizedString(forKey: "ok"), style: .cancel, handler: { _ in - }) + let cancelAction = UIAlertAction(title: Bundle.mxk_localizedString(forKey: "ok"), style: .cancel, handler: nil) alert.addAction(cancelAction) self.presenter.toPresentable().present(alert, animated: true, completion: nil) diff --git a/Riot/Modules/MediaPicker/SingleImagePickerPresenter.swift b/Riot/Modules/MediaPicker/SingleImagePickerPresenter.swift index 9876aa901..0bb730d60 100644 --- a/Riot/Modules/MediaPicker/SingleImagePickerPresenter.swift +++ b/Riot/Modules/MediaPicker/SingleImagePickerPresenter.swift @@ -64,8 +64,7 @@ final class SingleImagePickerPresenter: NSObject { self.presentPhotoLibray(sourceView: sourceView, sourceRect: sourceRect, animated: animated) }) - let cancelAction = UIAlertAction(title: VectorL10n.cancel, style: .cancel, handler: { _ in - }) + let cancelAction = UIAlertAction(title: VectorL10n.cancel, style: .cancel, handler: nil) alert.addAction(cameraAction) alert.addAction(photoLibraryAction) diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index 5d9f6b7f9..946061357 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -792,8 +792,8 @@ // Refresh here the preview header according to the coming screen orientation. // Retrieve the affine transform indicating the amount of rotation being applied to the interface. - // This transform is the identity transform when no rotation is applied; - // otherwise, it is a transform that applies a 90 degree, -90 degree, or 180 degree rotation. + // This transform is the identity transform when no rotation is applied. + // Otherwise, it is a transform that applies a 90 degree, -90 degree, or 180 degree rotation. CGAffineTransform transform = coordinator.targetTransform; // Consider here only the transform that applies a +/- 90 degree. diff --git a/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m b/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m index 533bf7c8c..605b06623 100644 --- a/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m +++ b/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m @@ -248,14 +248,6 @@ #pragma mark - HPGrowingTextView delegate -//- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)hpGrowingTextView -//{ -// // The return sends the message rather than giving a carriage return. -// [self onTouchUpInside:self.rightInputToolbarButton]; -// -// return NO; -//} - - (void)growingTextViewDidChange:(HPGrowingTextView *)hpGrowingTextView { // Clean the carriage return added on return press diff --git a/Riot/Modules/Rooms/RoomsViewController.m b/Riot/Modules/Rooms/RoomsViewController.m index 23195cafe..7c9e404a2 100644 --- a/Riot/Modules/Rooms/RoomsViewController.m +++ b/Riot/Modules/Rooms/RoomsViewController.m @@ -84,11 +84,6 @@ } } -- (void)dealloc -{ - -} - - (void)destroy { [super destroy]; diff --git a/Riot/Modules/ServiceTerms/Modal/Modal/ServiceTermsModalScreenViewModel.swift b/Riot/Modules/ServiceTerms/Modal/Modal/ServiceTermsModalScreenViewModel.swift index 063b45552..87cfc3a92 100644 --- a/Riot/Modules/ServiceTerms/Modal/Modal/ServiceTermsModalScreenViewModel.swift +++ b/Riot/Modules/ServiceTerms/Modal/Modal/ServiceTermsModalScreenViewModel.swift @@ -48,9 +48,6 @@ final class ServiceTermsModalScreenViewModel: ServiceTermsModalScreenViewModelTy self.outOfContext = outOfContext } - deinit { - } - // MARK: - Public func process(viewAction: ServiceTermsModalScreenViewAction) { diff --git a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m index 8042ab63e..235652aec 100644 --- a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m +++ b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m @@ -732,7 +732,6 @@ enum { { NSLog(@"[ManageSessionVC] Delete device (%@) failed, auth session flow type is not supported", self->device.deviceId); [self.activityIndicator stopAnimating]; - //[[AppDelegate theDelegate] showErrorAsAlert:error]; } } failure:^(NSError *error) { diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index c123bf9e4..eb8f1222a 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -93,12 +93,6 @@ enum NOTIFICATION_SETTINGS_GLOBAL_SETTINGS_INDEX, NOTIFICATION_SETTINGS_PIN_MISSED_NOTIFICATIONS_INDEX, NOTIFICATION_SETTINGS_PIN_UNREAD_INDEX, - //NOTIFICATION_SETTINGS_CONTAINING_MY_USER_NAME_INDEX, - //NOTIFICATION_SETTINGS_CONTAINING_MY_DISPLAY_NAME_INDEX, - //NOTIFICATION_SETTINGS_SENT_TO_ME_INDEX, - //NOTIFICATION_SETTINGS_INVITED_TO_ROOM_INDEX, - //NOTIFICATION_SETTINGS_PEOPLE_LEAVE_JOIN_INDEX, - //NOTIFICATION_SETTINGS_CALL_INVITATION_INDEX, }; enum @@ -3014,46 +3008,6 @@ TableViewSectionsDelegate> [self pushViewController:newPhoneNumberCountryPicker]; } -//- (void)onRuleUpdate:(id)sender -//{ -// MXPushRule* pushRule = nil; -// MXSession* session = [[AppDelegate theDelegate].mxSessions objectAtIndex:0]; -// -// NSInteger row = ((UIView*)sender).tag; -// -// if (row == NOTIFICATION_SETTINGS_CONTAINING_MY_DISPLAY_NAME_INDEX) -// { -// pushRule = [session.notificationCenter ruleById:kMXNotificationCenterContainDisplayNameRuleID]; -// } -// else if (row == NOTIFICATION_SETTINGS_CONTAINING_MY_USER_NAME_INDEX) -// { -// pushRule = [session.notificationCenter ruleById:kMXNotificationCenterContainUserNameRuleID]; -// } -// else if (row == NOTIFICATION_SETTINGS_SENT_TO_ME_INDEX) -// { -// pushRule = [session.notificationCenter ruleById:kMXNotificationCenterOneToOneRoomRuleID]; -// } -// else if (row == NOTIFICATION_SETTINGS_INVITED_TO_ROOM_INDEX) -// { -// pushRule = [session.notificationCenter ruleById:kMXNotificationCenterInviteMeRuleID]; -// } -// else if (row == NOTIFICATION_SETTINGS_PEOPLE_LEAVE_JOIN_INDEX) -// { -// pushRule = [session.notificationCenter ruleById:kMXNotificationCenterMemberEventRuleID]; -// } -// else if (row == NOTIFICATION_SETTINGS_CALL_INVITATION_INDEX) -// { -// pushRule = [session.notificationCenter ruleById:kMXNotificationCenterCallRuleID]; -// } -// -// if (pushRule) -// { -// // toggle the rule -// [session.notificationCenter enableRule:pushRule isEnabled:!pushRule.enabled]; -// } -//} - - - (void)onSave:(id)sender { // sanity check