Notifications
This commit is contained in:
parent
0ee2c53650
commit
2f2a751cec
|
|
@ -509,6 +509,7 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
|
|||
//return 'Designs: ${company.designs}';
|
||||
//return 'PDF Variables: ${company.settings.pdfVariables}';
|
||||
//return 'Account: ${userCompany.account}';
|
||||
return 'Notifications: ${user.userCompany.notifications} ${uiState.settingsUIState.user.userCompany.notifications}';
|
||||
return 'Layout: ${prefState.appLayout}, Route: ${uiState.currentRoute} Prev: ${uiState.previousRoute}';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,10 @@ UserCompanyEntity loadCompanySuccessReducer(
|
|||
if (userCompany.settings == null) {
|
||||
userCompany = userCompany.rebuild((b) => b
|
||||
..settings.replace(UserSettingsEntity())
|
||||
..notifications.replace(BuiltMap<String, BuiltList<String>>()));
|
||||
..user
|
||||
.userCompany
|
||||
.notifications
|
||||
.replace(BuiltMap<String, BuiltList<String>>()));
|
||||
}
|
||||
|
||||
userCompany = userCompany.rebuild((b) => b.company
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/user_model.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/forms/app_dropdown_button.dart';
|
||||
|
|
@ -8,9 +10,11 @@ import 'package:invoiceninja_flutter/utils/localization.dart';
|
|||
|
||||
class NotificationSettings extends StatelessWidget {
|
||||
const NotificationSettings({
|
||||
@required this.user,
|
||||
@required this.onChanged,
|
||||
});
|
||||
|
||||
final UserEntity user;
|
||||
final Function(String, List<String>) onChanged;
|
||||
|
||||
static const NOTIFY_MINE = 'user';
|
||||
|
|
@ -20,14 +24,15 @@ class NotificationSettings extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print('## build: ${user.userCompany.notifications}');
|
||||
|
||||
final localization = AppLocalization.of(context);
|
||||
final state = StoreProvider.of<AppState>(context).state;
|
||||
final userCompany = state.userCompany;
|
||||
final notifications = userCompany.notifications;
|
||||
final List<String> emailNotifications =
|
||||
final notifications =
|
||||
user.userCompany.notifications ?? BuiltMap<String, BuiltList<String>>();
|
||||
final BuiltList<String> emailNotifications =
|
||||
notifications.containsKey(kNotificationChannelEmail)
|
||||
? notifications[kNotificationChannelEmail]
|
||||
: <String>[];
|
||||
: BuiltList<String>();
|
||||
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@ class _UserDetailsState extends State<UserDetails> {
|
|||
],
|
||||
),
|
||||
NotificationSettings(
|
||||
user: user,
|
||||
onChanged: (channel, options) {
|
||||
print('## NotificationSettings.onChanged: $channel - $options');
|
||||
viewModel.onChanged(user.rebuild((b) =>
|
||||
|
|
|
|||
Loading…
Reference in New Issue