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