mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 09:02:44 +02:00
b298dedc22
Merge commit 'f823ab9aae70e8d15ed7cc079210dd9bbbb6c8e1' into feature/foss_update_1_11_19 * commit 'f823ab9aae70e8d15ed7cc079210dd9bbbb6c8e1': finish version++ version++ comments update submodule remove obsolete tests removed unused code update submodule fix Libolm removal update license macro update license Prepare for new sprint # Conflicts: # Config/AppVersion.xcconfig # IDETemplateMacros.plist # LICENSE # README.md # Riot/Categories/MXSession+Riot.m # Riot/Managers/EncryptionKeyManager/EncryptionKeyManager.swift # Riot/Managers/KeyValueStorage/Extensions/Keychain.swift # Riot/Managers/KeyValueStorage/KeyValueStore.swift # Riot/Managers/KeyValueStorage/KeychainStore.swift # Riot/Managers/KeyValueStorage/MemoryStore.swift # Riot/Managers/PushNotification/PushNotificationService.m # Riot/Managers/Settings/RiotSettings.swift # Riot/Managers/Settings/Shared/RiotSharedSettings.swift # Riot/Modules/Analytics/AnalyticsUIElement.swift # Riot/Modules/Application/AppCoordinator.swift # Riot/Modules/Application/LegacyAppDelegate.h # Riot/Modules/Application/LegacyAppDelegate.m # Riot/Modules/Authentication/Legacy/AuthenticationViewController.h # Riot/Modules/Authentication/Legacy/AuthenticationViewController.m # Riot/Modules/Authentication/Legacy/Views/AuthInputsView.h # Riot/Modules/Authentication/Legacy/Views/AuthInputsView.m # Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m # Riot/Modules/Common/Recents/RecentsViewController.m # Riot/Modules/Common/WebViewController/WebViewViewController.m # Riot/Modules/Contacts/Details/ContactDetailsViewController.m # Riot/Modules/Contacts/Views/ContactTableViewCell.m # Riot/Modules/Favorites/FavouritesViewController.h # Riot/Modules/Favorites/FavouritesViewController.m # Riot/Modules/GlobalSearch/UnifiedSearchViewController.m # Riot/Modules/People/PeopleViewController.h # Riot/Modules/People/PeopleViewController.m # Riot/Modules/Room/ContextualMenu/ReactionsMenu/ReactionsMenuViewModel.swift # Riot/Modules/Room/DataSources/RoomDataSource.m # Riot/Modules/Room/Files/RoomFilesViewController.m # Riot/Modules/Room/Members/Detail/RoomMemberDetailsViewController.m # Riot/Modules/Room/Members/RoomParticipantsViewController.m # Riot/Modules/Room/RoomViewController.m # Riot/Modules/Room/Settings/RoomSettingsViewController.m # Riot/Modules/Room/TimelineCells/RoomCreationIntro/RoomCreationIntroCell.swift # Riot/Modules/Room/TimelineCells/RoomCreationIntro/RoomCreationIntroCellContentView.swift # Riot/Modules/Room/TimelineCells/RoomCreationIntro/RoomCreationIntroViewData.swift # Riot/Modules/Room/TimelineCells/RoomTimelineCellIdentifier.h # Riot/Modules/Rooms/RoomsViewController.h # Riot/Modules/Rooms/ShowDirectory/Cells/Network/DirectoryNetworkTableHeaderFooterView.swift # Riot/Modules/Rooms/ShowDirectory/Cells/Room/DirectoryRoomTableViewCell.swift # Riot/Modules/Rooms/ShowDirectory/PublicRoomsDirectoryViewModel.swift # Riot/Modules/Secrets/Recover/RecoverWithKey/SecretsRecoveryWithKeyCoordinator.swift # Riot/Modules/Secrets/Recover/RecoverWithKey/SecretsRecoveryWithKeyViewController.swift # Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseCoordinator.swift # Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseViewController.swift # Riot/Modules/Secrets/Recover/SecretsRecoveryCoordinator.swift # Riot/Modules/SecureBackup/Setup/Intro/SecureBackupSetupIntroViewController.swift # Riot/Modules/SecureBackup/Setup/Intro/SecureBackupSetupIntroViewModel.swift # Riot/Modules/SecureBackup/Setup/Intro/SecureBackupSetupIntroViewModelType.swift # Riot/Modules/SetPinCode/PinCodePreferences.swift # Riot/Modules/SetPinCode/SetupBiometrics/BiometricsAuthenticationPresenter.swift # Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m # Riot/Modules/Settings/Security/SecurityViewController.m # Riot/Modules/Settings/SettingsViewController.m # Riot/Modules/SplitView/SplitViewCoordinator.swift # Riot/Modules/SplitView/SplitViewCoordinatorType.swift # Riot/Modules/StartChat/StartChatViewController.m # Riot/Modules/TabBar/MasterTabBarController.h # Riot/Modules/TabBar/MasterTabBarController.m # Riot/Utils/EventFormatter.m # Riot/Utils/HTMLFormatter.swift # Riot/Utils/Tools.m # RiotNSE/NotificationService.swift
239 lines
9.0 KiB
Objective-C
239 lines
9.0 KiB
Objective-C
/*
|
|
Copyright 2024 New Vector Ltd.
|
|
Copyright 2019 The Matrix.org Foundation C.I.C
|
|
Copyright 2017 Vector Creations Ltd
|
|
Copyright 2015 OpenMarket Ltd
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
Please see LICENSE in the repository root for full details.
|
|
*/
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import <Contacts/Contacts.h>
|
|
|
|
#import <MatrixSDK/MatrixSDK.h>
|
|
|
|
#import "MXKSectionedContacts.h"
|
|
#import "MXKContact.h"
|
|
|
|
/**
|
|
Posted when the matrix contact list is loaded or updated.
|
|
The notification object is:
|
|
- a contact Id when a matrix contact has been added/updated/removed.
|
|
or
|
|
- nil when all matrix contacts are concerned.
|
|
*/
|
|
extern NSString * _Nonnull const kMXKContactManagerDidUpdateMatrixContactsNotification;
|
|
|
|
/**
|
|
Posted when the local contact list is loaded and updated.
|
|
The notification object is:
|
|
- a contact Id when a local contact has been added/updated/removed.
|
|
or
|
|
- nil when all local contacts are concerned.
|
|
*/
|
|
extern NSString * _Nonnull const kMXKContactManagerDidUpdateLocalContactsNotification;
|
|
|
|
/**
|
|
Posted when local contact matrix ids is updated.
|
|
The notification object is:
|
|
- a contact Id when a local contact has been added/updated/removed.
|
|
or
|
|
- nil when all local contacts are concerned.
|
|
*/
|
|
extern NSString * _Nonnull const kMXKContactManagerDidUpdateLocalContactMatrixIDsNotification;
|
|
|
|
/**
|
|
Posted when the presence of a matrix user linked at least to one contact has changed.
|
|
The notification object is the matrix Id. The `userInfo` dictionary contains an `MXPresenceString` object under the `kMXKContactManagerMatrixPresenceKey` key, representing the matrix user presence.
|
|
*/
|
|
extern NSString * _Nonnull const kMXKContactManagerMatrixUserPresenceChangeNotification;
|
|
extern NSString * _Nonnull const kMXKContactManagerMatrixPresenceKey;
|
|
|
|
/**
|
|
Posted when all phonenumbers of local contacts have been internationalized.
|
|
The notification object is nil.
|
|
*/
|
|
extern NSString * _Nonnull const kMXKContactManagerDidInternationalizeNotification;
|
|
|
|
/**
|
|
Used to identify the type of data when requesting MXKeyProvider
|
|
*/
|
|
extern NSString * _Nonnull const MXKContactManagerDataType;
|
|
|
|
/**
|
|
Define the contact creation for the room members
|
|
*/
|
|
typedef NS_ENUM(NSInteger, MXKContactManagerMXRoomSource) {
|
|
MXKContactManagerMXRoomSourceNone = 0, // the MXMember does not create any new contact.
|
|
MXKContactManagerMXRoomSourceDirectChats = 1, // the direct chat users have their own contact even if they are not defined in the device contacts book
|
|
MXKContactManagerMXRoomSourceAll = 2, // all the room members have their own contact even if they are not defined in the device contacts book
|
|
};
|
|
|
|
/**
|
|
This manager handles 2 kinds of contact list:
|
|
- The local contacts retrieved from the device phonebook.
|
|
- The matrix contacts retrieved from the matrix one-to-one rooms.
|
|
|
|
Note: The local contacts handling depends on the 'syncLocalContacts' and 'phonebookCountryCode' properties
|
|
of the shared application settings object '[MXKAppSettings standardAppSettings]'.
|
|
*/
|
|
@interface MXKContactManager : NSObject
|
|
|
|
/**
|
|
The shared instance of contact manager.
|
|
*/
|
|
+ (MXKContactManager* _Nonnull)sharedManager;
|
|
|
|
/**
|
|
Block called (if any) to discover the Matrix users bound to a set of third-party identifiers (email addresses, phone numbers).
|
|
If this property is unset, the contact manager will consider the potential identity server URL (see the `identityServer` property)
|
|
to build its own Restclient and trigger `lookup3PIDs` requests.
|
|
|
|
@param threepids the list of 3rd party ids: [[<(MX3PIDMedium)media1>, <(NSString*)address1>], [<(MX3PIDMedium)media2>, <(NSString*)address2>], ...].
|
|
@param success a block object called when the operation succeeds. It provides the array of the discovered users:
|
|
[[<(MX3PIDMedium)media>, <(NSString*)address>, <(NSString*)userId>], ...].
|
|
@param failure a block object called when the operation fails.
|
|
*/
|
|
typedef void(^MXKContactManagerDiscoverUsersBoundTo3PIDs)(NSArray<NSArray<NSString *> *> * _Nonnull threepids,
|
|
void (^ _Nonnull success)(NSArray<NSArray<NSString *> *> *_Nonnull),
|
|
void (^ _Nonnull failure)(NSError *_Nonnull));
|
|
@property (nonatomic, nullable) MXKContactManagerDiscoverUsersBoundTo3PIDs discoverUsersBoundTo3PIDsBlock;
|
|
|
|
/**
|
|
Define if the room member must have their dedicated contact even if they are not define in the device contacts book.
|
|
The default value is MXKContactManagerMXRoomSourceDirectChats;
|
|
*/
|
|
@property (nonatomic) MXKContactManagerMXRoomSource contactManagerMXRoomSource;
|
|
|
|
/**
|
|
Associated matrix sessions (empty by default).
|
|
*/
|
|
@property (nonatomic, readonly, nonnull) NSArray *mxSessions;
|
|
|
|
/**
|
|
The current list of the contacts extracted from matrix data. Depends on 'contactManagerMXRoomSource'.
|
|
*/
|
|
@property (nonatomic, readonly, nullable) NSArray *matrixContacts;
|
|
|
|
/**
|
|
The current list of the local contacts (nil by default until the contacts are loaded).
|
|
*/
|
|
@property (nonatomic, readonly, nullable) NSArray *localContacts;
|
|
|
|
/**
|
|
The current list of the local contacts who have contact methods which can be used to invite them or to discover matrix users.
|
|
*/
|
|
@property (nonatomic, readonly, nullable) NSArray *localContactsWithMethods;
|
|
|
|
/**
|
|
The contacts list obtained by splitting each local contact by contact method.
|
|
This list is alphabetically sorted.
|
|
Each contact has one and only one contact method.
|
|
*/
|
|
//- (void)localContactsSplitByContactMethod:(void (^)(NSArray<MXKContact*> *localContactsSplitByContactMethod))onComplete;
|
|
|
|
@property (nonatomic, readonly, nullable) NSArray *localContactsSplitByContactMethod;
|
|
|
|
/**
|
|
The current list of the contacts for whom a direct chat exists.
|
|
*/
|
|
@property (nonatomic, readonly, nonnull) NSArray *directMatrixContacts;
|
|
|
|
/// Flag to allow local contacts access or not. Default value is YES.
|
|
@property (nonatomic, assign) BOOL allowLocalContactsAccess;
|
|
|
|
/**
|
|
Add/remove matrix session. The matrix contact list is automatically updated (see kMXKContactManagerDidUpdateMatrixContactsNotification event).
|
|
*/
|
|
- (void)addMatrixSession:(MXSession* _Nonnull)mxSession;
|
|
- (void)removeMatrixSession:(MXSession* _Nonnull)mxSession;
|
|
|
|
/**
|
|
Takes into account the state of the identity service's terms, local contacts access authorization along with
|
|
whether the user has left the app for the Settings app to update the contacts access, and enables/disables
|
|
the `syncLocalContacts` property of `MXKAppSettings` when necessary.
|
|
@param mxSession The session who's identity service shall be used.
|
|
*/
|
|
- (void)validateSyncLocalContactsStateForSession:(MXSession *)mxSession;
|
|
|
|
/**
|
|
Load and/or refresh the local contacts. Observe kMXKContactManagerDidUpdateLocalContactsNotification to know when local contacts are available.
|
|
*/
|
|
- (void)refreshLocalContacts;
|
|
|
|
/**
|
|
Delete contacts info
|
|
*/
|
|
- (void)reset;
|
|
|
|
/**
|
|
Get contact by its identifier.
|
|
|
|
@param contactID the contact identifier.
|
|
@return the contact defined with the provided id.
|
|
*/
|
|
- (MXKContact* _Nullable)contactWithContactID:(NSString* _Nonnull)contactID;
|
|
|
|
/**
|
|
Refresh matrix IDs for a specific local contact. See kMXKContactManagerDidUpdateLocalContactMatrixIDsNotification
|
|
posted when update is done.
|
|
|
|
@param contact the local contact to refresh.
|
|
*/
|
|
- (void)updateMatrixIDsForLocalContact:(MXKContact* _Nonnull)contact;
|
|
|
|
/**
|
|
Refresh matrix IDs for all local contacts. See kMXKContactManagerDidUpdateLocalContactMatrixIDsNotification
|
|
posted when update for all local contacts is done.
|
|
*/
|
|
- (void)updateMatrixIDsForAllLocalContacts;
|
|
|
|
/**
|
|
The contacts list obtained by splitting each local contact by contact method.
|
|
This list is alphabetically sorted.
|
|
Each contact has one and only one contact method.
|
|
*/
|
|
//- (void)localContactsSplitByContactMethod:(void (^)(NSArray<MXKContact*> *localContactsSplitByContactMethod))onComplete;
|
|
|
|
/**
|
|
Sort a contacts array in sectioned arrays to be displayable in a UITableview
|
|
*/
|
|
- (MXKSectionedContacts* _Nullable)getSectionedContacts:(NSArray* _Nonnull)contactList;
|
|
|
|
/**
|
|
Sort alphabetically an array of contacts.
|
|
|
|
@param contactsArray the array of contacts to sort.
|
|
*/
|
|
- (void)sortAlphabeticallyContacts:(NSMutableArray<MXKContact*> * _Nonnull)contactsArray;
|
|
|
|
/**
|
|
Sort an array of contacts by last active, with "active now" first.
|
|
...and then alphabetically.
|
|
|
|
@param contactsArray the array of contacts to sort.
|
|
*/
|
|
- (void)sortContactsByLastActiveInformation:(NSMutableArray<MXKContact*> * _Nonnull)contactsArray;
|
|
|
|
/**
|
|
Refresh the international phonenumber of the local contacts (See kMXKContactManagerDidInternationalizeNotification).
|
|
|
|
@param countryCode the country code.
|
|
*/
|
|
- (void)internationalizePhoneNumbers:(NSString* _Nonnull)countryCode;
|
|
|
|
/**
|
|
Request user permission for syncing local contacts.
|
|
|
|
@param viewController the view controller to attach the dialog to the user.
|
|
@param handler the block called with the result of requesting access
|
|
*/
|
|
+ (void)requestUserConfirmationForLocalContactsSyncInViewController:(UIViewController* _Nonnull)viewController
|
|
completionHandler:(void (^_Nonnull)(BOOL granted))handler;
|
|
|
|
// bwi: we need this public
|
|
- (void)refreshMatrixContacts;
|
|
|
|
@end
|