Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 5790196

Browse files
author
Chris Yang
committed
fix
1 parent d64abdb commit 5790196

File tree

29 files changed

+1122
-3
lines changed

29 files changed

+1122
-3
lines changed

shell/platform/darwin/common/framework/Source/FlutterNSBundleUtils.mm

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,23 @@
6161
NSString* flutterAssetsPath = FLTAssetPath(bundle);
6262
// Use the raw path solution so that asset path can be returned from unloaded bundles.
6363
// See https://github.com/flutter/engine/pull/46073
64-
NSString* assetsPath = [bundle pathForResource:flutterAssetsPath ofType:@""];
64+
NSString* assetsPath = [bundle pathForResource:flutterAssetsPath ofType:nil];
65+
if (assetsPath.length == 0) {
66+
// In app_extension, using full relative path: kDefaultAssetPath
67+
// returns nil because the app bundle is not loaded. We try to use
68+
// the sub folder name, which can successfully return a valid path.
69+
assetsPath = [bundle pathForResource:@"flutter_assets" ofType:nil];
70+
}
71+
72+
if (assetsPath.length == 0) {
73+
assetsPath = [[NSBundle mainBundle] pathForResource:flutterAssetsPath ofType:nil];
74+
}
6575

6676
if (assetsPath.length == 0) {
67-
assetsPath = [[NSBundle mainBundle] pathForResource:flutterAssetsPath ofType:@""];
77+
// In app_extension, using full relative path: kDefaultAssetPath
78+
// returns nil because the app bundle is not loaded. We try to use
79+
// the sub folder name, which can successfully return a valid path.
80+
assetsPath = [[NSBundle mainBundle] pathForResource:@"flutter_assets" ofType:nil];
6881
}
6982
return assetsPath;
7083
}

testing/scenario_app/ios/FlutterAppExtensionTestHost/FlutterAppExtensionTestHost.xcodeproj/project.pbxproj

Lines changed: 372 additions & 0 deletions
Large diffs are not rendered by default.

