diff --git a/CHANGES.rst b/CHANGES.rst index d4d3f5727..0b7f748a4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,26 @@ +Changes in Vector iOS in 0.1.6 (2016-05-04) +=============================================== + +Improvements: + * Upgrade MatrixKit version (v0.3.7). + * Room member details: Order members by power levels (me, admins then moderators then others). + * Room member details: Sort members with the same algo as Vector web client. + * Universal link: Add www.vector.im as associated domain. + * Chat screen: Open member details on tap-on-avatar #294. + * Ability to report abuse #295. + * Ability to ignore users #295. + +Bug fixes: + * 6+/iPad: Better manage user with no room in landscape #268. + * Handle the error on joining a room where everyone has left #283. + * Video playback stops when you rotate the device #266. + * 'Enable notifications on your device' toggle spills over the side on an iPhone 5 display #167. + * Media Picker: user's albums are missing #208. + * Authentication screen: inputs fields are missing (blank screen) on first app launch. + * Room member details: only the "start chat" text is clickable, not that whole button area. #282 + * Media Picker: Fix icons used on video preview. + * Room Participants - Search session: the return key must be 'Done' instead of 'Search' #292. + Changes in Vector iOS in 0.1.5 (2016-04-27) =============================================== diff --git a/Podfile b/Podfile index 8eda6cec7..c7a05d59e 100644 --- a/Podfile +++ b/Podfile @@ -8,7 +8,7 @@ target "Vector" do # Different flavours of pods to MatrixKit # The tagged version on which this version of Console has been built -#pod 'MatrixKit', '~> 0.3.6' +#pod 'MatrixKit', '~> 0.3.7' # The lastest release available on the CocoaPods repository #pod 'MatrixKit' @@ -24,8 +24,5 @@ pod 'MatrixKit', :git => 'https://github.com/matrix-org/matrix-ios-kit.git', :br pod 'GBDeviceInfo', '~> 3.4.0' - - - end diff --git a/Podfile.lock b/Podfile.lock index a5fb57051..241a21f57 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -24,12 +24,12 @@ PODS: - GBJailbreakDetection (~> 1.0) - GBJailbreakDetection (1.3.0) - HPGrowingTextView (1.1) - - libPhoneNumber-iOS (0.8.11) - - MatrixKit (0.3.6): + - libPhoneNumber-iOS (0.8.12) + - MatrixKit (0.3.7): - HPGrowingTextView (~> 1.1) - libPhoneNumber-iOS (~> 0.8.7) - - MatrixSDK (~> 0.6.6) - - MatrixSDK (0.6.6): + - MatrixSDK (~> 0.6.7) + - MatrixSDK (0.6.7): - AFNetworking (~> 2.6.0) DEPENDENCIES: @@ -47,10 +47,10 @@ EXTERNAL SOURCES: CHECKOUT OPTIONS: MatrixKit: - :commit: def36b2e672c7b242b781e983b5e6451705bf49b + :commit: f11f4db8316de760e0bf97b7a623c83d82aebca3 :git: https://github.com/matrix-org/matrix-ios-kit.git MatrixSDK: - :commit: be44b85021516f5c6c95df77b3e5a538405f49b7 + :commit: 33b97ce44c93e2936dcd437bd7eeafe4f83f82e5 :git: https://github.com/matrix-org/matrix-ios-sdk.git SPEC CHECKSUMS: @@ -58,8 +58,8 @@ SPEC CHECKSUMS: GBDeviceInfo: bab0f43d351b6f641a626cd7d21492abef1afe46 GBJailbreakDetection: a216773574b62dddb6c876ffdb52c54ac05e27e0 HPGrowingTextView: 88a716d97fb853bcb08a4a08e4727da17efc9b19 - libPhoneNumber-iOS: ded33fab2c51ee847979556aa504c9e70f32d703 - MatrixKit: 4f5350456d503575cd40e9a9a9e672a7bb326d85 - MatrixSDK: dcf3a2cc6478a6a1f0c8b8eaead78b74ada7c439 + libPhoneNumber-iOS: 3f1889b70403cf7848c0e4136780a0d0aef9016d + MatrixKit: 579965124d6095186a80a827494b9babcd7be91c + MatrixSDK: 0ee4a7fbf85ee6e966d36aeccf767e82245f0cc0 COCOAPODS: 0.39.0 diff --git a/Vector/AppDelegate.m b/Vector/AppDelegate.m index cd87ffa34..ad04d246d 100644 --- a/Vector/AppDelegate.m +++ b/Vector/AppDelegate.m @@ -561,8 +561,11 @@ // Dispatch the completion in order to let navigation stack refresh itself // It is required to display the auth VC at startup dispatch_async(dispatch_get_main_queue(), ^{ - completion(); - }); + if (completion) + { + completion(); + } + }); } } @@ -1164,6 +1167,15 @@ [self logout]; } }]; + + [[NSNotificationCenter defaultCenter] addObserverForName:kMXSessionIgnoredUsersDidChangeNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull notif) { + + NSLog(@"[AppDelegate] kMXSessionIgnoredUsersDidChangeNotification received. Reload the app"); + + // Reload entirely the app when a user has been ignored or unignored + [[AppDelegate theDelegate] reloadMatrixSessions:YES]; + + }]; // Observe settings changes [[MXKAppSettings standardAppSettings] addObserver:self forKeyPath:@"showAllEventsInRoomHistory" options:0 context:nil]; diff --git a/Vector/Assets/en.lproj/Vector.strings b/Vector/Assets/en.lproj/Vector.strings index 812f15985..e904ba531 100644 --- a/Vector/Assets/en.lproj/Vector.strings +++ b/Vector/Assets/en.lproj/Vector.strings @@ -133,8 +133,10 @@ "room_participants_action_invite" = "Invite"; "room_participants_action_leave" = "Leave this room"; "room_participants_action_remove" = "Remove from this room"; -"room_participants_action_ban" = "Block"; -"room_participants_action_unban" = "Unblock"; +"room_participants_action_ban" = "Ban from this room"; +"room_participants_action_unban" = "Unban"; +"room_participants_action_ignore" = "Hide all messages from this user"; +"room_participants_action_unignore" = "Show all messages from this user"; "room_participants_action_set_default_power_level" = "Reset to normal user"; "room_participants_action_set_moderator" = "Make moderator"; "room_participants_action_set_admin" = "Make admin"; @@ -156,6 +158,9 @@ "room_event_action_share" = "Share"; "room_event_action_redact" = "Redact"; "room_event_action_permalink" = "Permalink"; +"room_event_action_report" = "Report content"; +"room_event_action_report_prompt_reason" = "Reason for reporting this content"; +"room_event_action_report_prompt_ignore_user" = "Do you want to hide all messages from this user?"; "room_event_action_save" = "Save"; "room_event_action_resend" = "Resend"; "room_event_action_delete" = "Delete"; @@ -198,7 +203,7 @@ "settings_phone_number" = "Phone Number"; "settings_night_mode" = "Night Mode"; -"settings_enable_push_notif" = "Enable notifications on your device"; +"settings_enable_push_notif" = "Notifications on this device"; "settings_global_settings_info" = "Global notification settings are available on your Vector web client"; //"settings_enable_all_notif" = "Enable all notifications"; //"settings_messages_my_display_name" = "Msg containing my display name"; diff --git a/Vector/Base.lproj/Main.storyboard b/Vector/Base.lproj/Main.storyboard index 74dbc20af..e49873652 100644 --- a/Vector/Base.lproj/Main.storyboard +++ b/Vector/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - + @@ -37,12 +37,31 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Vector/Info.plist b/Vector/Info.plist index b3a29ec3b..32686dbe4 100644 --- a/Vector/Info.plist +++ b/Vector/Info.plist @@ -36,7 +36,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.1.5 + 0.1.6 CFBundleSignature ???? CFBundleVersion diff --git a/Vector/Utils/Tools.h b/Vector/Utils/Tools.h index 9705c5eeb..89e7fc48f 100644 --- a/Vector/Utils/Tools.h +++ b/Vector/Utils/Tools.h @@ -28,9 +28,13 @@ */ + (NSString*)presenceText:(MXUser*)user; - #pragma mark - Universal link +/** + The url of the Vector web application. + */ ++ (NSString*)webAppUrl; + /** Detect if a URL is a universal link for the application. diff --git a/Vector/Utils/Tools.m b/Vector/Utils/Tools.m index 3b9ba03a4..9a2ce9adb 100644 --- a/Vector/Utils/Tools.m +++ b/Vector/Utils/Tools.m @@ -61,6 +61,13 @@ #pragma mark - Universal link ++ (NSString *)webAppUrl +{ + // FIXME: When available, use the prod Vector web app URL + return [[NSUserDefaults standardUserDefaults] objectForKey:@"webAppUrlBeta"]; + //return [[NSUserDefaults standardUserDefaults] objectForKey:@"webAppUrlDev"]; +} + + (BOOL)isUniversalLink:(NSURL*)url { BOOL isUniversalLink = NO; diff --git a/Vector/Vector-Defaults.plist b/Vector/Vector-Defaults.plist index 52ae90cbb..8c60cb6a0 100644 --- a/Vector/Vector-Defaults.plist +++ b/Vector/Vector-Defaults.plist @@ -11,11 +11,13 @@ identityserverurl https://vector.im homeserverurl - https://matrix.org + https://vector.im homeserver matrix.org webAppUrlDev https://vector.im/develop + webAppUrlBeta + https://vector.im/beta apnsDeviceToken showAllEventsInRoomHistory diff --git a/Vector/ViewController/AuthenticationViewController.m b/Vector/ViewController/AuthenticationViewController.m index e8f5cdc43..bf6bc1cbe 100644 --- a/Vector/ViewController/AuthenticationViewController.m +++ b/Vector/ViewController/AuthenticationViewController.m @@ -23,6 +23,17 @@ #import "VectorDesignValues.h" +@interface AuthenticationViewController () +{ + /** + Store the potential login error received by using the new default homeserver (vector.im) + while we retry a login process against the matrix.org HS. + */ + NSError *loginError; +} + +@end + @implementation AuthenticationViewController + (UINib *)nib @@ -232,6 +243,48 @@ } } +- (void)onFailureDuringAuthRequest:(NSError *)error +{ + // Homeserver migration: the default homeserver url has been updated with https://vector.im. + // The login process with an existing matrix.org accounts will then fail. + // Patch: Falling back to matrix.org HS so we don't break everyone's logins + if (self.authType == MXKAuthenticationTypeLogin) + { + if ([self.homeServerTextField.text isEqualToString:@"https://vector.im"]) + { + MXError *mxError = [[MXError alloc] initWithNSError:error]; + if (mxError && [mxError.errcode isEqualToString:kMXErrCodeStringForbidden]) + { + // Retry against the matrix.org HS + NSLog(@"[MXKAuthenticationVC] Falling back to matrix.org HS"); + + loginError = error; + [self setHomeServerTextFieldText:@"https://matrix.org"]; + + [self onButtonPressed:self.submitButton]; + + return; + } + } + else if (loginError) + { + // This is not an existing matrix.org accounts + NSLog(@"[MXKAuthenticationVC] This is not an existing matrix.org accounts"); + + // Restore the default HS + [self setHomeServerTextFieldText: @"https://vector.im"]; + + // Consider the original login error + [super onFailureDuringAuthRequest:loginError]; + loginError = nil; + + return; + } + } + + [super onFailureDuringAuthRequest:loginError]; +} + #pragma mark - - (void)hideServerOptionsContainer:(BOOL)hidden diff --git a/Vector/ViewController/RoomMemberDetailsViewController.m b/Vector/ViewController/RoomMemberDetailsViewController.m index f3d8b50e8..daeb334a1 100644 --- a/Vector/ViewController/RoomMemberDetailsViewController.m +++ b/Vector/ViewController/RoomMemberDetailsViewController.m @@ -358,8 +358,22 @@ { [actionsArray addObject:@(MXKRoomMemberDetailsActionBan)]; } + + // Check whether the option Ignore may be presented + if (self.mxRoomMember.membership == MXMembershipJoin) + { + // is he already ignored ? + if (![self.mainSession isUserIgnored:self.mxRoomMember.userId]) + { + [actionsArray addObject:@(MXKRoomMemberDetailsActionIgnore)]; + } + else + { + [actionsArray addObject:@(MXKRoomMemberDetailsActionUnignore)]; + } + } break; - } + } case MXMembershipLeave: { // Check conditions to be able to invite someone @@ -414,6 +428,12 @@ case MXKRoomMemberDetailsActionUnban: title = NSLocalizedStringFromTable(@"room_participants_action_unban", @"Vector", nil); break; + case MXKRoomMemberDetailsActionIgnore: + title = NSLocalizedStringFromTable(@"room_participants_action_ignore", @"Vector", nil); + break; + case MXKRoomMemberDetailsActionUnignore: + title = NSLocalizedStringFromTable(@"room_participants_action_unignore", @"Vector", nil); + break; case MXKRoomMemberDetailsActionSetDefaultPowerLevel: title = NSLocalizedStringFromTable(@"room_participants_action_set_default_power_level", @"Vector", nil); break; diff --git a/Vector/ViewController/RoomViewController.m b/Vector/ViewController/RoomViewController.m index 3b43b5f6e..c97de8cf7 100644 --- a/Vector/ViewController/RoomViewController.m +++ b/Vector/ViewController/RoomViewController.m @@ -34,6 +34,7 @@ #import "PreviewRoomTitleView.h" #import "RoomParticipantsViewController.h" +#import "RoomMemberDetailsViewController.h" #import "SegmentedViewController.h" #import "RoomSettingsViewController.h" @@ -97,8 +98,6 @@ CGPoint startScrollingPoint; } -@property (strong, nonatomic) MXKAlert *currentAlert; - @end @implementation RoomViewController @@ -276,10 +275,10 @@ [super viewWillDisappear:animated]; // hide action - if (self.currentAlert) + if (currentAlert) { - [self.currentAlert dismiss:NO]; - self.currentAlert = nil; + [currentAlert dismiss:NO]; + currentAlert = nil; } [self removeTypingNotificationsListener]; @@ -569,10 +568,10 @@ { self.navigationItem.rightBarButtonItem.enabled = NO; - if (self.currentAlert) + if (currentAlert) { - [self.currentAlert dismiss:NO]; - self.currentAlert = nil; + [currentAlert dismiss:NO]; + currentAlert = nil; } if (customizedRoomDataSource) @@ -1047,7 +1046,15 @@ // Handle here user actions on bubbles for Vector app if (customizedRoomDataSource) { - if ([actionIdentifier isEqualToString:kMXKRoomBubbleCellTapOnMessageTextView] || [actionIdentifier isEqualToString:kMXKRoomBubbleCellTapOnContentView]) + if ([actionIdentifier isEqualToString:kMXKRoomBubbleCellTapOnAvatarView]) + { + selectedRoomMember = [self.roomDataSource.room.state memberWithUserId:userInfo[kMXKRoomBubbleCellUserIdKey]]; + if (selectedRoomMember) + { + [self performSegueWithIdentifier:@"showMemberDetails" sender:self]; + } + } + else if ([actionIdentifier isEqualToString:kMXKRoomBubbleCellTapOnMessageTextView] || [actionIdentifier isEqualToString:kMXKRoomBubbleCellTapOnContentView]) { // Retrieve the tapped event MXEvent *tappedEvent = userInfo[kMXKRoomBubbleCellEventKey]; @@ -1081,19 +1088,19 @@ if (selectedEvent) { - if (self.currentAlert) + if (currentAlert) { - [self.currentAlert dismiss:NO]; - self.currentAlert = nil; + [currentAlert dismiss:NO]; + currentAlert = nil; } __weak __typeof(self) weakSelf = self; - self.currentAlert = [[MXKAlert alloc] initWithTitle:nil message:nil style:MXKAlertStyleActionSheet]; + currentAlert = [[MXKAlert alloc] initWithTitle:nil message:nil style:MXKAlertStyleActionSheet]; // Add actions for a failed event if (selectedEvent.mxkState == MXKEventStateSendingFailed) { - [self.currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_resend", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + [currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_resend", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { __strong __typeof(weakSelf)strongSelf = weakSelf; [strongSelf cancelEventSelection]; @@ -1103,7 +1110,7 @@ }]; - [self.currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_delete", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + [currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_delete", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { __strong __typeof(weakSelf)strongSelf = weakSelf; [strongSelf cancelEventSelection]; @@ -1127,7 +1134,7 @@ selectedComponent = nil; } - [self.currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_copy", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + [currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_copy", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { __strong __typeof(weakSelf)strongSelf = weakSelf; [strongSelf cancelEventSelection]; @@ -1136,7 +1143,7 @@ }]; - [self.currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_share", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + [currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_share", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { __strong __typeof(weakSelf)strongSelf = weakSelf; [strongSelf cancelEventSelection]; @@ -1157,7 +1164,7 @@ { if (attachment.type == MXKAttachmentTypeImage || attachment.type == MXKAttachmentTypeVideo) { - [self.currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_save", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + [currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_save", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { __strong __typeof(weakSelf)strongSelf = weakSelf; [strongSelf cancelEventSelection]; @@ -1185,7 +1192,7 @@ }]; } - [self.currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_copy", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + [currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_copy", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { __strong __typeof(weakSelf)strongSelf = weakSelf; [strongSelf cancelEventSelection]; @@ -1211,7 +1218,7 @@ [roomBubbleTableViewCell startProgressUI]; }]; - [self.currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_share", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + [currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_share", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { __strong __typeof(weakSelf)strongSelf = weakSelf; [strongSelf cancelEventSelection]; @@ -1249,7 +1256,7 @@ NSString *uploadId = roomBubbleTableViewCell.bubbleData.attachment.actualURL; if ([MXKMediaManager existingUploaderWithId:uploadId]) { - [self.currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_cancel_upload", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + [currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_cancel_upload", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { __strong __typeof(weakSelf)strongSelf = weakSelf; [strongSelf cancelEventSelection]; @@ -1274,7 +1281,7 @@ NSString *cacheFilePath = roomBubbleTableViewCell.bubbleData.attachment.cacheFilePath; if ([MXKMediaManager existingDownloaderWithOutputFilePath:cacheFilePath]) { - [self.currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_cancel_download", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + [currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_cancel_download", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { __strong __typeof(weakSelf)strongSelf = weakSelf; [strongSelf cancelEventSelection]; @@ -1292,7 +1299,7 @@ } } - [self.currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_redact", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + [currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_redact", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { __strong __typeof(weakSelf)strongSelf = weakSelf; [strongSelf cancelEventSelection]; @@ -1316,25 +1323,110 @@ }]; }]; - [self.currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_permalink", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + [currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_permalink", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { __strong __typeof(weakSelf)strongSelf = weakSelf; [strongSelf cancelEventSelection]; // Create a permalink that is common to all Vector.im clients - // FIXME: When available, use the prod Vector web app URL - NSString *webAppUrl = [[NSUserDefaults standardUserDefaults] objectForKey:@"webAppUrlDev"]; - NSString *permalink = [NSString stringWithFormat:@"%@/#/room/%@/%@", - webAppUrl, + [Tools webAppUrl], selectedEvent.roomId, selectedEvent.eventId]; [[UIPasteboard generalPasteboard] setString:permalink]; }]; + + [currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_event_action_report", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + + __strong __typeof(weakSelf)strongSelf = weakSelf; + [strongSelf cancelEventSelection]; + + // Prompt user to enter a description of the problem content. + MXKAlert *reasonAlert = [[MXKAlert alloc] initWithTitle:NSLocalizedStringFromTable(@"room_event_action_report_prompt_reason", @"Vector", nil) message:nil style:MXKAlertStyleAlert]; + + [reasonAlert addTextFieldWithConfigurationHandler:^(UITextField *textField) { + textField.secureTextEntry = NO; + textField.placeholder = nil; + textField.keyboardType = UIKeyboardTypeDefault; + }]; + + [reasonAlert addActionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + + UITextField *textField = [alert textFieldAtIndex:0]; + + __strong __typeof(weakSelf)strongSelf = weakSelf; + strongSelf->currentAlert = nil; + + [strongSelf startActivityIndicator]; + + [strongSelf.roomDataSource.room reportEvent:selectedEvent.eventId score:-100 reason:textField.text success:^{ + + __strong __typeof(weakSelf)strongSelf = weakSelf; + [strongSelf stopActivityIndicator]; + + // Prompt user to ignore content from this user + MXKAlert *ignoreAlert = [[MXKAlert alloc] initWithTitle:NSLocalizedStringFromTable(@"room_event_action_report_prompt_ignore_user", @"Vector", nil) message:nil style:MXKAlertStyleAlert]; + + [ignoreAlert addActionWithTitle:[NSBundle mxk_localizedStringForKey:@"yes"] style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + + __strong __typeof(weakSelf)strongSelf = weakSelf; + strongSelf->currentAlert = nil; + + [strongSelf startActivityIndicator]; + + // Add the user to the blacklist: ignored users + [strongSelf.mainSession ignoreUsers:@[selectedEvent.sender] success:^{ + + __strong __typeof(weakSelf)strongSelf = weakSelf; + [strongSelf stopActivityIndicator]; + + } failure:^(NSError *error) { + + __strong __typeof(weakSelf)strongSelf = weakSelf; + [strongSelf stopActivityIndicator]; + + NSLog(@"[Vector RoomVC] Ignore user (%@) failed", selectedEvent.sender); + //Alert user + [[AppDelegate theDelegate] showErrorAsAlert:error]; + + }]; + + }]; + + ignoreAlert.cancelButtonIndex = [ignoreAlert addActionWithTitle:[NSBundle mxk_localizedStringForKey:@"no"] style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + + __strong __typeof(weakSelf)strongSelf = weakSelf; + strongSelf->currentAlert = nil; + }]; + + strongSelf->currentAlert = ignoreAlert; + [ignoreAlert showInViewController:strongSelf]; + + } failure:^(NSError *error) { + + __strong __typeof(weakSelf)strongSelf = weakSelf; + [strongSelf stopActivityIndicator]; + + NSLog(@"[Vector RoomVC] Report event (%@) failed", selectedEvent.eventId); + //Alert user + [[AppDelegate theDelegate] showErrorAsAlert:error]; + + }]; + }]; + + reasonAlert.cancelButtonIndex = [reasonAlert addActionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + + __strong __typeof(weakSelf)strongSelf = weakSelf; + strongSelf->currentAlert = nil; + }]; + + strongSelf->currentAlert = reasonAlert; + [reasonAlert showInViewController:strongSelf]; + }]; } - self.currentAlert.cancelButtonIndex = [self.currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"cancel", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + currentAlert.cancelButtonIndex = [currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"cancel", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { __strong __typeof(weakSelf)strongSelf = weakSelf; [strongSelf cancelEventSelection]; @@ -1342,14 +1434,14 @@ }]; // Do not display empty action sheet - if (self.currentAlert.cancelButtonIndex) + if (currentAlert.cancelButtonIndex) { - self.currentAlert.sourceView = roomBubbleTableViewCell; - [self.currentAlert showInViewController:self]; + currentAlert.sourceView = roomBubbleTableViewCell; + [currentAlert showInViewController:self]; } else { - self.currentAlert = nil; + currentAlert = nil; } } } @@ -1392,10 +1484,10 @@ - (void)cancelEventSelection { - if (self.currentAlert) + if (currentAlert) { - [self.currentAlert dismiss:NO]; - self.currentAlert = nil; + [currentAlert dismiss:NO]; + currentAlert = nil; } customizedRoomDataSource.selectedEventId = nil; @@ -1463,6 +1555,21 @@ RoomSearchDataSource *roomSearchDataSource = [[RoomSearchDataSource alloc] initWithRoomDataSource:self.roomDataSource andMatrixSession:self.mainSession]; [roomSearchViewController displaySearch:roomSearchDataSource]; } + else if ([[segue identifier] isEqualToString:@"showMemberDetails"]) + { + if (selectedRoomMember) + { + RoomMemberDetailsViewController *memberViewController = pushedViewController; + // Set rageShake handler + memberViewController.rageShakeManager = [RageShakeManager sharedManager]; + // Set delegate to handle start chat option + memberViewController.delegate = [AppDelegate theDelegate]; + + [memberViewController displayRoomMember:selectedRoomMember withMatrixRoom:self.roomDataSource.room]; + + selectedRoomMember = nil; + } + } // Hide back button title self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil]; @@ -1883,23 +1990,23 @@ } andIconTapGesture:^{ - if (self.currentAlert) + if (currentAlert) { - [self.currentAlert dismiss:NO]; + [currentAlert dismiss:NO]; } __weak __typeof(self) weakSelf = self; - self.currentAlert = [[MXKAlert alloc] initWithTitle:nil message:nil style:MXKAlertStyleActionSheet]; + currentAlert = [[MXKAlert alloc] initWithTitle:nil message:nil style:MXKAlertStyleActionSheet]; - [self.currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_resend_unsent_messages", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + [currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_resend_unsent_messages", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { __strong __typeof(weakSelf)strongSelf = weakSelf; [strongSelf resendAllUnsentMessages]; - strongSelf.currentAlert = nil; + strongSelf->currentAlert = nil; }]; - [self.currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_delete_unsent_messages", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + [currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"room_delete_unsent_messages", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { __strong __typeof(weakSelf)strongSelf = weakSelf; @@ -1916,18 +2023,18 @@ index ++; } } - strongSelf.currentAlert = nil; + strongSelf->currentAlert = nil; }]; - self.currentAlert.cancelButtonIndex = [self.currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"cancel", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { + currentAlert.cancelButtonIndex = [currentAlert addActionWithTitle:NSLocalizedStringFromTable(@"cancel", @"Vector", nil) style:MXKAlertActionStyleDefault handler:^(MXKAlert *alert) { __strong __typeof(weakSelf)strongSelf = weakSelf; - strongSelf.currentAlert = nil; + strongSelf->currentAlert = nil; }]; - self.currentAlert.sourceView = roomActivitiesView; - [self.currentAlert showInViewController:self]; + currentAlert.sourceView = roomActivitiesView; + [currentAlert showInViewController:self]; }]; } diff --git a/Vector/ViewController/SettingsViewController.m b/Vector/ViewController/SettingsViewController.m index bfa3ce616..7a4b7c442 100644 --- a/Vector/ViewController/SettingsViewController.m +++ b/Vector/ViewController/SettingsViewController.m @@ -710,9 +710,10 @@ enableAllCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_enable_push_notif", @"Vector", nil); enableAllCell.mxkSwitch.on = account.pushNotificationServiceIsActive; - [enableAllCell.mxkSwitch removeTarget:self action:nil forControlEvents:UIControlEventTouchUpInside]; + [enableAllCell.mxkSwitch removeTarget:self action:nil forControlEvents:UIControlEventTouchUpInside]; [enableAllCell.mxkSwitch addTarget:self action:@selector(togglePushNotifications:) forControlEvents:UIControlEventTouchUpInside]; + [enableAllCell layoutIfNeeded]; cell = enableAllCell; } else if (row == NOTIFICATION_SETTINGS_GLOBAL_SETTINGS_INDEX) diff --git a/Vector/Views/Authentication/AuthInputsView.m b/Vector/Views/Authentication/AuthInputsView.m index 09ee7bc01..bad5b9cbb 100644 --- a/Vector/Views/Authentication/AuthInputsView.m +++ b/Vector/Views/Authentication/AuthInputsView.m @@ -17,6 +17,7 @@ #import "AuthInputsView.h" #import "VectorDesignValues.h" +#import "Tools.h" @interface AuthInputsView () { @@ -332,11 +333,8 @@ submittedEmail = [[MXK3PID alloc] initWithMedium:kMX3PIDMediumEmail andAddress:self.emailTextField.text]; // Create the next link that is common to all Vector.im clients - // FIXME: When available, use the prod Vector web app URL - NSString *webAppUrl = [[NSUserDefaults standardUserDefaults] objectForKey:@"webAppUrlDev"]; - NSString *nextLink = [NSString stringWithFormat:@"%@/#/register?client_secret=%@&hs_url=%@&is_url=%@&session_id=%@", - webAppUrl, + [Tools webAppUrl], [submittedEmail.clientSecret stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]], [restClient.homeserver stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]], [restClient.identityServer stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]],