|
| 1 | +import 'package:flutter/foundation.dart'; |
1 | 2 | import 'package:flutter/material.dart';
|
2 | 3 | import 'package:heroicons/heroicons.dart';
|
3 | 4 | import 'package:hooks_riverpod/hooks_riverpod.dart';
|
@@ -124,16 +125,28 @@ class ConfirmButton extends ConsumerWidget {
|
124 | 125 | );
|
125 | 126 | return;
|
126 | 127 | }
|
127 |
| - final bool didAuthenticate = await auth.authenticate( |
128 |
| - localizedReason: 'Veuillez vous authentifier pour payer', |
129 |
| - authMessages: [ |
130 |
| - const AndroidAuthMessages( |
131 |
| - signInTitle: 'L\'authentification est requise pour payer', |
132 |
| - cancelButton: 'Non merci', |
133 |
| - ), |
134 |
| - const IOSAuthMessages(cancelButton: 'Non merci'), |
135 |
| - ], |
136 |
| - ); |
| 128 | + late bool didAuthenticate; |
| 129 | + try { |
| 130 | + didAuthenticate = await auth.authenticate( |
| 131 | + localizedReason: 'Veuillez vous authentifier pour payer', |
| 132 | + authMessages: [ |
| 133 | + const AndroidAuthMessages( |
| 134 | + signInTitle: 'L\'authentification est requise pour payer', |
| 135 | + cancelButton: 'Non merci', |
| 136 | + ), |
| 137 | + const IOSAuthMessages(cancelButton: 'Non merci'), |
| 138 | + ], |
| 139 | + ); |
| 140 | + } catch (e) { |
| 141 | + if (kDebugMode) { |
| 142 | + debugPrint('Authentication failed with error : $e'); |
| 143 | + } |
| 144 | + displayToastWithContext( |
| 145 | + TypeMsg.error, |
| 146 | + 'Erreur lors de l\'authentification', |
| 147 | + ); |
| 148 | + return; |
| 149 | + } |
137 | 150 | if (!didAuthenticate) {
|
138 | 151 | displayToastWithContext(
|
139 | 152 | TypeMsg.error,
|
|
0 commit comments