44using System . Threading . Tasks ;
55using CommunityToolkit . Mvvm . DependencyInjection ;
66using Flow . Launcher . Plugin ;
7+ using Flow . Launcher . Infrastructure ;
78
89namespace Flow . Launcher . Core . ExternalPlugins
910{
@@ -39,13 +40,23 @@ public static async Task<bool> UpdateManifestAsync(bool usePrimaryUrlOnly = fals
3940 var results = await mainPluginStore . FetchAsync ( token , usePrimaryUrlOnly ) . ConfigureAwait ( false ) ;
4041
4142 // If the results are empty, we shouldn't update the manifest because the results are invalid.
42- if ( results . Count ! = 0 )
43- {
44- UserPlugins = results ;
45- lastFetchedAt = DateTime . Now ;
43+ if ( results . Count = = 0 )
44+ return false ;
45+
46+ lastFetchedAt = DateTime . Now ;
4647
47- return true ;
48+ var updatedPluginResults = new List < UserPlugin > ( ) ;
49+ var appVersion = SemanticVersioning . Version . Parse ( Constant . Version ) ;
50+
51+ for ( int i = 0 ; i < results . Count ; i ++ )
52+ {
53+ if ( IsMinimumAppVersionSatisfied ( results [ i ] , appVersion ) )
54+ updatedPluginResults . Add ( results [ i ] ) ;
4855 }
56+
57+ UserPlugins = updatedPluginResults ;
58+
59+ return true ;
4960 }
5061 }
5162 catch ( Exception e )
@@ -59,5 +70,16 @@ public static async Task<bool> UpdateManifestAsync(bool usePrimaryUrlOnly = fals
5970
6071 return false ;
6172 }
73+
74+ private static bool IsMinimumAppVersionSatisfied ( UserPlugin plugin , SemanticVersioning . Version appVersion )
75+ {
76+ if ( string . IsNullOrEmpty ( plugin . MinimumAppVersion ) || appVersion >= SemanticVersioning . Version . Parse ( plugin . MinimumAppVersion ) )
77+ return true ;
78+
79+ API . LogDebug ( ClassName , $ "Plugin { plugin . Name } requires minimum Flow Launcher version { plugin . MinimumAppVersion } , "
80+ + $ "but current version is { Constant . Version } . Plugin excluded from manifest.") ;
81+
82+ return false ;
83+ }
6284 }
6385}
0 commit comments