mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-01 05:10:15 +02:00
Added category add/remove (no recolour/rename for now)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
// Exposes functions used to save/load app settings
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
@@ -144,4 +146,11 @@ class SettingsProvider with ChangeNotifier {
|
||||
prefs?.setString(settingId, value);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Map<String, int> get categories =>
|
||||
Map<String, int>.from(jsonDecode(prefs?.getString('categories') ?? '{}'));
|
||||
|
||||
set categories(Map<String, int> cats) {
|
||||
prefs?.setString('categories', jsonEncode(cats));
|
||||
}
|
||||
}
|
||||
|
@@ -47,6 +47,7 @@ class App {
|
||||
late Map<String, String> additionalSettings;
|
||||
late DateTime? lastUpdateCheck;
|
||||
bool pinned = false;
|
||||
String? category;
|
||||
App(
|
||||
this.id,
|
||||
this.url,
|
||||
@@ -58,7 +59,8 @@ class App {
|
||||
this.preferredApkIndex,
|
||||
this.additionalSettings,
|
||||
this.lastUpdateCheck,
|
||||
this.pinned);
|
||||
this.pinned,
|
||||
{this.category});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@@ -107,7 +109,8 @@ class App {
|
||||
json['lastUpdateCheck'] == null
|
||||
? null
|
||||
: DateTime.fromMicrosecondsSinceEpoch(json['lastUpdateCheck']),
|
||||
json['pinned'] ?? false);
|
||||
json['pinned'] ?? false,
|
||||
category: json['category']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
@@ -121,7 +124,8 @@ class App {
|
||||
'preferredApkIndex': preferredApkIndex,
|
||||
'additionalSettings': jsonEncode(additionalSettings),
|
||||
'lastUpdateCheck': lastUpdateCheck?.microsecondsSinceEpoch,
|
||||
'pinned': pinned
|
||||
'pinned': pinned,
|
||||
'category': category
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user