88import Foundation
99
1010public final class BindingStore {
11-
11+
1212 private static var requsetId : UInt32 = . init( )
1313 private static let requestLock : NSLock = . init( )
1414 private static let asyncResponseLock : NSLock = . init( )
1515 public static var responses : [ UInt32 : ( _ requestId: UInt32 ,
1616 _ stringResponse: String ,
1717 _ responseType: TSDKBindingResponseType ,
1818 _ finished: Bool ) throws -> Void ] = . init( )
19-
19+
2020 /// BECAUSE SDK METHODS LIKE PROCESS MESSAGE RETURNED TWO RESPONSE
2121 /// FIRST REAL RESPONSE AND LAST EMPTY STRING WITH STATUS FINISHED
2222 public typealias RawResponse = ( requestId: UInt32 ,
@@ -44,18 +44,18 @@ public final class BindingStore {
4444 defer { completeResponsesLock. unlock ( ) }
4545 completeResponses [ id] = nil
4646 }
47-
47+
4848 public class func addResponseHandler( _ requestId: UInt32 ,
49- _ response: @escaping ( _ requestId: UInt32 ,
50- _ stringResponse: String ,
51- _ responseType: TSDKBindingResponseType ,
52- _ finished: Bool ) throws -> Void
49+ _ response: @escaping @ Sendable ( _ requestId: UInt32 ,
50+ _ stringResponse: String ,
51+ _ responseType: TSDKBindingResponseType ,
52+ _ finished: Bool ) throws -> Void
5353 ) {
5454 asyncResponseLock. lock ( )
5555 responses [ requestId] = response
5656 asyncResponseLock. unlock ( )
5757 }
58-
58+
5959 public class func getResponseHandler( _ requestId: UInt32 ) -> ( ( _ requestId: UInt32 ,
6060 _ stringResponse: String ,
6161 _ responseType: TSDKBindingResponseType ,
@@ -64,13 +64,13 @@ public final class BindingStore {
6464 defer { asyncResponseLock. unlock ( ) }
6565 return responses [ requestId]
6666 }
67-
67+
6868 public class func deleteResponseHandler( _ requestId: UInt32 ) {
6969 asyncResponseLock. lock ( )
7070 defer { asyncResponseLock. unlock ( ) }
7171 responses [ requestId] = nil
7272 }
73-
73+
7474 public class func generate_request_id( ) -> UInt32 {
7575 requestLock. lock ( )
7676 defer { requestLock. unlock ( ) }
0 commit comments