Skip to content

Commit aaf1cac

Browse files
committed
[macos] Implement destroy method
1 parent 4a789f3 commit aaf1cac

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

example/macos/Flutter/GeneratedPluginRegistrant.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
import FlutterMacOS
66
import Foundation
77

8+
import tray_manager
89
import window_manager
910

1011
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
12+
TrayManagerPlugin.register(with: registry.registrar(forPlugin: "TrayManagerPlugin"))
1113
WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin"))
1214
}

example/macos/Podfile.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
PODS:
22
- FlutterMacOS (1.0.0)
3+
- tray_manager (0.0.1):
4+
- FlutterMacOS
35
- window_manager (0.1.4):
46
- FlutterMacOS
57

68
DEPENDENCIES:
79
- FlutterMacOS (from `Flutter/ephemeral`)
10+
- tray_manager (from `Flutter/ephemeral/.symlinks/plugins/tray_manager/macos`)
811
- window_manager (from `Flutter/ephemeral/.symlinks/plugins/window_manager/macos`)
912

1013
EXTERNAL SOURCES:
1114
FlutterMacOS:
1215
:path: Flutter/ephemeral
16+
tray_manager:
17+
:path: Flutter/ephemeral/.symlinks/plugins/tray_manager/macos
1318
window_manager:
1419
:path: Flutter/ephemeral/.symlinks/plugins/window_manager/macos
1520

1621
SPEC CHECKSUMS:
1722
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
23+
tray_manager: 9064e219c56d75c476e46b9a21182087930baf90
1824
window_manager: 02776e5a599084cd4576e27a42dd5ec6f49132cf
1925

2026
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c

macos/Classes/WindowManager.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ public class WindowManager: NSObject, NSWindowDelegate {
7272
titleBarView.isHidden = true
7373
}
7474
}
75+
76+
public func destroy() {
77+
NSApp.terminate(nil)
78+
}
7579

7680
public func close() {
7781
mainWindow.performClose(nil)

macos/Classes/WindowManagerPlugin.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public class WindowManagerPlugin: NSObject, FlutterPlugin {
5656
windowManager.setAsFrameless()
5757
result(true)
5858
break
59+
case "destroy":
60+
windowManager.destroy()
61+
result(true)
62+
break
5963
case "close":
6064
windowManager.close()
6165
result(true)

0 commit comments

Comments
 (0)