From 139fc8e7d3bfec3387956afff1fa773afe9e7f38 Mon Sep 17 00:00:00 2001 From: Sai Naw Wun Date: Sun, 20 Sep 2020 08:06:14 +0630 Subject: [PATCH] add sigin notification --- .gitignore | 3 +++ lib/fcs/common/domain/constants.dart | 1 + lib/fcs/common/pages/chat/message_detail.dart | 20 +++++++++++++++++++ .../pages/customer/customer_editor.dart | 10 +++++----- lib/fcs/common/pages/home_page.dart | 10 ---------- lib/fcs/common/pages/model/main_model.dart | 1 + .../common/pages/profile/profile_page.dart | 5 +++++ lib/main-prod.dart | 10 ++++------ 8 files changed, 39 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 734f9d4..2adc0e1 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,6 @@ app.*.map.json !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages android/key.properties android/key.jks +android/app/src/prod/AndroidManifest.xml +android/app/src/prod/google-services.json +android/app/src/prod/res/values/strings.xml diff --git a/lib/fcs/common/domain/constants.dart b/lib/fcs/common/domain/constants.dart index 2c66e1f..be1bc62 100644 --- a/lib/fcs/common/domain/constants.dart +++ b/lib/fcs/common/domain/constants.dart @@ -18,6 +18,7 @@ const page_buying_instructions = "buying_instructions"; // Message type const message_type_package = "t_p"; +const message_type_profile = "t_profile"; ////////////////////////////// diff --git a/lib/fcs/common/pages/chat/message_detail.dart b/lib/fcs/common/pages/chat/message_detail.dart index 50e31ff..74e9c76 100644 --- a/lib/fcs/common/pages/chat/message_detail.dart +++ b/lib/fcs/common/pages/chat/message_detail.dart @@ -1,10 +1,15 @@ import 'package:fcs/fcs/common/domain/constants.dart'; import 'package:fcs/fcs/common/domain/entities/package.dart'; +import 'package:fcs/fcs/common/domain/entities/user.dart'; import 'package:fcs/fcs/common/domain/vo/message.dart'; import 'package:fcs/fcs/common/helpers/theme.dart'; import 'package:fcs/fcs/common/pages/chat/model/message_model.dart'; +import 'package:fcs/fcs/common/pages/customer/customer_editor.dart'; +import 'package:fcs/fcs/common/pages/customer/model/customer_model.dart'; +import 'package:fcs/fcs/common/pages/model/main_model.dart'; import 'package:fcs/fcs/common/pages/package/model/package_model.dart'; import 'package:fcs/fcs/common/pages/package/package_info.dart'; +import 'package:fcs/fcs/common/pages/profile/profile_page.dart'; import 'package:fcs/fcs/common/pages/util.dart'; import 'package:fcs/fcs/common/pages/widgets/bottom_up_page_route.dart'; import 'package:flutter/material.dart'; @@ -168,5 +173,20 @@ class MessageDetail extends StatelessWidget { Package p = await packageModel.getPackage(message.messageID); Navigator.push(context, BottomUpPageRoute(PackageInfo(package: p))); } + if (message.messageType == message_type_profile && + message.messageID != null && + message.messageID != "") { + MainModel mainModel = Provider.of(context, listen: false); + + if (mainModel.user.isCustomer()) { + Navigator.push(context, BottomUpPageRoute(Profile())); + } else { + CustomerModel customerModel = + Provider.of(context, listen: false); + User user = await customerModel.getUser(message.messageID); + Navigator.of(context) + .push(BottomUpPageRoute(CustomerEditor(customer: user))); + } + } } } diff --git a/lib/fcs/common/pages/customer/customer_editor.dart b/lib/fcs/common/pages/customer/customer_editor.dart index b62fcc6..3e7d271 100644 --- a/lib/fcs/common/pages/customer/customer_editor.dart +++ b/lib/fcs/common/pages/customer/customer_editor.dart @@ -70,16 +70,16 @@ class _CustomerEditorState extends State { child: ListView( children: [ phoneNumberBox, - DisplayText( - text: widget.customer.status, - labelText: getLocalString(context, "customer.status"), - iconData: Icons.add_alarm, - ), DisplayText( text: widget.customer.fcsID, labelText: getLocalString(context, "customer.fcs.id"), icon: FcsIDIcon(), ), + DisplayText( + text: widget.customer.status, + labelText: getLocalString(context, "customer.status"), + iconData: Icons.add_alarm, + ), SizedBox( height: 20, ), diff --git a/lib/fcs/common/pages/home_page.dart b/lib/fcs/common/pages/home_page.dart index 71696cc..9474028 100644 --- a/lib/fcs/common/pages/home_page.dart +++ b/lib/fcs/common/pages/home_page.dart @@ -421,16 +421,6 @@ class _HomePageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - user.requested - ? Container( - padding: const EdgeInsets.all(8.0), - child: Text( - getLocalString( - context, "home.invitation.request.msg"), - style: TextStyle(color: Colors.white70), - ), - ) - : Container(), Expanded( child: ListView(children: [ Wrap( diff --git a/lib/fcs/common/pages/model/main_model.dart b/lib/fcs/common/pages/model/main_model.dart index 3d5ca67..2e9a30d 100644 --- a/lib/fcs/common/pages/model/main_model.dart +++ b/lib/fcs/common/pages/model/main_model.dart @@ -171,6 +171,7 @@ class MainModel extends ChangeNotifier { if (authResult != null && authResult.authStatus == AuthStatus.AUTH_VERIFIED) { this.user = await Services.instance.authService.getUser(); + uploadMsgToken(); } return authResult; } diff --git a/lib/fcs/common/pages/profile/profile_page.dart b/lib/fcs/common/pages/profile/profile_page.dart index 8071d1c..22eaf59 100644 --- a/lib/fcs/common/pages/profile/profile_page.dart +++ b/lib/fcs/common/pages/profile/profile_page.dart @@ -157,6 +157,11 @@ class _ProfileState extends State { phonenumberbox, fcsIDBox, usaShippingAddressBox, + DisplayText( + text: mainModel.user.status, + labelText: getLocalString(context, "customer.status"), + iconData: Icons.add_alarm, + ), // getShippingAddressList(context), ], ), diff --git a/lib/main-prod.dart b/lib/main-prod.dart index 34ef854..fd9fc07 100644 --- a/lib/main-prod.dart +++ b/lib/main-prod.dart @@ -1,7 +1,6 @@ +import 'package:fcs/config.dart'; import 'package:flutter/material.dart'; import 'package:logging/logging.dart'; -import 'package:fcs/config.dart'; -import 'package:shared_preferences/shared_preferences.dart'; import 'app.dart'; @@ -10,10 +9,9 @@ void main() { Config( flavor: Flavor.PRODUCTION, color: Colors.blue, - apiURL: - "https://asia-northeast1-mokkon-wholesale-dev.cloudfunctions.net/APIOK", - reportURL: "http://petrok-dev.mokkon.com:8080", - reportProjectID: "prod", + apiURL: "https://asia-northeast1-fcs-prod1.cloudfunctions.net/API", + reportURL: "http://petrok.mokkon.com:8092", + reportProjectID: "fcs-prod", level: Level.ALL); runApp(App()); }