mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-11-03 23:03:29 +01:00 
			
		
		
		
	Addresses #90
This commit is contained in:
		@@ -120,8 +120,9 @@ class AppsPageState extends State<AppsPage> {
 | 
			
		||||
      sortedApps = sortedApps.reversed.toList();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var existingUpdateIdsAllOrSelected = appsProvider
 | 
			
		||||
        .getExistingUpdates(installedOnly: true)
 | 
			
		||||
    var existingUpdates = appsProvider.getExistingUpdates(installedOnly: true);
 | 
			
		||||
 | 
			
		||||
    var existingUpdateIdsAllOrSelected = existingUpdates
 | 
			
		||||
        .where((element) => selectedIds.isEmpty
 | 
			
		||||
            ? sortedApps.where((a) => a.app.id == element).isNotEmpty
 | 
			
		||||
            : selectedIds.contains(element))
 | 
			
		||||
@@ -133,6 +134,18 @@ class AppsPageState extends State<AppsPage> {
 | 
			
		||||
            : selectedIds.contains(element))
 | 
			
		||||
        .toList();
 | 
			
		||||
 | 
			
		||||
    if (settingsProvider.pinUpdates) {
 | 
			
		||||
      var temp = [];
 | 
			
		||||
      sortedApps = sortedApps.where((sa) {
 | 
			
		||||
        if (existingUpdates.contains(sa.app.id)) {
 | 
			
		||||
          temp.add(sa);
 | 
			
		||||
          return false;
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
      }).toList();
 | 
			
		||||
      sortedApps = [...temp, ...sortedApps];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return Scaffold(
 | 
			
		||||
      backgroundColor: Theme.of(context).colorScheme.surface,
 | 
			
		||||
      body: RefreshIndicator(
 | 
			
		||||
 
 | 
			
		||||
@@ -155,6 +155,20 @@ class _SettingsPageState extends State<SettingsPage> {
 | 
			
		||||
                                    })
 | 
			
		||||
                              ],
 | 
			
		||||
                            ),
 | 
			
		||||
                            const SizedBox(
 | 
			
		||||
                              height: 16,
 | 
			
		||||
                            ),
 | 
			
		||||
                            Row(
 | 
			
		||||
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
 | 
			
		||||
                              children: [
 | 
			
		||||
                                const Text('Pin Updates to Top of Apps View'),
 | 
			
		||||
                                Switch(
 | 
			
		||||
                                    value: settingsProvider.pinUpdates,
 | 
			
		||||
                                    onChanged: (value) {
 | 
			
		||||
                                      settingsProvider.pinUpdates = value;
 | 
			
		||||
                                    })
 | 
			
		||||
                              ],
 | 
			
		||||
                            ),
 | 
			
		||||
                            const Divider(
 | 
			
		||||
                              height: 16,
 | 
			
		||||
                            ),
 | 
			
		||||
 
 | 
			
		||||
@@ -123,6 +123,15 @@ class SettingsProvider with ChangeNotifier {
 | 
			
		||||
    notifyListeners();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  bool get pinUpdates {
 | 
			
		||||
    return prefs?.getBool('pinUpdates') ?? true;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  set pinUpdates(bool show) {
 | 
			
		||||
    prefs?.setBool('pinUpdates', show);
 | 
			
		||||
    notifyListeners();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  String? getSettingString(String settingId) {
 | 
			
		||||
    return prefs?.getString(settingId);
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user