testing/scenario_app/ios/FlutterAppExtensionTestHost/FlutterAppExtensionTestHost.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright 2018 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#import <UIKit/UIKit.h>
6+
7+
@interface AppDelegate : UIResponder <UIApplicationDelegate>
8+
9+
@end
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2018 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
#import "AppDelegate.h"
5+
6+
@interface AppDelegate ()
7+
8+
@end
9+
10+
@implementation AppDelegate
11+
12+
- (BOOL)application:(UIApplication*)application
13+
didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
14+
// Override point for customization after application launch.
15+
return YES;
16+
}
17+
18+
#pragma mark - UISceneSession lifecycle
19+
20+
- (UISceneConfiguration*)application:(UIApplication*)application
21+
configurationForConnectingSceneSession:(UISceneSession*)connectingSceneSession
22+
options:(UISceneConnectionOptions*)options {
23+
// Called when a new scene session is being created.
24+
// Use this method to select a configuration to create the new scene with.
25+
return [[UISceneConfiguration alloc] initWithName:@"Default Configuration"
26+
sessionRole:connectingSceneSession.role];
27+
}
28+
29+
- (void)application:(UIApplication*)application
30+
didDiscardSceneSessions:(NSSet<UISceneSession*>*)sceneSessions {
31+
// Called when the user discards a scene session.
32+
// If any sessions were discarded while the application was not running, this will be called
33+
// shortly after application:didFinishLaunchingWithOptions. Use this method to release any
34+
// resources that were specific to the discarded scenes, as they will not return.
35+
}
36+
37+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"colors" : [
3+
{
4+
"idiom" : "universal"
5+
}
6+
],
7+
"info" : {
8+
"author" : "xcode",
9+
"version" : 1
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"platform" : "ios",
6+
"size" : "1024x1024"
7+
}
8+
],
9+
"info" : {
10+
"author" : "xcode",
11+
"version" : 1
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<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">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
5+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
6+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
7+
</dependencies>
8+
<scenes>
9+
<!--View Controller-->
10+
<scene sceneID="EHf-IW-A2E">
11+
<objects>
12+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
13+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
14+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
15+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
16+
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
17+
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
18+
</view>
19+
</viewController>
20+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
21+
</objects>
22+
<point key="canvasLocation" x="53" y="375"/>
23+
</scene>
24+
</scenes>
25+
</document>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
5+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
6+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
7+
</dependencies>
8+
<scenes>
9+
<!--View Controller-->
10+
<scene sceneID="tne-QT-ifu">
11+
<objects>
12+
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
13+
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
14+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
15+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
16+
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
17+
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
18+
</view>
19+
</viewController>
20+
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
21+
</objects>
22+
</scene>
23+
</scenes>
24+
</document>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>UIApplicationSceneManifest</key>
6+
<dict>
7+
<key>UIApplicationSupportsMultipleScenes</key>
8+
<false/>
9+
<key>UISceneConfigurations</key>
10+
<dict>
11+
<key>UIWindowSceneSessionRoleApplication</key>
12+
<array>
13+
<dict>
14+
<key>UISceneConfigurationName</key>
15+
<string>Default Configuration</string>
16+
<key>UISceneDelegateClassName</key>
17+
<string>SceneDelegate</string>
18+
<key>UISceneStoryboardFile</key>
19+
<string>Main</string>
20+
</dict>
21+
</array>
22+
</dict>
23+
</dict>
24+
</dict>
25+
</plist>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2018 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#import <UIKit/UIKit.h>
6+
7+
@interface SceneDelegate : UIResponder <UIWindowSceneDelegate>
8+
9+
@property(strong, nonatomic) UIWindow* window;
10+
11+
@end
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright 2018 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#import "SceneDelegate.h"
6+
7+
@interface SceneDelegate ()
8+
9+
@end
10+
11+
@implementation SceneDelegate
12+
13+
- (void)scene:(UIScene*)scene
14+
willConnectToSession:(UISceneSession*)session
15+
options:(UISceneConnectionOptions*)connectionOptions {
16+
// Use this method to optionally configure and attach the UIWindow `window` to the provided
17+
// UIWindowScene `scene`. If using a storyboard, the `window` property will automatically be
18+
// initialized and attached to the scene. This delegate does not imply the connecting scene or
19+
// session are new (see `application:configurationForConnectingSceneSession` instead).
20+
}
21+
22+
- (void)sceneDidDisconnect:(UIScene*)scene {
23+
// Called as the scene is being released by the system.
24+
// This occurs shortly after the scene enters the background, or when its session is discarded.
25+
// Release any resources associated with this scene that can be re-created the next time the scene
26+
// connects. The scene may re-connect later, as its session was not necessarily discarded (see
27+
// `application:didDiscardSceneSessions` instead).
28+
}
29+
30+
- (void)sceneDidBecomeActive:(UIScene*)scene {
31+
// Called when the scene has moved from an inactive state to an active state.
32+
// Use this method to restart any tasks that were paused (or not yet started) when the scene was
33+
// inactive.
34+
}
35+
36+
- (void)sceneWillResignActive:(UIScene*)scene {
37+
// Called when the scene will move from an active state to an inactive state.
38+
// This may occur due to temporary interruptions (ex. an incoming phone call).
39+
}
40+
41+
- (void)sceneWillEnterForeground:(UIScene*)scene {
42+
// Called as the scene transitions from the background to the foreground.
43+
// Use this method to undo the changes made on entering the background.
44+
}
45+
46+
- (void)sceneDidEnterBackground:(UIScene*)scene {
47+
// Called as the scene transitions from the foreground to the background.
48+
// Use this method to save data, release shared resources, and store enough scene-specific state
49+
// information to restore the scene back to its current state.
50+
}
51+
52+
@end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright 2018 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#import <UIKit/UIKit.h>
6+
7+
@interface ViewController : UIViewController
8+
9+
@end
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright 2018 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#import "ViewController.h"
6+
7+
@interface ViewController ()
8+
9+
@end
10+
11+
@implementation ViewController
12+
13+
- (void)viewDidLoad {
14+
[super viewDidLoad];
15+
UIButton* openShare =
16+
[UIButton systemButtonWithPrimaryAction:[UIAction actionWithHandler:^(
17+
__kindof UIAction* _Nonnull action) {
18+
UIActivityViewController* activityVC =
19+
[[UIActivityViewController alloc] initWithActivityItems:@[ @"text to share" ]
20+
applicationActivities:nil];
21+
activityVC.excludedActivityTypes = @[
22+
UIActivityTypePrint, UIActivityTypeCopyToPasteboard,
23+
UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll
24+
]; // Exclude whichever aren't relevant
25+
[self presentViewController:activityVC animated:YES completion:nil];
26+
}]];
27+
openShare.backgroundColor = [UIColor systemPinkColor];
28+
[openShare setTitle:@"Open Share" forState:UIControlStateNormal];
29+
[self.view addSubview:openShare];
30+
openShare.frame = CGRectMake(0, 0, 200, 200);
31+
}
32+
33+
@end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2018 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#import <UIKit/UIKit.h>
6+
#import "AppDelegate.h"
7+
8+
int main(int argc, char* argv[]) {
9+
NSString* appDelegateClassName;
10+
@autoreleasepool {
11+
// Setup code that might create autoreleased objects goes here.
12+
appDelegateClassName = NSStringFromClass([AppDelegate class]);
13+
}
14+
return UIApplicationMain(argc, argv, nil, appDelegateClassName);
15+
}

testing/scenario_app/ios/Scenarios.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict/>
5+
</plist>

0 commit comments

Comments
 (0)