add pin login and add pin code

This commit is contained in:
tzw
2024-10-04 13:55:59 +06:30
parent b5023a4171
commit 81dfeb037d
18 changed files with 340 additions and 68 deletions

View File

@@ -4,6 +4,8 @@ import 'dart:io';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:dio/dio.dart';
import 'package:fcs/data/services/services.dart';
import 'package:fcs/domain/entities/user.dart';
import 'package:fcs/domain/vo/status.dart';
import 'package:logging/logging.dart';
import 'package:path_provider/path_provider.dart';
@@ -28,6 +30,10 @@ Future<dynamic> requestAPI(String path, method,
if (token != null) {
headers["Token"] = token;
}
User? pinLoginUser = Services.instance.authService.getPinLoginUser();
if (pinLoginUser != null) {
headers["pin_token"] = pinLoginUser.pinToken;
}
if (devInfo.deviceID != null) {
headers["Device"] = devInfo.deviceID ?? "" + ":" + deviceName;
}

View File

@@ -108,4 +108,14 @@ class SharedPref {
static Future<void> clearRecentSearch(String key) async {
return await _remove(key);
}
static Future<bool?> getPinLockOn() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return prefs.getBool('pin_lock');
}
static Future<void> setPinLockOn(bool isLockOn) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setBool('pin_lock', isLockOn);
}
}