v1.2.1+55
All checks were successful
Flutter Schmutter / build (push) Successful in 3m42s

- fix deeplink
- add mute button
This commit is contained in:
2025-06-13 15:01:48 +02:00
parent 9655f15927
commit 2a500144f5
7 changed files with 46 additions and 14 deletions

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:f0ckapp/models/mediaitem_model.dart';
@ -8,11 +9,15 @@ const List<String> mediaTypes = ["alles", "image", "video", "audio"];
const List<String> mediaModes = ["sfw", "nsfw", "untagged", "all"];
class ApiService extends GetConnect {
final _storage = const FlutterSecureStorage(
aOptions: AndroidOptions(encryptedSharedPreferences: true),
);
RxList<MediaItem> mediaItems = <MediaItem>[].obs;
RxnString tag = RxnString();
RxInt type = 0.obs;
RxInt mode = 0.obs;
RxBool random = false.obs;
RxBool muted = false.obs;
bool _isFetching = false;
DateTime? _lastFetchTime;
@ -21,9 +26,20 @@ class ApiService extends GetConnect {
@override
void onInit() {
super.onInit();
loadMutedState();
everAll([tag, type, mode, random], (_) => fetchMedia(reset: true));
}
Future<void> loadMutedState() async {
String? value = await _storage.read(key: 'muted');
muted.value = value == 'true';
}
Future<void> toggleMuted() async {
muted.value = !muted.value;
await _storage.write(key: 'muted', value: muted.value.toString());
}
Future<void> setTag(String? newTag) async {
tag.value = newTag;
return await fetchMedia(reset: true);