Skip to content

Commit

Permalink
Customization - Enable/Disable vibrations #130 / fix null pointerExce…
Browse files Browse the repository at this point in the history
…ption
  • Loading branch information
redDwarf03 committed Jun 23, 2022
1 parent b41c710 commit 489f14b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import 'package:aeuniverse/ui/views/authenticate/yubikey_screen.dart';
class AuthFactory {
static Future<bool> authenticate(
BuildContext context, AuthenticationMethod authMethod,
{bool transitions = false}) async {
{bool transitions = false, bool activeVibrations = false}) async {
bool auth = false;
switch (authMethod.method) {
case (AuthMethod.yubikeyWithYubicloud):
Expand All @@ -47,11 +47,9 @@ class AuthFactory {
break;
}
if (auth) {
sl.get<HapticUtil>().feedback(
FeedbackType.success, StateContainer.of(context).activeVibrations);
sl.get<HapticUtil>().feedback(FeedbackType.success, activeVibrations);
} else {
sl.get<HapticUtil>().feedback(
FeedbackType.error, StateContainer.of(context).activeVibrations);
sl.get<HapticUtil>().feedback(FeedbackType.error, activeVibrations);
}
return auth;
}
Expand Down
5 changes: 2 additions & 3 deletions packages/aeuniverse/lib/ui/views/settings/set_yubikey.dart
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,8 @@ class _SetYubikeyState extends State<SetYubikey> {
_vault.setYubikeyClientID(_clientIDController!.text);

bool auth = await AuthFactory.authenticate(
context,
AuthenticationMethod(AuthMethod.yubikeyWithYubicloud),
);
context, AuthenticationMethod(AuthMethod.yubikeyWithYubicloud),
activeVibrations: StateContainer.of(context).activeVibrations);
if (auth) {
final Preferences _preferences = await Preferences.getInstance();
_preferences.setAuthMethod(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -719,8 +719,10 @@ class _SettingsSheetWalletMobileState extends State<SettingsSheetWalletMobile>
final AuthenticationMethod authMethod =
preferences.getAuthMethod();

bool auth =
await AuthFactory.authenticate(context, authMethod);
bool auth = await AuthFactory.authenticate(
context, authMethod,
activeVibrations:
StateContainer.of(context).activeVibrations);
if (auth) {
StateContainer.of(context)
.getSeed()
Expand Down
6 changes: 4 additions & 2 deletions packages/aewallet/lib/ui/views/nft/add_nft_confirm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,10 @@ class _AddNFTConfirmState extends State<AddNFTConfirm> {
await Preferences.getInstance();
final AuthenticationMethod authMethod =
preferences.getAuthMethod();
bool auth =
await AuthFactory.authenticate(context, authMethod);
bool auth = await AuthFactory.authenticate(
context, authMethod,
activeVibrations:
StateContainer.of(context).activeVibrations);
if (auth) {
EventTaxiImpl.singleton()
.fire(AuthenticatedEvent(AUTH_EVENT_TYPE.send));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,10 @@ class _TransferConfirmSheetState extends State<TransferConfirmSheet> {
// Authenticate
final AuthenticationMethod authMethod =
preferences.getAuthMethod();
bool auth =
await AuthFactory.authenticate(context, authMethod);
bool auth = await AuthFactory.authenticate(
context, authMethod,
activeVibrations:
StateContainer.of(context).activeVibrations);
if (auth) {
EventTaxiImpl.singleton()
.fire(AuthenticatedEvent(AUTH_EVENT_TYPE.send));
Expand Down

0 comments on commit 489f14b

Please sign in to comment.