Skip to content

Commit

Permalink
Fix missing quick unlock settings in ios
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyrat committed Dec 16, 2022
1 parent 18edbf3 commit 6691865
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/flutter_release_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
release:
types: [published]

#TODO: Use ${{ github.event.release.tag_name }} to only publish if tag name contains "-android" or contains no "-"
jobs:
setupAndTestAndroid:
name: Build and release Google play to beta channel
if: ${{ !contains (github.event.release.tag_name, '_' ) || endsWith( github.event.release.tag_name, '_android' ) }}

runs-on: ubuntu-latest

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/flutter_release_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ name: Flutter release ios
on:
release:
types: [published]
#TODO: Use ${{ github.event.release.tag_name }} to only publish if tag name contains "-ios" or contains no "-"
jobs:
DeployIosBetaAdhoc:
name: Build and release beta adhoc
if: ${{ !contains ( github.event.release.tag_name, '_' ) || endsWith( github.event.release.tag_name, '_ios' ) }}
# NB: ${{ syntax }} is required despite GitHub docs to the contrary. Appears that ! operator can't be used otherwise.

runs-on: macos-12

Expand Down Expand Up @@ -66,6 +67,7 @@ jobs:
DeployIosProdTestflight:
name: Build and release prod testflight
if: ${{ !contains ( github.event.release.tag_name, '_' ) || endsWith( github.event.release.tag_name, '_ios' ) }}

runs-on: macos-12

Expand Down
106 changes: 54 additions & 52 deletions lib/widgets/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,58 @@ class _BiometricSettingWidgetState extends State<BiometricSettingWidget> {
@override
Widget build(BuildContext context) {
final str = S.of(context);
final quickUnlockSettings = [
TextInputSettingsTile(
title: str.automaticallySignInFor,
settingKey: 'authGracePeriod',
initialValue: '60',
keyboardType: TextInputType.number,
validator: (String? gracePeriod) {
if (gracePeriod != null) {
final number = int.tryParse(gracePeriod);
if (number != null && number >= 1 && number <= 3600) {
return null;
}
}
return str.enterNumberBetweenXAndY(1, 3600);
},
onChange: (_) async {
final vaultCubit = BlocProvider.of<VaultCubit>(context);
await vaultCubit.disableQuickUnlock();
final user = BlocProvider.of<AccountCubit>(context).currentUserIfKnown;
await vaultCubit.enableQuickUnlock(
user,
vaultCubit.currentVaultFile?.files.current,
);
},
autovalidateMode: AutovalidateMode.always,
),
TextInputSettingsTile(
title: str.requireFullPasswordEvery,
settingKey: 'requireFullPasswordPeriod',
initialValue: '60',
keyboardType: TextInputType.number,
validator: (String? requireFullPasswordPeriod) {
if (requireFullPasswordPeriod != null) {
final number = int.tryParse(requireFullPasswordPeriod);
if (number != null && number >= 1 && number <= 180) {
return null;
}
}
return str.enterNumberBetweenXAndY(1, 180);
},
onChange: (_) async {
final vaultCubit = BlocProvider.of<VaultCubit>(context);
await vaultCubit.disableQuickUnlock();
final user = BlocProvider.of<AccountCubit>(context).currentUserIfKnown;
await vaultCubit.enableQuickUnlock(
user,
vaultCubit.currentVaultFile?.files.current,
);
},
autovalidateMode: AutovalidateMode.always,
),
];
return Column(children: [
Padding(
padding: const EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 16.0),
Expand All @@ -217,6 +269,7 @@ class _BiometricSettingWidgetState extends State<BiometricSettingWidget> {
child: Text(str.quickSignInExplainer(KeeVaultPlatform.isIOS ? 'Passcode' : 'PIN'))),
Visibility(
visible: !KeeVaultPlatform.isIOS,
replacement: Column(children: quickUnlockSettings),
child: SwitchSettingsTile(
settingKey: 'biometrics-enabled',
title: str.biometricSignIn,
Expand All @@ -238,58 +291,7 @@ class _BiometricSettingWidgetState extends State<BiometricSettingWidget> {
},
enabled: widget.isEnabledOnDevice,
defaultValue: true,
childrenIfEnabled: [
TextInputSettingsTile(
title: str.automaticallySignInFor,
settingKey: 'authGracePeriod',
initialValue: '60',
keyboardType: TextInputType.number,
validator: (String? gracePeriod) {
if (gracePeriod != null) {
final number = int.tryParse(gracePeriod);
if (number != null && number >= 1 && number <= 3600) {
return null;
}
}
return str.enterNumberBetweenXAndY(1, 3600);
},
onChange: (_) async {
final vaultCubit = BlocProvider.of<VaultCubit>(context);
await vaultCubit.disableQuickUnlock();
final user = BlocProvider.of<AccountCubit>(context).currentUserIfKnown;
await vaultCubit.enableQuickUnlock(
user,
vaultCubit.currentVaultFile?.files.current,
);
},
autovalidateMode: AutovalidateMode.always,
),
TextInputSettingsTile(
title: str.requireFullPasswordEvery,
settingKey: 'requireFullPasswordPeriod',
initialValue: '60',
keyboardType: TextInputType.number,
validator: (String? requireFullPasswordPeriod) {
if (requireFullPasswordPeriod != null) {
final number = int.tryParse(requireFullPasswordPeriod);
if (number != null && number >= 1 && number <= 180) {
return null;
}
}
return str.enterNumberBetweenXAndY(1, 180);
},
onChange: (_) async {
final vaultCubit = BlocProvider.of<VaultCubit>(context);
await vaultCubit.disableQuickUnlock();
final user = BlocProvider.of<AccountCubit>(context).currentUserIfKnown;
await vaultCubit.enableQuickUnlock(
user,
vaultCubit.currentVaultFile?.files.current,
);
},
autovalidateMode: AutovalidateMode.always,
),
],
childrenIfEnabled: quickUnlockSettings,
),
),
]),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.16+40
version: 1.0.17+41

environment:
sdk: '>=2.18.0 <3.0.0'
Expand Down

0 comments on commit 6691865

Please sign in to comment.