|
...
|
...
|
@@ -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&¶m!=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);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|