File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Modules/Sources/NetworkingCore/ApplicationPassword Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,10 @@ import enum Alamofire.AFError
33import struct Alamofire. HTTPMethod
44import KeychainAccess
55
6- #if canImport(UIKit )
6+ #if !os(watchOS )
77import UIKit
8+ #else
9+ import WatchKit
810#endif
911
1012public enum ApplicationPasswordUseCaseError : Error {
@@ -148,13 +150,16 @@ final public class DefaultApplicationPasswordUseCase: ApplicationPasswordUseCase
148150private extension DefaultApplicationPasswordUseCase {
149151 /// Helper method to create password name from device
150152 static func createPasswordName( ) -> String {
151- #if !os(watchOS)
152153 let bundleIdentifier = Bundle . main. bundleIdentifier ?? " Unknown "
154+ #if !os(watchOS)
153155 let model = UIDevice . current. model
154156 let identifierForVendor = UIDevice . current. identifierForVendor? . uuidString ?? " "
155157 return " \( bundleIdentifier) .ios-app-client. \( model) . \( identifierForVendor) "
156158 #else
157- fatalError ( " Unexpected error: Application password should not be generated through watch app " )
159+ let model = WKInterfaceDevice . current ( ) . model
160+ let identifierForVendor =
161+ WKInterfaceDevice . current ( ) . identifierForVendor? . uuidString ?? " "
162+ return " \( bundleIdentifier) .watch-app-client. \( model) . \( identifierForVendor) "
158163 #endif
159164 }
160165
You can’t perform that action at this time.
0 commit comments