rework privacy page
This commit is contained in:
parent
385526fa82
commit
110ad64d55
|
@ -1264,7 +1264,7 @@ class _GamePageState extends State<GamePage>
|
||||||
|
|
||||||
Future<void> _showPrivacyDialog() async {
|
Future<void> _showPrivacyDialog() async {
|
||||||
if (!LocalDatabaseService.preferences.isPrivacyPolicyAccepted &&
|
if (!LocalDatabaseService.preferences.isPrivacyPolicyAccepted &&
|
||||||
Localizations.localeOf(context).languageCode == "zh") {
|
Localizations.localeOf(context).languageCode.startsWith("zh_")) {
|
||||||
await showPrivacyDialog(context);
|
await showPrivacyDialog(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1288,11 +1288,11 @@ class _GamePageState extends State<GamePage>
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
|
|
||||||
_showPrivacyDialog();
|
|
||||||
|
|
||||||
screenPaddingH = _screenPaddingH;
|
screenPaddingH = _screenPaddingH;
|
||||||
ltr = Directionality.of(context) == TextDirection.ltr;
|
ltr = Directionality.of(context) == TextDirection.ltr;
|
||||||
_tip = S.of(context).welcome;
|
_tip = S.of(context).welcome;
|
||||||
|
|
||||||
|
_showPrivacyDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:devicelocale/devicelocale.dart';
|
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
@ -40,29 +39,16 @@ class _LinkTextSpan extends TextSpan {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> showPrivacyDialog(
|
Future<void> showPrivacyDialog(BuildContext context) async {
|
||||||
BuildContext context,
|
assert(Localizations.localeOf(context).languageCode.startsWith("zh_"));
|
||||||
) async {
|
|
||||||
final ThemeData themeData = Theme.of(context);
|
final ThemeData themeData = Theme.of(context);
|
||||||
final TextStyle? aboutTextStyle = themeData.textTheme.bodyText1;
|
final TextStyle aboutTextStyle = themeData.textTheme.bodyText1!;
|
||||||
final TextStyle linkStyle = themeData.textTheme.bodyText1!
|
final TextStyle linkStyle =
|
||||||
.copyWith(color: themeData.colorScheme.secondary);
|
aboutTextStyle.copyWith(color: themeData.colorScheme.secondary);
|
||||||
|
|
||||||
String? locale = "en_US";
|
const String eulaURL = Constants.giteeEulaURL;
|
||||||
late String eulaURL;
|
const String privacyPolicyURL = Constants.giteePrivacyPolicyURL;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _setPrivacyPolicyAccepted({required bool value}) async {
|
Future<void> _setPrivacyPolicyAccepted({required bool value}) async {
|
||||||
LocalDatabaseService.preferences = LocalDatabaseService.preferences
|
LocalDatabaseService.preferences = LocalDatabaseService.preferences
|
||||||
|
|
Loading…
Reference in New Issue