mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[ios] Convert int in Dart to long long in Objective-C. (flutter/engine#39331)
For native targets, an `int` in Dart maps to a signed 64-bit integer representation.
This commit is contained in:
parent
9aeba94a67
commit
97d65c8a45
@ -193,14 +193,14 @@ void FlutterPlatformViewsController::OnMethodCall(FlutterMethodCall* call, Flutt
|
||||
void FlutterPlatformViewsController::OnCreate(FlutterMethodCall* call, FlutterResult& result) {
|
||||
NSDictionary<NSString*, id>* args = [call arguments];
|
||||
|
||||
long viewId = [args[@"id"] longValue];
|
||||
int64_t viewId = [args[@"id"] longLongValue];
|
||||
NSString* viewTypeString = args[@"viewType"];
|
||||
std::string viewType(viewTypeString.UTF8String);
|
||||
|
||||
if (views_.count(viewId) != 0) {
|
||||
result([FlutterError errorWithCode:@"recreating_view"
|
||||
message:@"trying to create an already created view"
|
||||
details:[NSString stringWithFormat:@"view id: '%ld'", viewId]]);
|
||||
details:[NSString stringWithFormat:@"view id: '%lld'", viewId]]);
|
||||
}
|
||||
|
||||
NSObject<FlutterPlatformViewFactory>* factory = factories_[viewType].get();
|
||||
@ -234,7 +234,8 @@ void FlutterPlatformViewsController::OnCreate(FlutterMethodCall* call, FlutterRe
|
||||
arguments:params];
|
||||
UIView* platform_view = [embedded_view view];
|
||||
// Set a unique view identifier, so the platform view can be identified in unit tests.
|
||||
platform_view.accessibilityIdentifier = [NSString stringWithFormat:@"platform_view[%ld]", viewId];
|
||||
platform_view.accessibilityIdentifier =
|
||||
[NSString stringWithFormat:@"platform_view[%lld]", viewId];
|
||||
views_[viewId] = fml::scoped_nsobject<NSObject<FlutterPlatformView>>([embedded_view retain]);
|
||||
|
||||
FlutterTouchInterceptingView* touch_interceptor = [[[FlutterTouchInterceptingView alloc]
|
||||
|
||||
@ -90,7 +90,7 @@
|
||||
if ([[call method] isEqualToString:@"create"]) {
|
||||
NSMutableDictionary<NSString*, id>* args = [call arguments];
|
||||
if ([args objectForKey:@"id"]) {
|
||||
int64_t viewId = [args[@"id"] longValue];
|
||||
int64_t viewId = [args[@"id"] longLongValue];
|
||||
NSString* viewType = [NSString stringWithUTF8String:([args[@"viewType"] UTF8String])];
|
||||
[self onCreateWithViewID:viewId viewType:viewType result:result];
|
||||
} else {
|
||||
@ -100,7 +100,7 @@
|
||||
}
|
||||
} else if ([[call method] isEqualToString:@"dispose"]) {
|
||||
NSNumber* arg = [call arguments];
|
||||
int64_t viewId = [arg longValue];
|
||||
int64_t viewId = [arg longLongValue];
|
||||
[self onDisposeWithViewID:viewId result:result];
|
||||
} else {
|
||||
result(FlutterMethodNotImplemented);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user