File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
Flow.Launcher.Core/Plugin
Flow.Launcher.Plugin/Interfaces Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,38 @@ public static async Task ReloadDataAsync()
88
88
} ) . ToArray ( ) ) ;
89
89
}
90
90
91
+ public static async Task OpenExternalPreviewAsync ( string path , bool sendFailToast = true )
92
+ {
93
+ await Task . WhenAll ( AllPlugins . Select ( plugin => plugin . Plugin switch
94
+ {
95
+ IAsyncExternalPreview p => p . OpenPreviewAsync ( path , sendFailToast ) ,
96
+ _ => Task . CompletedTask ,
97
+ } ) . ToArray ( ) ) ;
98
+ }
99
+
100
+ public static async Task CloseExternalPreviewAsync ( )
101
+ {
102
+ await Task . WhenAll ( AllPlugins . Select ( plugin => plugin . Plugin switch
103
+ {
104
+ IAsyncExternalPreview p => p . ClosePreviewAsync ( ) ,
105
+ _ => Task . CompletedTask ,
106
+ } ) . ToArray ( ) ) ;
107
+ }
108
+
109
+ public static async Task SwitchExternalPreviewAsync ( string path , bool sendFailToast = true )
110
+ {
111
+ await Task . WhenAll ( AllPlugins . Select ( plugin => plugin . Plugin switch
112
+ {
113
+ IAsyncExternalPreview p => p . SwitchPreviewAsync ( path , sendFailToast ) ,
114
+ _ => Task . CompletedTask ,
115
+ } ) . ToArray ( ) ) ;
116
+ }
117
+
118
+ public static bool UseExternalPreview ( )
119
+ {
120
+ return GetPluginsForInterface < IAsyncExternalPreview > ( ) . Any ( x => ! x . Metadata . Disabled ) ;
121
+ }
122
+
91
123
static PluginManager ( )
92
124
{
93
125
// validate user directory
Original file line number Diff line number Diff line change
1
+ using System . Threading . Tasks ;
2
+
3
+ namespace Flow . Launcher . Plugin
4
+ {
5
+ public interface IAsyncExternalPreview : IFeatures
6
+ {
7
+ public Task TogglePreviewAsync ( string path ) ;
8
+
9
+ public Task OpenPreviewAsync ( string path , bool sendFailToast = true ) ;
10
+
11
+ public Task ClosePreviewAsync ( ) ;
12
+
13
+ public Task SwitchPreviewAsync ( string path , bool sendFailToast = true ) ;
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments