Turn on add-to-app iOS platform unit tests (#61007)
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
@import XCTest;
|
||||
|
||||
@interface FlutterUITests : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation FlutterUITests
|
||||
|
||||
- (void)setUp {
|
||||
self.continueAfterFailure = NO;
|
||||
}
|
||||
|
||||
- (void)testFullScreenColdPop {
|
||||
XCUIApplication *app = [[XCUIApplication alloc] init];
|
||||
[app launch];
|
||||
|
||||
[app.buttons[@"Full Screen (Cold)"] tap];
|
||||
|
||||
XCTAssertTrue([app.otherElements[@"Button tapped 0 times."] waitForExistenceWithTimeout:1.0]);
|
||||
[app.otherElements[@"Increment via Flutter"] tap];
|
||||
XCTAssertTrue([app.otherElements[@"Button tapped 1 time."] waitForExistenceWithTimeout:1.0]);
|
||||
|
||||
// Back navigation.
|
||||
[app.buttons[@"POP"] tap];
|
||||
XCTAssertTrue([app.navigationBars[@"Flutter iOS Demos Home"] waitForExistenceWithTimeout:1.0]);
|
||||
}
|
||||
|
||||
- (void)testFullScreenWarm {
|
||||
XCUIApplication *app = [[XCUIApplication alloc] init];
|
||||
[app launch];
|
||||
|
||||
[app.buttons[@"Full Screen (Warm)"] tap];
|
||||
|
||||
XCTAssertTrue([app.otherElements[@"Button tapped 0 times."] waitForExistenceWithTimeout:1.0]);
|
||||
[app.otherElements[@"Increment via Flutter"] tap];
|
||||
XCTAssertTrue([app.otherElements[@"Button tapped 1 time."] waitForExistenceWithTimeout:1.0]);
|
||||
|
||||
// Back navigation.
|
||||
[app.buttons[@"POP"] tap];
|
||||
XCTAssertTrue([app.navigationBars[@"Flutter iOS Demos Home"] waitForExistenceWithTimeout:1.0]);
|
||||
}
|
||||
|
||||
- (void)testFlutterViewWarm {
|
||||
XCUIApplication *app = [[XCUIApplication alloc] init];
|
||||
[app launch];
|
||||
|
||||
[app.buttons[@"Flutter View (Warm)"] tap];
|
||||
|
||||
XCTAssertTrue([app.otherElements[@"Button tapped 0 times."] waitForExistenceWithTimeout:1.0]);
|
||||
[app.otherElements[@"Increment via Flutter"] tap];
|
||||
XCTAssertTrue([app.otherElements[@"Button tapped 1 time."] waitForExistenceWithTimeout:1.0]);
|
||||
|
||||
// Back navigation.
|
||||
[app.buttons[@"POP"] tap];
|
||||
XCTAssertTrue([app.navigationBars[@"Flutter iOS Demos Home"] waitForExistenceWithTimeout:1.0]);
|
||||
}
|
||||
|
||||
- (void)testHybridViewWarm {
|
||||
XCUIApplication *app = [[XCUIApplication alloc] init];
|
||||
[app launch];
|
||||
|
||||
[app.buttons[@"Hybrid View (Warm)"] tap];
|
||||
|
||||
XCTAssertTrue([app.staticTexts[@"Flutter button tapped 0 times."] waitForExistenceWithTimeout:1.0]);
|
||||
XCTAssertTrue(app.otherElements[@"Platform button tapped 0 times."].exists);
|
||||
|
||||
[app.otherElements[@"Increment via Flutter"] tap];
|
||||
XCTAssertTrue([app.staticTexts[@"Flutter button tapped 1 time."] waitForExistenceWithTimeout:1.0]);
|
||||
XCTAssertTrue(app.otherElements[@"Platform button tapped 0 times."].exists);
|
||||
|
||||
[app.buttons[@"Increment via iOS"] tap];
|
||||
XCTAssertTrue([app.staticTexts[@"Flutter button tapped 1 time."] waitForExistenceWithTimeout:1.0]);
|
||||
XCTAssertTrue(app.otherElements[@"Platform button tapped 1 time."].exists);
|
||||
|
||||
// Back navigation.
|
||||
[app.navigationBars[@"Hybrid Flutter/Native"].buttons[@"Flutter iOS Demos Home"] tap];
|
||||
XCTAssertTrue([app.navigationBars[@"Flutter iOS Demos Home"] waitForExistenceWithTimeout:1.0]);
|
||||
}
|
||||
|
||||
- (void)testDualCold {
|
||||
XCUIApplication *app = [[XCUIApplication alloc] init];
|
||||
[app launch];
|
||||
|
||||
[app.buttons[@"Dual Flutter View (Cold)"] tap];
|
||||
|
||||
// There are two marquees.
|
||||
XCTAssertTrue([app.otherElements[@"This is Marquee"] waitForExistenceWithTimeout:1.0]);
|
||||
XCTAssertEqual([app.otherElements matchingType:XCUIElementTypeOther identifier:@"This is Marquee"].count, 2);
|
||||
|
||||
// Back navigation.
|
||||
[app.navigationBars[@"Dual Flutter Views"].buttons[@"Flutter iOS Demos Home"] tap];
|
||||
XCTAssertTrue([app.navigationBars[@"Flutter iOS Demos Home"] waitForExistenceWithTimeout:1.0]);
|
||||
}
|
||||
|
||||
@end
|
||||
22
dev/integration_tests/ios_host_app/FlutterUITests/Info.plist
Normal file
22
dev/integration_tests/ios_host_app/FlutterUITests/Info.plist
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -3,29 +3,61 @@
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 50;
|
||||
objectVersion = 51;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
4AF9D63425F74F0694CAB07D /* libPods-Host.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E20960BD8B505D605FE82853 /* libPods-Host.a */; };
|
||||
74F97866215AB9E8005A0F04 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 74F97865215AB9E8005A0F04 /* AppDelegate.m */; };
|
||||
74F97869215AB9E8005A0F04 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 74F97868215AB9E8005A0F04 /* ViewController.m */; };
|
||||
74F9786C215AB9E8005A0F04 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 74F9786A215AB9E8005A0F04 /* Main.storyboard */; };
|
||||
74F9786E215AB9E9005A0F04 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 74F9786D215AB9E9005A0F04 /* Assets.xcassets */; };
|
||||
74F97871215AB9E9005A0F04 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 74F9786F215AB9E9005A0F04 /* LaunchScreen.storyboard */; };
|
||||
74F97874215AB9E9005A0F04 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 74F97873215AB9E9005A0F04 /* main.m */; };
|
||||
7E06ECD9FAEFCA4A0ED04D6E /* libPods-FlutterUITests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 327E8CC22A494E7D7155FB58 /* libPods-FlutterUITests.a */; };
|
||||
F7C2661424AC18D00085742D /* DualFlutterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F7C2660E24AC18D00085742D /* DualFlutterViewController.m */; };
|
||||
F7C2661524AC18D00085742D /* FullScreenViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F7C2660F24AC18D00085742D /* FullScreenViewController.m */; };
|
||||
F7C2661624AC18D00085742D /* HybridViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F7C2661124AC18D00085742D /* HybridViewController.m */; };
|
||||
F7C2661B24AC18DD0085742D /* NativeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F7C2661824AC18DD0085742D /* NativeViewController.m */; };
|
||||
F7C2661C24AC18DD0085742D /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F7C2661A24AC18DD0085742D /* MainViewController.m */; };
|
||||
F7C2664624AC1E3A0085742D /* FlutterUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = F7C2664524AC1E3A0085742D /* FlutterUITests.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
F7C2664824AC1E3A0085742D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 74F97859215AB9E8005A0F04 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 74F97860215AB9E8005A0F04;
|
||||
remoteInfo = Host;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
167171877EDE2F421DEC809C /* Pods-FlutterUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FlutterUITests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FlutterUITests/Pods-FlutterUITests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
327E8CC22A494E7D7155FB58 /* libPods-FlutterUITests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-FlutterUITests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
41D0C662C99CDA4C35B51C32 /* Pods-Host.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Host.release.xcconfig"; path = "Pods/Target Support Files/Pods-Host/Pods-Host.release.xcconfig"; sourceTree = "<group>"; };
|
||||
74F97861215AB9E8005A0F04 /* Host.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Host.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
74F97864215AB9E8005A0F04 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||
74F97865215AB9E8005A0F04 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
||||
74F97867215AB9E8005A0F04 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
|
||||
74F97868215AB9E8005A0F04 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
|
||||
74F9786B215AB9E8005A0F04 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
74F9786D215AB9E9005A0F04 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
74F97870215AB9E9005A0F04 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
74F97872215AB9E9005A0F04 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
74F97873215AB9E9005A0F04 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
8E6751F293967EE3DFF4178A /* Pods-FlutterUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FlutterUITests.release.xcconfig"; path = "Pods/Target Support Files/Pods-FlutterUITests/Pods-FlutterUITests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
91B7D4263BFD246A27391225 /* Pods-Host.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Host.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Host/Pods-Host.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
E20960BD8B505D605FE82853 /* libPods-Host.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Host.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F7C2660E24AC18D00085742D /* DualFlutterViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DualFlutterViewController.m; sourceTree = "<group>"; };
|
||||
F7C2660F24AC18D00085742D /* FullScreenViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FullScreenViewController.m; sourceTree = "<group>"; };
|
||||
F7C2661024AC18D00085742D /* HybridViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HybridViewController.h; sourceTree = "<group>"; };
|
||||
F7C2661124AC18D00085742D /* HybridViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HybridViewController.m; sourceTree = "<group>"; };
|
||||
F7C2661224AC18D00085742D /* FullScreenViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FullScreenViewController.h; sourceTree = "<group>"; };
|
||||
F7C2661324AC18D00085742D /* DualFlutterViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DualFlutterViewController.h; sourceTree = "<group>"; };
|
||||
F7C2661724AC18DD0085742D /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = "<group>"; };
|
||||
F7C2661824AC18DD0085742D /* NativeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NativeViewController.m; sourceTree = "<group>"; };
|
||||
F7C2661924AC18DD0085742D /* NativeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeViewController.h; sourceTree = "<group>"; };
|
||||
F7C2661A24AC18DD0085742D /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = "<group>"; };
|
||||
F7C2664324AC1E3A0085742D /* FlutterUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FlutterUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F7C2664524AC1E3A0085742D /* FlutterUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FlutterUITests.m; sourceTree = "<group>"; };
|
||||
F7C2664724AC1E3A0085742D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -33,6 +65,15 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4AF9D63425F74F0694CAB07D /* libPods-Host.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F7C2664024AC1E3A0085742D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
7E06ECD9FAEFCA4A0ED04D6E /* libPods-FlutterUITests.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -43,6 +84,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
74F97863215AB9E8005A0F04 /* Host */,
|
||||
F7C2664424AC1E3A0085742D /* FlutterUITests */,
|
||||
74F97862215AB9E8005A0F04 /* Products */,
|
||||
74F9788B215AC328005A0F04 /* Frameworks */,
|
||||
A4A9971F50C4EE357B74B6E0 /* Pods */,
|
||||
@@ -53,6 +95,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
74F97861215AB9E8005A0F04 /* Host.app */,
|
||||
F7C2664324AC1E3A0085742D /* FlutterUITests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -60,11 +103,18 @@
|
||||
74F97863215AB9E8005A0F04 /* Host */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F7C2661724AC18DD0085742D /* MainViewController.h */,
|
||||
F7C2661A24AC18DD0085742D /* MainViewController.m */,
|
||||
F7C2661924AC18DD0085742D /* NativeViewController.h */,
|
||||
F7C2661824AC18DD0085742D /* NativeViewController.m */,
|
||||
F7C2661324AC18D00085742D /* DualFlutterViewController.h */,
|
||||
F7C2660E24AC18D00085742D /* DualFlutterViewController.m */,
|
||||
F7C2661224AC18D00085742D /* FullScreenViewController.h */,
|
||||
F7C2660F24AC18D00085742D /* FullScreenViewController.m */,
|
||||
F7C2661024AC18D00085742D /* HybridViewController.h */,
|
||||
F7C2661124AC18D00085742D /* HybridViewController.m */,
|
||||
74F97864215AB9E8005A0F04 /* AppDelegate.h */,
|
||||
74F97865215AB9E8005A0F04 /* AppDelegate.m */,
|
||||
74F97867215AB9E8005A0F04 /* ViewController.h */,
|
||||
74F97868215AB9E8005A0F04 /* ViewController.m */,
|
||||
74F9786A215AB9E8005A0F04 /* Main.storyboard */,
|
||||
74F9786D215AB9E9005A0F04 /* Assets.xcassets */,
|
||||
74F9786F215AB9E9005A0F04 /* LaunchScreen.storyboard */,
|
||||
74F97872215AB9E9005A0F04 /* Info.plist */,
|
||||
@@ -76,6 +126,8 @@
|
||||
74F9788B215AC328005A0F04 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E20960BD8B505D605FE82853 /* libPods-Host.a */,
|
||||
327E8CC22A494E7D7155FB58 /* libPods-FlutterUITests.a */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
@@ -83,10 +135,23 @@
|
||||
A4A9971F50C4EE357B74B6E0 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
91B7D4263BFD246A27391225 /* Pods-Host.debug.xcconfig */,
|
||||
41D0C662C99CDA4C35B51C32 /* Pods-Host.release.xcconfig */,
|
||||
167171877EDE2F421DEC809C /* Pods-FlutterUITests.debug.xcconfig */,
|
||||
8E6751F293967EE3DFF4178A /* Pods-FlutterUITests.release.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F7C2664424AC1E3A0085742D /* FlutterUITests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F7C2664524AC1E3A0085742D /* FlutterUITests.m */,
|
||||
F7C2664724AC1E3A0085742D /* Info.plist */,
|
||||
);
|
||||
path = FlutterUITests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -94,9 +159,12 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 74F97877215AB9E9005A0F04 /* Build configuration list for PBXNativeTarget "Host" */;
|
||||
buildPhases = (
|
||||
DF650341152DB73976A358C2 /* [CP] Check Pods Manifest.lock */,
|
||||
C954A75BD5C4F1EEA5AFF464 /* [CP-User] Run Flutter Build hello Script */,
|
||||
74F9785D215AB9E8005A0F04 /* Sources */,
|
||||
74F9785E215AB9E8005A0F04 /* Frameworks */,
|
||||
74F9785F215AB9E8005A0F04 /* Resources */,
|
||||
83F5A04FAA44C2FFFC4CBFBA /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -107,6 +175,27 @@
|
||||
productReference = 74F97861215AB9E8005A0F04 /* Host.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
F7C2664224AC1E3A0085742D /* FlutterUITests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = F7C2664A24AC1E3A0085742D /* Build configuration list for PBXNativeTarget "FlutterUITests" */;
|
||||
buildPhases = (
|
||||
09D119997F3FFD16DBA33278 /* [CP] Check Pods Manifest.lock */,
|
||||
5F3CDDFEC2CA4EEE4767777D /* [CP-User] Run Flutter Build hello Script */,
|
||||
F7C2663F24AC1E3A0085742D /* Sources */,
|
||||
F7C2664024AC1E3A0085742D /* Frameworks */,
|
||||
F7C2664124AC1E3A0085742D /* Resources */,
|
||||
5EABD4D6B64D840CAF712234 /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
F7C2664924AC1E3A0085742D /* PBXTargetDependency */,
|
||||
);
|
||||
name = FlutterUITests;
|
||||
productName = FlutterUITests;
|
||||
productReference = F7C2664324AC1E3A0085742D /* FlutterUITests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.ui-testing";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
@@ -119,6 +208,10 @@
|
||||
74F97860215AB9E8005A0F04 = {
|
||||
CreatedOnToolsVersion = 10.0;
|
||||
};
|
||||
F7C2664224AC1E3A0085742D = {
|
||||
CreatedOnToolsVersion = 12.0;
|
||||
TestTargetID = 74F97860215AB9E8005A0F04;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 74F9785C215AB9E8005A0F04 /* Build configuration list for PBXProject "Host" */;
|
||||
@@ -135,6 +228,7 @@
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
74F97860215AB9E8005A0F04 /* Host */,
|
||||
F7C2664224AC1E3A0085742D /* FlutterUITests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@@ -146,34 +240,165 @@
|
||||
files = (
|
||||
74F97871215AB9E9005A0F04 /* LaunchScreen.storyboard in Resources */,
|
||||
74F9786E215AB9E9005A0F04 /* Assets.xcassets in Resources */,
|
||||
74F9786C215AB9E8005A0F04 /* Main.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F7C2664124AC1E3A0085742D /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
09D119997F3FFD16DBA33278 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-FlutterUITests-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
5EABD4D6B64D840CAF712234 /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-FlutterUITests/Pods-FlutterUITests-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-FlutterUITests/Pods-FlutterUITests-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-FlutterUITests/Pods-FlutterUITests-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
5F3CDDFEC2CA4EEE4767777D /* [CP-User] Run Flutter Build hello Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${SRCROOT}/../hello/.metadata",
|
||||
"${SRCROOT}/../hello/.ios/Flutter/App.framework/App",
|
||||
"${SRCROOT}/../hello/.ios/Flutter/engine/Flutter.framework/Flutter",
|
||||
"${SRCROOT}/../hello/.ios/Flutter/flutter_export_environment.sh",
|
||||
);
|
||||
name = "[CP-User] Run Flutter Build hello Script";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "set -e\nset -u\nsource \"${SRCROOT}/../hello/.ios/Flutter/flutter_export_environment.sh\"\n\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/xcode_backend.sh build";
|
||||
};
|
||||
83F5A04FAA44C2FFFC4CBFBA /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Host/Pods-Host-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Host/Pods-Host-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Host/Pods-Host-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
C954A75BD5C4F1EEA5AFF464 /* [CP-User] Run Flutter Build hello Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${SRCROOT}/../hello/.metadata",
|
||||
"${SRCROOT}/../hello/.ios/Flutter/App.framework/App",
|
||||
"${SRCROOT}/../hello/.ios/Flutter/engine/Flutter.framework/Flutter",
|
||||
"${SRCROOT}/../hello/.ios/Flutter/flutter_export_environment.sh",
|
||||
);
|
||||
name = "[CP-User] Run Flutter Build hello Script";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "set -e\nset -u\nsource \"${SRCROOT}/../hello/.ios/Flutter/flutter_export_environment.sh\"\n\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/xcode_backend.sh build";
|
||||
};
|
||||
DF650341152DB73976A358C2 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-Host-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
74F9785D215AB9E8005A0F04 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
74F97869215AB9E8005A0F04 /* ViewController.m in Sources */,
|
||||
F7C2661524AC18D00085742D /* FullScreenViewController.m in Sources */,
|
||||
F7C2661424AC18D00085742D /* DualFlutterViewController.m in Sources */,
|
||||
F7C2661C24AC18DD0085742D /* MainViewController.m in Sources */,
|
||||
74F97874215AB9E9005A0F04 /* main.m in Sources */,
|
||||
F7C2661624AC18D00085742D /* HybridViewController.m in Sources */,
|
||||
F7C2661B24AC18DD0085742D /* NativeViewController.m in Sources */,
|
||||
74F97866215AB9E8005A0F04 /* AppDelegate.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
F7C2663F24AC1E3A0085742D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F7C2664624AC1E3A0085742D /* FlutterUITests.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
74F9786A215AB9E8005A0F04 /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
74F9786B215AB9E8005A0F04 /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
/* Begin PBXTargetDependency section */
|
||||
F7C2664924AC1E3A0085742D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 74F97860215AB9E8005A0F04 /* Host */;
|
||||
targetProxy = F7C2664824AC1E3A0085742D /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
74F9786F215AB9E9005A0F04 /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
@@ -299,10 +524,11 @@
|
||||
};
|
||||
74F97878215AB9E9005A0F04 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 91B7D4263BFD246A27391225 /* Pods-Host.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DEVELOPMENT_TEAM = S8QB4VV633;
|
||||
INFOPLIST_FILE = Host/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@@ -316,10 +542,11 @@
|
||||
};
|
||||
74F97879215AB9E9005A0F04 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 41D0C662C99CDA4C35B51C32 /* Pods-Host.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DEVELOPMENT_TEAM = S8QB4VV633;
|
||||
INFOPLIST_FILE = Host/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@@ -331,6 +558,48 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
F7C2664B24AC1E3A0085742D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 167171877EDE2F421DEC809C /* Pods-FlutterUITests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = S8QB4VV633;
|
||||
INFOPLIST_FILE = FlutterUITests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.flutterio.FlutterUITests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_TARGET_NAME = Host;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
F7C2664C24AC1E3A0085742D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 8E6751F293967EE3DFF4178A /* Pods-FlutterUITests.release.xcconfig */;
|
||||
buildSettings = {
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = S8QB4VV633;
|
||||
INFOPLIST_FILE = FlutterUITests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.flutterio.FlutterUITests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_TARGET_NAME = Host;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
@@ -352,6 +621,15 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
F7C2664A24AC1E3A0085742D /* Build configuration list for PBXNativeTarget "FlutterUITests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
F7C2664B24AC1E3A0085742D /* Debug */,
|
||||
F7C2664C24AC1E3A0085742D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 74F97859215AB9E8005A0F04 /* Project object */;
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1200"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "74F97860215AB9E8005A0F04"
|
||||
BuildableName = "Host.app"
|
||||
BlueprintName = "Host"
|
||||
ReferencedContainer = "container:Host.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "F7C2664224AC1E3A0085742D"
|
||||
BuildableName = "FlutterUITests.xctest"
|
||||
BlueprintName = "FlutterUITests"
|
||||
ReferencedContainer = "container:Host.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "74F97860215AB9E8005A0F04"
|
||||
BuildableName = "Host.app"
|
||||
BlueprintName = "Host"
|
||||
ReferencedContainer = "container:Host.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "74F97860215AB9E8005A0F04"
|
||||
BuildableName = "Host.app"
|
||||
BlueprintName = "Host"
|
||||
ReferencedContainer = "container:Host.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -6,4 +6,8 @@
|
||||
#import <Flutter/Flutter.h>
|
||||
|
||||
@interface AppDelegate : FlutterAppDelegate
|
||||
|
||||
@property(nonatomic, strong) FlutterEngine* engine;
|
||||
@property(nonatomic, strong) FlutterBasicMessageChannel* reloadMessageChannel;
|
||||
|
||||
@end
|
||||
|
||||
@@ -3,6 +3,51 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "MainViewController.h"
|
||||
|
||||
@interface AppDelegate ()
|
||||
|
||||
@end
|
||||
|
||||
static NSString *_kReloadChannelName = @"reload";
|
||||
|
||||
@implementation AppDelegate {
|
||||
MainViewController *_mainViewController;
|
||||
UINavigationController *_navigationController;
|
||||
FlutterEngine *_engine;
|
||||
FlutterBasicMessageChannel *_reloadMessageChannel;
|
||||
}
|
||||
|
||||
- (FlutterEngine *)engine {
|
||||
return _engine;
|
||||
}
|
||||
|
||||
- (FlutterBasicMessageChannel *)reloadMessabeChannel {
|
||||
return _reloadMessageChannel;
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication *)application
|
||||
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
||||
|
||||
_mainViewController = [[MainViewController alloc] init];
|
||||
_navigationController = [[UINavigationController alloc]
|
||||
initWithRootViewController:_mainViewController];
|
||||
|
||||
_navigationController.navigationBar.translucent = NO;
|
||||
|
||||
_engine = [[FlutterEngine alloc] initWithName:@"test" project:nil];
|
||||
[_engine runWithEntrypoint:nil];
|
||||
|
||||
_reloadMessageChannel = [[FlutterBasicMessageChannel alloc]
|
||||
initWithName:_kReloadChannelName
|
||||
binaryMessenger:_engine.binaryMessenger
|
||||
codec:[FlutterStringCodec sharedInstance]];
|
||||
|
||||
self.window.rootViewController = _navigationController;
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@implementation AppDelegate
|
||||
@end
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
@@ -13,8 +16,30 @@
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="© 2018 The Flutter Authors. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
|
||||
<rect key="frame" x="0.0" y="626" width="375" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ios_add2app" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
|
||||
<rect key="frame" x="0.0" y="202" width="375" height="43"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
<constraints>
|
||||
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="obG-Y5-kRd" secondAttribute="centerX" id="5cz-MP-9tL"/>
|
||||
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
|
||||
<constraint firstItem="obG-Y5-kRd" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" symbolic="YES" id="SfN-ll-jLj"/>
|
||||
<constraint firstAttribute="bottom" secondItem="obG-Y5-kRd" secondAttribute="bottom" constant="20" id="Y44-ml-fuU"/>
|
||||
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
|
||||
<constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" constant="20" symbolic="YES" id="x7j-FC-K8j"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
@@ -0,0 +1,16 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DualFlutterViewController : UIViewController
|
||||
|
||||
@property (readonly, strong, nonatomic) FlutterViewController* topFlutterViewController;
|
||||
@property (readonly, strong, nonatomic) FlutterViewController* bottomFlutterViewController;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,45 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Flutter/Flutter.h>
|
||||
|
||||
#import "DualFlutterViewController.h"
|
||||
|
||||
@interface DualFlutterViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation DualFlutterViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.title = @"Dual Flutter Views";
|
||||
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc]
|
||||
initWithTitle:@"Back"
|
||||
style:UIBarButtonItemStylePlain
|
||||
target:nil
|
||||
action:nil];
|
||||
|
||||
UIStackView* stackView = [[UIStackView alloc] initWithFrame:self.view.frame];
|
||||
stackView.axis = UILayoutConstraintAxisVertical;
|
||||
stackView.distribution = UIStackViewDistributionFillEqually;
|
||||
stackView.layoutMargins = UIEdgeInsetsMake(0, 0, 50, 0);
|
||||
stackView.layoutMarginsRelativeArrangement = YES;
|
||||
[self.view addSubview:stackView];
|
||||
|
||||
_topFlutterViewController = [[FlutterViewController alloc] init];
|
||||
_bottomFlutterViewController= [[FlutterViewController alloc] init];
|
||||
|
||||
[_topFlutterViewController setInitialRoute:@"marquee_green"];
|
||||
[self addChildViewController:_topFlutterViewController];
|
||||
[stackView addArrangedSubview:_topFlutterViewController.view];
|
||||
[_topFlutterViewController didMoveToParentViewController:self];
|
||||
|
||||
[_bottomFlutterViewController setInitialRoute:@"marquee_purple"];
|
||||
[self addChildViewController:_bottomFlutterViewController];
|
||||
[stackView addArrangedSubview:_bottomFlutterViewController.view];
|
||||
[_bottomFlutterViewController didMoveToParentViewController:self];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,13 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Flutter/Flutter.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface FullScreenViewController : FlutterViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,39 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import "FullScreenViewController.h"
|
||||
|
||||
@interface FullScreenViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation FullScreenViewController
|
||||
|
||||
-(void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
self.title = @"Full Screen Flutter";
|
||||
self.navigationController.navigationBarHidden = YES;
|
||||
self.navigationController.hidesBarsOnSwipe = YES;
|
||||
}
|
||||
|
||||
-(void)viewWillDisappear:(BOOL)animated {
|
||||
[super viewWillDisappear:animated];
|
||||
self.navigationController.navigationBarHidden = NO;
|
||||
self.navigationController.hidesBarsOnSwipe = NO;
|
||||
if (self.isMovingFromParentViewController) {
|
||||
// Note that if we were doing things that might cause the VC
|
||||
// to disappear (like using the image_picker plugin)
|
||||
// we shouldn't do this. But in this case we know we're
|
||||
// just going back to the navigation controller.
|
||||
// If we needed Flutter to tell us when we could actually go away,
|
||||
// we'd need to communicate over a method channel with it.
|
||||
[self.engine setViewController:nil];
|
||||
}
|
||||
}
|
||||
|
||||
-(BOOL)prefersStatusBarHidden {
|
||||
return true;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "NativeViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface HybridViewController : UIViewController<NativeViewControllerDelegate>
|
||||
|
||||
@property (readonly, strong, nonatomic) FlutterViewController* flutterViewController;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,76 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Flutter/Flutter.h>
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "HybridViewController.h"
|
||||
|
||||
@interface HybridViewController ()
|
||||
|
||||
@end
|
||||
|
||||
static NSString *_kChannel = @"increment";
|
||||
static NSString *_kPing = @"ping";
|
||||
|
||||
@implementation HybridViewController {
|
||||
FlutterBasicMessageChannel *_messageChannel;
|
||||
}
|
||||
|
||||
- (FlutterEngine *)engine {
|
||||
return [(AppDelegate *)[[UIApplication sharedApplication] delegate] engine];
|
||||
}
|
||||
|
||||
- (FlutterBasicMessageChannel *)reloadMessageChannel {
|
||||
return [(AppDelegate *)[[UIApplication sharedApplication] delegate]
|
||||
reloadMessageChannel];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.title = @"Hybrid Flutter/Native";
|
||||
UIStackView *stackView = [[UIStackView alloc] initWithFrame:self.view.frame];
|
||||
stackView.axis = UILayoutConstraintAxisVertical;
|
||||
stackView.distribution = UIStackViewDistributionFillEqually;
|
||||
stackView.layoutMargins = UIEdgeInsetsMake(0, 0, 50, 0);
|
||||
stackView.layoutMarginsRelativeArrangement = YES;
|
||||
[self.view addSubview:stackView];
|
||||
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc]
|
||||
initWithTitle:@"Back"
|
||||
style:UIBarButtonItemStylePlain
|
||||
target:nil
|
||||
action:nil];
|
||||
|
||||
NativeViewController *nativeViewController =
|
||||
[[NativeViewController alloc] initWithDelegate:self];
|
||||
[self addChildViewController:nativeViewController];
|
||||
[stackView addArrangedSubview:nativeViewController.view];
|
||||
[nativeViewController didMoveToParentViewController:self];
|
||||
|
||||
_flutterViewController =
|
||||
[[FlutterViewController alloc] initWithEngine:[self engine]
|
||||
nibName:nil
|
||||
bundle:nil];
|
||||
[[self reloadMessageChannel] sendMessage:@"hybrid"];
|
||||
|
||||
_messageChannel = [[FlutterBasicMessageChannel alloc]
|
||||
initWithName:_kChannel
|
||||
binaryMessenger:_flutterViewController.binaryMessenger
|
||||
codec:[FlutterStringCodec sharedInstance]];
|
||||
[self addChildViewController:_flutterViewController];
|
||||
[stackView addArrangedSubview:_flutterViewController.view];
|
||||
[_flutterViewController didMoveToParentViewController:self];
|
||||
|
||||
__weak NativeViewController *weakNativeViewController = nativeViewController;
|
||||
[_messageChannel setMessageHandler:^(id message, FlutterReply reply) {
|
||||
[weakNativeViewController didReceiveIncrement];
|
||||
reply(@"");
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)didTapIncrementButton {
|
||||
[_messageChannel sendMessage:_kPing];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -22,8 +22,6 @@
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <Flutter/Flutter.h>
|
||||
|
||||
@interface MainViewController : UIViewController
|
||||
|
||||
@interface ViewController : UIViewController
|
||||
@end
|
||||
124
dev/integration_tests/ios_host_app/Host/MainViewController.m
Normal file
124
dev/integration_tests/ios_host_app/Host/MainViewController.m
Normal file
@@ -0,0 +1,124 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import "MainViewController.h"
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "DualFlutterViewController.h"
|
||||
#import "FullScreenViewController.h"
|
||||
#import "HybridViewController.h"
|
||||
#import "NativeViewController.h"
|
||||
|
||||
@interface MainViewController ()
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation MainViewController {
|
||||
UIStackView *_stackView;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
[self.view setFrame:self.view.window.bounds];
|
||||
self.title = @"Flutter iOS Demos Home";
|
||||
self.view.backgroundColor = UIColor.whiteColor;
|
||||
|
||||
_stackView = [[UIStackView alloc] initWithFrame:self.view.frame];
|
||||
_stackView.axis = UILayoutConstraintAxisVertical;
|
||||
_stackView.distribution = UIStackViewDistributionEqualSpacing;
|
||||
_stackView.alignment = UIStackViewAlignmentCenter;
|
||||
_stackView.autoresizingMask =
|
||||
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
_stackView.layoutMargins = UIEdgeInsetsMake(0, 0, 50, 0);
|
||||
_stackView.layoutMarginsRelativeArrangement = YES;
|
||||
[self.view addSubview:_stackView];
|
||||
|
||||
[self addButton:@"Native iOS View" action:@selector(showNative)];
|
||||
[self addButton:@"Full Screen (Cold)" action:@selector(showFullScreenCold)];
|
||||
[self addButton:@"Full Screen (Warm)" action:@selector(showFullScreenWarm)];
|
||||
[self addButton:@"Flutter View (Warm)" action:@selector(showFlutterViewWarm)];
|
||||
[self addButton:@"Hybrid View (Warm)" action:@selector(showHybridView)];
|
||||
[self addButton:@"Dual Flutter View (Cold)" action:@selector(showDualView)];
|
||||
}
|
||||
|
||||
- (FlutterEngine *)engine {
|
||||
return [(AppDelegate *)[[UIApplication sharedApplication] delegate] engine];
|
||||
}
|
||||
|
||||
- (FlutterBasicMessageChannel*)reloadMessageChannel {
|
||||
return [(AppDelegate *)[[UIApplication sharedApplication] delegate] reloadMessageChannel];
|
||||
}
|
||||
|
||||
- (void)showDualView {
|
||||
DualFlutterViewController *dualViewController =
|
||||
[[DualFlutterViewController alloc] init];
|
||||
[self.navigationController pushViewController:dualViewController
|
||||
animated:YES];
|
||||
}
|
||||
|
||||
- (void)showHybridView {
|
||||
HybridViewController *hybridViewController =
|
||||
[[HybridViewController alloc] init];
|
||||
[self.navigationController pushViewController:hybridViewController
|
||||
animated:YES];
|
||||
}
|
||||
- (void)showNative {
|
||||
NativeViewController *nativeViewController =
|
||||
[[NativeViewController alloc] init];
|
||||
[self.navigationController pushViewController:nativeViewController
|
||||
animated:YES];
|
||||
}
|
||||
|
||||
- (void)showFullScreenCold {
|
||||
FullScreenViewController *flutterViewController =
|
||||
[[FullScreenViewController alloc] init];
|
||||
[flutterViewController setInitialRoute:@"full"];
|
||||
[[self reloadMessageChannel] sendMessage:@"full"];
|
||||
[self.navigationController
|
||||
pushViewController:flutterViewController
|
||||
animated:NO]; // Animating this is janky because of
|
||||
// transitions with header on the native side.
|
||||
// It's especially bad with a cold engine.
|
||||
}
|
||||
|
||||
- (void)showFullScreenWarm {
|
||||
[[self engine].navigationChannel invokeMethod:@"setInitialRoute"
|
||||
arguments:@"full"];
|
||||
[[self reloadMessageChannel] sendMessage:@"full"];
|
||||
|
||||
FullScreenViewController *flutterViewController =
|
||||
[[FullScreenViewController alloc] initWithEngine:[self engine]
|
||||
nibName:nil
|
||||
bundle:nil];
|
||||
[self.navigationController
|
||||
pushViewController:flutterViewController
|
||||
animated:NO]; // Animating this is problematic.
|
||||
}
|
||||
|
||||
- (void)showFlutterViewWarm {
|
||||
[[self engine].navigationChannel invokeMethod:@"setInitialRoute"
|
||||
arguments:@"/"];
|
||||
[[self reloadMessageChannel] sendMessage:@"/"];
|
||||
|
||||
|
||||
FlutterViewController *flutterViewController =
|
||||
[[FlutterViewController alloc] initWithEngine:[self engine]
|
||||
nibName:nil
|
||||
bundle:nil];
|
||||
[self.navigationController pushViewController:flutterViewController
|
||||
animated:YES];
|
||||
}
|
||||
|
||||
- (void)addButton:(NSString *)title action:(SEL)action {
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
[button setTitle:title forState:UIControlStateNormal];
|
||||
[button addTarget:self
|
||||
action:action
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
[_stackView addArrangedSubview:button];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@protocol NativeViewControllerDelegate
|
||||
/// Triggered when the increment button from the NativeViewController is tapped.
|
||||
-(void)didTapIncrementButton;
|
||||
|
||||
@end
|
||||
|
||||
@interface NativeViewController : UIViewController
|
||||
|
||||
- (instancetype)initWithDelegate:(id<NativeViewControllerDelegate>)delegate
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@property(nonatomic, weak) id<NativeViewControllerDelegate> delegate;
|
||||
|
||||
-(void)didReceiveIncrement;
|
||||
|
||||
@end
|
||||
144
dev/integration_tests/ios_host_app/Host/NativeViewController.m
Normal file
144
dev/integration_tests/ios_host_app/Host/NativeViewController.m
Normal file
@@ -0,0 +1,144 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import "NativeViewController.h"
|
||||
|
||||
@interface NativeViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation NativeViewController {
|
||||
int _counter;
|
||||
UILabel* _incrementLabel;
|
||||
}
|
||||
|
||||
- (instancetype)initWithDelegate:(id<NativeViewControllerDelegate>)delegate {
|
||||
self = [super initWithNibName:nil bundle:nil];
|
||||
if (self) {
|
||||
self.delegate = delegate;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
|
||||
return [self initWithDelegate:nil];
|
||||
}
|
||||
|
||||
-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||
return [self initWithDelegate:nil];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
self.title = @"Native iOS View";
|
||||
self.view.backgroundColor = UIColor.lightGrayColor;
|
||||
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc]
|
||||
initWithTitle:@"Back"
|
||||
style:UIBarButtonItemStylePlain
|
||||
target:nil
|
||||
action:nil];
|
||||
|
||||
_incrementLabel = [self addIncrementLabel];
|
||||
UIStackView* footer = [self addFooter];
|
||||
|
||||
_incrementLabel.translatesAutoresizingMaskIntoConstraints = false;
|
||||
footer.translatesAutoresizingMaskIntoConstraints = false;
|
||||
UILayoutGuide* marginsGuide = self.view.layoutMarginsGuide;
|
||||
NSMutableArray* array = [[NSMutableArray alloc] init];
|
||||
[array addObject:[_incrementLabel.centerXAnchor
|
||||
constraintEqualToAnchor:self.view.centerXAnchor]];
|
||||
[array addObject:[_incrementLabel.centerYAnchor
|
||||
constraintEqualToAnchor:self.view.centerYAnchor]];
|
||||
[array addObject:[footer.centerXAnchor
|
||||
constraintEqualToAnchor:self.view.centerXAnchor]];
|
||||
[array addObject:[footer.widthAnchor
|
||||
constraintEqualToAnchor:marginsGuide.widthAnchor]];
|
||||
[array addObject:[footer.bottomAnchor
|
||||
constraintEqualToAnchor:marginsGuide.bottomAnchor]];
|
||||
|
||||
[NSLayoutConstraint activateConstraints:array];
|
||||
[self updateIncrementLabel];
|
||||
}
|
||||
|
||||
/// Adds a label to the view that will contain the counter text.
|
||||
///
|
||||
/// - Returns: The new label.
|
||||
-(UILabel*) addIncrementLabel {
|
||||
UILabel* incrementLabel = [[UILabel alloc] init];
|
||||
incrementLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
|
||||
incrementLabel.textColor = UIColor.blackColor;
|
||||
incrementLabel.accessibilityIdentifier = @"counter_on_iOS";
|
||||
[self.view addSubview:incrementLabel];
|
||||
return incrementLabel;
|
||||
}
|
||||
|
||||
/// Adds a horizontal stack to the view, anchored to the bottom.
|
||||
///
|
||||
/// - Returns: The new stack.
|
||||
-(UIStackView*) addFooter {
|
||||
UILabel* mainLabel = [self createMainLabel];
|
||||
UIButton* incrementButton = [self createIncrementButton];
|
||||
UIStackView* stackView = [[UIStackView alloc] initWithFrame:self.view.frame];
|
||||
[stackView addArrangedSubview:mainLabel];
|
||||
[stackView addArrangedSubview:incrementButton];
|
||||
stackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
stackView.alignment = UIStackViewAlignmentBottom;
|
||||
[self.view addSubview:stackView];
|
||||
return stackView;
|
||||
}
|
||||
|
||||
/// Creates a label identifying this view. Does not add it to the view.
|
||||
///
|
||||
/// - Returns: The new label.
|
||||
-(UILabel*) createMainLabel {
|
||||
UILabel* mainLabel = [[UILabel alloc] init];
|
||||
mainLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleTitle1];
|
||||
mainLabel.textColor = UIColor.blackColor;
|
||||
mainLabel.text = @"Native";
|
||||
return mainLabel;
|
||||
}
|
||||
|
||||
/// Creates a button that will increment a counter. Does not add it to the view.
|
||||
///
|
||||
/// - Returns: The new button.
|
||||
-(UIButton*) createIncrementButton {
|
||||
UIButton *incrementButton = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
incrementButton.titleLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleTitle2];
|
||||
[incrementButton setTitle:@"Add" forState:UIControlStateNormal];
|
||||
incrementButton.accessibilityLabel = @"Increment via iOS";
|
||||
incrementButton.layer.cornerRadius = 15.0;
|
||||
[incrementButton addTarget:self
|
||||
action:@selector(handleIncrement:)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
return incrementButton;
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
/// Action triggered from tapping on the increment button. Triggers a corresponding event in the
|
||||
/// delegate if one is available, otherwise increments our internal counter.
|
||||
-(void) handleIncrement:(UIButton*)sender {
|
||||
if (self.delegate) {
|
||||
[self.delegate didTapIncrementButton];
|
||||
} else {
|
||||
[self didReceiveIncrement];
|
||||
}
|
||||
}
|
||||
|
||||
/// Updates the increment label text to match the increment counter.
|
||||
-(void) updateIncrementLabel {
|
||||
_incrementLabel.text = [NSString
|
||||
stringWithFormat:@"%@ tapped %d %@.",
|
||||
self.delegate == nil ? @"Button" : @"Flutter button",
|
||||
_counter, _counter == 1 ? @"time" : @"times"];
|
||||
}
|
||||
|
||||
/// Increments our internal counter and updates the view.
|
||||
-(void) didReceiveIncrement {
|
||||
_counter += 1;
|
||||
[self updateIncrementLabel];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,30 +0,0 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import "ViewController.h"
|
||||
#import <Flutter/Flutter.h>
|
||||
#import <FlutterPluginRegistrant/GeneratedPluginRegistrant.h>
|
||||
|
||||
@implementation ViewController
|
||||
|
||||
// Boiler-plate add-to-app demo. Not integration tested anywhere.
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[button addTarget:self
|
||||
action:@selector(handleButtonAction)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
[button setTitle:@"Press me" forState:UIControlStateNormal];
|
||||
[button setBackgroundColor:[UIColor blueColor]];
|
||||
button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
|
||||
[self.view addSubview:button];
|
||||
}
|
||||
|
||||
- (void)handleButtonAction {
|
||||
FlutterViewController* flutterViewController = [[FlutterViewController alloc] init];
|
||||
[GeneratedPluginRegistrant registerWithRegistry:flutterViewController];
|
||||
[self presentViewController:flutterViewController animated:false completion:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -6,7 +6,7 @@
|
||||
#import "AppDelegate.h"
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
@autoreleasepool {
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
||||
}
|
||||
@autoreleasepool {
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,9 @@ load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
|
||||
|
||||
target 'Host' do
|
||||
install_all_flutter_pods flutter_application_path
|
||||
|
||||
target 'FlutterUITests' do
|
||||
inherit! :search_paths
|
||||
install_all_flutter_pods flutter_application_path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,8 +1,34 @@
|
||||
# iOS host app
|
||||
|
||||
Used by the `module_test_ios.dart` device lab test.
|
||||
|
||||
iOS host app for a Flutter module created using
|
||||
```
|
||||
$ flutter create -t module hello
|
||||
```
|
||||
and placed in a sibling folder to (a clone of) the host app.
|
||||
Used by the `module_test_ios.dart` device lab test.
|
||||
`flutterapp/lib/marquee.dart` and `flutterapp/lib/main.dart`
|
||||
must be copied into the new module `lib` for platform unit tests
|
||||
to pass.
|
||||
|
||||
This application demonstrates some basic functionality for Add2App,
|
||||
along with a native iOS ViewController as a baseline and to demonstrate
|
||||
interaction.
|
||||
|
||||
1. A regular iOS view controller (UIViewController), similar to the default
|
||||
`flutter create` template (NativeViewController.m).
|
||||
1. A FlutterViewController subclass that takes over full screen. Demos showing
|
||||
this both from a cold/fresh engine state and a warm engine state
|
||||
(FullScreenViewController.m).
|
||||
1. A demo of pushing a FlutterViewController on as a child view.
|
||||
1. A demo of showing both the native and the Flutter views using a platform
|
||||
channel to interact with each other (HybridViewController.m).
|
||||
1. A demo of showing two FlutterViewControllers simultaneously
|
||||
(DualViewController.m).
|
||||
|
||||
A few key things are tested here (FlutterUITests.m):
|
||||
|
||||
1. The ability to pre-warm the engine and attach/detatch a ViewController from
|
||||
it.
|
||||
1. The ability to use platform channels to communicate between views.
|
||||
1. The ability to simultaneously run two instances of the engine.
|
||||
|
||||
196
dev/integration_tests/ios_host_app/flutterapp/lib/main
Normal file
196
dev/integration_tests/ios_host_app/flutterapp/lib/main
Normal file
@@ -0,0 +1,196 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'marquee.dart';
|
||||
|
||||
/// Route names. (See [main] for more details.)
|
||||
///
|
||||
/// The route names must match those sent by the platform-specific component.
|
||||
const String greenMarqueeRouteName = 'marquee_green';
|
||||
const String purpleMarqueeRouteName = 'marquee_purple';
|
||||
const String fullscreenRouteName = 'full';
|
||||
const String hybridRouteName = 'hybrid';
|
||||
|
||||
/// Channel used to let the Flutter app know to reset the app to a specific
|
||||
/// route. See the [run] method.
|
||||
///
|
||||
/// Note that we shouldn't use the `setInitialRoute` method on the system
|
||||
/// navigation channel, as that never gets propagated back to Flutter after the
|
||||
/// initial call.
|
||||
const String _kReloadChannelName = 'reload';
|
||||
const BasicMessageChannel<String> _kReloadChannel =
|
||||
BasicMessageChannel<String>(_kReloadChannelName, StringCodec());
|
||||
|
||||
void main() {
|
||||
// Ensures bindings are initialized before doing anything.
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
// Start listening immediately for messages from the iOS side. ObjC calls
|
||||
// will be made to let us know when we should be changing the app state.
|
||||
_kReloadChannel.setMessageHandler(run);
|
||||
// Start off with whatever the initial route is supposed to be.
|
||||
run(ui.window.defaultRouteName);
|
||||
}
|
||||
|
||||
Future<String> run(String name) async {
|
||||
// The platform-specific component will call [setInitialRoute] on the Flutter
|
||||
// view (or view controller for iOS) to set [ui.window.defaultRouteName].
|
||||
// We then dispatch based on the route names to show different Flutter
|
||||
// widgets.
|
||||
// Since we don't really care about Flutter-side navigation in this app, we're
|
||||
// not using a regular routes map.
|
||||
switch (name) {
|
||||
case greenMarqueeRouteName:
|
||||
runApp(Marquee(color: Colors.green[400]));
|
||||
break;
|
||||
case purpleMarqueeRouteName:
|
||||
runApp(Marquee(color: Colors.purple[400]));
|
||||
break;
|
||||
case fullscreenRouteName:
|
||||
case hybridRouteName:
|
||||
default:
|
||||
runApp(FlutterView(initialRoute: name));
|
||||
break;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
class FlutterView extends StatelessWidget {
|
||||
const FlutterView({@required this.initialRoute});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Flutter View',
|
||||
home: MyHomePage(initialRoute: initialRoute),
|
||||
);
|
||||
}
|
||||
|
||||
final String initialRoute;
|
||||
}
|
||||
|
||||
class MyHomePage extends StatefulWidget {
|
||||
const MyHomePage({this.initialRoute});
|
||||
|
||||
@override
|
||||
_MyHomePageState createState() => _MyHomePageState();
|
||||
|
||||
final String initialRoute;
|
||||
|
||||
/// Whether we should display the home page in fullscreen mode.
|
||||
///
|
||||
/// If in full screen mode, we will use an [AppBar] widget to show our own
|
||||
/// title.
|
||||
bool get isFullscreen => initialRoute == fullscreenRouteName;
|
||||
|
||||
/// Whether tapping the Flutter button should notify an external source.
|
||||
///
|
||||
/// If false, the button will increments our own internal counter.
|
||||
bool get hasExternalTarget => initialRoute == hybridRouteName;
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
// The name of the message channel used to communicate with the
|
||||
// platform-specific component.
|
||||
//
|
||||
// This string must match the one used on the platform side.
|
||||
static const String _channel = 'increment';
|
||||
|
||||
// The message to send to the platform-specific component when our button
|
||||
// is tapped.
|
||||
static const String _pong = 'pong';
|
||||
|
||||
// Used to pass messages between the platform-specific component and the
|
||||
// Flutter component.
|
||||
static const BasicMessageChannel<String> _platform =
|
||||
BasicMessageChannel<String>(_channel, StringCodec());
|
||||
|
||||
// An internal count. Normally this represents the number of times that the
|
||||
// button on the Flutter page has been tapped.
|
||||
int _counter = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_platform.setMessageHandler(_handlePlatformIncrement);
|
||||
}
|
||||
|
||||
/// Directly increments our internal counter and rebuilds the UI.
|
||||
void _incrementCounter() {
|
||||
setState(() {
|
||||
_counter++;
|
||||
});
|
||||
}
|
||||
|
||||
/// Callback for messages sent by the platform-specific component.
|
||||
///
|
||||
/// Increments our internal counter.
|
||||
Future<String> _handlePlatformIncrement(String message) async {
|
||||
// Normally we'd dispatch based on the value of [message], but in this
|
||||
// sample, there is only one message that is sent to us.
|
||||
_incrementCounter();
|
||||
return '';
|
||||
}
|
||||
|
||||
/// Sends a message to the platform-specific component to increment its
|
||||
/// counter.
|
||||
void _sendFlutterIncrement() {
|
||||
_platform.send(_pong);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final String buttonName =
|
||||
widget.hasExternalTarget ? 'Platform button' : 'Button';
|
||||
return Scaffold(
|
||||
appBar: widget.isFullscreen
|
||||
? AppBar(title: const Text('Fullscreen Flutter'))
|
||||
: null,
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Center(
|
||||
child: Text(
|
||||
'$buttonName tapped $_counter time${_counter == 1 ? '' : 's'}.',
|
||||
style: const TextStyle(fontSize: 17.0),
|
||||
),
|
||||
),
|
||||
const FlatButton(
|
||||
child: Text('POP'),
|
||||
onPressed: SystemNavigator.pop,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.only(bottom: 15.0, left: 5.0),
|
||||
child: Row(
|
||||
children: const <Widget>[
|
||||
Text('Flutter', style: TextStyle(fontSize: 30.0)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
floatingActionButton: Semantics(
|
||||
label: 'Increment via Flutter',
|
||||
child: FloatingActionButton(
|
||||
onPressed: widget.hasExternalTarget
|
||||
? _sendFlutterIncrement
|
||||
: _incrementCounter,
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
74
dev/integration_tests/ios_host_app/flutterapp/lib/marquee
Normal file
74
dev/integration_tests/ios_host_app/flutterapp/lib/marquee
Normal file
@@ -0,0 +1,74 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/animation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class _MarqueeText extends AnimatedWidget {
|
||||
const _MarqueeText({Key key, Animation<double> animation})
|
||||
: super(key: key, listenable: animation);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Animation<double> animation = listenable as Animation<double>;
|
||||
return Container(
|
||||
margin: EdgeInsets.only(left: animation.value),
|
||||
child: const Text(
|
||||
'This is Marquee',
|
||||
softWrap: false,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Marquee extends StatefulWidget {
|
||||
const Marquee({this.color});
|
||||
|
||||
final Color color;
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => MarqueeState();
|
||||
}
|
||||
|
||||
class MarqueeState extends State<Marquee> with SingleTickerProviderStateMixin {
|
||||
AnimationController controller;
|
||||
Animation<double> animation;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
controller = AnimationController(
|
||||
duration: const Duration(milliseconds: 2000),
|
||||
vsync: this,
|
||||
);
|
||||
animation = Tween<double>(begin: 0.0, end: 400.0).animate(controller);
|
||||
controller.repeat();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
color: widget.color,
|
||||
child: Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Align(
|
||||
child: _MarqueeText(animation: animation),
|
||||
alignment: Alignment.centerLeft,
|
||||
),
|
||||
const FlatButton(child: Text('POP'), onPressed: SystemNavigator.pop),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user