Merge branch 'develop' into doug/4528_fix_share_extension_search_layout

This commit is contained in:
Doug 2021-07-13 17:10:43 +01:00 committed by GitHub
commit 61256a7383
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
206 changed files with 2135 additions and 299 deletions

View file

@ -2,7 +2,6 @@
disabled_rules:
- trailing_whitespace
- todo
- conditional_binding_cascade
- mark
- vertical_whitespace
- syntactic_sugar

View file

@ -5,9 +5,18 @@ Changes to be released in next version
*
🙌 Improvements
*
* Room Notification Settings: Ability to change between "All Messages", "Mentions and Keywords" and "None". Not yet exposed in Element UI. (#4458).
* Add support for sending slow motion videos (#4483).
🐛 Bugfix
* VoIP: Do not present ended calls.
* More fixes to Main.storyboard layout on iPhone 12 Pro Max (#4527)
* Fix crash on Apple Silicon Macs.
* Media Picker: Generate video thumbnails with the correct orientation (#4515).
* Directory List (pop-up one): Fix duplicate rooms being shown (#4537).
* Use different title for scan button for self verification (#4525).
* it's easy for the back button to trigger a leftpanel reveal (#4438).
* Show / hide reset button in secrets recovery screen (#4546).
* Share Extension: Fix layout when searching (#4258).
⚠️ API Changes
@ -20,7 +29,7 @@ Changes to be released in next version
*
Others
*
* Silenced some documentation, deprecations and SwiftLint warnings.
Changes in 1.4.4 (2021-06-30)
=================================================

View file

@ -295,6 +295,7 @@ final class BuildSettings: NSObject {
static let roomSettingsScreenShowFlairSettings: Bool = true
static let roomSettingsScreenShowAdvancedSettings: Bool = true
static let roomSettingsScreenAdvancedShowEncryptToVerifiedOption: Bool = true
static let roomSettingsScreenShowNotificationsV2: Bool = false
// MARK: - Room Member Screen
@ -320,6 +321,9 @@ final class BuildSettings: NSObject {
static let authScreenShowForgotPassword = true
static let authScreenShowCustomServerOptions = true
// Mark: - Unified Search
// MARK: - Unified Search
static let unifiedSearchScreenShowPublicDirectory = true
// MARK: - Secrets Recovery
static let secretsRecoveryAllowReset = true
}

View file

@ -151,7 +151,7 @@
<!--People View Controller-->
<scene sceneID="Qba-PP-lco">
<objects>
<viewController storyboardIdentifier="PeopleViewController" id="IGB-jr-yFz" customClass="PeopleViewController" sceneMemberID="viewController">
<viewController storyboardIdentifier="PeopleViewController" extendedLayoutIncludesOpaqueBars="YES" id="IGB-jr-yFz" customClass="PeopleViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Mhy-d3-Jh6"/>
<viewControllerLayoutGuide type="bottom" id="Hkk-qB-8tq"/>
@ -177,7 +177,7 @@
<!--Favourites View Controller-->
<scene sceneID="z6B-k5-ano">
<objects>
<viewController storyboardIdentifier="FavouritesViewController" id="HnD-LA-psC" customClass="FavouritesViewController" sceneMemberID="viewController">
<viewController storyboardIdentifier="FavouritesViewController" extendedLayoutIncludesOpaqueBars="YES" id="HnD-LA-psC" customClass="FavouritesViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="pOc-AC-QkD"/>
<viewControllerLayoutGuide type="bottom" id="W6L-Au-CaZ"/>
@ -463,7 +463,7 @@
<!--Rooms View Controller-->
<scene sceneID="SDg-Pp-8Uj">
<objects>
<viewController storyboardIdentifier="RoomsViewController" id="HPQ-zg-lZR" customClass="RoomsViewController" sceneMemberID="viewController">
<viewController storyboardIdentifier="RoomsViewController" extendedLayoutIncludesOpaqueBars="YES" id="HPQ-zg-lZR" customClass="RoomsViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Hkg-kw-ioH"/>
<viewControllerLayoutGuide type="bottom" id="UI8-oQ-9M9"/>
@ -581,7 +581,7 @@
</scene>
</scenes>
<inferredMetricsTieBreakers>
<segue reference="mhb-l9-pM3"/>
<segue reference="Tfl-tq-LQp"/>
<segue reference="f5u-Y1-7nt"/>
</inferredMetricsTieBreakers>
<resources>

View file

@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "room_action_notification_muted.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_action_notification_muted@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_action_notification_muted@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View file

@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "notifications.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "notifications@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "notifications@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,018 B

View file

@ -710,6 +710,7 @@ Tap the + to start adding people.";
"room_details_topic" = "Topic";
"room_details_favourite_tag" = "Favourite";
"room_details_low_priority_tag" = "Low priority";
"room_details_notifs" = "Notifications";
"room_details_mute_notifs" = "Mute notifications";
"room_details_direct_chat" = "Direct Chat";
"room_details_access_section"="Who can access this room?";
@ -772,6 +773,17 @@ Tap the + to start adding people.";
"room_details_copy_room_address" = "Copy Room Address";
"room_details_copy_room_url" = "Copy Room URL";
// Room Notification Settings
"room_notifs_settings_notify_me_for" = "Notify me for";
"room_notifs_settings_all_messages" = "All Messages";
"room_notifs_settings_mentions_and_keywords" = "Mentions and Keywords only";
"room_notifs_settings_none" = "None";
"room_notifs_settings_done_action" = "Done";
"room_notifs_settings_cancel_action" = "Cancel";
"room_notifs_settings_manage_notifications" = "You can manage notifications in %@";
"room_notifs_settings_account_settings" = "Account settings";
"room_notifs_settings_encrypted_room_notice" = "Please note that mentions & keyword notifications are not available in encrypted rooms on mobile.";
// Group Details
"group_details_title" = "Community Details";
"group_details_home" = "Home";
@ -1375,6 +1387,7 @@ Tap the + to start adding people.";
"key_verification_verify_qr_code_information_other_device" = "Scan the code below to verify:";
"key_verification_verify_qr_code_emoji_information" = "Verify by comparing unique emoji.";
"key_verification_verify_qr_code_scan_code_action" = "Scan their code";
"key_verification_verify_qr_code_scan_code_other_device_action" = "Scan with this device";
"key_verification_verify_qr_code_cannot_scan_action" = "Can't scan?";
"key_verification_verify_qr_code_start_emoji_action" = "Verify by emoji";

View file

@ -19,7 +19,7 @@ import UIKit
/// Protocol describing a [Coordinator](http://khanlou.com/2015/10/coordinators-redux/).
/// Coordinators are the objects which control the navigation flow of the application.
/// It helps to isolate and reuse view controllers and pass dependencies down the navigation hierarchy.
protocol Coordinator: class {
protocol Coordinator: AnyObject {
/// Starts job of the coordinator.
func start()

View file

@ -85,6 +85,7 @@ internal enum Asset {
internal static let roomActionFavourite = ImageAsset(name: "room_action_favourite")
internal static let roomActionLeave = ImageAsset(name: "room_action_leave")
internal static let roomActionNotification = ImageAsset(name: "room_action_notification")
internal static let roomActionNotificationMuted = ImageAsset(name: "room_action_notification_muted")
internal static let roomActionPriorityHigh = ImageAsset(name: "room_action_priority_high")
internal static let roomActionPriorityLow = ImageAsset(name: "room_action_priority_low")
internal static let homeEmptyScreenArtwork = ImageAsset(name: "home_empty_screen_artwork")
@ -144,6 +145,7 @@ internal enum Asset {
internal static let membersListIcon = ImageAsset(name: "members_list_icon")
internal static let modIcon = ImageAsset(name: "mod_icon")
internal static let moreReactions = ImageAsset(name: "more_reactions")
internal static let notifications = ImageAsset(name: "notifications")
internal static let scrollup = ImageAsset(name: "scrollup")
internal static let roomsEmptyScreenArtwork = ImageAsset(name: "rooms_empty_screen_artwork")
internal static let roomsEmptyScreenArtworkDark = ImageAsset(name: "rooms_empty_screen_artwork_dark")

View file

@ -172,6 +172,11 @@ internal enum StoryboardScene {
internal static let initialScene = InitialSceneType<Riot.RoomInfoListViewController>(storyboard: RoomInfoListViewController.self)
}
internal enum RoomNotificationSettingsViewController: StoryboardType {
internal static let storyboardName = "RoomNotificationSettingsViewController"
internal static let initialScene = InitialSceneType<Riot.RoomNotificationSettingsViewController>(storyboard: RoomNotificationSettingsViewController.self)
}
internal enum SecretsRecoveryWithKeyViewController: StoryboardType {
internal static let storyboardName = "SecretsRecoveryWithKeyViewController"

View file

@ -2014,6 +2014,10 @@ internal enum VectorL10n {
internal static var keyVerificationVerifyQrCodeScanCodeAction: String {
return VectorL10n.tr("Vector", "key_verification_verify_qr_code_scan_code_action")
}
/// Scan with this device
internal static var keyVerificationVerifyQrCodeScanCodeOtherDeviceAction: String {
return VectorL10n.tr("Vector", "key_verification_verify_qr_code_scan_code_other_device_action")
}
/// QR code has been successfully validated.
internal static var keyVerificationVerifyQrCodeScanOtherCodeSuccessMessage: String {
return VectorL10n.tr("Vector", "key_verification_verify_qr_code_scan_other_code_success_message")
@ -2710,6 +2714,10 @@ internal enum VectorL10n {
internal static var roomDetailsNoLocalAddressesForDm: String {
return VectorL10n.tr("Vector", "room_details_no_local_addresses_for_dm")
}
/// Notifications
internal static var roomDetailsNotifs: String {
return VectorL10n.tr("Vector", "room_details_notifs")
}
/// Members
internal static var roomDetailsPeople: String {
return VectorL10n.tr("Vector", "room_details_people")
@ -3018,6 +3026,42 @@ internal enum VectorL10n {
internal static var roomNoPrivilegesToCreateGroupCall: String {
return VectorL10n.tr("Vector", "room_no_privileges_to_create_group_call")
}
/// Account settings
internal static var roomNotifsSettingsAccountSettings: String {
return VectorL10n.tr("Vector", "room_notifs_settings_account_settings")
}
/// All Messages
internal static var roomNotifsSettingsAllMessages: String {
return VectorL10n.tr("Vector", "room_notifs_settings_all_messages")
}
/// Cancel
internal static var roomNotifsSettingsCancelAction: String {
return VectorL10n.tr("Vector", "room_notifs_settings_cancel_action")
}
/// Done
internal static var roomNotifsSettingsDoneAction: String {
return VectorL10n.tr("Vector", "room_notifs_settings_done_action")
}
/// Please note that mentions & keyword notifications are not available in encrypted rooms on mobile.
internal static var roomNotifsSettingsEncryptedRoomNotice: String {
return VectorL10n.tr("Vector", "room_notifs_settings_encrypted_room_notice")
}
/// You can manage notifications in %@
internal static func roomNotifsSettingsManageNotifications(_ p1: String) -> String {
return VectorL10n.tr("Vector", "room_notifs_settings_manage_notifications", p1)
}
/// Mentions and Keywords only
internal static var roomNotifsSettingsMentionsAndKeywords: String {
return VectorL10n.tr("Vector", "room_notifs_settings_mentions_and_keywords")
}
/// None
internal static var roomNotifsSettingsNone: String {
return VectorL10n.tr("Vector", "room_notifs_settings_none")
}
/// Notify me for
internal static var roomNotifsSettingsNotifyMeFor: String {
return VectorL10n.tr("Vector", "room_notifs_settings_notify_me_for")
}
/// Connectivity to the server has been lost.
internal static var roomOfflineNotification: String {
return VectorL10n.tr("Vector", "room_offline_notification")

View file

@ -393,7 +393,9 @@ class CallPresenter: NSObject {
if let oldCallVC = self.callVCs.values.first,
self.presentedCallVC == nil,
!self.uiOperationQueue.containsPresentCallVCOperation,
!self.uiOperationQueue.containsEnterPiPOperation {
!self.uiOperationQueue.containsEnterPiPOperation,
let oldCall = oldCallVC.mxCall,
oldCall.state != .ended {
// present the call screen after dismissing this one
self.presentCallVC(oldCallVC)
}

View file

@ -17,7 +17,7 @@
import Foundation
@objc
protocol CallPresenterDelegate: class {
protocol CallPresenterDelegate: AnyObject {
// Call screens
func callPresenter(_ presenter: CallPresenter,
presentCallViewController viewController: UIViewController,

View file

@ -23,7 +23,7 @@ import UIKit
case topLeft
}
@objc protocol PiPViewDelegate: class {
@objc protocol PiPViewDelegate: AnyObject {
@objc optional func pipView(_ view: PiPView, didMoveTo position: PiPViewPosition)
@objc optional func pipViewDidTap(_ view: PiPView)
}

View file

@ -80,6 +80,7 @@ final class RiotSettings: NSObject {
static let roomMemberScreenShowIgnore = "roomMemberScreenShowIgnore"
static let unifiedSearchScreenShowPublicDirectory = "unifiedSearchScreenShowPublicDirectory"
static let hideSpaceBetaAnnounce = "hideSpaceBetaAnnounce"
static let secretsRecoveryAllowReset = "secretsRecoveryAllowReset"
}
static let shared = RiotSettings()
@ -695,7 +696,7 @@ final class RiotSettings: NSObject {
}
}
// Mark: - Unified Search
// MARK: - Unified Search
var unifiedSearchScreenShowPublicDirectory: Bool {
get {
@ -708,6 +709,19 @@ final class RiotSettings: NSObject {
}
}
// MARK: - Secrets Recovery
var secretsRecoveryAllowReset: Bool {
get {
guard defaults.object(forKey: UserDefaultsKeys.secretsRecoveryAllowReset) != nil else {
return BuildSettings.secretsRecoveryAllowReset
}
return defaults.bool(forKey: UserDefaultsKeys.secretsRecoveryAllowReset)
} set {
defaults.set(newValue, forKey: UserDefaultsKeys.secretsRecoveryAllowReset)
}
}
// MARK: - Beta
var hideSpaceBetaAnnounce: Bool {

View file

@ -16,6 +16,6 @@
import Foundation
@objc protocol Themable: class {
@objc protocol Themable: AnyObject {
func update(theme: Theme)
}

View file

@ -183,7 +183,7 @@ FOUNDATION_EXPORT NSString *const WidgetManagerErrorOpenIdTokenKey;
/**
Store the integration manager configuration for a user.
@param the integration manager configuration.
@param config the integration manager configuration.
@param userId the user id.
*/
- (void)setConfig:(WidgetManagerConfig*)config forUser:(NSString*)userId;

View file

@ -76,10 +76,17 @@
Contructors.
@param roomId the id of the room.
@param emailInvitationParams, in case of an email invitation link, the query parameters extracted from the link.
@param mxSession the session to open the room preview with.
*/
- (instancetype)initWithRoomId:(NSString*)roomId andSession:(MXSession*)mxSession;
/**
Contructors.
@param roomId the id of the room.
@param emailInvitationParams in case of an email invitation link, the query parameters extracted from the link.
@param mxSession the session to open the room preview with.
*/
- (instancetype)initWithRoomId:(NSString*)roomId emailInvitationParams:(NSDictionary*)emailInvitationParams andSession:(MXSession*)mxSession;
/**

View file

@ -21,8 +21,12 @@ import Intents
import FLEX
#endif
/// The AppCoordinator is responsible of screen navigation and data injection at root application level. It decides if authentication or home screen should be shown and inject data needed for these flows, it changes the navigation stack on deep link, displays global warning.
/// This class should avoid to contain too many data management code not related to screen navigation logic. For example `MXSession` or push notification management should be handled in dedicated classes and report only navigation changes to the AppCoordinator.
/// The AppCoordinator is responsible of screen navigation and data injection at root application level. It decides
/// if authentication or home screen should be shown and inject data needed for these flows, it changes the navigation
/// stack on deep link, displays global warning.
/// This class should avoid to contain too many data management code not related to screen navigation logic. For example
/// `MXSession` or push notification management should be handled in dedicated classes and report only navigation
/// changes to the AppCoordinator.
final class AppCoordinator: NSObject, AppCoordinatorType {
// MARK: - Constants
@ -83,7 +87,8 @@ final class AppCoordinator: NSObject, AppCoordinatorType {
}
func open(url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
// NOTE: As said in the Apple documentation be careful on security issues with Custom Scheme URL (see https://developer.apple.com/documentation/xcode/allowing_apps_and_websites_to_link_to_your_content/defining_a_custom_url_scheme_for_your_app)
// NOTE: As said in the Apple documentation be careful on security issues with Custom Scheme URL:
// https://developer.apple.com/documentation/xcode/allowing_apps_and_websites_to_link_to_your_content/defining_a_custom_url_scheme_for_your_app
do {
let deepLinkOption = try self.customSchemeURLParser.parse(url: url, options: options)

View file

@ -173,7 +173,7 @@ UINavigationControllerDelegate
Log out all the accounts without confirmation.
Show the authentication screen on successful logout.
@param sendLogoutRequest Indicate whether send logout request to homeserver.
@param sendLogoutServerRequest Indicate whether send logout request to homeserver.
@param completion the block to execute at the end of the operation.
*/
- (void)logoutSendingRequestServer:(BOOL)sendLogoutServerRequest
@ -183,7 +183,7 @@ UINavigationControllerDelegate
Present incoming key verification request to accept.
@param incomingKeyVerificationRequest The incoming key verification request.
@param The matrix session.
@param session The matrix session.
@return Indicate NO if the key verification screen could not be presented.
*/
- (BOOL)presentIncomingKeyVerificationRequest:(MXKeyVerificationRequest*)incomingKeyVerificationRequest

View file

@ -351,6 +351,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
NSURL *messageSoundURL = [[NSBundle mainBundle] URLForResource:@"message" withExtension:@"caf"];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)messageSoundURL, &_messageSound);
// Set app info now as Mac (Designed for iPad) accesses it before didFinishLaunching is called
self.appInfo = AppInfo.current;
MXLogDebug(@"[AppDelegate] willFinishLaunchingWithOptions: Done");
return YES;
@ -371,8 +374,6 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
_configuration = [AppConfiguration new];
self.appInfo = AppInfo.current;
// Log app information
NSString *appDisplayName = self.appInfo.displayName;
NSString* appVersion = self.appVersion;

View file

@ -17,7 +17,7 @@
import UIKit
import Reusable
@objc protocol SocialLoginListViewDelegate: class {
@objc protocol SocialLoginListViewDelegate: AnyObject {
func socialLoginListView(_ socialLoginListView: SocialLoginListView, didTapSocialButtonWithIdentifier identifier: String)
}

View file

@ -19,7 +19,7 @@
import UIKit
import libPhoneNumber_iOS
@objc protocol DialpadViewControllerDelegate: class {
@objc protocol DialpadViewControllerDelegate: AnyObject {
@objc optional func dialpadViewControllerDidTapCall(_ viewController: DialpadViewController,
withPhoneNumber phoneNumber: String)
@objc optional func dialpadViewControllerDidTapClose(_ viewController: DialpadViewController)

View file

@ -18,7 +18,7 @@
import UIKit
@objc protocol CallTransferMainViewControllerDelegate: class {
@objc protocol CallTransferMainViewControllerDelegate: AnyObject {
func callTransferMainViewControllerDidComplete(_ viewController: CallTransferMainViewController,
consult: Bool,
contact: MXKContact?,

View file

@ -19,7 +19,7 @@
import UIKit
import Reusable
protocol CallTransferSelectContactViewControllerDelegate: class {
protocol CallTransferSelectContactViewControllerDelegate: AnyObject {
func callTransferSelectContactViewControllerDidSelectContact(_ viewController: CallTransferSelectContactViewController,
contact: MXKContact?)
}

View file

@ -18,7 +18,7 @@ import Foundation
import UIKit
import AVFoundation
@objc protocol CameraPresenterDelegate: class {
@objc protocol CameraPresenterDelegate: AnyObject {
func cameraPresenter(_ presenter: CameraPresenter, didSelectImageData imageData: Data, withUTI uti: MXKUTI?)
func cameraPresenter(_ presenter: CameraPresenter, didSelectVideoAt url: URL)
func cameraPresenterDidCancel(_ cameraPresenter: CameraPresenter)

View file

@ -161,10 +161,15 @@
- (void)makeDirectEditedRoom:(BOOL)isDirect;
/**
Enable/disable the notifications for the selected room.
*/
Enable/disable the notifications for the selected room.
*/
- (void)muteEditedRoomNotifications:(BOOL)mute;
/**
Edit notification settings for the selected room.
*/
- (void)changeEditedRoomNotificationSettings;
/**
Show room directory.
*/

View file

@ -34,7 +34,7 @@
#import "Riot-Swift.h"
@interface RecentsViewController () <CreateRoomCoordinatorBridgePresenterDelegate, RoomsDirectoryCoordinatorBridgePresenterDelegate>
@interface RecentsViewController () <CreateRoomCoordinatorBridgePresenterDelegate, RoomsDirectoryCoordinatorBridgePresenterDelegate, RoomNotificationSettingsCoordinatorBridgePresenterDelegate>
{
// Tell whether a recents refresh is pending (suspended during editing mode).
BOOL isRefreshPending;
@ -74,6 +74,8 @@
@property (nonatomic, strong) CustomSizedPresentationController *customSizedPresentationController;
@property (nonatomic, strong) RoomNotificationSettingsCoordinatorBridgePresenter *roomNotificationSettingsCoordinatorBridgePresenter;
@end
@implementation RecentsViewController
@ -1031,12 +1033,31 @@
UIContextualAction *muteAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive
title:title
handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
[self muteEditedRoomNotifications:!isMuted];
if ([BuildSettings roomSettingsScreenShowNotificationsV2])
{
[self changeEditedRoomNotificationSettings];
}
else
{
[self muteEditedRoomNotifications:!isMuted];
}
completionHandler(YES);
}];
muteAction.backgroundColor = actionBackgroundColor;
UIImage *notificationImage = [UIImage imageNamed:@"room_action_notification"];
UIImage *notificationImage;
if([BuildSettings roomSettingsScreenShowNotificationsV2])
{
notificationImage = isMuted ? [UIImage imageNamed:@"room_action_notification_muted"] : [UIImage imageNamed:@"room_action_notification"];
}
else
{
notificationImage = [UIImage imageNamed:@"room_action_notification"];
}
notificationImage = [notificationImage vc_tintedImageUsingColor:isMuted ? unselectedColor : selectedColor];
muteAction.image = [notificationImage vc_notRenderedImage];
@ -1298,6 +1319,23 @@
}
}
- (void)changeEditedRoomNotificationSettings
{
if (editedRoomId)
{
// Check whether the user didn't leave the room
MXRoom *room = [self.mainSession roomWithRoomId:editedRoomId];
if (room)
{
// navigate
self.roomNotificationSettingsCoordinatorBridgePresenter = [[RoomNotificationSettingsCoordinatorBridgePresenter alloc] initWithRoom:room];
self.roomNotificationSettingsCoordinatorBridgePresenter.delegate = self;
[self.roomNotificationSettingsCoordinatorBridgePresenter presentFrom:self animated:YES];
}
[self cancelEditionMode:isRefreshPending];
}
}
- (void)muteEditedRoomNotifications:(BOOL)mute
{
if (editedRoomId)
@ -1307,27 +1345,27 @@
if (room)
{
[self startActivityIndicator];
if (mute)
{
[room mentionsOnly:^{
[self stopActivityIndicator];
// Leave editing mode
[self cancelEditionMode:isRefreshPending];
[self cancelEditionMode:self->isRefreshPending];
}];
}
else
{
[room allMessages:^{
[self stopActivityIndicator];
// Leave editing mode
[self cancelEditionMode:isRefreshPending];
[self cancelEditionMode:self->isRefreshPending];
}];
}
}
@ -2219,4 +2257,11 @@
}
}
#pragma mark - RoomNotificationSettingsCoordinatorBridgePresenterDelegate
-(void)roomNotificationSettingsCoordinatorBridgePresenterDelegateDidComplete:(RoomNotificationSettingsCoordinatorBridgePresenter *)coordinatorBridgePresenter
{
[coordinatorBridgePresenter dismissWithAnimated:YES completion:nil];
self.roomNotificationSettingsCoordinatorBridgePresenter = nil;
}
@end

View file

@ -0,0 +1,39 @@
//
// Copyright 2021 New Vector 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 Foundation
import Reusable
class TitleHeaderView: UITableViewHeaderFooterView {
@IBOutlet weak var label: UILabel!
func update(title: String) {
label.text = title.uppercased()
}
}
extension TitleHeaderView: NibReusable {}
extension TitleHeaderView: Themable {
func update(theme: Theme) {
contentView.backgroundColor = theme.headerBackgroundColor
label.textColor = theme.headerTextSecondaryColor
label.font = theme.fonts.body
}
}

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="Yhn-wn-PmC" customClass="TitleHeaderView" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Yhn-wn-PmC" id="o2E-Jb-B0E">
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Gq6-Mz-QTu">
<rect key="frame" x="20" y="11" width="374" height="22"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="Gq6-Mz-QTu" firstAttribute="bottom" secondItem="o2E-Jb-B0E" secondAttribute="bottomMargin" id="3FQ-Oa-GSW"/>
<constraint firstAttribute="trailingMargin" secondItem="Gq6-Mz-QTu" secondAttribute="trailing" id="NOy-36-cTp"/>
<constraint firstItem="Gq6-Mz-QTu" firstAttribute="top" secondItem="o2E-Jb-B0E" secondAttribute="topMargin" id="iyg-1J-QRk"/>
<constraint firstItem="Gq6-Mz-QTu" firstAttribute="leading" secondItem="o2E-Jb-B0E" secondAttribute="leadingMargin" id="rPi-h4-Odq"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="label" destination="Gq6-Mz-QTu" id="dWm-UN-U4w"/>
</connections>
<point key="canvasLocation" x="-86" y="-242"/>
</tableViewCell>
</objects>
</document>

View file

@ -74,7 +74,7 @@
/**
init the segmentedViewController with a list of UIViewControllers.
@param titles the section tiles
@param viewControllers the list of viewControllers to display.
@param someViewControllers the list of viewControllers to display.
@param defaultSelected index of the default selected UIViewController in the list.
*/
- (void)initWithTitles:(NSArray*)titles viewControllers:(NSArray*)someViewControllers defaultSelected:(NSUInteger)defaultSelected

View file

@ -18,7 +18,7 @@
import Foundation
protocol CreateRoomCoordinatorDelegate: class {
protocol CreateRoomCoordinatorDelegate: AnyObject {
func createRoomCoordinator(_ coordinator: CreateRoomCoordinatorType, didCreateNewRoom room: MXRoom)
func createRoomCoordinatorDidCancel(_ coordinator: CreateRoomCoordinatorType)
}

View file

@ -17,7 +17,7 @@
import UIKit
import Reusable
protocol ChooseAvatarTableViewCellDelegate: class {
protocol ChooseAvatarTableViewCellDelegate: AnyObject {
func chooseAvatarTableViewCellDidTapChooseAvatar(_ cell: ChooseAvatarTableViewCell, sourceView: UIView)
}

View file

@ -18,7 +18,7 @@
import Foundation
protocol EnterNewRoomDetailsCoordinatorDelegate: class {
protocol EnterNewRoomDetailsCoordinatorDelegate: AnyObject {
func enterNewRoomDetailsCoordinator(_ coordinator: EnterNewRoomDetailsCoordinatorType, didCreateNewRoom room: MXRoom)
func enterNewRoomDetailsCoordinatorDidCancel(_ coordinator: EnterNewRoomDetailsCoordinatorType)
}

View file

@ -18,11 +18,11 @@
import Foundation
protocol EnterNewRoomDetailsViewModelViewDelegate: class {
protocol EnterNewRoomDetailsViewModelViewDelegate: AnyObject {
func enterNewRoomDetailsViewModel(_ viewModel: EnterNewRoomDetailsViewModelType, didUpdateViewState viewSate: EnterNewRoomDetailsViewState)
}
protocol EnterNewRoomDetailsViewModelCoordinatorDelegate: class {
protocol EnterNewRoomDetailsViewModelCoordinatorDelegate: AnyObject {
func enterNewRoomDetailsViewModel(_ viewModel: EnterNewRoomDetailsViewModelType, didCreateNewRoom room: MXRoom)
func enterNewRoomDetailsViewModel(_ viewModel: EnterNewRoomDetailsViewModelType, didTapChooseAvatar sourceView: UIView)
func enterNewRoomDetailsViewModelDidCancel(_ viewModel: EnterNewRoomDetailsViewModelType)

View file

@ -16,7 +16,7 @@
import UIKit
@objc protocol CrossSigningSetupBannerCellDelegate: class {
@objc protocol CrossSigningSetupBannerCellDelegate: AnyObject {
func crossSigningSetupBannerCellDidTapCloseAction(_ cell: CrossSigningSetupBannerCell)
}

View file

@ -18,7 +18,7 @@
import Foundation
protocol CrossSigningSetupCoordinatorDelegate: class {
protocol CrossSigningSetupCoordinatorDelegate: AnyObject {
func crossSigningSetupCoordinatorDidComplete(_ coordinator: CrossSigningSetupCoordinatorType)
func crossSigningSetupCoordinatorDidCancel(_ coordinator: CrossSigningSetupCoordinatorType)
func crossSigningSetupCoordinator(_ coordinator: CrossSigningSetupCoordinatorType, didFailWithError error: Error)

View file

@ -16,7 +16,7 @@
import Foundation
@objc protocol GDPRConsentViewControllerDelegate: class {
@objc protocol GDPRConsentViewControllerDelegate: AnyObject {
func gdprConsentViewControllerDidConsentToGDPRWithSuccess(_ gdprConsentViewController: GDPRConsentViewController)
}

View file

@ -54,20 +54,20 @@
self.titleLabel.text = NSLocalizedStringFromTable(@"directory_search_results_title", @"Vector", nil);
// Do we need to display like ">20 results found" or "18 results found"?
NSString *descriptionLabel = (publicRoomsDirectoryDataSource.moreThanRoomsCount && publicRoomsDirectoryDataSource.roomsCount > 0) ? NSLocalizedStringFromTable(@"directory_search_results_more_than", @"Vector", nil) : NSLocalizedStringFromTable(@"directory_search_results", @"Vector", nil);
NSString *descriptionLabel = (publicRoomsDirectoryDataSource.searchResultsCountIsLimited && publicRoomsDirectoryDataSource.searchResultsCount > 0) ? NSLocalizedStringFromTable(@"directory_search_results_more_than", @"Vector", nil) : NSLocalizedStringFromTable(@"directory_search_results", @"Vector", nil);
self.descriptionLabel.text = [NSString stringWithFormat:descriptionLabel,
publicRoomsDirectoryDataSource.roomsCount,
publicRoomsDirectoryDataSource.searchResultsCount,
publicRoomsDirectoryDataSource.searchPattern];
}
else
{
self.titleLabel.text = NSLocalizedStringFromTable(@"directory_cell_title", @"Vector", nil);
self.descriptionLabel.text = [NSString stringWithFormat:NSLocalizedStringFromTable(@"directory_cell_description", @"Vector", nil),
publicRoomsDirectoryDataSource.roomsCount];
publicRoomsDirectoryDataSource.searchResultsCount];
}
if (publicRoomsDirectoryDataSource.roomsCount)
if (publicRoomsDirectoryDataSource.searchResultsCount)
{
self.userInteractionEnabled = YES;
self.chevronImageView.hidden = NO;

View file

@ -347,7 +347,16 @@
tableViewCell.notificationsButton.tag = room.isMute || room.isMentionsOnly;
[tableViewCell.notificationsButton addTarget:self action:@selector(onNotificationsButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
tableViewCell.notificationsImageView.image = [UIImage imageNamed:@"room_action_notification"];
if ([BuildSettings roomSettingsScreenShowNotificationsV2])
{
tableViewCell.notificationsImageView.image = tableViewCell.notificationsButton.tag ? [UIImage imageNamed:@"room_action_notification_muted"] : [UIImage imageNamed:@"room_action_notification"];
}
else
{
tableViewCell.notificationsImageView.image = [UIImage imageNamed:@"room_action_notification"];
}
tableViewCell.notificationsImageView.tintColor = tableViewCell.notificationsButton.tag ? unselectedColor : selectedColor;
// Get the room tag (use only the first one).
@ -663,8 +672,15 @@
MXRoom *room = [self.mainSession roomWithRoomId:editedRoomId];
if (room)
{
UIButton *button = (UIButton*)sender;
[self muteEditedRoomNotifications:!button.tag];
if ([BuildSettings roomSettingsScreenShowNotificationsV2])
{
[self changeEditedRoomNotificationSettings];
}
else
{
UIButton *button = (UIButton*)sender;
[self muteEditedRoomNotifications:!button.tag];
}
}
}
}

View file

@ -16,7 +16,7 @@
import Foundation
protocol KeyBackupRecoverCoordinatorDelegate: class {
protocol KeyBackupRecoverCoordinatorDelegate: AnyObject {
func keyBackupRecoverCoordinatorDidRecover(_ keyBackupRecoverCoordinator: KeyBackupRecoverCoordinatorType)
func keyBackupRecoverCoordinatorDidCancel(_ keyBackupRecoverCoordinator: KeyBackupRecoverCoordinatorType)
}

View file

@ -16,7 +16,7 @@
import Foundation
protocol KeyBackupRecoverFromPassphraseCoordinatorDelegate: class {
protocol KeyBackupRecoverFromPassphraseCoordinatorDelegate: AnyObject {
func keyBackupRecoverFromPassphraseCoordinatorDidRecover(_ keyBackupRecoverFromPassphraseCoordinator: KeyBackupRecoverFromPassphraseCoordinatorType)
func keyBackupRecoverFromPassphraseCoordinatorDoNotKnowPassphrase(_ keyBackupRecoverFromPassphraseCoordinator: KeyBackupRecoverFromPassphraseCoordinatorType)
func keyBackupRecoverFromPassphraseCoordinatorDidCancel(_ keyBackupRecoverFromPassphraseCoordinator: KeyBackupRecoverFromPassphraseCoordinatorType)

View file

@ -16,11 +16,11 @@
import Foundation
protocol KeyBackupRecoverFromPassphraseViewModelViewDelegate: class {
protocol KeyBackupRecoverFromPassphraseViewModelViewDelegate: AnyObject {
func keyBackupRecoverFromPassphraseViewModel(_ viewModel: KeyBackupRecoverFromPassphraseViewModelType, didUpdateViewState viewSate: KeyBackupRecoverFromPassphraseViewState)
}
protocol KeyBackupRecoverFromPassphraseViewModelCoordinatorDelegate: class {
protocol KeyBackupRecoverFromPassphraseViewModelCoordinatorDelegate: AnyObject {
func keyBackupRecoverFromPassphraseViewModelDidRecover(_ viewModel: KeyBackupRecoverFromPassphraseViewModelType)
func keyBackupRecoverFromPassphraseViewModelDidCancel(_ viewModel: KeyBackupRecoverFromPassphraseViewModelType)
func keyBackupRecoverFromPassphraseViewModelDoNotKnowPassphrase(_ viewModel: KeyBackupRecoverFromPassphraseViewModelType)

View file

@ -18,7 +18,7 @@
import Foundation
protocol KeyBackupRecoverFromPrivateKeyCoordinatorDelegate: class {
protocol KeyBackupRecoverFromPrivateKeyCoordinatorDelegate: AnyObject {
func keyBackupRecoverFromPrivateKeyCoordinatorDidRecover(_ coordinator: KeyBackupRecoverFromPrivateKeyCoordinatorType)
func keyBackupRecoverFromPrivateKeyCoordinatorDidPrivateKeyFail(_ coordinator: KeyBackupRecoverFromPrivateKeyCoordinatorType)
func keyBackupRecoverFromPrivateKeyCoordinatorDidCancel(_ coordinator: KeyBackupRecoverFromPrivateKeyCoordinatorType)

View file

@ -18,11 +18,11 @@
import Foundation
protocol KeyBackupRecoverFromPrivateKeyViewModelViewDelegate: class {
protocol KeyBackupRecoverFromPrivateKeyViewModelViewDelegate: AnyObject {
func keyBackupRecoverFromPrivateKeyViewModel(_ viewModel: KeyBackupRecoverFromPrivateKeyViewModelType, didUpdateViewState viewSate: KeyBackupRecoverFromPrivateKeyViewState)
}
protocol KeyBackupRecoverFromPrivateKeyViewModelCoordinatorDelegate: class {
protocol KeyBackupRecoverFromPrivateKeyViewModelCoordinatorDelegate: AnyObject {
func keyBackupRecoverFromPrivateKeyViewModelDidRecover(_ viewModel: KeyBackupRecoverFromPrivateKeyViewModelType)
func keyBackupRecoverFromPrivateKeyViewModelDidPrivateKeyFail(_ viewModel: KeyBackupRecoverFromPrivateKeyViewModelType)
func keyBackupRecoverFromPrivateKeyViewModelDidCancel(_ viewModel: KeyBackupRecoverFromPrivateKeyViewModelType)

View file

@ -16,7 +16,7 @@
import Foundation
protocol KeyBackupRecoverFromRecoveryKeyCoordinatorDelegate: class {
protocol KeyBackupRecoverFromRecoveryKeyCoordinatorDelegate: AnyObject {
func keyBackupRecoverFromPassphraseCoordinatorDidRecover(_ keyBackupRecoverFromRecoveryKeyCoordinator: KeyBackupRecoverFromRecoveryKeyCoordinatorType)
func keyBackupRecoverFromPassphraseCoordinatorDidCancel(_ keyBackupRecoverFromRecoveryKeyCoordinator: KeyBackupRecoverFromRecoveryKeyCoordinatorType)
}

View file

@ -16,11 +16,11 @@
import Foundation
protocol KeyBackupRecoverFromRecoveryKeyViewModelViewDelegate: class {
protocol KeyBackupRecoverFromRecoveryKeyViewModelViewDelegate: AnyObject {
func keyBackupRecoverFromPassphraseViewModel(_ viewModel: KeyBackupRecoverFromRecoveryKeyViewModelType, didUpdateViewState viewSate: KeyBackupRecoverFromRecoveryKeyViewState)
}
protocol KeyBackupRecoverFromRecoveryKeyViewModelCoordinatorDelegate: class {
protocol KeyBackupRecoverFromRecoveryKeyViewModelCoordinatorDelegate: AnyObject {
func keyBackupRecoverFromRecoveryKeyViewModelDidRecover(_ viewModel: KeyBackupRecoverFromRecoveryKeyViewModelType)
func keyBackupRecoverFromRecoveryKeyViewModelDidCancel(_ viewModel: KeyBackupRecoverFromRecoveryKeyViewModelType)
}

View file

@ -16,7 +16,7 @@
import UIKit
protocol KeyBackupRecoverSuccessViewControllerDelegate: class {
protocol KeyBackupRecoverSuccessViewControllerDelegate: AnyObject {
func keyBackupRecoverSuccessViewControllerDidTapDone(_ keyBackupRecoverSuccessViewController: KeyBackupRecoverSuccessViewController)
}

View file

@ -16,7 +16,7 @@
import UIKit
protocol KeyBackupSetupIntroViewControllerDelegate: class {
protocol KeyBackupSetupIntroViewControllerDelegate: AnyObject {
func keyBackupSetupIntroViewControllerDidTapSetupAction(_ keyBackupSetupIntroViewController: KeyBackupSetupIntroViewController)
func keyBackupSetupIntroViewControllerDidCancel(_ keyBackupSetupIntroViewController: KeyBackupSetupIntroViewController)
}

View file

@ -16,7 +16,7 @@
import Foundation
protocol KeyBackupSetupCoordinatorDelegate: class {
protocol KeyBackupSetupCoordinatorDelegate: AnyObject {
func keyBackupSetupCoordinatorDidCancel(_ keyBackupSetupCoordinator: KeyBackupSetupCoordinatorType)
func keyBackupSetupCoordinatorDidSetupRecoveryKey(_ keyBackupSetupCoordinator: KeyBackupSetupCoordinatorType)
}

View file

@ -16,7 +16,7 @@
import Foundation
protocol KeyBackupSetupPassphraseCoordinatorDelegate: class {
protocol KeyBackupSetupPassphraseCoordinatorDelegate: AnyObject {
func keyBackupSetupPassphraseCoordinator(_ keyBackupSetupPassphraseCoordinator: KeyBackupSetupPassphraseCoordinatorType, didCreateBackupFromPassphraseWithResultingRecoveryKey recoveryKey: String)
func keyBackupSetupPassphraseCoordinator(_ keyBackupSetupPassphraseCoordinator: KeyBackupSetupPassphraseCoordinatorType, didCreateBackupFromRecoveryKey recoveryKey: String)
func keyBackupSetupPassphraseCoordinatorDidCancel(_ keyBackupSetupPassphraseCoordinator: KeyBackupSetupPassphraseCoordinatorType)

View file

@ -16,12 +16,12 @@
import Foundation
protocol KeyBackupSetupPassphraseViewModelViewDelegate: class {
protocol KeyBackupSetupPassphraseViewModelViewDelegate: AnyObject {
func keyBackupSetupPassphraseViewModel(_ viewModel: KeyBackupSetupPassphraseViewModelType, didUpdateViewState viewSate: KeyBackupSetupPassphraseViewState)
func keyBackupSetupPassphraseViewModelShowSkipAlert(_ viewModel: KeyBackupSetupPassphraseViewModelType)
}
protocol KeyBackupSetupPassphraseViewModelCoordinatorDelegate: class {
protocol KeyBackupSetupPassphraseViewModelCoordinatorDelegate: AnyObject {
func keyBackupSetupPassphraseViewModel(_ viewModel: KeyBackupSetupPassphraseViewModelType, didCreateBackupFromPassphraseWithResultingRecoveryKey recoveryKey: String)
func keyBackupSetupPassphraseViewModel(_ viewModel: KeyBackupSetupPassphraseViewModelType, didCreateBackupFromRecoveryKey recoveryKey: String)
func keyBackupSetupPassphraseViewModelDidCancel(_ viewModel: KeyBackupSetupPassphraseViewModelType)

View file

@ -16,7 +16,7 @@
import UIKit
protocol KeyBackupSetupSuccessFromPassphraseViewControllerDelegate: class {
protocol KeyBackupSetupSuccessFromPassphraseViewControllerDelegate: AnyObject {
func keyBackupSetupSuccessFromPassphraseViewControllerDidTapDoneAction(_ viewController: KeyBackupSetupSuccessFromPassphraseViewController)
}

View file

@ -16,7 +16,7 @@
import UIKit
protocol KeyBackupSetupSuccessFromRecoveryKeyViewControllerDelegate: class {
protocol KeyBackupSetupSuccessFromRecoveryKeyViewControllerDelegate: AnyObject {
func keyBackupSetupSuccessFromRecoveryKeyViewControllerDidTapDoneAction(_ viewController: KeyBackupSetupSuccessFromRecoveryKeyViewController)
}

View file

@ -16,7 +16,7 @@
import UIKit
protocol KeyBackupSetupSuccessFromSecureBackupViewControllerDelegate: class {
protocol KeyBackupSetupSuccessFromSecureBackupViewControllerDelegate: AnyObject {
func keyBackupSetupSuccessFromSecureBackupViewControllerDidTapDoneAction(_ viewController: KeyBackupSetupSuccessFromSecureBackupViewController)
}

View file

@ -18,7 +18,7 @@
import Foundation
protocol KeyVerificationCoordinatorDelegate: class {
protocol KeyVerificationCoordinatorDelegate: AnyObject {
func keyVerificationCoordinatorDidComplete(_ coordinator: KeyVerificationCoordinatorType, otherUserId: String, otherDeviceId: String)
func keyVerificationCoordinatorDidCancel(_ coordinator: KeyVerificationCoordinatorType)
}

View file

@ -18,7 +18,7 @@
import Foundation
protocol KeyVerificationDataLoadingCoordinatorDelegate: class {
protocol KeyVerificationDataLoadingCoordinatorDelegate: AnyObject {
func keyVerificationDataLoadingCoordinator(_ coordinator: KeyVerificationDataLoadingCoordinatorType, didLoadUser user: MXUser, device: MXDeviceInfo)
func keyVerificationDataLoadingCoordinator(_ coordinator: KeyVerificationDataLoadingCoordinatorType, didAcceptKeyVerificationRequestWithTransaction transaction: MXKeyVerificationTransaction)
func keyVerificationDataLoadingCoordinator(_ coordinator: KeyVerificationDataLoadingCoordinatorType, didAcceptKeyVerificationRequest keyVerificationRequest: MXKeyVerificationRequest)

View file

@ -18,11 +18,11 @@
import Foundation
protocol KeyVerificationDataLoadingViewModelViewDelegate: class {
protocol KeyVerificationDataLoadingViewModelViewDelegate: AnyObject {
func keyVerificationDataLoadingViewModel(_ viewModel: KeyVerificationDataLoadingViewModelType, didUpdateViewState viewSate: KeyVerificationDataLoadingViewState)
}
protocol KeyVerificationDataLoadingViewModelCoordinatorDelegate: class {
protocol KeyVerificationDataLoadingViewModelCoordinatorDelegate: AnyObject {
func keyVerificationDataLoadingViewModel(_ viewModel: KeyVerificationDataLoadingViewModelType, didLoadUser user: MXUser, device: MXDeviceInfo)
func keyVerificationDataLoadingViewModel(_ viewModel: KeyVerificationDataLoadingViewModelType, didAcceptKeyVerificationWithTransaction transaction: MXKeyVerificationTransaction)
func keyVerificationDataLoadingViewModel(_ viewModel: KeyVerificationDataLoadingViewModelType, didAcceptKeyVerificationRequest keyVerificationRequest: MXKeyVerificationRequest)

View file

@ -18,7 +18,7 @@
import Foundation
protocol KeyVerificationScanConfirmationCoordinatorDelegate: class {
protocol KeyVerificationScanConfirmationCoordinatorDelegate: AnyObject {
func keyVerificationScanConfirmationCoordinatorDidComplete(_ coordinator: KeyVerificationScanConfirmationCoordinatorType)
func keyVerificationScanConfirmationCoordinatorDidCancel(_ coordinator: KeyVerificationScanConfirmationCoordinatorType)
}

View file

@ -18,11 +18,11 @@
import Foundation
protocol KeyVerificationScanConfirmationViewModelViewDelegate: class {
protocol KeyVerificationScanConfirmationViewModelViewDelegate: AnyObject {
func keyVerificationScanConfirmationViewModel(_ viewModel: KeyVerificationScanConfirmationViewModelType, didUpdateViewState viewSate: KeyVerificationScanConfirmationViewState)
}
protocol KeyVerificationScanConfirmationViewModelCoordinatorDelegate: class {
protocol KeyVerificationScanConfirmationViewModelCoordinatorDelegate: AnyObject {
func keyVerificationScanConfirmationViewModelDidComplete(_ viewModel: KeyVerificationScanConfirmationViewModelType)
func keyVerificationScanConfirmationViewModelDidCancel(_ viewModel: KeyVerificationScanConfirmationViewModelType)
}

View file

@ -18,7 +18,7 @@
import UIKit
protocol KeyVerificationVerifiedViewControllerDelegate: class {
protocol KeyVerificationVerifiedViewControllerDelegate: AnyObject {
func keyVerificationVerifiedViewControllerDidTapSetupAction(_ viewController: KeyVerificationVerifiedViewController)
func keyVerificationVerifiedViewControllerDidCancel(_ viewController: KeyVerificationVerifiedViewController)
}

View file

@ -18,7 +18,7 @@
import Foundation
protocol KeyVerificationVerifyBySASCoordinatorDelegate: class {
protocol KeyVerificationVerifyBySASCoordinatorDelegate: AnyObject {
func keyVerificationVerifyBySASCoordinatorDidComplete(_ coordinator: KeyVerificationVerifyBySASCoordinatorType)
func keyVerificationVerifyBySASCoordinatorDidCancel(_ coordinator: KeyVerificationVerifyBySASCoordinatorType)
}

View file

@ -18,11 +18,11 @@
import Foundation
protocol KeyVerificationVerifyBySASViewModelViewDelegate: class {
protocol KeyVerificationVerifyBySASViewModelViewDelegate: AnyObject {
func keyVerificationVerifyBySASViewModel(_ viewModel: KeyVerificationVerifyBySASViewModelType, didUpdateViewState viewSate: KeyVerificationVerifyViewState)
}
protocol KeyVerificationVerifyBySASViewModelCoordinatorDelegate: class {
protocol KeyVerificationVerifyBySASViewModelCoordinatorDelegate: AnyObject {
func keyVerificationVerifyViewModelDidComplete(_ viewModel: KeyVerificationVerifyBySASViewModelType)
func keyVerificationVerifyViewModelDidCancel(_ viewModel: KeyVerificationVerifyBySASViewModelType)
}

View file

@ -18,7 +18,7 @@
import Foundation
protocol KeyVerificationVerifyByScanningCoordinatorDelegate: class {
protocol KeyVerificationVerifyByScanningCoordinatorDelegate: AnyObject {
func keyVerificationVerifyByScanningCoordinatorDidCancel(_ coordinator: KeyVerificationVerifyByScanningCoordinatorType)
func keyVerificationVerifyByScanningCoordinator(_ coordinator: KeyVerificationVerifyByScanningCoordinatorType, didScanOtherQRCodeData qrCodeData: MXQRCodeData, withTransaction transaction: MXQRCodeTransaction)
func keyVerificationVerifyByScanningCoordinator(_ coordinator: KeyVerificationVerifyByScanningCoordinatorType, qrCodeDidScannedByOtherWithTransaction transaction: MXQRCodeTransaction)

View file

@ -143,7 +143,9 @@ final class KeyVerificationVerifyByScanningViewController: UIViewController {
self.titleLabel.text = VectorL10n.keyVerificationVerifyQrCodeTitle
self.informationLabel.text = VectorL10n.keyVerificationVerifyQrCodeInformation
self.scanCodeButton.setTitle(VectorL10n.keyVerificationVerifyQrCodeScanCodeAction, for: .normal)
// Hide until we have the type of the verification request
self.scanCodeButton.isHidden = true
self.cannotScanButton.setTitle(VectorL10n.keyVerificationVerifyQrCodeCannotScanAction, for: .normal)
}
@ -157,8 +159,8 @@ final class KeyVerificationVerifyByScanningViewController: UIViewController {
self.render(error: error)
case .scannedCodeValidated(let isValid):
self.renderScannedCode(valid: isValid)
case .cancelled(let reason):
self.renderCancelled(reason: reason)
case .cancelled(let reason, let verificationKind):
self.renderCancelled(reason: reason, verificationKind: verificationKind)
case .cancelledByMe(let reason):
self.renderCancelledByMe(reason: reason)
}
@ -195,10 +197,13 @@ final class KeyVerificationVerifyByScanningViewController: UIViewController {
switch viewData.verificationKind {
case .user:
informationText = VectorL10n.keyVerificationVerifyQrCodeInformation
self.scanCodeButton.setTitle(VectorL10n.keyVerificationVerifyQrCodeScanCodeAction, for: .normal)
default:
informationText = VectorL10n.keyVerificationVerifyQrCodeInformationOtherDevice
self.scanCodeButton.setTitle(VectorL10n.keyVerificationVerifyQrCodeScanCodeOtherDeviceAction, for: .normal)
}
self.scanCodeButton.isHidden = false
self.informationLabel.text = informationText
}
}
@ -231,12 +236,21 @@ final class KeyVerificationVerifyByScanningViewController: UIViewController {
}
}
private func renderCancelled(reason: MXTransactionCancelCode) {
private func renderCancelled(reason: MXTransactionCancelCode,
verificationKind: KeyVerificationKind) {
self.activityPresenter.removeCurrentActivityIndicator(animated: true)
self.stopQRCodeScanningIfPresented()
self.errorPresenter.presentError(from: self.alertPresentingViewController, title: "", message: VectorL10n.deviceVerificationCancelled, animated: true) {
// if we're verifying with someone else, let the user know they cancelled.
// if we're verifying our own device, assume the user probably knows since it was them who
// cancelled on their other device
if verificationKind == .user {
self.errorPresenter.presentError(from: self.alertPresentingViewController, title: "", message: VectorL10n.deviceVerificationCancelled, animated: true) {
self.dismissQRCodeScanningIfPresented(animated: false)
self.viewModel.process(viewAction: .cancel)
}
} else {
self.dismissQRCodeScanningIfPresented(animated: false)
self.viewModel.process(viewAction: .cancel)
}

View file

@ -225,7 +225,7 @@ final class KeyVerificationVerifyByScanningViewModel: KeyVerificationVerifyBySca
return
}
self.unregisterTransactionDidStateChangeNotification()
self.update(viewState: .cancelled(reason))
self.update(viewState: .cancelled(cancelCode: reason, verificationKind: verificationKind))
case MXSASTransactionStateCancelledByMe:
guard let reason = transaction.reasonCancelCode else {
return
@ -251,7 +251,7 @@ final class KeyVerificationVerifyByScanningViewModel: KeyVerificationVerifyBySca
return
}
self.unregisterTransactionDidStateChangeNotification()
self.update(viewState: .cancelled(reason))
self.update(viewState: .cancelled(cancelCode: reason, verificationKind: verificationKind))
case .cancelledByMe:
guard let reason = transaction.reasonCancelCode else {
return

View file

@ -18,11 +18,11 @@
import Foundation
protocol KeyVerificationVerifyByScanningViewModelViewDelegate: class {
protocol KeyVerificationVerifyByScanningViewModelViewDelegate: AnyObject {
func keyVerificationVerifyByScanningViewModel(_ viewModel: KeyVerificationVerifyByScanningViewModelType, didUpdateViewState viewSate: KeyVerificationVerifyByScanningViewState)
}
protocol KeyVerificationVerifyByScanningViewModelCoordinatorDelegate: class {
protocol KeyVerificationVerifyByScanningViewModelCoordinatorDelegate: AnyObject {
func keyVerificationVerifyByScanningViewModelDidCancel(_ viewModel: KeyVerificationVerifyByScanningViewModelType)
func keyVerificationVerifyByScanningViewModel(_ viewModel: KeyVerificationVerifyByScanningViewModelType, didScanOtherQRCodeData qrCodeData: MXQRCodeData, withTransaction transaction: MXQRCodeTransaction)

View file

@ -29,7 +29,7 @@ enum KeyVerificationVerifyByScanningViewState {
case loading
case loaded(viewData: KeyVerificationVerifyByScanningViewData)
case scannedCodeValidated(isValid: Bool)
case cancelled(MXTransactionCancelCode)
case cancelled(cancelCode: MXTransactionCancelCode, verificationKind: KeyVerificationKind)
case cancelledByMe(MXTransactionCancelCode)
case error(Error)
}

View file

@ -18,7 +18,7 @@
import Foundation
protocol DeviceVerificationIncomingCoordinatorDelegate: class {
protocol DeviceVerificationIncomingCoordinatorDelegate: AnyObject {
func deviceVerificationIncomingCoordinator(_ coordinator: DeviceVerificationIncomingCoordinatorType, didAcceptTransaction message: MXSASTransaction)
func deviceVerificationIncomingCoordinatorDidCancel(_ coordinator: DeviceVerificationIncomingCoordinatorType)
}

View file

@ -18,11 +18,11 @@
import Foundation
protocol DeviceVerificationIncomingViewModelViewDelegate: class {
protocol DeviceVerificationIncomingViewModelViewDelegate: AnyObject {
func deviceVerificationIncomingViewModel(_ viewModel: DeviceVerificationIncomingViewModelType, didUpdateViewState viewSate: DeviceVerificationIncomingViewState)
}
protocol DeviceVerificationIncomingViewModelCoordinatorDelegate: class {
protocol DeviceVerificationIncomingViewModelCoordinatorDelegate: AnyObject {
func deviceVerificationIncomingViewModel(_ viewModel: DeviceVerificationIncomingViewModelType, didAcceptTransaction transaction: MXSASTransaction)
func deviceVerificationIncomingViewModelDidCancel(_ viewModel: DeviceVerificationIncomingViewModelType)
}

View file

@ -18,7 +18,7 @@
import Foundation
protocol KeyVerificationManuallyVerifyCoordinatorDelegate: class {
protocol KeyVerificationManuallyVerifyCoordinatorDelegate: AnyObject {
func keyVerificationManuallyVerifyCoordinator(_ coordinator: KeyVerificationManuallyVerifyCoordinatorType, didVerifiedDeviceWithId deviceId: String, of userId: String)
func keyVerificationManuallyVerifyCoordinatorDidCancel(_ coordinator: KeyVerificationManuallyVerifyCoordinatorType)
}

View file

@ -18,11 +18,11 @@
import Foundation
protocol KeyVerificationManuallyVerifyViewModelViewDelegate: class {
protocol KeyVerificationManuallyVerifyViewModelViewDelegate: AnyObject {
func keyVerificationManuallyVerifyViewModel(_ viewModel: KeyVerificationManuallyVerifyViewModelType, didUpdateViewState viewSate: KeyVerificationManuallyVerifyViewState)
}
protocol KeyVerificationManuallyVerifyViewModelCoordinatorDelegate: class {
protocol KeyVerificationManuallyVerifyViewModelCoordinatorDelegate: AnyObject {
func keyVerificationManuallyVerifyViewModel(_ viewModel: KeyVerificationManuallyVerifyViewModelType, didVerifiedDeviceWithId deviceId: String, of userId: String)
func keyVerificationManuallyVerifyViewModelDidCancel(_ viewModel: KeyVerificationManuallyVerifyViewModelType)
}

View file

@ -18,7 +18,7 @@
import Foundation
protocol KeyVerificationSelfVerifyStartCoordinatorDelegate: class {
protocol KeyVerificationSelfVerifyStartCoordinatorDelegate: AnyObject {
func keyVerificationSelfVerifyStartCoordinator(_ coordinator: KeyVerificationSelfVerifyStartCoordinatorType, otherDidAcceptRequest request: MXKeyVerificationRequest)

View file

@ -18,11 +18,11 @@
import Foundation
protocol KeyVerificationSelfVerifyStartViewModelViewDelegate: class {
protocol KeyVerificationSelfVerifyStartViewModelViewDelegate: AnyObject {
func keyVerificationSelfVerifyStartViewModel(_ viewModel: KeyVerificationSelfVerifyStartViewModelType, didUpdateViewState viewSate: KeyVerificationSelfVerifyStartViewState)
}
protocol KeyVerificationSelfVerifyStartViewModelCoordinatorDelegate: class {
protocol KeyVerificationSelfVerifyStartViewModelCoordinatorDelegate: AnyObject {
func keyVerificationSelfVerifyStartViewModel(_ viewModel: KeyVerificationSelfVerifyStartViewModelType, otherDidAcceptRequest request: MXKeyVerificationRequest)
func keyVerificationSelfVerifyStartViewModelDidCancel(_ viewModel: KeyVerificationSelfVerifyStartViewModelType)
}

View file

@ -18,7 +18,7 @@
import Foundation
protocol KeyVerificationSelfVerifyWaitCoordinatorDelegate: class {
protocol KeyVerificationSelfVerifyWaitCoordinatorDelegate: AnyObject {
func keyVerificationSelfVerifyWaitCoordinator(_ coordinator: KeyVerificationSelfVerifyWaitCoordinatorType, didAcceptKeyVerificationRequest keyVerificationRequest: MXKeyVerificationRequest)
func keyVerificationSelfVerifyWaitCoordinator(_ coordinator: KeyVerificationSelfVerifyWaitCoordinatorType, didAcceptIncomingSASTransaction incomingSASTransaction: MXIncomingSASTransaction)
func keyVerificationSelfVerifyWaitCoordinatorDidCancel(_ coordinator: KeyVerificationSelfVerifyWaitCoordinatorType)

View file

@ -18,11 +18,11 @@
import Foundation
protocol KeyVerificationSelfVerifyWaitViewModelViewDelegate: class {
protocol KeyVerificationSelfVerifyWaitViewModelViewDelegate: AnyObject {
func keyVerificationSelfVerifyWaitViewModel(_ viewModel: KeyVerificationSelfVerifyWaitViewModelType, didUpdateViewState viewSate: KeyVerificationSelfVerifyWaitViewState)
}
protocol KeyVerificationSelfVerifyWaitViewModelCoordinatorDelegate: class {
protocol KeyVerificationSelfVerifyWaitViewModelCoordinatorDelegate: AnyObject {
func keyVerificationSelfVerifyWaitViewModel(_ viewModel: KeyVerificationSelfVerifyWaitViewModelType, didAcceptKeyVerificationRequest keyVerificationRequest: MXKeyVerificationRequest)
func keyVerificationSelfVerifyWaitViewModel(_ viewModel: KeyVerificationSelfVerifyWaitViewModelType, didAcceptIncomingSASTransaction incomingSASTransaction: MXIncomingSASTransaction)
func keyVerificationSelfVerifyWaitViewModelDidCancel(_ viewModel: KeyVerificationSelfVerifyWaitViewModelType)

View file

@ -18,7 +18,7 @@
import Foundation
protocol DeviceVerificationStartCoordinatorDelegate: class {
protocol DeviceVerificationStartCoordinatorDelegate: AnyObject {
func deviceVerificationStartCoordinator(_ coordinator: DeviceVerificationStartCoordinatorType, didCompleteWithOutgoingTransaction transaction: MXSASTransaction)
func deviceVerificationStartCoordinator(_ coordinator: DeviceVerificationStartCoordinatorType, didTransactionCancelled transaction: MXSASTransaction)

View file

@ -18,11 +18,11 @@
import Foundation
protocol DeviceVerificationStartViewModelViewDelegate: class {
protocol DeviceVerificationStartViewModelViewDelegate: AnyObject {
func deviceVerificationStartViewModel(_ viewModel: DeviceVerificationStartViewModelType, didUpdateViewState viewSate: DeviceVerificationStartViewState)
}
protocol DeviceVerificationStartViewModelCoordinatorDelegate: class {
protocol DeviceVerificationStartViewModelCoordinatorDelegate: AnyObject {
func deviceVerificationStartViewModelDidUseLegacyVerification(_ viewModel: DeviceVerificationStartViewModelType)
func deviceVerificationStartViewModel(_ viewModel: DeviceVerificationStartViewModelType, didCompleteWithOutgoingTransaction transaction: MXSASTransaction)

View file

@ -18,7 +18,7 @@
import Foundation
protocol UserVerificationSessionStatusCoordinatorDelegate: class {
protocol UserVerificationSessionStatusCoordinatorDelegate: AnyObject {
func userVerificationSessionStatusCoordinator(_ coordinator: UserVerificationSessionStatusCoordinatorType, wantsToVerifyDeviceWithId deviceId: String, for userId: String)
func userVerificationSessionStatusCoordinator(_ coordinator: UserVerificationSessionStatusCoordinatorType, wantsToManuallyVerifyDeviceWithId deviceId: String, for userId: String)
func userVerificationSessionStatusCoordinatorDidClose(_ coordinator: UserVerificationSessionStatusCoordinatorType)

View file

@ -18,11 +18,11 @@
import Foundation
protocol UserVerificationSessionStatusViewModelViewDelegate: class {
protocol UserVerificationSessionStatusViewModelViewDelegate: AnyObject {
func userVerificationSessionStatusViewModel(_ viewModel: UserVerificationSessionStatusViewModelType, didUpdateViewState viewSate: UserVerificationSessionStatusViewState)
}
protocol UserVerificationSessionStatusViewModelCoordinatorDelegate: class {
protocol UserVerificationSessionStatusViewModelCoordinatorDelegate: AnyObject {
func userVerificationSessionStatusViewModel(_ viewModel: UserVerificationSessionStatusViewModelType, wantsToVerifyDeviceWithId deviceId: String, for userId: String)
func userVerificationSessionStatusViewModel(_ viewModel: UserVerificationSessionStatusViewModelType, wantsToManuallyVerifyDeviceWithId deviceId: String, for userId: String)
func userVerificationSessionStatusViewModelDidClose(_ viewModel: UserVerificationSessionStatusViewModelType)

View file

@ -18,7 +18,7 @@
import Foundation
protocol UserVerificationSessionsStatusCoordinatorDelegate: class {
protocol UserVerificationSessionsStatusCoordinatorDelegate: AnyObject {
func userVerificationSessionsStatusCoordinatorDidClose(_ coordinator: UserVerificationSessionsStatusCoordinatorType)
func userVerificationSessionsStatusCoordinator(_ coordinator: UserVerificationSessionsStatusCoordinatorType, didSelectDeviceWithId deviceId: String, for userId: String)
}

View file

@ -18,11 +18,11 @@
import Foundation
protocol UserVerificationSessionsStatusViewModelViewDelegate: class {
protocol UserVerificationSessionsStatusViewModelViewDelegate: AnyObject {
func userVerificationSessionsStatusViewModel(_ viewModel: UserVerificationSessionsStatusViewModelType, didUpdateViewState viewSate: UserVerificationSessionsStatusViewState)
}
protocol UserVerificationSessionsStatusViewModelCoordinatorDelegate: class {
protocol UserVerificationSessionsStatusViewModelCoordinatorDelegate: AnyObject {
func userVerificationSessionsStatusViewModel(_ viewModel: UserVerificationSessionsStatusViewModelType, didSelectDeviceWithId deviceId: String, for userId: String)
func userVerificationSessionsStatusViewModelDidClose(_ viewModel: UserVerificationSessionsStatusViewModelType)
}

View file

@ -18,7 +18,7 @@
import Foundation
protocol UserVerificationStartCoordinatorDelegate: class {
protocol UserVerificationStartCoordinatorDelegate: AnyObject {
func userVerificationStartCoordinator(_ coordinator: UserVerificationStartCoordinatorType, otherDidAcceptRequest request: MXKeyVerificationRequest)

View file

@ -18,11 +18,11 @@
import Foundation
protocol UserVerificationStartViewModelViewDelegate: class {
protocol UserVerificationStartViewModelViewDelegate: AnyObject {
func userVerificationStartViewModel(_ viewModel: UserVerificationStartViewModelType, didUpdateViewState viewSate: UserVerificationStartViewState)
}
protocol UserVerificationStartViewModelCoordinatorDelegate: class {
protocol UserVerificationStartViewModelCoordinatorDelegate: AnyObject {
func userVerificationStartViewModel(_ viewModel: UserVerificationStartViewModelType, otherDidAcceptRequest request: MXKeyVerificationRequest)

View file

@ -18,7 +18,7 @@
import Foundation
protocol UserVerificationCoordinatorDelegate: class {
protocol UserVerificationCoordinatorDelegate: AnyObject {
func userVerificationCoordinatorDidComplete(_ coordinator: UserVerificationCoordinatorType)
}

View file

@ -83,8 +83,8 @@ extension MediaPickerCoordinator: MediaPickerViewControllerDelegate {
self.delegate?.mediaPickerCoordinator(self, didSelectImageData: imageData, withUTI: uti)
}
func mediaPickerController(_ mediaPickerController: MediaPickerViewController!, didSelectVideo videoURL: URL!) {
self.delegate?.mediaPickerCoordinator(self, didSelectVideoAt: videoURL)
func mediaPickerController(_ mediaPickerController: MediaPickerViewController!, didSelectVideo videoAsset: AVAsset!) {
self.delegate?.mediaPickerCoordinator(self, didSelectVideo: videoAsset)
}
func mediaPickerController(_ mediaPickerController: MediaPickerViewController!, didSelect assets: [PHAsset]!) {

View file

@ -20,7 +20,7 @@ import Foundation
@objc protocol MediaPickerCoordinatorBridgePresenterDelegate {
func mediaPickerCoordinatorBridgePresenter(_ coordinatorBridgePresenter: MediaPickerCoordinatorBridgePresenter, didSelectImageData imageData: Data, withUTI uti: MXKUTI?)
func mediaPickerCoordinatorBridgePresenter(_ coordinatorBridgePresenter: MediaPickerCoordinatorBridgePresenter, didSelectVideoAt url: URL)
func mediaPickerCoordinatorBridgePresenter(_ coordinatorBridgePresenter: MediaPickerCoordinatorBridgePresenter, didSelectVideo videoAsset: AVAsset)
func mediaPickerCoordinatorBridgePresenter(_ coordinatorBridgePresenter: MediaPickerCoordinatorBridgePresenter, didSelectAssets assets: [PHAsset])
func mediaPickerCoordinatorBridgePresenterDidCancel(_ coordinatorBridgePresenter: MediaPickerCoordinatorBridgePresenter)
}
@ -110,8 +110,8 @@ extension MediaPickerCoordinatorBridgePresenter: MediaPickerCoordinatorDelegate
self.delegate?.mediaPickerCoordinatorBridgePresenter(self, didSelectImageData: imageData, withUTI: uti)
}
func mediaPickerCoordinator(_ coordinator: MediaPickerCoordinatorType, didSelectVideoAt url: URL) {
self.delegate?.mediaPickerCoordinatorBridgePresenter(self, didSelectVideoAt: url)
func mediaPickerCoordinator(_ coordinator: MediaPickerCoordinatorType, didSelectVideo videoAsset: AVAsset) {
self.delegate?.mediaPickerCoordinatorBridgePresenter(self, didSelectVideo: videoAsset)
}
func mediaPickerCoordinator(_ coordinator: MediaPickerCoordinatorType, didSelectAssets assets: [PHAsset]) {

View file

@ -18,9 +18,9 @@
import Foundation
protocol MediaPickerCoordinatorDelegate: class {
protocol MediaPickerCoordinatorDelegate: AnyObject {
func mediaPickerCoordinator(_ coordinator: MediaPickerCoordinatorType, didSelectImageData imageData: Data, withUTI uti: MXKUTI?)
func mediaPickerCoordinator(_ coordinator: MediaPickerCoordinatorType, didSelectVideoAt url: URL)
func mediaPickerCoordinator(_ coordinator: MediaPickerCoordinatorType, didSelectVideo videoAsset: AVAsset)
func mediaPickerCoordinator(_ coordinator: MediaPickerCoordinatorType, didSelectAssets assets: [PHAsset])
func mediaPickerCoordinatorDidCancel(_ coordinator: MediaPickerCoordinatorType)
}

View file

@ -39,9 +39,9 @@
Tells the delegate that the user select a video.
@param mediaPickerController the `MediaPickerViewController` instance.
@param videoURL the local url of the video to send.
@param videoAsset an `AVAsset` that represents the video to send.
*/
- (void)mediaPickerController:(MediaPickerViewController *)mediaPickerController didSelectVideo:(NSURL*)videoURL;
- (void)mediaPickerController:(MediaPickerViewController *)mediaPickerController didSelectVideo:(AVAsset*)videoAsset;
/**
Tells the delegate that the user wants to cancel media picking.

View file

@ -608,28 +608,19 @@
if (asset)
{
if ([asset isKindOfClass:[AVURLAsset class]])
{
MXLogDebug(@"[MediaPickerVC] didSelectAsset: Got AVAsset for video");
AVURLAsset *avURLAsset = (AVURLAsset*)asset;
MXLogDebug(@"[MediaPickerVC] didSelectAsset: Got AVAsset for video");
// Validate first the selected video
[self validateSelectedVideo:asset responseHandler:^(BOOL isValidated) {
if (isValidated)
{
[self.delegate mediaPickerController:self didSelectVideo:asset];
}
// Validate first the selected video
[self validateSelectedVideo:[avURLAsset URL] responseHandler:^(BOOL isValidated) {
if (isValidated)
{
[self.delegate mediaPickerController:self didSelectVideo:[avURLAsset URL]];
}
self->isValidationInProgress = NO;
}];
}
else
{
MXLogDebug(@"[MediaPickerVC] Selected video asset is not initialized from an URL!");
self->isValidationInProgress = NO;
}
}];
}
else
{
@ -693,7 +684,7 @@
[self setNeedsStatusBarAppearanceUpdate];
}
- (void)validateSelectedVideo:(NSURL*)selectedVideoURL responseHandler:(void (^)(BOOL isValidated))handler
- (void)validateSelectedVideo:(AVAsset*)selectedVideo responseHandler:(void (^)(BOOL isValidated))handler
{
[self dismissImageValidationView];
@ -727,15 +718,16 @@
videoPlayer = [[AVPlayerViewController alloc] init];
if (videoPlayer)
{
AVPlayerItem *item = [AVPlayerItem playerItemWithAsset:selectedVideo];
videoPlayer.allowsPictureInPicturePlayback = NO;
videoPlayer.updatesNowPlayingInfoCenter = NO;
videoPlayer.player = [AVPlayer playerWithURL:selectedVideoURL];
videoPlayer.player = [AVPlayer playerWithPlayerItem:item];
videoPlayer.videoGravity = AVLayerVideoGravityResizeAspect;
videoPlayer.showsPlaybackControls = NO;
// create a thumbnail for the first frame
AVAsset *asset = [AVAsset assetWithURL:selectedVideoURL];
AVAssetImageGenerator *generator = [AVAssetImageGenerator assetImageGeneratorWithAsset:asset];
AVAssetImageGenerator *generator = [AVAssetImageGenerator assetImageGeneratorWithAsset:selectedVideo];
generator.appliesPreferredTrackTransform = YES;
CGImageRef thumbnailRef = [generator copyCGImageAtTime:kCMTimeZero actualTime:nil error:nil];
// set thumbnail on validationView

View file

@ -18,7 +18,7 @@ import Foundation
import UIKit
import AVFoundation
@objc protocol SingleImagePickerPresenterDelegate: class {
@objc protocol SingleImagePickerPresenterDelegate: AnyObject {
func singleImagePickerPresenter(_ presenter: SingleImagePickerPresenter, didSelectImageData imageData: Data, withUTI uti: MXKUTI?)
func singleImagePickerPresenterDidCancel(_ presenter: SingleImagePickerPresenter)
}
@ -135,7 +135,7 @@ extension SingleImagePickerPresenter: MediaPickerCoordinatorBridgePresenterDeleg
self.delegate?.singleImagePickerPresenter(self, didSelectImageData: imageData, withUTI: uti)
}
func mediaPickerCoordinatorBridgePresenter(_ coordinatorBridgePresenter: MediaPickerCoordinatorBridgePresenter, didSelectVideoAt url: URL) {
func mediaPickerCoordinatorBridgePresenter(_ coordinatorBridgePresenter: MediaPickerCoordinatorBridgePresenter, didSelectVideo videoAsset: AVAsset) {
self.delegate?.singleImagePickerPresenterDidCancel(self)
}

View file

@ -62,11 +62,16 @@
@property (nonatomic, readonly) NSString *directoryServerDisplayname;
/**
The number of public rooms matching `searchPattern`.
It is accurate only if 'moreThanRoomsCount' is NO.
The number of public rooms that have been fetched so far.
*/
@property (nonatomic, readonly) NSUInteger roomsCount;
/**
The total number of public rooms matching `searchPattern`.
It is accurate only if 'searchResultsCountIsLimited' is NO.
*/
@property (nonatomic, readonly) NSUInteger searchResultsCount;
/**
In case of search with a lot of matching public rooms, we cannot return an accurate
value except by paginating the full list of rooms, which is not expected.
@ -74,7 +79,7 @@
This flag indicates that we know that there is more matching rooms than we got
so far.
*/
@property (nonatomic, readonly) BOOL moreThanRoomsCount;
@property (nonatomic, readonly) BOOL searchResultsCountIsLimited;
/**
The maximum number of public rooms to retrieve during a pagination.

View file

@ -165,6 +165,11 @@ static NSString *const kNSFWKeyword = @"nsfw";
}
}
- (NSUInteger)roomsCount
{
return rooms.count;
}
- (NSIndexPath*)cellIndexPathWithRoomId:(NSString*)roomId andMatrixSession:(MXSession*)matrixSession
{
NSIndexPath *indexPath = nil;
@ -217,8 +222,8 @@ static NSString *const kNSFWKeyword = @"nsfw";
// Reset all pagination vars
[rooms removeAllObjects];
nextBatch = nil;
_roomsCount = 0;
_moreThanRoomsCount = NO;
_searchResultsCount = 0;
_searchResultsCountIsLimited = NO;
_hasReachedPaginationEnd = NO;
}
@ -264,14 +269,14 @@ static NSString *const kNSFWKeyword = @"nsfw";
if (!self->_searchPattern)
{
// When there is no search, we can use totalRoomCountEstimate returned by the server
self->_roomsCount = publicRoomsResponse.totalRoomCountEstimate;
self->_moreThanRoomsCount = NO;
self->_searchResultsCount = publicRoomsResponse.totalRoomCountEstimate;
self->_searchResultsCountIsLimited = NO;
}
else
{
// Else we can only display something like ">20 matching rooms"
self->_roomsCount = self->rooms.count;
self->_moreThanRoomsCount = publicRoomsResponse.nextBatch ? YES : NO;
self->_searchResultsCount = self->rooms.count;
self->_searchResultsCountIsLimited = publicRoomsResponse.nextBatch ? YES : NO;
}
// Detect pagination end

View file

@ -17,7 +17,7 @@
import UIKit
import ZXingObjC
protocol QRCodeReaderViewControllerDelegate: class {
protocol QRCodeReaderViewControllerDelegate: AnyObject {
func qrCodeReaderViewController(_ viewController: QRCodeReaderViewController, didFound payloadData: Data)
func qrCodeReaderViewControllerDidCancel(_ viewController: QRCodeReaderViewController)
}

Some files were not shown because too many files have changed in this diff Show more