Commit e6d769df849242266dbd1965512cff156a6c2a71

Authored by gaiyaguang
1 parent 6b776015

消息调整

1 -7babc7873f8d177769b987ba4c6c2911  
  1 +c8424a7225c7d158c8fb32a172a5bf4c
@@ -140,4 +140,4 @@ SPEC CHECKSUMS: @@ -140,4 +140,4 @@ SPEC CHECKSUMS:
140 140
141 PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c 141 PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
142 142
143 -COCOAPODS: 1.9.3 143 +COCOAPODS: 1.9.1
@@ -5,6 +5,7 @@ import 'package:flutter_picker/flutter_picker.dart'; @@ -5,6 +5,7 @@ import 'package:flutter_picker/flutter_picker.dart';
5 import 'package:flutter_screenutil/flutter_screenutil.dart'; 5 import 'package:flutter_screenutil/flutter_screenutil.dart';
6 import 'package:one_key/models/manager.dart'; 6 import 'package:one_key/models/manager.dart';
7 import 'package:one_key/models/notebook_detail.dart'; 7 import 'package:one_key/models/notebook_detail.dart';
  8 +import 'package:one_key/provider/message_dialog_model.dart';
8 import 'package:one_key/provider/notebook_detail_model.dart'; 9 import 'package:one_key/provider/notebook_detail_model.dart';
9 import 'package:one_key/provider/user_model.dart'; 10 import 'package:one_key/provider/user_model.dart';
10 import 'package:one_key/res/colors.dart'; 11 import 'package:one_key/res/colors.dart';
@@ -29,9 +30,10 @@ import 'package:provider/provider.dart'; @@ -29,9 +30,10 @@ import 'package:provider/provider.dart';
29 30
30 class NotebookDetailPage extends StatefulWidget { 31 class NotebookDetailPage extends StatefulWidget {
31 final String rid; 32 final String rid;
  33 + final String mid;
32 final bool fromNotify; 34 final bool fromNotify;
33 35
34 - NotebookDetailPage(this.rid, {this.fromNotify=false}); 36 + NotebookDetailPage(this.rid, {this.fromNotify=false, this.mid});
35 37
36 @override 38 @override
37 State<StatefulWidget> createState() { 39 State<StatefulWidget> createState() {
@@ -86,6 +88,19 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -86,6 +88,19 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
86 }); 88 });
87 } 89 }
88 90
  91 + //设置消息状态
  92 + setMessageStatus(){
  93 + if(widget.mid==null||widget.mid.isEmpty)return;
  94 + bus.emit("remove_untreated_message", widget.mid);
  95 + Map<String, String> params = {
  96 + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  97 + "id": widget.mid,
  98 + "status": "is_handle"
  99 + };
  100 + MessageDialogModel messageDialogModel=Provider.of<MessageDialogModel>(context,listen: false);
  101 + messageDialogModel.setMessageStatus(context,params);
  102 + }
  103 +
89 @override 104 @override
90 void dispose() { 105 void dispose() {
91 bus.off("refresh_detail"); 106 bus.off("refresh_detail");
@@ -98,6 +113,9 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -98,6 +113,9 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
98 setState(() { 113 setState(() {
99 cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman; 114 cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman;
100 }); 115 });
  116 + if(detailEntity.status == "4"){
  117 + setMessageStatus();
  118 + }
101 } 119 }
102 120
103 /// 初始化取消原因数据 121 /// 初始化取消原因数据
@@ -67,40 +67,41 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -67,40 +67,41 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
67 child: MyPage(), 67 child: MyPage(),
68 )); 68 ));
69 WidgetsBinding.instance.addPostFrameCallback((_){ 69 WidgetsBinding.instance.addPostFrameCallback((_){
  70 + initPlatformState();
70 if(widget.initialIndex==0)return; 71 if(widget.initialIndex==0)return;
71 - if(Platform.isAndroid){  
72 - _getIntent();  
73 - }  
74 - Future.delayed(Duration(milliseconds: 300),(){  
75 - initPlatformState();  
76 - }); 72 + _getIntent();
77 Future.delayed(Duration(milliseconds: 30000), () { 73 Future.delayed(Duration(milliseconds: 30000), () {
78 ContactModel.getInstance().uploadLocalContact(context); 74 ContactModel.getInstance().uploadLocalContact(context);
  75 + UpdateModel updateModel = new UpdateModel();
  76 + updateModel.checkUpdate(context, showToast: false);
79 }); 77 });
80 - getUntreatedMessage();  
81 timer = Timer.periodic(Duration(minutes: 3), (_) { 78 timer = Timer.periodic(Duration(minutes: 3), (_) {
82 getUntreatedMessage(); 79 getUntreatedMessage();
83 }); 80 });
84 - UpdateModel updateModel = new UpdateModel();  
85 - updateModel.checkUpdate(context, showToast: false);  
86 }); 81 });
87 } 82 }
88 83
  84 + //获取点击通知栏的自定义参数
