Implement reactivate email API call
This commit is contained in:
parent
d7713a9c68
commit
fc24804211
|
|
@ -6,6 +6,8 @@ import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
|||
|
||||
// Project imports:
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/data/web_client.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/help_text.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/icon_text.dart';
|
||||
|
|
@ -134,6 +136,7 @@ class _ContactListTile extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
final localization = AppLocalization.of(context)!;
|
||||
final store = StoreProvider.of<AppState>(context);
|
||||
final state = store.state;
|
||||
|
||||
/*
|
||||
final invitationButton = (invitation?.link ?? '').isNotEmpty
|
||||
|
|
@ -168,13 +171,6 @@ class _ContactListTile extends StatelessWidget {
|
|||
),
|
||||
value: localization.copyLink,
|
||||
),
|
||||
PopupMenuItem<String>(
|
||||
child: IconText(
|
||||
text: localization.reactivateEmail,
|
||||
icon: Icons.check_circle,
|
||||
),
|
||||
value: localization.reactivateEmail,
|
||||
),
|
||||
];
|
||||
},
|
||||
onSelected: (String action) {
|
||||
|
|
@ -216,7 +212,7 @@ class _ContactListTile extends StatelessWidget {
|
|||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
fullName.isNotEmpty
|
||||
|
|
@ -245,14 +241,30 @@ class _ContactListTile extends StatelessWidget {
|
|||
),
|
||||
if ((invitation?.emailError ?? '').isNotEmpty &&
|
||||
invitation?.emailStatus !=
|
||||
InvitationEntity.EMAIL_STATUS_DELIVERED)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: Text(
|
||||
invitation!.emailError,
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
InvitationEntity.EMAIL_STATUS_DELIVERED) ...[
|
||||
SizedBox(height: 16),
|
||||
OutlinedButton(
|
||||
onPressed: () {
|
||||
final credentials = state.credentials;
|
||||
store.dispatch(StartSaving());
|
||||
WebClient()
|
||||
.post(
|
||||
'${credentials.url}/reactivate_email/${invitation!.messageId}',
|
||||
credentials.token)
|
||||
.then((value) {
|
||||
store.dispatch(StopSaving());
|
||||
showToast(localization.emailReactivated);
|
||||
}).catchError((error) {
|
||||
store.dispatch(StopSaving());
|
||||
});
|
||||
},
|
||||
child: Text(localization.reactivateEmail)),
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
invitation!.emailError,
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
],
|
||||
SizedBox(height: 8),
|
||||
],
|
||||
],
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
'en': {
|
||||
// STARTER: lang key - do not remove comment
|
||||
'reactivate_email': 'Reactivate Email',
|
||||
'email_reactivated': 'Successfully reactivated email',
|
||||
'template_help': 'Enable using the design as a template',
|
||||
'delivery_note_design': 'Delivery Note Design',
|
||||
'statement_design': 'Statement Design',
|
||||
|
|
@ -109975,6 +109976,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
_localizedValues[localeCode]!['reactivate_email'] ??
|
||||
_localizedValues['en']!['reactivate_email']!;
|
||||
|
||||
String get emailReactivated =>
|
||||
_localizedValues[localeCode]!['email_reactivated'] ??
|
||||
_localizedValues['en']!['email_reactivated']!;
|
||||
|
||||
// STARTER: lang field - do not remove comment
|
||||
|
||||
String lookup(String? key) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue