Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions shell/platform/darwin/ios/framework/Source/FlutterEngine.mm
Original file line number Diff line number Diff line change
Expand Up @@ -396,17 +396,22 @@ - (void)setupChannels {

- (void)maybeSetupPlatformViewChannels {
if (_shell && self.shell.IsSetup()) {
FlutterPlatformPlugin* platformPlugin = _platformPlugin.get();
[_platformChannel.get() setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {
[_platformPlugin.get() handleMethodCall:call result:result];
[platformPlugin handleMethodCall:call result:result];
}];

fml::WeakPtr<FlutterEngine> weakSelf = [self getWeakPtr];
[_platformViewsChannel.get()
setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {
_platformViewsController->OnMethodCall(call, result);
if (weakSelf) {
weakSelf.get().platformViewsController->OnMethodCall(call, result);
}
}];

FlutterTextInputPlugin* textInputPlugin = _textInputPlugin.get();
[_textInputChannel.get() setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {
[_textInputPlugin.get() handleMethodCall:call result:result];
[textInputPlugin handleMethodCall:call result:result];
}];
}
}
Expand Down
15 changes: 13 additions & 2 deletions shell/platform/darwin/ios/framework/Source/FlutterEngineTest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

FLUTTER_ASSERT_ARC

@interface FlutteEngineTest : XCTestCase
@interface FlutterEngineTest : XCTestCase
@end

@implementation FlutteEngineTest
@implementation FlutterEngineTest

- (void)setUp {
}
Expand All @@ -26,6 +26,17 @@ - (void)testCreate {
XCTAssertNotNil(engine);
}

- (void)testDeallocated {
__weak FlutterEngine* weakEngine = nil;
{
FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"foobar"];
weakEngine = engine;
[engine run];
XCTAssertNotNil(weakEngine);
}
XCTAssertNil(weakEngine);
}

- (void)testSendMessageBeforeRun {
id project = OCMClassMock([FlutterDartProject class]);
FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"foobar" project:project];
Expand Down