diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ac2cc778..9e6d63540 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,35 @@ +Changelog for ownCloud iOS Client [11.8.1] (2021-12-22) +======================================= +The following sections list the changes in ownCloud iOS Client 11.8.1 relevant to +ownCloud admins and users. + +[11.8.1]: https://github.com/owncloud/ios-app/compare/milestone/11.8.0...milestone/11.8.1 + +Summary +------- + +* Change - Fallback on OIDC Dynamic Client Registration: [#1068](https://github.com/owncloud/ios-app/pull/1068) +* Change - Localized Sort Order: [#975](https://github.com/owncloud/ios-app/issues/975) + +Details +------- + +* Change - Fallback on OIDC Dynamic Client Registration: [#1068](https://github.com/owncloud/ios-app/pull/1068) + + Adds authentication-oauth2.oidc-fallback-on-client-registration-failure - + defaulting to true - to allow the automatic fallback to default client_id / client_secret if + OpenID Connect Dynamic Client Registration fails with any error. Furthermore fixed an + infinite OAuth2 token refresh loop via SDK update. + + https://github.com/owncloud/ios-app/pull/1068 + +* Change - Localized Sort Order: [#975](https://github.com/owncloud/ios-app/issues/975) + + Improved sorting results and localized sorting across query results and database queries, + via the SDK's new OCLOCALIZED collation and sort comparator. + + https://github.com/owncloud/ios-app/issues/975 + Changelog for ownCloud iOS Client [11.8.0] (2021-12-01) ======================================= The following sections list the changes in ownCloud iOS Client 11.8.0 relevant to diff --git a/changelog/11.8.1_2021-12-22/1068 b/changelog/11.8.1_2021-12-22/1068 new file mode 100644 index 000000000..8e939e558 --- /dev/null +++ b/changelog/11.8.1_2021-12-22/1068 @@ -0,0 +1,5 @@ +Change: Fallback on OIDC Dynamic Client Registration + +Adds authentication-oauth2.oidc-fallback-on-client-registration-failure - defaulting to true - to allow the automatic fallback to default client_id / client_secret if OpenID Connect Dynamic Client Registration fails with any error. Furthermore fixed an infinite OAuth2 token refresh loop via SDK update. + +https://github.com/owncloud/ios-app/pull/1068 diff --git a/changelog/11.8.1_2021-12-22/975 b/changelog/11.8.1_2021-12-22/975 new file mode 100644 index 000000000..a7bf19b29 --- /dev/null +++ b/changelog/11.8.1_2021-12-22/975 @@ -0,0 +1,5 @@ +Change: Localized Sort Order + +Improved sorting results and localized sorting across query results and database queries, via the SDK's new OCLOCALIZED collation and sort comparator. + +https://github.com/owncloud/ios-app/issues/975 diff --git a/docs/modules/ROOT/pages/ios_mdm_tables.adoc b/docs/modules/ROOT/pages/ios_mdm_tables.adoc index fe6fb3575..e1f49cf44 100644 --- a/docs/modules/ROOT/pages/ios_mdm_tables.adoc +++ b/docs/modules/ROOT/pages/ios_mdm_tables.adoc @@ -1,6 +1,6 @@ tag::account[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -20,7 +20,7 @@ end::account[] tag::actions[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -33,7 +33,7 @@ tag::actions[] |stringArray |`[]` |List of all allowed actions. If provided, actions not listed here are not allowed. -[cols="1,2"] +[cols="1,1"] !=== ! Value ! Description @@ -117,7 +117,7 @@ tag::actions[] |stringArray |`[]` |List of all disallowed actions. If provided, actions not listed here are allowed. -[cols="1,2"] +[cols="1,1"] !=== ! Value ! Description @@ -202,7 +202,7 @@ end::actions[] tag::app[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -252,7 +252,7 @@ end::app[] tag::authentication[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -265,7 +265,7 @@ tag::authentication[] |string |`operating-system` |Alternative browser session class to use instead of `ASWebAuthenticationSession`. Please also see Compile Time Configuration if you want to use this. -[cols="1,2"] +[cols="1,1"] !=== ! Value ! Description @@ -299,7 +299,7 @@ end::authentication[] tag::bookmarks[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -325,7 +325,7 @@ end::bookmarks[] tag::branding[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -344,7 +344,7 @@ tag::branding[] |stringArray | |List of disabled import methods that can't be used. -[cols="1,2"] +[cols="1,1"] !=== ! Value ! Description @@ -479,7 +479,7 @@ branding.profile-allowed-authentication-methods |stringArray | |The identifiers of the authentication methods allowed for this profile. Allows to f.ex. force OAuth2, or to use Basic Auth even if OAuth2 is available. -[cols="1,2"] +[cols="1,1"] !=== ! Value ! Description @@ -609,7 +609,7 @@ end::branding[] tag::browsersession[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -635,7 +635,7 @@ end::browsersession[] tag::build[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -667,7 +667,7 @@ end::build[] tag::connection[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -720,7 +720,7 @@ The following placeholders can be used to make it dynamic: |stringArray | |Allows fine-tuning the behavior of the connection validator by enabling/disabling aspects of it. -[cols="1,2"] +[cols="1,1"] !=== ! Value ! Description @@ -786,7 +786,7 @@ The following placeholders can be used to make it dynamic: |stringArray |`[]` |Active Host simulation extensions. -[cols="1,2"] +[cols="1,1"] !=== ! Value ! Description @@ -814,7 +814,7 @@ end::connection[] tag::diagnostics[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -834,7 +834,7 @@ end::diagnostics[] tag::displaysettings[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -866,7 +866,7 @@ end::displaysettings[] tag::endpoints[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -940,7 +940,7 @@ end::endpoints[] tag::licensing[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -966,7 +966,7 @@ end::licensing[] tag::localization[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -988,7 +988,7 @@ end::localization[] tag::logging[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -1001,7 +1001,7 @@ tag::logging[] |int |`4` |Log level -[cols="1,2"] +[cols="1,1"] !=== ! Value ! Description @@ -1049,7 +1049,7 @@ tag::logging[] |stringArray |`[writer.stderr writer.file]` |List of enabled logging system components. -[cols="1,2"] +[cols="1,1"] !=== ! Value ! Description @@ -1073,7 +1073,7 @@ tag::logging[] |string |`text` |Determines the format that log messages are saved in -[cols="1,2"] +[cols="1,1"] !=== ! Value ! Description @@ -1143,7 +1143,7 @@ end::logging[] tag::oauth2[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -1193,7 +1193,7 @@ end::oauth2[] tag::oidc[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -1231,7 +1231,7 @@ end::oidc[] tag::passcode[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -1275,7 +1275,7 @@ end::passcode[] tag::policies[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -1307,7 +1307,7 @@ end::policies[] tag::privacy[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -1327,7 +1327,7 @@ end::privacy[] tag::releasenotes[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -1353,7 +1353,7 @@ end::releasenotes[] tag::security[] -[cols="1,2,3,4a,5",options=header] +[cols="2,1,1,2a,1",options=header] |=== |Key |Type @@ -1366,7 +1366,7 @@ tag::security[] |stringArray | |Array of allowed authentication methods. Nil/Missing for no restrictions. -[cols="1,2"] +[cols="1,1"] !=== ! Value ! Description @@ -1387,7 +1387,7 @@ tag::security[] |stringArray |`[com.owncloud.openid-connect com.owncloud.oauth2 com.owncloud.basicauth]` |Array of authentication methods in order of preference (most preferred first). -[cols="1,2"] +[cols="1,1"] !=== ! Value ! Description diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 9ede59e37..29a2631cf 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -289,7 +289,7 @@ platform :ios do BETA_APP_ICON: false, APP_NAME: "ownCloud", URL_SCHEME: "owncloud-app", - IPA_NAME: "ownCloud-regular.ipa" + IPA_NAME: "ownCloud-regular" ) end @@ -314,7 +314,7 @@ platform :ios do BETA_APP_ICON: false, APP_NAME: "ownCloud", URL_SCHEME: "owncloud-emm", - IPA_NAME: "ownCloud-emm.ipa" + IPA_NAME: "ownCloud-emm" ) end @@ -339,7 +339,7 @@ lane :owncloud_online_build do BETA_APP_ICON: false, APP_NAME: "ownCloud Online", URL_SCHEME: "owncloud-online", - IPA_NAME: "ownCloud-online.ipa" + IPA_NAME: "ownCloud-online" ) end @@ -419,7 +419,7 @@ end CONFIGURATION: "Debug", BETA_APP_ICON: true, APP_NAME: "ownCloud", - IPA_NAME: "ownCloud.ipa" + IPA_NAME: "ownCloud" ) end @@ -481,6 +481,10 @@ end end end + gitbranch = sh "git rev-parse --abbrev-ref HEAD" + sdkgitbranch = sh "git -C ../ios-sdk/ rev-parse --abbrev-ref HEAD" + puts "App Git Branch: " + gitbranch + puts "SDK Git Branch: " + sdkgitbranch if File.exist?("../" + themePath) # Extract from Branding.plist tmpAppBuildFlags = get_info_plist_value(path: themePath, key: "build.flags") @@ -518,13 +522,14 @@ end commit = sh "git rev-parse --short HEAD" sdkcommit = sh "git -C ../ios-sdk/ rev-parse --short HEAD" - puts "Git Hash: " + commit + puts "App Git Hash: " + commit puts "SDK Git Hash: " + sdkcommit - set_info_plist_value(path: themePath, key: "LastGitCommit", value: commit) - set_info_plist_value(path: themePath, key: "SDKLastGitCommit", value: sdkcommit) + set_info_plist_value(path: themePath, key: "GitHash", value: commit) + set_info_plist_value(path: themePath, key: "SDKGitHash", value: sdkcommit) + set_info_plist_value(path: themePath, key: "GitBranch", value: gitbranch) + set_info_plist_value(path: themePath, key: "SDKGitBranch", value: sdkgitbranch) end - puts "App Name: " + appName puts "App Build Flags: " + appBuildFlags puts "Custom App Scheme: " + appCustomAppScheme @@ -767,9 +772,7 @@ end version_key: "APP_SHORT_VERSION" ) - if !values[:IPA_NAME].nil? - ipaName = values[:IPA_NAME] - elsif + time = Time.now ipaSuffix = EXPORT_METHOD + "-" + time.strftime("%Y%m%d-%k%M") if !customAppVersionNumber.nil? @@ -778,13 +781,17 @@ end if !values[:BUILD_NUMBER].nil? version += "." + BUILD_NUMBER end - ipaName = appName + "-" + version + "-" + ipaSuffix + ".ipa" + + if !values[:IPA_NAME].nil? + ipaName = values[:IPA_NAME] + "-" + version + "-" + gitbranch.strip + "-" + ipaSuffix + ".ipa" + elsif + ipaName = appName + "-" + version + "-" + ipaSuffix + ".ipa" + end if File.exist?("../" + themePath) # Copy the Branding.plist file with additional app and build informtion in the file name sh "cp " + "\"../" + themePath + "\" \"../" + themeFolder + appName + "-" + version + "-" + ipaSuffix + ".plist\"" end - end generate_appicon() diff --git a/fastlane/metadata-emm/en-US/release_notes.txt b/fastlane/metadata-emm/en-US/release_notes.txt index 7ab5f4e9d..f6cc529f5 100644 --- a/fastlane/metadata-emm/en-US/release_notes.txt +++ b/fastlane/metadata-emm/en-US/release_notes.txt @@ -1,15 +1,9 @@ -• Account List -There is a fresh new look for the single account overview. +• Sorting +Localized and improved sorting -• Biometrical Unlock -When protecting the app with a pin code, biometrical unlock will be suggested as default. +• Fix: Authentication Improvement +Fixed an OAuth2 token refresh problem -• Display Name -If the users display name is available, it will be shown in the account view, instead of the user name. - -• Background Location Settings -Only show background location settings if needed. - -• Improvements -There are a lot of improvements under the hood. +• Fix: Connection Problem +Fixed a possible connection problem in the single account view diff --git a/fastlane/metadata-owncloud-online/en-US/release_notes.txt b/fastlane/metadata-owncloud-online/en-US/release_notes.txt index 7ab5f4e9d..f6cc529f5 100644 --- a/fastlane/metadata-owncloud-online/en-US/release_notes.txt +++ b/fastlane/metadata-owncloud-online/en-US/release_notes.txt @@ -1,15 +1,9 @@ -• Account List -There is a fresh new look for the single account overview. +• Sorting +Localized and improved sorting -• Biometrical Unlock -When protecting the app with a pin code, biometrical unlock will be suggested as default. +• Fix: Authentication Improvement +Fixed an OAuth2 token refresh problem -• Display Name -If the users display name is available, it will be shown in the account view, instead of the user name. - -• Background Location Settings -Only show background location settings if needed. - -• Improvements -There are a lot of improvements under the hood. +• Fix: Connection Problem +Fixed a possible connection problem in the single account view diff --git a/fastlane/metadata/en-US/release_notes.txt b/fastlane/metadata/en-US/release_notes.txt index 7ab5f4e9d..f6cc529f5 100644 --- a/fastlane/metadata/en-US/release_notes.txt +++ b/fastlane/metadata/en-US/release_notes.txt @@ -1,15 +1,9 @@ -• Account List -There is a fresh new look for the single account overview. +• Sorting +Localized and improved sorting -• Biometrical Unlock -When protecting the app with a pin code, biometrical unlock will be suggested as default. +• Fix: Authentication Improvement +Fixed an OAuth2 token refresh problem -• Display Name -If the users display name is available, it will be shown in the account view, instead of the user name. - -• Background Location Settings -Only show background location settings if needed. - -• Improvements -There are a lot of improvements under the hood. +• Fix: Connection Problem +Fixed a possible connection problem in the single account view diff --git a/ios-sdk b/ios-sdk index 1093eca79..00e01d20d 160000 --- a/ios-sdk +++ b/ios-sdk @@ -1 +1 @@ -Subproject commit 1093eca793c928c46b9fe8b8a72972692367117a +Subproject commit 00e01d20dafd90eaa68ece1b1cac8004f66f7ccb diff --git a/ownCloud.xcodeproj/project.pbxproj b/ownCloud.xcodeproj/project.pbxproj index 54af8ddc4..15526c668 100644 --- a/ownCloud.xcodeproj/project.pbxproj +++ b/ownCloud.xcodeproj/project.pbxproj @@ -4730,8 +4730,8 @@ APP_BUILD_FLAGS = "$(inherited)"; APP_BUILD_FLAGS_SWIFT = "$(APP_BUILD_FLAGS)"; APP_PRODUCT_NAME = ownCloud; - APP_SHORT_VERSION = 11.8.0; - APP_VERSION = 202; + APP_SHORT_VERSION = 11.8.1; + APP_VERSION = 207; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -4799,8 +4799,8 @@ APP_BUILD_FLAGS = "$(inherited)"; APP_BUILD_FLAGS_SWIFT = "$(APP_BUILD_FLAGS)"; APP_PRODUCT_NAME = ownCloud; - APP_SHORT_VERSION = 11.8.0; - APP_VERSION = 202; + APP_SHORT_VERSION = 11.8.1; + APP_VERSION = 207; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -4863,8 +4863,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - APP_SHORT_VERSION = 11.8.0; - APP_VERSION = 202; + APP_SHORT_VERSION = 11.8.1; + APP_VERSION = 207; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = ownCloud/ownCloud.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; @@ -4897,8 +4897,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - APP_SHORT_VERSION = 11.8.0; - APP_VERSION = 202; + APP_SHORT_VERSION = 11.8.1; + APP_VERSION = 207; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = ownCloud/ownCloud.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; @@ -5255,8 +5255,8 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; - APP_SHORT_VERSION = 11.8.0; - APP_VERSION = 202; + APP_SHORT_VERSION = 11.8.1; + APP_VERSION = 207; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = NO; @@ -5299,8 +5299,8 @@ isa = XCBuildConfiguration; buildSettings = { APPLICATION_EXTENSION_API_ONLY = YES; - APP_SHORT_VERSION = 11.8.0; - APP_VERSION = 202; + APP_SHORT_VERSION = 11.8.1; + APP_VERSION = 207; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = NO; diff --git a/ownCloud/Bookmarks/BookmarkViewController.swift b/ownCloud/Bookmarks/BookmarkViewController.swift index 568ee8fde..1dae9557d 100644 --- a/ownCloud/Bookmarks/BookmarkViewController.swift +++ b/ownCloud/Bookmarks/BookmarkViewController.swift @@ -564,7 +564,8 @@ class BookmarkViewController: StaticTableViewController { connection.connect { [weak self] (error, issue) in if let strongSelf = self { if error == nil { - bookmark.displayName = connection.loggedInUser?.displayName + bookmark.userDisplayName = connection.loggedInUser?.displayName + connection.disconnect(completionHandler: { switch strongSelf.mode { case .create: diff --git a/ownCloud/Release Notes/ReleaseNotes.plist b/ownCloud/Release Notes/ReleaseNotes.plist index 3a7d35c68..1ca57d8a2 100644 --- a/ownCloud/Release Notes/ReleaseNotes.plist +++ b/ownCloud/Release Notes/ReleaseNotes.plist @@ -1438,6 +1438,43 @@ Added an optional "Wait for completion" option to the "Save File& + + Version + 11.8.1 + ReleaseNotes + + + Title + Sorting + Subtitle + Localized and improved sorting + Type + New + ImageName + wrench + + + Title + Fix: Authentication Improvement + Subtitle + Fixed an OAuth2 token refresh problem + Type + Fix + ImageName + bandage + + + Title + Fix: Connection Problem + Subtitle + Fixed a possible connection problem in the single account view + Type + Fix + ImageName + bandage + + + diff --git a/ownCloud/Server List/ServerListTableViewController.swift b/ownCloud/Server List/ServerListTableViewController.swift index 3962abd48..cef56d2b2 100644 --- a/ownCloud/Server List/ServerListTableViewController.swift +++ b/ownCloud/Server List/ServerListTableViewController.swift @@ -375,7 +375,21 @@ class ServerListTableViewController: UITableViewController, Themeable, StateRest // MARK: - Actions @IBAction func addBookmark() { - showBookmarkUI(attemptLoginOnSuccess: true) + var attemptLoginOnSuccess = true + + // Prevent requesting and immediately returning a core for the newly generated bookmark if it is the first one and + // the conditions in didUpdateServerList() would lead to a replacement of this view controller. Because then, this would + // happen: + // - didUpdateServerList() replaces ServerListTableViewController with StaticLoginSingleAccountServerListViewController + // - showBookmarkUI(attemptLoginOnSuccess:true) starts a new connection on the replaced ServerListTableViewController, which requests a core from OCCoreManager + // - then immediately ClientRootViewController gets deallocated, which returns the core to OCCoreManager + // - the unusual *immediate* request + return might lead to an overlap with the next request for a core, so duplicate OCCore and OCConnection instances exist for a moment, + // possibly interfering event and request routing of one another + if !VendorServices.shared.isBranded, OCBookmarkManager.shared.bookmarks.count == 0 { + attemptLoginOnSuccess = false + } + + showBookmarkUI(attemptLoginOnSuccess: attemptLoginOnSuccess) } func showBookmarkUI(edit bookmark: OCBookmark? = nil, performContinue: Bool = false, attemptLoginOnSuccess: Bool = false, autosolveErrorOnSuccess: NSError? = nil, removeAuthDataFromCopy: Bool = true) { @@ -394,13 +408,15 @@ class ServerListTableViewController: UITableViewController, Themeable, StateRest _ = target.perform(action, with: self) } - if attemptLoginOnSuccess { - bookmarkViewController.userActionCompletionHandler = { [weak self] (bookmark, success) in - if success, let bookmark = bookmark, let self = self { - self.didUpdateServerList() - if let error = autosolveErrorOnSuccess as Error? { - OCMessageQueue.global.resolveIssues(forError: error, forBookmarkUUID: bookmark.uuid) - } + bookmarkViewController.userActionCompletionHandler = { [weak self] (bookmark, success) in + if success, let bookmark = bookmark, let self = self { + self.didUpdateServerList() + + if let error = autosolveErrorOnSuccess as Error? { + OCMessageQueue.global.resolveIssues(forError: error, forBookmarkUUID: bookmark.uuid) + } + + if attemptLoginOnSuccess { self.connect(to: bookmark, lastVisibleItemId: nil, animated: true) } } diff --git a/ownCloud/Static Login/Interface/StaticLoginSingleAccountServerListViewController.swift b/ownCloud/Static Login/Interface/StaticLoginSingleAccountServerListViewController.swift index 723ba713f..3981767fd 100644 --- a/ownCloud/Static Login/Interface/StaticLoginSingleAccountServerListViewController.swift +++ b/ownCloud/Static Login/Interface/StaticLoginSingleAccountServerListViewController.swift @@ -54,6 +54,8 @@ class StaticLoginSingleAccountServerListViewController: ServerListTableViewContr private var settingsRows: [SettingsRowIndex] = [.settings] + private var bookmarkChangesObserver : NSObjectProtocol? + var themeApplierToken : ThemeApplierToken? deinit { @@ -91,6 +93,10 @@ class StaticLoginSingleAccountServerListViewController: ServerListTableViewContr } retrieveDisplayName() + + bookmarkChangesObserver = NotificationCenter.default.addObserver(forName: .OCBookmarkManagerListChanged, object: nil, queue: OperationQueue.main) { [weak self] (_) in + self?.retrieveDisplayName() + } } override func viewWillAppear(_ animated: Bool) { @@ -374,21 +380,17 @@ class StaticLoginSingleAccountServerListViewController: ServerListTableViewContr extension StaticLoginSingleAccountServerListViewController { func retrieveDisplayName() { - guard let bookmark : OCBookmark = OCBookmarkManager.shared.bookmarks.first else { return } - let connection = OCConnection(bookmark: bookmark) - - connection.connect { error, issue in - guard error == nil, issue == nil, let displayName = connection.loggedInUser?.displayName else { return } - self.displayName = displayName - self.headerView = nil - OnMainThread { - self.tableView.reloadData() - } - connection.disconnect { + if let userDisplayName = OCBookmarkManager.shared.bookmarks.first?.displayName { + if self.displayName != userDisplayName { + OnMainThread { + self.displayName = userDisplayName + self.headerView = nil + + self.tableView.reloadData() + } } } } - } extension StaticLoginSingleAccountServerListViewController { diff --git a/ownCloudAppFramework/SDK Extensions/OCBookmark+AppExtensions.h b/ownCloudAppFramework/SDK Extensions/OCBookmark+AppExtensions.h index ae2b8141a..9d31666ec 100644 --- a/ownCloudAppFramework/SDK Extensions/OCBookmark+AppExtensions.h +++ b/ownCloudAppFramework/SDK Extensions/OCBookmark+AppExtensions.h @@ -22,11 +22,9 @@ NS_ASSUME_NONNULL_BEGIN @interface OCBookmark (AppExtensions) -@property(strong,nonatomic,nullable) NSString *displayName; +@property(readonly,nonatomic,nullable) NSString *displayName; // Returns the user.displayName, using bookmark.userDisplayName - or data from the userInfo dictionary (legacy) @property(readonly,strong,nonatomic) NSString *shortName; @end -extern OCBookmarkUserInfoKey OCBookmarkUserInfoKeyDisplayName; - NS_ASSUME_NONNULL_END diff --git a/ownCloudAppFramework/SDK Extensions/OCBookmark+AppExtensions.m b/ownCloudAppFramework/SDK Extensions/OCBookmark+AppExtensions.m index 04dcf6399..89aef145b 100644 --- a/ownCloudAppFramework/SDK Extensions/OCBookmark+AppExtensions.m +++ b/ownCloudAppFramework/SDK Extensions/OCBookmark+AppExtensions.m @@ -18,16 +18,18 @@ #import "OCBookmark+AppExtensions.h" +static OCBookmarkUserInfoKey OCBookmarkUserInfoKeyDisplayName = @"OCBookmarkDisplayName"; + @implementation OCBookmark (AppExtensions) - (NSString *)displayName { - return ((NSString *)self.userInfo[OCBookmarkUserInfoKeyDisplayName]); -} + if (self.userDisplayName != nil) + { + return (self.userDisplayName); + } -- (void)setDisplayName:(NSString *)displayName -{ - self.userInfo[OCBookmarkUserInfoKeyDisplayName] = displayName; + return ((NSString *)self.userInfo[OCBookmarkUserInfoKeyDisplayName]); } - (NSString *)shortName @@ -39,11 +41,15 @@ - (NSString *)shortName else { NSString *userNamePrefix = @""; - NSString *displayName = nil, *userName = nil; + NSString *userDisplayName = nil, *userName = nil; - if (((displayName = self.displayName) != nil) && (displayName.length > 0)) + if (((userDisplayName = self.userDisplayName) != nil) && (userDisplayName.length > 0)) { - userNamePrefix = [displayName stringByAppendingString:@"@"]; + userNamePrefix = [userDisplayName stringByAppendingString:@"@"]; + } + else if (((userDisplayName = self.displayName) != nil) && (userDisplayName.length > 0)) + { + userNamePrefix = [userDisplayName stringByAppendingString:@"@"]; } if ((userNamePrefix.length == 0) && ((userName = self.userName) != nil) && (userName.length > 0)) @@ -67,5 +73,3 @@ - (NSString *)shortName } @end - -OCBookmarkUserInfoKey OCBookmarkUserInfoKeyDisplayName = @"OCBookmarkDisplayName"; diff --git a/ownCloudAppShared/Client/User Interface/SortMethod.swift b/ownCloudAppShared/Client/User Interface/SortMethod.swift index 075eedfd1..1dc5e0ca3 100644 --- a/ownCloudAppShared/Client/User Interface/SortMethod.swift +++ b/ownCloudAppShared/Client/User Interface/SortMethod.swift @@ -77,16 +77,17 @@ public enum SortMethod: Int { public func comparator(direction: SortDirection) -> OCSort { var comparator: OCSort var combinedComparator: OCSort? + let localizedSortComparator = OCSQLiteCollationLocalized.sortComparator! let alphabeticComparator : OCSort = { (left, right) in guard let leftName = (left as? OCItem)?.name, let rightName = (right as? OCItem)?.name else { return .orderedSame } if direction == .descendant { - return rightName.caseInsensitiveCompare(leftName) + return localizedSortComparator(rightName, leftName) } - return leftName.caseInsensitiveCompare(rightName) + return localizedSortComparator(leftName, rightName) } let itemTypeComparator : OCSort = { (left, right) in