5#import "flutter/shell/platform/darwin/macos/framework/Headers/FlutterAppDelegate.h"
6#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterAppDelegate_Internal.h"
8#import <AppKit/AppKit.h>
10#include "flutter/fml/logging.h"
11#import "flutter/shell/platform/darwin/macos/framework/Headers/FlutterAppLifecycleDelegate.h"
12#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterAppLifecycleDelegate_Internal.h"
13#include "flutter/shell/platform/embedder/embedder.h"
29 _terminationHandler = nil;
35- (void)applicationWillFinishLaunching:(NSNotification*)notification {
39 for (NSMenuItem* menuItem in _applicationMenu.itemArray) {
40 menuItem.title = [menuItem.title stringByReplacingOccurrencesOfString:@"APP_NAME"
41 withString:applicationName];
45#pragma mark - Delegate handling
48 [
self.lifecycleRegistrar addDelegate:delegate];
52 [
self.lifecycleRegistrar removeDelegate:delegate];
55#pragma mark Private Methods
59 [NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleDisplayName"];
61 applicationName = [NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleName"];
66#pragma mark NSApplicationDelegate
68- (void)application:(NSApplication*)application openURLs:(NSArray<NSURL*>*)urls {
69 for (NSObject<FlutterAppLifecycleDelegate>* delegate in
self.lifecycleRegistrar.delegates) {
70 if ([delegate respondsToSelector:
@selector(handleOpenURLs:)] &&
77- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication* _Nonnull)sender {
80 return NSTerminateNow;
86 exitType:kFlutterAppExitTypeCancelable
92 return NSTerminateCancel;
void requestApplicationTermination:exitType:result:(NSApplication *sender,[exitType] FlutterAppExitType type,[result] nullable FlutterResult result)
FlutterEngineTerminationHandler * terminationHandler
FlutterAppLifecycleRegistrar * lifecycleRegistrar
NSString * applicationName()
BOOL handleOpenURLs:(NSArray< NSURL * > *urls)