mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-10 12:07:58 -06:00
WIP - Replaced get_it + injectable with Provider
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:paperless_mobile/di_initializer.dart';
|
||||
import 'package:paperless_mobile/features/login/services/authentication_service.dart';
|
||||
import 'package:paperless_mobile/features/settings/bloc/application_settings_cubit.dart';
|
||||
import 'package:paperless_mobile/features/settings/model/application_settings_state.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class BiometricAuthenticationSetting extends StatelessWidget {
|
||||
const BiometricAuthenticationSetting({super.key});
|
||||
@@ -28,8 +28,9 @@ class BiometricAuthenticationSetting extends StatelessWidget {
|
||||
: S
|
||||
.of(context)
|
||||
.appSettingsDisableBiometricAuthenticationReasonText;
|
||||
final changeValue = await getIt<LocalAuthenticationService>()
|
||||
.authenticateLocalUser(localizedReason);
|
||||
final changeValue =
|
||||
await Provider.of<LocalAuthenticationService>(context)
|
||||
.authenticateLocalUser(localizedReason);
|
||||
if (changeValue) {
|
||||
settingsBloc.setIsBiometricAuthenticationEnabled(val);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart' as cm;
|
||||
import 'package:paperless_mobile/core/service/file_service.dart';
|
||||
import 'package:paperless_mobile/di_initializer.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ClearStorageSetting extends StatelessWidget {
|
||||
const ClearStorageSetting({super.key});
|
||||
@@ -12,12 +12,10 @@ class ClearStorageSetting extends StatelessWidget {
|
||||
title: Text("Clear data"),
|
||||
subtitle:
|
||||
Text("Remove downloaded files, scans and clear the cache's content"),
|
||||
onTap: _clearCache,
|
||||
onTap: () {
|
||||
Provider.of<cm.CacheManager>(context).emptyCache();
|
||||
FileService.clearUserData();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void _clearCache() async {
|
||||
getIt<cm.CacheManager>().emptyCache();
|
||||
FileService.clearUserData();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user