mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: bio auth setting
This commit is contained in:
@@ -586,7 +586,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 585;
|
||||
CURRENT_PROJECT_VERSION = 587;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||
@@ -596,7 +596,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.585;
|
||||
MARKETING_VERSION = 1.0.587;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@@ -720,7 +720,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 585;
|
||||
CURRENT_PROJECT_VERSION = 587;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||
@@ -730,7 +730,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.585;
|
||||
MARKETING_VERSION = 1.0.587;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@@ -748,7 +748,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 585;
|
||||
CURRENT_PROJECT_VERSION = 587;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||
@@ -758,7 +758,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.585;
|
||||
MARKETING_VERSION = 1.0.587;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@@ -779,7 +779,7 @@
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 585;
|
||||
CURRENT_PROJECT_VERSION = 587;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
@@ -792,7 +792,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.585;
|
||||
MARKETING_VERSION = 1.0.587;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
||||
@@ -818,7 +818,7 @@
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 585;
|
||||
CURRENT_PROJECT_VERSION = 587;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
@@ -831,7 +831,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.585;
|
||||
MARKETING_VERSION = 1.0.587;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@@ -854,7 +854,7 @@
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 585;
|
||||
CURRENT_PROJECT_VERSION = 587;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
@@ -867,7 +867,7 @@
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.585;
|
||||
MARKETING_VERSION = 1.0.587;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@@ -890,7 +890,7 @@
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 585;
|
||||
CURRENT_PROJECT_VERSION = 587;
|
||||
DEVELOPMENT_ASSET_PATHS = "";
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
@@ -902,7 +902,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.585;
|
||||
MARKETING_VERSION = 1.0.587;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
|
||||
@@ -931,7 +931,7 @@
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 585;
|
||||
CURRENT_PROJECT_VERSION = 587;
|
||||
DEVELOPMENT_ASSET_PATHS = "";
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
@@ -943,7 +943,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.585;
|
||||
MARKETING_VERSION = 1.0.587;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
|
||||
PRODUCT_NAME = ServerBox;
|
||||
@@ -969,7 +969,7 @@
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 585;
|
||||
CURRENT_PROJECT_VERSION = 587;
|
||||
DEVELOPMENT_ASSET_PATHS = "";
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
@@ -981,7 +981,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.585;
|
||||
MARKETING_VERSION = 1.0.587;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
|
||||
PRODUCT_NAME = ServerBox;
|
||||
|
||||
@@ -6,7 +6,9 @@ import 'package:toolbox/core/extension/context/common.dart';
|
||||
import 'package:toolbox/core/extension/context/dialog.dart';
|
||||
import 'package:toolbox/core/extension/context/locale.dart';
|
||||
import 'package:toolbox/core/extension/context/snackbar.dart';
|
||||
import 'package:toolbox/core/utils/platform/auth.dart';
|
||||
import 'package:toolbox/data/res/store.dart';
|
||||
import 'package:toolbox/view/page/setting/platform_pub.dart';
|
||||
import 'package:toolbox/view/widget/custom_appbar.dart';
|
||||
import 'package:toolbox/view/widget/input_field.dart';
|
||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||
@@ -39,6 +41,8 @@ class _AndroidSettingsPageState extends State<AndroidSettingsPage> {
|
||||
children: [
|
||||
_buildBgRun(),
|
||||
_buildAndroidWidgetSharedPreference(),
|
||||
if (BioAuth.isPlatformSupported)
|
||||
PlatformPublicSettings.buildBioAuth(),
|
||||
].map((e) => RoundRectCard(e)).toList(),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -11,7 +11,6 @@ import 'package:toolbox/core/extension/context/snackbar.dart';
|
||||
import 'package:toolbox/core/extension/locale.dart';
|
||||
import 'package:toolbox/core/extension/context/dialog.dart';
|
||||
import 'package:toolbox/core/extension/stringx.dart';
|
||||
import 'package:toolbox/core/utils/platform/auth.dart';
|
||||
import 'package:toolbox/core/utils/platform/base.dart';
|
||||
import 'package:toolbox/core/utils/rebuild.dart';
|
||||
import 'package:toolbox/data/res/provider.dart';
|
||||
@@ -29,7 +28,6 @@ import '../../../data/res/path.dart';
|
||||
import '../../../data/res/ui.dart';
|
||||
import '../../widget/color_picker.dart';
|
||||
import '../../widget/custom_appbar.dart';
|
||||
import '../../widget/future_widget.dart';
|
||||
import '../../widget/input_field.dart';
|
||||
import '../../widget/round_rect_card.dart';
|
||||
import '../../widget/store_switch.dart';
|
||||
@@ -187,9 +185,6 @@ class _SettingPageState extends State<SettingPage> {
|
||||
//_buildLaunchPage(),
|
||||
_buildCheckUpdate(),
|
||||
];
|
||||
if (BioAuth.isPlatformSupported) {
|
||||
children.add(_buildBioAuth());
|
||||
}
|
||||
|
||||
/// Platform specific settings
|
||||
if (OS.hasSettings) {
|
||||
@@ -1014,47 +1009,6 @@ class _SettingPageState extends State<SettingPage> {
|
||||
// );
|
||||
// }
|
||||
|
||||
Widget _buildBioAuth() {
|
||||
return FutureWidget<bool>(
|
||||
future: BioAuth.isAvail,
|
||||
loading: ListTile(
|
||||
title: Text(l10n.bioAuth),
|
||||
subtitle: Text(l10n.serverTabLoading, style: UIs.textGrey),
|
||||
),
|
||||
error: (e, __) => ListTile(
|
||||
title: Text(l10n.bioAuth),
|
||||
subtitle: Text('${l10n.failed}: $e', style: UIs.textGrey),
|
||||
),
|
||||
success: (can) {
|
||||
return ListTile(
|
||||
title: Text(l10n.bioAuth),
|
||||
subtitle: can
|
||||
? null
|
||||
: const Text('Error: Bio auth is not available',
|
||||
style: UIs.textGrey),
|
||||
trailing: can
|
||||
? StoreSwitch(
|
||||
prop: Stores.setting.useBioAuth,
|
||||
func: (val) async {
|
||||
if (val) {
|
||||
Stores.setting.useBioAuth.put(false);
|
||||
return;
|
||||
}
|
||||
// Only auth when turn off (val == false)
|
||||
final result = await BioAuth.auth(l10n.authRequired);
|
||||
// If failed, turn on again
|
||||
if (result != AuthResult.success) {
|
||||
Stores.setting.useBioAuth.put(true);
|
||||
}
|
||||
},
|
||||
)
|
||||
: null,
|
||||
);
|
||||
},
|
||||
noData: UIs.placeholder,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPlatformSetting() {
|
||||
return ListTile(
|
||||
title: Text('${OS.type} ${l10n.setting}'),
|
||||
|
||||
@@ -6,10 +6,12 @@ import 'package:toolbox/core/extension/context/locale.dart';
|
||||
import 'package:toolbox/core/extension/context/snackbar.dart';
|
||||
import 'package:toolbox/core/route.dart';
|
||||
import 'package:toolbox/core/utils/misc.dart';
|
||||
import 'package:toolbox/core/utils/platform/auth.dart';
|
||||
import 'package:toolbox/data/res/logger.dart';
|
||||
import 'package:toolbox/data/res/misc.dart';
|
||||
import 'package:toolbox/data/res/store.dart';
|
||||
import 'package:toolbox/data/res/ui.dart';
|
||||
import 'package:toolbox/view/page/setting/platform_pub.dart';
|
||||
import 'package:toolbox/view/widget/custom_appbar.dart';
|
||||
import 'package:toolbox/view/widget/future_widget.dart';
|
||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||
@@ -40,6 +42,8 @@ class _IOSSettingsPageState extends State<IOSSettingsPage> {
|
||||
_buildPushToken(),
|
||||
_buildAutoUpdateHomeWidget(),
|
||||
_buildWatchApp(),
|
||||
if (BioAuth.isPlatformSupported)
|
||||
PlatformPublicSettings.buildBioAuth(),
|
||||
].map((e) => RoundRectCard(e)).toList(),
|
||||
),
|
||||
);
|
||||
|
||||
52
lib/view/page/setting/platform_pub.dart
Normal file
52
lib/view/page/setting/platform_pub.dart
Normal file
@@ -0,0 +1,52 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:toolbox/core/extension/context/locale.dart';
|
||||
import 'package:toolbox/core/utils/platform/auth.dart';
|
||||
import 'package:toolbox/data/res/store.dart';
|
||||
import 'package:toolbox/data/res/ui.dart';
|
||||
import 'package:toolbox/view/widget/future_widget.dart';
|
||||
import 'package:toolbox/view/widget/store_switch.dart';
|
||||
|
||||
class PlatformPublicSettings {
|
||||
static Widget buildBioAuth() {
|
||||
return FutureWidget<bool>(
|
||||
future: BioAuth.isAvail,
|
||||
loading: ListTile(
|
||||
title: Text(l10n.bioAuth),
|
||||
subtitle: Text(l10n.serverTabLoading, style: UIs.textGrey),
|
||||
),
|
||||
error: (e, __) => ListTile(
|
||||
title: Text(l10n.bioAuth),
|
||||
subtitle: Text('${l10n.failed}: $e', style: UIs.textGrey),
|
||||
),
|
||||
success: (can) {
|
||||
return can
|
||||
? ListTile(
|
||||
title: Text(l10n.bioAuth),
|
||||
subtitle: can
|
||||
? null
|
||||
: const Text('Error: Bio auth is not available',
|
||||
style: UIs.textGrey),
|
||||
trailing: can
|
||||
? StoreSwitch(
|
||||
prop: Stores.setting.useBioAuth,
|
||||
func: (val) async {
|
||||
if (val) {
|
||||
Stores.setting.useBioAuth.put(false);
|
||||
return;
|
||||
}
|
||||
// Only auth when turn off (val == false)
|
||||
final result = await BioAuth.auth(l10n.authRequired);
|
||||
// If failed, turn on again
|
||||
if (result != AuthResult.success) {
|
||||
Stores.setting.useBioAuth.put(true);
|
||||
}
|
||||
},
|
||||
)
|
||||
: null,
|
||||
)
|
||||
: UIs.placeholder;
|
||||
},
|
||||
noData: UIs.placeholder,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -476,9 +476,9 @@
|
||||
baseConfigurationReference = C1C758C41C4E208965A68933 /* Pods-RunnerTests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CURRENT_PROJECT_VERSION = 585;
|
||||
CURRENT_PROJECT_VERSION = 587;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0.585;
|
||||
MARKETING_VERSION = 1.0.587;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
@@ -491,9 +491,9 @@
|
||||
baseConfigurationReference = 15AF97DF993E8968098D6EBE /* Pods-RunnerTests.release.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CURRENT_PROJECT_VERSION = 585;
|
||||
CURRENT_PROJECT_VERSION = 587;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0.585;
|
||||
MARKETING_VERSION = 1.0.587;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
@@ -506,9 +506,9 @@
|
||||
baseConfigurationReference = 7CFA7DE7FABA75685DFB6948 /* Pods-RunnerTests.profile.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CURRENT_PROJECT_VERSION = 585;
|
||||
CURRENT_PROJECT_VERSION = 587;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0.585;
|
||||
MARKETING_VERSION = 1.0.587;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
|
||||
16
make.dart
16
make.dart
@@ -10,7 +10,7 @@ const buildDataFilePath = 'lib/data/res/build_data.dart';
|
||||
const apkPath = 'build/app/outputs/flutter-apk/app-release.apk';
|
||||
const appleXCConfigPath = 'Runner.xcodeproj/project.pbxproj';
|
||||
const macOSArchievePath = 'build/macos/Build/Products/Release/server_box.app';
|
||||
const releaseDir = 'release';
|
||||
const releaseDir = '/Volumes/pm981/release/serverbox';
|
||||
|
||||
var regAppleProjectVer = RegExp(r'CURRENT_PROJECT_VERSION = .+;');
|
||||
var regAppleMarketVer = RegExp(r'MARKETING_VERSION = .+');
|
||||
@@ -18,8 +18,9 @@ var regAppleMarketVer = RegExp(r'MARKETING_VERSION = .+');
|
||||
const buildFuncs = {
|
||||
'ios': flutterBuildIOS,
|
||||
'android': flutterBuildAndroid,
|
||||
'macos': flutterBuildMacOS,
|
||||
'mac': flutterBuildMacOS,
|
||||
'linux': flutterBuildLinux,
|
||||
'win': flutterBuildWin,
|
||||
};
|
||||
|
||||
int? build;
|
||||
@@ -122,11 +123,9 @@ Future<void> flutterBuild(String buildType) async {
|
||||
args.add('--bundle-sksl-path=$skslPath');
|
||||
}
|
||||
final isAndroid = 'apk' == buildType;
|
||||
// [--target-platform] only for Android
|
||||
if (isAndroid) {
|
||||
args.addAll([
|
||||
'--target-platform=android-arm64',
|
||||
]);
|
||||
// Only arm64
|
||||
args.add('--target-platform=android-arm64');
|
||||
}
|
||||
print('\n[$buildType]\nBuilding with args: ${args.join(' ')}');
|
||||
final buildResult = await Process.run('flutter', args);
|
||||
@@ -160,6 +159,11 @@ Future<void> flutterBuildLinux() async {
|
||||
await scpLinux2CDN();
|
||||
}
|
||||
|
||||
Future<void> flutterBuildWin() async {
|
||||
await flutterBuild('windows');
|
||||
//await scpWindows2CDN();
|
||||
}
|
||||
|
||||
Future<void> scpApk2CDN() async {
|
||||
final sha256 = await getFileSha256(apkPath);
|
||||
print('SHA256: $sha256');
|
||||
|
||||
Reference in New Issue
Block a user