4
4
using System . Threading . Tasks ;
5
5
using CommunityToolkit . Mvvm . DependencyInjection ;
6
6
using Flow . Launcher . Plugin ;
7
+ using Flow . Launcher . Infrastructure ;
7
8
8
9
namespace Flow . Launcher . Core . ExternalPlugins
9
10
{
@@ -39,13 +40,23 @@ public static async Task<bool> UpdateManifestAsync(bool usePrimaryUrlOnly = fals
39
40
var results = await mainPluginStore . FetchAsync ( token , usePrimaryUrlOnly ) . ConfigureAwait ( false ) ;
40
41
41
42
// 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 ;
46
47
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 ] ) ;
48
55
}
56
+
57
+ UserPlugins = updatedPluginResults ;
58
+
59
+ return true ;
49
60
}
50
61
}
51
62
catch ( Exception e )
@@ -59,5 +70,16 @@ public static async Task<bool> UpdateManifestAsync(bool usePrimaryUrlOnly = fals
59
70
60
71
return false ;
61
72
}
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
+ }
62
84
}
63
85
}
0 commit comments