Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use new account property scopes.
Signed-off-by: Ivan Sein <[email protected]>
  • Loading branch information
Ivansss committed Apr 17, 2023
commit dae87a4bdbc2b014904fc2ea3a39c72ed121cc3a
4 changes: 3 additions & 1 deletion NextcloudTalk/NCDatabaseManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

NSString *const kTalkDatabaseFolder = @"Library/Application Support/Talk";
NSString *const kTalkDatabaseFileName = @"talk.realm";
uint64_t const kTalkDatabaseSchemaVersion = 47;
uint64_t const kTalkDatabaseSchemaVersion = 48;

NSString * const kCapabilitySystemMessages = @"system-messages";
NSString * const kCapabilityNotificationLevels = @"notification-levels";
Expand Down Expand Up @@ -374,6 +374,8 @@ - (void)setServerCapabilities:(NSDictionary *)serverCapabilities forAccountId:(N
capabilities.readStatusPrivacy = [[[[talkCaps objectForKey:@"config"] objectForKey:@"chat"] objectForKey:@"read-privacy"] boolValue];
capabilities.accountPropertyScopesVersion2 = [[provisioningAPICaps objectForKey:@"AccountPropertyScopesVersion"] integerValue] == 2;
capabilities.accountPropertyScopesFederationEnabled = [[provisioningAPICaps objectForKey:@"AccountPropertyScopesFederationEnabled"] boolValue];
capabilities.accountPropertyScopesFederatedEnabled = [[provisioningAPICaps objectForKey:@"AccountPropertyScopesFederatedEnabled"] boolValue];
capabilities.accountPropertyScopesPublishedEnabled = [[provisioningAPICaps objectForKey:@"AccountPropertyScopesPublishedEnabled"] boolValue];
capabilities.talkVersion = [talkCaps objectForKey:@"version"];
capabilities.guestsAppEnabled = [[guestsCaps objectForKey:@"enabled"] boolValue];
capabilities.referenceApiSupported = [[coreCaps objectForKey:@"reference-api"] boolValue];
Expand Down
2 changes: 2 additions & 0 deletions NextcloudTalk/ServerCapabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ NS_ASSUME_NONNULL_BEGIN
@property BOOL readStatusPrivacy;
@property BOOL accountPropertyScopesVersion2;
@property BOOL accountPropertyScopesFederationEnabled;
@property BOOL accountPropertyScopesFederatedEnabled;
@property BOOL accountPropertyScopesPublishedEnabled;
@property BOOL callEnabled;
@property NSString *talkVersion;
@property NSString *externalSignalingServerVersion;
Expand Down
7 changes: 7 additions & 0 deletions NextcloudTalk/UserProfileTableViewController+Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,17 @@ extension UserProfileTableViewController {
options.append(localOption)

let serverCapabilities = NCDatabaseManager.sharedInstance().serverCapabilities(forAccountId: account.accountId)
// Legacy capability
if serverCapabilities.accountPropertyScopesFederationEnabled {
options.append(federatedOption)
options.append(publishedOption)
}
if serverCapabilities.accountPropertyScopesFederatedEnabled {
options.append(federatedOption)
}
if serverCapabilities.accountPropertyScopesPublishedEnabled {
options.append(publishedOption)
}

let optionSelectorVC = DetailedOptionsSelectorTableViewController(options: options, forSenderIdentifier: field, andStyle: .insetGrouped)
if let optionSelectorVC = optionSelectorVC {
Expand Down
3 changes: 2 additions & 1 deletion NextcloudTalk/UserProfileTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ extension UserProfileTableViewController {
var headerView = HeaderWithButton()
headerView.button.addTarget(self, action: #selector(showScopeSelectionDialog(_:)), for: .touchUpInside)
let serverCapabilities = NCDatabaseManager.sharedInstance().serverCapabilities(forAccountId: account.accountId)
let shouldEnableNameAndEmailScopeButton = serverCapabilities.accountPropertyScopesFederationEnabled
let shouldEnableNameAndEmailScopeButton = serverCapabilities.accountPropertyScopesFederationEnabled ||
serverCapabilities.accountPropertyScopesFederatedEnabled || serverCapabilities.accountPropertyScopesPublishedEnabled

switch profileSection {
case ProfileSection.kProfileSectionName.rawValue:
Expand Down