Commit e6d769df849242266dbd1965512cff156a6c2a71

Authored by gaiyaguang
1 parent 6b776015

消息调整

7babc7873f8d177769b987ba4c6c2911
\ No newline at end of file
c8424a7225c7d158c8fb32a172a5bf4c
\ No newline at end of file
... ...
... ... @@ -140,4 +140,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
COCOAPODS: 1.9.3
COCOAPODS: 1.9.1
... ...
... ... @@ -5,6 +5,7 @@ import 'package:flutter_picker/flutter_picker.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/manager.dart';
import 'package:one_key/models/notebook_detail.dart';
import 'package:one_key/provider/message_dialog_model.dart';
import 'package:one_key/provider/notebook_detail_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
... ... @@ -29,9 +30,10 @@ import 'package:provider/provider.dart';
class NotebookDetailPage extends StatefulWidget {
final String rid;
final String mid;
final bool fromNotify;
NotebookDetailPage(this.rid, {this.fromNotify=false});
NotebookDetailPage(this.rid, {this.fromNotify=false, this.mid});
@override
State<StatefulWidget> createState() {
... ... @@ -86,6 +88,19 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
});
}
//设置消息状态
setMessageStatus(){
if(widget.mid==null||widget.mid.isEmpty)return;
bus.emit("remove_untreated_message", widget.mid);
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
"id": widget.mid,
"status": "is_handle"
};
MessageDialogModel messageDialogModel=Provider.of<MessageDialogModel>(context,listen: false);
messageDialogModel.setMessageStatus(context,params);
}
@override
void dispose() {
bus.off("refresh_detail");
... ... @@ -98,6 +113,9 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
setState(() {
cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman;
});
if(detailEntity.status == "4"){
setMessageStatus();
}
}
/// 初始化取消原因数据
... ...
... ... @@ -67,40 +67,41 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
child: MyPage(),
));
WidgetsBinding.instance.addPostFrameCallback((_){
initPlatformState();
if(widget.initialIndex==0)return;
if(Platform.isAndroid){
_getIntent();
}
Future.delayed(Duration(milliseconds: 300),(){
initPlatformState();
});
_getIntent();
Future.delayed(Duration(milliseconds: 30000), () {
ContactModel.getInstance().uploadLocalContact(context);
UpdateModel updateModel = new UpdateModel();
updateModel.checkUpdate(context, showToast: false);
});
getUntreatedMessage();
timer = Timer.periodic(Duration(minutes: 3), (_) {
getUntreatedMessage();
});
UpdateModel updateModel = new UpdateModel();
updateModel.checkUpdate(context, showToast: false);
});
}
//获取点击通知栏的自定义参数
_getIntent() async {
Map notifyParam = await Tools().getIntent();
LogUtil.v(notifyParam.toString());
Map param = await Tools().getIntent();
Map notifyParam=param;
if(Platform.isIOS&&param!=null){
notifyParam=json.decode(param['custom'].toString());
}
if (notifyParam != null && notifyParam.isNotEmpty) {
switch (notifyParam["messageType"]) {
case "10":
NavigatorUtil.goNotebookDetailPage(context, notifyParam['rid'],
NavigatorUtil.goHandleOnlinePage(
context, notifyParam["rid"], notifyParam['mid'],
fromNotify: true);
break;
case "11":
NavigatorUtil.goHandleOnlinePage(
context, notifyParam["rid"], notifyParam['mid'],
NavigatorUtil.goNotebookDetailPage(context, notifyParam['rid'],mid:notifyParam['mid'],
fromNotify: true);
break;
}
}else{
getUntreatedMessage();
}
}
... ... @@ -144,7 +145,6 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
},
xgPushDidSetBadge: (String msg) async {
print("flutter xgPushDidSetBadge: $msg");
/// 在此可设置应用角标
XgFlutterPlugin().setAppBadge(0);
},
... ... @@ -161,18 +161,17 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
print("flutter xgPushDidClearAllIdentifiers: $msg");
},
xgPushClickAction: (Map<String, dynamic> msg) async {
print("flutter xgPushClickAction ${msg['custom']}");
if(Platform.isIOS&&msg!=null&&msg['custom']!=null){
Map<String,dynamic> custom=jsonDecode(msg['custom'].toString());
Map custom=json.decode(msg['custom'].toString());
switch(custom["messageType"].toString()){
case "10":
NavigatorUtil.goNotebookDetailPage(
context, custom['rid'].toString(),
NavigatorUtil.goHandleOnlinePage(
context, custom["rid"].toString(), custom['mid'].toString(),
fromNotify: true);
break;
case "11":
NavigatorUtil.goHandleOnlinePage(
context, custom["rid"].toString(), custom['mid'],
NavigatorUtil.goNotebookDetailPage(
context, custom['rid'].toString(),mid:custom['mid'].toString(),
fromNotify: true);
break;
}
... ... @@ -245,7 +244,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
super.didChangeAppLifecycleState(state);
switch (state) {
case AppLifecycleState.resumed: //应用前台可见
getUntreatedMessage();
// getUntreatedMessage();
break;
default:
break;
... ... @@ -344,7 +343,6 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
if (timer != null) {
timer.cancel();
}
XgFlutterPlugin().stopXg();
WidgetsBinding.instance.removeObserver(this);
}
}
... ...
... ... @@ -8,7 +8,6 @@ class Tools {
Future<Map> getIntent() async {
Map result = await _channel.invokeMethod("getIntent");
// Utils.showToast(json.encode(result));
return result;
}
}
... ...
... ... @@ -12,6 +12,7 @@ import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
import '../app.dart';
... ... @@ -212,6 +213,7 @@ class UserModel with ChangeNotifier {
Utils.showToast(baseResp.msg ?? "退出登录失败,请稍后重试");
} else {
App.sp.setBool("isLogin", false);
XgFlutterPlugin().stopXg();
NavigatorUtil.goLoginPage(context);
}
}
... ...
... ... @@ -40,8 +40,9 @@ var homeHandler = new Handler(
var reserveDetailHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
String rid = params['rid'].first;
String mid=params['mid'].first;
bool fromNotify=FluroConvertUtils.string2bool(params["fromNotify"].first);
return NotebookDetailPage(rid,fromNotify: fromNotify,);
return NotebookDetailPage(rid,mid:mid,fromNotify: fromNotify,);
});
// 跳转到处理在线预订
... ...
... ... @@ -39,8 +39,8 @@ class NavigatorUtil {
/// 订单详情
static void goNotebookDetailPage(BuildContext context, String rid,
{bool fromNotify=false,replace = false}) {
_navigateTo(context, "${Routes.reserve_detail}?rid=$rid&fromNotify=$fromNotify", replace: replace);
{String mid="",bool fromNotify=false,replace = false}) {
_navigateTo(context, "${Routes.reserve_detail}?rid=$rid&mid=$mid&fromNotify=$fromNotify", replace: replace);
}
/// 处理在线预订
... ...