@@ -9,14 +9,21 @@ import Quartz
9
9
import MtProtoKit
10
10
import CoreServices
11
11
import LocalAuthentication
12
- import WalletCore
12
+ // import WalletCore
13
13
import OpenSSLEncryption
14
14
import CoreSpotlight
15
15
#if !APP_STORE
16
16
import AppCenter
17
17
import AppCenterCrashes
18
18
#endif
19
19
20
+ #if !SHARE
21
+ extension Account {
22
+ var diceCache : DiceCache ? {
23
+ return ( NSApp . delegate as? AppDelegate ) ? . contextValue? . context. diceCache
24
+ }
25
+ }
26
+ #endif
20
27
21
28
22
29
private final class SharedApplicationContext {
@@ -63,7 +70,7 @@ class AppDelegate: NSResponder, NSApplicationDelegate, NSUserNotificationCenterD
63
70
}
64
71
65
72
66
- private var contextValue : AuthorizedApplicationContext ?
73
+ fileprivate var contextValue : AuthorizedApplicationContext ?
67
74
private let context = Promise < AuthorizedApplicationContext ? > ( )
68
75
69
76
private var authContextValue : UnauthorizedApplicationContext ?
@@ -377,7 +384,7 @@ class AppDelegate: NSResponder, NSApplicationDelegate, NSUserNotificationCenterD
377
384
}
378
385
} )
379
386
380
- let networkArguments = NetworkInitializationArguments ( apiId: ApiEnvironment . apiId, apiHash: ApiEnvironment . apiHash, languagesCategory: ApiEnvironment . language, appVersion: ApiEnvironment . version, voipMaxLayer: CallBridge . voipMaxLayer ( ) , appData: . single( ApiEnvironment . appData) , autolockDeadine: . single( nil ) , encryptionProvider: OpenSSLEncryptionProvider ( ) )
387
+ let networkArguments = NetworkInitializationArguments ( apiId: ApiEnvironment . apiId, apiHash: ApiEnvironment . apiHash, languagesCategory: ApiEnvironment . language, appVersion: ApiEnvironment . version, voipMaxLayer: CallBridge . voipMaxLayer ( ) , voipVersions : [ CallBridge . voipVersion ( ) ] , appData: . single( ApiEnvironment . appData) , autolockDeadine: . single( nil ) , encryptionProvider: OpenSSLEncryptionProvider ( ) )
381
388
382
389
let sharedContext = SharedAccountContext ( accountManager: accountManager, networkArguments: networkArguments, rootPath: rootPath, encryptionParameters: encryptionParameters, displayUpgradeProgress: displayUpgrade)
383
390
@@ -439,31 +446,31 @@ class AppDelegate: NSResponder, NSApplicationDelegate, NSUserNotificationCenterD
439
446
} )
440
447
441
448
442
- let tonKeychain : TonKeychain
443
-
444
- tonKeychain = TonKeychain ( encryptionPublicKey: {
445
- return Signal { subscriber in
446
- return EmptyDisposable
447
- }
448
- } , encrypt: { data in
449
- return Signal { subscriber in
450
- if #available( OSX 10 . 12 , * ) {
451
- if let context = self . contextValue? . context, let publicKey = TKPublicKey . get ( for: context. account) {
452
- if let result = publicKey. encrypt ( data: data) {
453
- subscriber. putNext ( TonKeychainEncryptedData ( publicKey: publicKey. key, data: result) )
454
- subscriber. putCompletion ( )
455
- return EmptyDisposable
456
- }
457
- }
458
- }
459
- subscriber. putError ( . generic)
460
- return EmptyDisposable
461
- }
462
- } , decrypt: { encryptedData in
463
- return Signal { subscriber in
464
- return EmptyDisposable
465
- }
466
- } )
449
+ // let tonKeychain: TonKeychain
450
+ //
451
+ // tonKeychain = TonKeychain(encryptionPublicKey: {
452
+ // return Signal { subscriber in
453
+ // return EmptyDisposable
454
+ // }
455
+ // }, encrypt: { data in
456
+ // return Signal { subscriber in
457
+ // if #available(OSX 10.12, *) {
458
+ // if let context = self.contextValue?.context, let publicKey = TKPublicKey.get(for: context.account) {
459
+ // if let result = publicKey.encrypt(data: data) {
460
+ // subscriber.putNext(TonKeychainEncryptedData(publicKey: publicKey.key, data: result))
461
+ // subscriber.putCompletion()
462
+ // return EmptyDisposable
463
+ // }
464
+ // }
465
+ // }
466
+ // subscriber.putError(.generic)
467
+ // return EmptyDisposable
468
+ // }
469
+ // }, decrypt: { encryptedData in
470
+ // return Signal { subscriber in
471
+ // return EmptyDisposable
472
+ // }
473
+ // })
467
474
468
475
469
476
@@ -493,9 +500,9 @@ class AppDelegate: NSResponder, NSApplicationDelegate, NSUserNotificationCenterD
493
500
} . start ( )
494
501
semaphore. wait ( )
495
502
}
496
- let tonContext = StoredTonContext ( basePath: account. basePath, postbox: account. postbox, network: account. network, keychain: tonKeychain)
503
+ // let tonContext = StoredTonContext(basePath: account.basePath, postbox: account.postbox, network: account.network, keychain: tonKeychain)
497
504
498
- let context = AccountContext ( sharedContext: sharedApplicationContext. sharedContext, window: window, tonContext : tonContext , account: account)
505
+ let context = AccountContext ( sharedContext: sharedApplicationContext. sharedContext, window: window, account: account)
499
506
return AuthorizedApplicationContext ( window: window, context: context, launchSettings: settings ?? LaunchSettings . defaultSettings)
500
507
501
508
} else {
0 commit comments