@@ -410,7 +410,7 @@ public extension NextcloudKit {
410410 capabilities. termsOfService = json. termsOfService? . enabled ?? false
411411
412412 // Persist capabilities in shared store
413- await NKCapabilities . shared. appendCapabilitiesAsync ( for: account, capabilities: capabilities)
413+ await NKCapabilities . shared. setCapabilities ( for: account, capabilities: capabilities)
414414 return capabilities
415415 } catch {
416416 nkLog ( error: " Could not decode json capabilities: \( error. localizedDescription) " )
@@ -490,49 +490,14 @@ final public class NKCapabilities: Sendable {
490490
491491 // MARK: - Public API
492492
493- public func appendCapabilitiesAsync ( for account: String , capabilities: Capabilities ) async {
493+ public func setCapabilities ( for account: String , capabilities: Capabilities ) async {
494494 await store. set ( account, value: capabilities)
495495 }
496496
497- /// Synchronously stores capabilities for the given account.
498- /// Blocks the current thread until the async actor completes.
499- /// Use only outside of async/actor contexts.
500- public func appendCapabilitiesBlocking( for account: String , capabilities: Capabilities ) {
501- let group = DispatchGroup ( )
502-
503- group. enter ( )
504- Task . detached ( priority: . userInitiated) {
505- await self . store. set ( account, value: capabilities)
506- group. leave ( )
507- }
508-
509- group. wait ( )
510- }
511-
512- public func getCapabilitiesAsync( for account: String ? ) async -> Capabilities {
497+ public func getCapabilities( for account: String ? ) async -> Capabilities {
513498 guard let account else {
514499 return Capabilities ( )
515500 }
516501 return await store. get ( account) ?? Capabilities ( )
517502 }
518-
519- /// Synchronously retrieves capabilities for the given account.
520- /// Blocks the current thread until the async actor returns.
521- /// Use only outside the Swift async context (never from another actor or async function).
522- public func getCapabilitiesBlocking( for account: String ? ) -> Capabilities {
523- guard let account else {
524- return Capabilities ( )
525- }
526- let group = DispatchGroup ( )
527- var result : Capabilities ?
528-
529- group. enter ( )
530- Task . detached ( priority: . userInitiated) {
531- result = await self . store. get ( account)
532- group. leave ( )
533- }
534-
535- group. wait ( )
536- return result ?? Capabilities ( )
537- }
538503}
0 commit comments