Skip to content

Commit

Permalink
remove use of userdefaults from library directly, remove unused liste…
Browse files Browse the repository at this point in the history
…ner config control (#29)
  • Loading branch information
heckj authored Apr 15, 2024
1 parent b5bd501 commit a23ef03
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,9 @@ public actor PeerToPeerProvider: NetworkProvider {
self.delegate = delegate
self.peerId = peerId
self.peerMetadata = metadata

// if listener = true, set up a listener...
if config.listening {
if peerName.isEmpty {
let defaultName = await PeerToPeerProviderConfiguration.defaultSharingIdentity()
setName(defaultName)
}
if peerName.isEmpty {
let defaultName = await PeerToPeerProviderConfiguration.defaultSharingIdentity()
setName(defaultName)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@ import UIKit // for UIDevice.name access

public struct PeerToPeerProviderConfiguration: Sendable {
let passcode: String
let listening: Bool
let reconnectOnError: Bool
let autoconnect: Bool

public init(
passcode: String,
listening: Bool,
reconnectOnError: Bool = true,
autoconnect: Bool? = nil
) {
self.reconnectOnError = reconnectOnError
self.listening = listening
if let auto = autoconnect {
self.autoconnect = auto
} else {
Expand All @@ -40,7 +37,6 @@ public struct PeerToPeerProviderConfiguration: Sendable {
#elseif os(macOS)
defaultName = Host.current().localizedName ?? "Automerge User"
#endif
return UserDefaults.standard
.string(forKey: UserDefaultKeys.publicPeerName) ?? defaultName
return defaultName
}
}

This file was deleted.

0 comments on commit a23ef03

Please sign in to comment.