rework privacy page

This commit is contained in:
Leptopoda-GitHub 2021-11-22 14:15:37 +01:00
parent 385526fa82
commit 110ad64d55
No known key found for this signature in database
GPG Key ID: 661B059EDE309F11
2 changed files with 11 additions and 25 deletions

View File

@ -1264,7 +1264,7 @@ class _GamePageState extends State<GamePage>
Future<void> _showPrivacyDialog() async {
if (!LocalDatabaseService.preferences.isPrivacyPolicyAccepted &&
Localizations.localeOf(context).languageCode == "zh") {
Localizations.localeOf(context).languageCode.startsWith("zh_")) {
await showPrivacyDialog(context);
}
}
@ -1288,11 +1288,11 @@ class _GamePageState extends State<GamePage>
void didChangeDependencies() {
super.didChangeDependencies();
_showPrivacyDialog();
screenPaddingH = _screenPaddingH;
ltr = Directionality.of(context) == TextDirection.ltr;
_tip = S.of(context).welcome;
_showPrivacyDialog();
}
@override

View File

@ -18,7 +18,6 @@
import 'dart:io';
import 'package:devicelocale/devicelocale.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -40,29 +39,16 @@ class _LinkTextSpan extends TextSpan {
);
}
Future<void> showPrivacyDialog(
BuildContext context,
) async {
Future<void> showPrivacyDialog(BuildContext context) async {
assert(Localizations.localeOf(context).languageCode.startsWith("zh_"));
final ThemeData themeData = Theme.of(context);
final TextStyle? aboutTextStyle = themeData.textTheme.bodyText1;
final TextStyle linkStyle = themeData.textTheme.bodyText1!
.copyWith(color: themeData.colorScheme.secondary);
final TextStyle aboutTextStyle = themeData.textTheme.bodyText1!;
final TextStyle linkStyle =
aboutTextStyle.copyWith(color: themeData.colorScheme.secondary);
String? locale = "en_US";
late String eulaURL;
late String privacyPolicyURL;
if (!Platform.isWindows) {
locale = await Devicelocale.currentLocale;
}
debugPrint("[about] local = $locale");
if (locale != null && locale.startsWith("zh_")) {
eulaURL = Constants.giteeEulaURL;
privacyPolicyURL = Constants.giteePrivacyPolicyURL;
} else {
eulaURL = Constants.githubEulaURL;
privacyPolicyURL = Constants.githubPrivacyPolicyURL;
}
const String eulaURL = Constants.giteeEulaURL;
const String privacyPolicyURL = Constants.giteePrivacyPolicyURL;
Future<void> _setPrivacyPolicyAccepted({required bool value}) async {
LocalDatabaseService.preferences = LocalDatabaseService.preferences