89 _getIntent() async { 85 _getIntent() async {
90 - Map notifyParam = await Tools().getIntent();  
91 - LogUtil.v(notifyParam.toString()); 86 + Map param = await Tools().getIntent();
  87 + Map notifyParam=param;
  88 + if(Platform.isIOS&&param!=null){
  89 + notifyParam=json.decode(param['custom'].toString());
  90 + }
92 if (notifyParam != null && notifyParam.isNotEmpty) { 91 if (notifyParam != null && notifyParam.isNotEmpty) {
93 switch (notifyParam["messageType"]) { 92 switch (notifyParam["messageType"]) {
94 case "10": 93 case "10":
95 - NavigatorUtil.goNotebookDetailPage(context, notifyParam['rid'], 94 + NavigatorUtil.goHandleOnlinePage(
  95 + context, notifyParam["rid"], notifyParam['mid'],
96 fromNotify: true); 96 fromNotify: true);
97 break; 97 break;
98 case "11": 98 case "11":
99 - NavigatorUtil.goHandleOnlinePage(  
100 - context, notifyParam["rid"], notifyParam['mid'], 99 + NavigatorUtil.goNotebookDetailPage(context, notifyParam['rid'],mid:notifyParam['mid'],
101 fromNotify: true); 100 fromNotify: true);
102 break; 101 break;
103 } 102 }
  103 + }else{
  104 + getUntreatedMessage();
104 } 105 }
105 } 106 }
106 107
@@ -144,7 +145,6 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -144,7 +145,6 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
144 }, 145 },
145 xgPushDidSetBadge: (String msg) async { 146 xgPushDidSetBadge: (String msg) async {
146 print("flutter xgPushDidSetBadge: $msg"); 147 print("flutter xgPushDidSetBadge: $msg");
147 -  
148 /// 在此可设置应用角标 148 /// 在此可设置应用角标
149 XgFlutterPlugin().setAppBadge(0); 149 XgFlutterPlugin().setAppBadge(0);
150 }, 150 },
@@ -161,18 +161,17 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -161,18 +161,17 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
161 print("flutter xgPushDidClearAllIdentifiers: $msg"); 161 print("flutter xgPushDidClearAllIdentifiers: $msg");
162 }, 162 },
163 xgPushClickAction: (Map<String, dynamic> msg) async { 163 xgPushClickAction: (Map<String, dynamic> msg) async {
164 - print("flutter xgPushClickAction ${msg['custom']}");  
165 if(Platform.isIOS&&msg!=null&&msg['custom']!=null){ 164 if(Platform.isIOS&&msg!=null&&msg['custom']!=null){
166 - Map<String,dynamic> custom=jsonDecode(msg['custom'].toString()); 165 + Map custom=json.decode(msg['custom'].toString());
167 switch(custom["messageType"].toString()){ 166 switch(custom["messageType"].toString()){
168 case "10": 167 case "10":
169 - NavigatorUtil.goNotebookDetailPage(  
170 - context, custom['rid'].toString(), 168 + NavigatorUtil.goHandleOnlinePage(
  169 + context, custom["rid"].toString(), custom['mid'].toString(),
171 fromNotify: true); 170 fromNotify: true);
172 break; 171 break;
173 case "11": 172 case "11":
174 - NavigatorUtil.goHandleOnlinePage(  
175 - context, custom["rid"].toString(), custom['mid'], 173 + NavigatorUtil.goNotebookDetailPage(
  174 + context, custom['rid'].toString(),mid:custom['mid'].toString(),
176 fromNotify: true); 175 fromNotify: true);
177 break; 176 break;
178 } 177 }
@@ -245,7 +244,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -245,7 +244,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
245 super.didChangeAppLifecycleState(state); 244 super.didChangeAppLifecycleState(state);
246 switch (state) { 245 switch (state) {
247 case AppLifecycleState.resumed: //应用前台可见 246 case AppLifecycleState.resumed: //应用前台可见
248 - getUntreatedMessage(); 247 +// getUntreatedMessage();
249 break; 248 break;
250 default: 249 default:
251 break; 250 break;
@@ -344,7 +343,6 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -344,7 +343,6 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
344 if (timer != null) { 343 if (timer != null) {
345 timer.cancel(); 344 timer.cancel();
346 } 345 }
347 - XgFlutterPlugin().stopXg();  
348 WidgetsBinding.instance.removeObserver(this); 346 WidgetsBinding.instance.removeObserver(this);
349 } 347 }
350 } 348 }
@@ -8,7 +8,6 @@ class Tools { @@ -8,7 +8,6 @@ class Tools {
8 8
9 Future<Map> getIntent() async { 9 Future<Map> getIntent() async {
10 Map result = await _channel.invokeMethod("getIntent"); 10 Map result = await _channel.invokeMethod("getIntent");
11 - // Utils.showToast(json.encode(result));  
12 return result; 11 return result;
13 } 12 }
14 } 13 }
@@ -12,6 +12,7 @@ import 'package:one_key/utils/navigator_util.dart'; @@ -12,6 +12,7 @@ import 'package:one_key/utils/navigator_util.dart';
12 import 'package:one_key/utils/utils.dart'; 12 import 'package:one_key/utils/utils.dart';
13 import 'package:one_key/widgets/MyDivider.dart'; 13 import 'package:one_key/widgets/MyDivider.dart';
14 import 'package:one_key/widgets/v_empty_view.dart'; 14 import 'package:one_key/widgets/v_empty_view.dart';
  15 +import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
15 16
16 import '../app.dart'; 17 import '../app.dart';
17 18
@@ -212,6 +213,7 @@ class UserModel with ChangeNotifier { @@ -212,6 +213,7 @@ class UserModel with ChangeNotifier {
212 Utils.showToast(baseResp.msg ?? "退出登录失败,请稍后重试"); 213 Utils.showToast(baseResp.msg ?? "退出登录失败,请稍后重试");
213 } else { 214 } else {
214 App.sp.setBool("isLogin", false); 215 App.sp.setBool("isLogin", false);
  216 + XgFlutterPlugin().stopXg();
215 NavigatorUtil.goLoginPage(context); 217 NavigatorUtil.goLoginPage(context);
216 } 218 }
217 } 219 }
@@ -40,8 +40,9 @@ var homeHandler = new Handler( @@ -40,8 +40,9 @@ var homeHandler = new Handler(
40 var reserveDetailHandler = new Handler( 40 var reserveDetailHandler = new Handler(
41 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 41 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
42 String rid = params['rid'].first; 42 String rid = params['rid'].first;
  43 + String mid=params['mid'].first;
43 bool fromNotify=FluroConvertUtils.string2bool(params["fromNotify"].first); 44 bool fromNotify=FluroConvertUtils.string2bool(params["fromNotify"].first);
44 - return NotebookDetailPage(rid,fromNotify: fromNotify,); 45 + return NotebookDetailPage(rid,mid:mid,fromNotify: fromNotify,);
45 }); 46 });
46 47
47 // 跳转到处理在线预订 48 // 跳转到处理在线预订
@@ -39,8 +39,8 @@ class NavigatorUtil { @@ -39,8 +39,8 @@ class NavigatorUtil {
39 39
40 /// 订单详情 40 /// 订单详情
41 static void goNotebookDetailPage(BuildContext context, String rid, 41 static void goNotebookDetailPage(BuildContext context, String rid,
42 - {bool fromNotify=false,replace = false}) {  
43 - _navigateTo(context, "${Routes.reserve_detail}?rid=$rid&fromNotify=$fromNotify", replace: replace); 42 + {String mid="",bool fromNotify=false,replace = false}) {
  43 + _navigateTo(context, "${Routes.reserve_detail}?rid=$rid&mid=$mid&fromNotify=$fromNotify", replace: replace);
44 } 44 }
45 45
46 /// 处理在线预订 46 /// 处理在线预订