File tree 2 files changed +9
-4
lines changed
core/tauri/mobile/ios-api/Sources/Tauri
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " tauri " : ' patch:enhance'
3
+ ---
4
+
5
+ Fixed the deserialisation of a ` Channel ` in iOS.
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ let channelDataKey = CodingUserInfoKey(rawValue: "sendChannelData")!
9
9
10
10
public class Channel : Decodable {
11
11
public let id : UInt64
12
- let handler : ( String ) -> Void
12
+ let handler : ( UInt64 , String ) -> Void
13
13
14
14
public required init ( from decoder: Decoder ) throws {
15
15
let container = try decoder. singleValueContainer ( )
@@ -30,7 +30,7 @@ public class Channel: Decodable {
30
30
)
31
31
}
32
32
33
- guard let handler = decoder. userInfo [ channelDataKey] as? ( String ) -> Void else {
33
+ guard let handler = decoder. userInfo [ channelDataKey] as? ( UInt64 , String ) -> Void else {
34
34
throw DecodingError . dataCorruptedError (
35
35
in: container,
36
36
debugDescription: " missing userInfo for Channel handler. This is a Tauri issue "
@@ -54,12 +54,12 @@ public class Channel: Decodable {
54
54
}
55
55
56
56
public func send( _ data: JsonValue ) {
57
- handler ( serialize ( data) )
57
+ handler ( id , serialize ( data) )
58
58
}
59
59
60
60
public func send< T: Encodable > ( _ data: T ) throws {
61
61
let json = try JSONEncoder ( ) . encode ( data)
62
- handler ( String ( decoding: json, as: UTF8 . self) )
62
+ handler ( id , String ( decoding: json, as: UTF8 . self) )
63
63
}
64
64
65
65
}
You can’t perform that action at this time.
0 commit comments