Flutter Engine
 
Loading...
Searching...
No Matches
FlutterSharedApplication.mm
Go to the documentation of this file.
1// Copyright 2013 The Flutter 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
6
9
11
12NSString* const kRestorationStateAppModificationKey = @"mod-date";
13
14@implementation FlutterSharedApplication
15
17 NSDictionary* nsExtension = [NSBundle.mainBundle objectForInfoDictionaryKey:@"NSExtension"];
18 return [nsExtension isKindOfClass:[NSDictionary class]];
19}
20
22 // If the bundle is an App Extension, the application is not available.
23 // Therefore access to `UIApplication.sharedApplication` is not allowed.
25}
26
27+ (UIApplication*)application {
29 return FlutterSharedApplication.sharedApplication;
30 }
31 return nil;
32}
33
34+ (UIApplication*)
35 sharedApplication NS_EXTENSION_UNAVAILABLE_IOS("Accesses unavailable sharedApplication.") {
36 return UIApplication.sharedApplication;
37}
38
41 for (UIScene* scene in FlutterSharedApplication.sharedApplication.connectedScenes) {
42 if (scene.delegate != nil) {
43 return YES;
44 }
45 }
46 }
47 return NO;
48}
49
50+ (int64_t)lastAppModificationTime {
51 NSDate* fileDate;
52 NSError* error = nil;
53 [[[NSBundle mainBundle] executableURL] getResourceValue:&fileDate
54 forKey:NSURLContentModificationDateKey
55 error:&error];
56 NSAssert(error == nil, @"Cannot obtain modification date of main bundle: %@", error);
57 return [fileDate timeIntervalSince1970];
58}
59
61 // Developers may disable deep linking through their Info.plist if they are using a plugin that
62 // handles deeplinking instead.
63 NSNumber* isDeepLinkingEnabled =
64 [[NSBundle mainBundle] objectForInfoDictionaryKey:@"FlutterDeepLinkingEnabled"];
65 // if not set, return YES
66 return isDeepLinkingEnabled ? [isDeepLinkingEnabled boolValue] : YES;
67}
68
69@end
FLUTTER_ASSERT_ARC NSString *const kRestorationStateAppModificationKey
const uint8_t uint32_t uint32_t GError ** error
int BOOL