Skip to content

Commit

Permalink
Decode UIView's creation parameters and pass them to the view factory. (
Browse files Browse the repository at this point in the history
  • Loading branch information
amirh authored Oct 31, 2018
1 parent 467ff33 commit c79faed
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,21 @@
return;
}

// TODO(amirh): decode and pass the creation args.
FlutterTouchInterceptingView* view = [[[FlutterTouchInterceptingView alloc]
initWithEmbeddedView:[factory createWithFrame:CGRectZero viewIdentifier:viewId arguments:nil]
flutterView:flutter_view_] autorelease];
id params = nil;
if ([factory respondsToSelector:@selector(createArgsCodec)]) {
NSObject<FlutterMessageCodec>* codec = [factory createArgsCodec];
if (codec != nil && args[@"params"] != nil) {
FlutterStandardTypedData* paramsData = args[@"params"];
params = [codec decode:paramsData.data];
}
}

UIView* embedded_view = [factory createWithFrame:CGRectZero
viewIdentifier:viewId
arguments:params];
FlutterTouchInterceptingView* view =
[[[FlutterTouchInterceptingView alloc] initWithEmbeddedView:embedded_view
flutterView:flutter_view_] autorelease];
views_[viewId] = fml::scoped_nsobject<FlutterTouchInterceptingView>([view retain]);

result(nil);
Expand Down

0 comments on commit c79faed

Please sign in to comment.