调整隐私政策和用户协议

This commit is contained in:
1147192855@qq.com 2024-04-17 10:54:53 +08:00
parent 1494e69b56
commit 8b4f38558f
5 changed files with 171 additions and 27 deletions

View File

@ -72,7 +72,7 @@ class _TheLoginState extends ConsumerState<TheLogin> with CommonMixin {
@override @override
void initState() { void initState() {
Future.delayed(Duration(seconds: 3), () => sysProtocol(context)); Future.delayed(Duration(seconds: 2), () => sysProtocol(context));
Future(() { Future(() {
// Provider // Provider
ref.read(userTokenProvider.notifier).clean(); // ref.read(userTokenProvider.notifier).clean(); //

View File

@ -27,7 +27,6 @@ import 'package:marking_app/pages/marking/index.dart';
import 'package:marking_app/provider/user_provider.dart'; import 'package:marking_app/provider/user_provider.dart';
import 'package:marking_app/utils/index.dart'; import 'package:marking_app/utils/index.dart';
import 'package:marking_app/utils/request/rest_client.dart'; import 'package:marking_app/utils/request/rest_client.dart';
import 'package:marking_app/utils/sys_protocol.dart';
import 'package:package_info/package_info.dart'; import 'package:package_info/package_info.dart';
import 'homework_correction/job_home.dart'; import 'homework_correction/job_home.dart';
@ -70,7 +69,6 @@ class TheMainPageState extends ConsumerState<TheMainPage> with CommonMixin {
void initState() { void initState() {
_pageController = PageController(initialPage: tabIndex); _pageController = PageController(initialPage: tabIndex);
_otherFocusNode = FocusNode(); _otherFocusNode = FocusNode();
Future.delayed(Duration(seconds: 1), () => sysProtocol(context));
// APP升级校验在登录后 // APP升级校验在登录后
_userListener = ref.read(userProvider.notifier).addListener((state) { _userListener = ref.read(userProvider.notifier).addListener((state) {
if (state.id != '0' && state.id != '') { if (state.id != '0' && state.id != '') {

File diff suppressed because one or more lines are too long

View File

@ -41,6 +41,7 @@ class FastData {
static const String _INPUT_KEYBOARD_GUIDE_PAGE_WORK = "APP:MARKING:GUIDE_PAGE:WORK"; static const String _INPUT_KEYBOARD_GUIDE_PAGE_WORK = "APP:MARKING:GUIDE_PAGE:WORK";
// //
static const String _SYS_PROTOCOL = "APP:SYS:PROTOCOL"; static const String _SYS_PROTOCOL = "APP:SYS:PROTOCOL";
static const String _SYS_PROTOCOL_SHOW = "APP:SYS:PROTOCOL_SHOW";
static SharedPreferences? _prefs; static SharedPreferences? _prefs;
@ -286,4 +287,19 @@ class FastData {
SharedPreferences thePrefs = await getSharedInstance(); SharedPreferences thePrefs = await getSharedInstance();
thePrefs.remove(_SYS_PROTOCOL); thePrefs.remove(_SYS_PROTOCOL);
} }
Future<bool> setSysProtocolShow(bool val) async {
SharedPreferences thePrefs = await getSharedInstance();
return await thePrefs.setBool(_SYS_PROTOCOL_SHOW, val);
}
Future<bool?> getSysProtocolShow([SharedPreferences? thePrefs]) async {
if (thePrefs == null) thePrefs = await getSharedInstance();
return thePrefs.getBool(_SYS_PROTOCOL_SHOW);
}
void cleanSysProtocolShow() async {
SharedPreferences thePrefs = await getSharedInstance();
thePrefs.remove(_SYS_PROTOCOL_SHOW);
}
} }

View File

@ -74,6 +74,7 @@ class Protocol extends Dialog {
], ],
), ),
), ),
SizedBox(height: 10.h),
Row( Row(
children: [ children: [
Expanded( Expanded(
@ -122,17 +123,25 @@ class Protocol extends Dialog {
} }
/// ///
void sysProtocol(BuildContext context) async { Future<void> sysProtocol(BuildContext context) async {
bool? _sysProtocol = await FastData.getInstance().getSysProtocol(); bool? _sysProtocol = await FastData.getInstance().getSysProtocol();
if (_sysProtocol == null || !_sysProtocol) { if (_sysProtocol == null || !_sysProtocol) {
print('进来这里....'); print('进来这里....');
bool? _sysProtocolShow = await FastData.getInstance().getSysProtocolShow();
showDialog( if (_sysProtocolShow != true) {
context: context, try {
barrierDismissible: false, await FastData.getInstance().setSysProtocolShow(true);
builder: (ctx) { return showDialog(
return Protocol(ctx); context: context,
}, barrierDismissible: false,
); // useRootNavigator: false,
builder: (ctx) => Protocol(ctx),
);
} catch (e) {
FastData.getInstance().cleanSysProtocol();
} finally {
FastData.getInstance().cleanSysProtocolShow();
}
}
} }
} }