-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Open
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: requires breaking changeA change that should be batched into the next breaking change to this packageA change that should be batched into the next breaking change to this packagep: webviewThe WebView pluginThe WebView pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallyteam-iosOwned by iOS platform teamOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamTriaged by iOS platform team
Description
Problem
Now JavaScriptChannelHandler.m - (void)userContentController:didReceiveScriptMessage: arguments receive Dictionary or Array will got a string that hard to serialized like below.
{
action = do_somethineg;
data = {
key_1 = some_info;
key_2 = "some_info";
};
timestamp = 1570005270866;
token = "jwt_token";
}Suggestion to modify
NSString *body;
if ([message.body isKindOfClass:[NSDictionary class]] ||
[message.body isKindOfClass:[NSArray class]]) {
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:message.body
options:NSJSONWritingPrettyPrinted
error:nil];
body = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
if (body.length <= 0) {
body = [NSString stringWithFormat:@"%@", message.body];
}
NSDictionary* arguments = @{
@"channel" : _javaScriptChannelName,
@"message" : body
};
[_methodChannel invokeMethod:@"javascriptChannelMessage" arguments:arguments];hope it will getting update soon 👍🏼
long1eu, slightfoot, Luk3s, orestesgaolin and jayjah
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: requires breaking changeA change that should be batched into the next breaking change to this packageA change that should be batched into the next breaking change to this packagep: webviewThe WebView pluginThe WebView pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallyteam-iosOwned by iOS platform teamOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamTriaged by iOS platform team