Commit 19372b692028f6160a5ad63ebe9322a9b1f63025

Authored by “gaiyaguang”
2 parents 862ed9c7 a4b235e9

Merge branch 'v1.1+' of http://123.56.79.57/xt/Flutter-ReserveApp into v1.1+

... ... @@ -33,7 +33,7 @@ class HomePage extends StatefulWidget{
}
}
class HomePageState extends State<HomePage>{
class HomePageState extends State<HomePage> with WidgetsBindingObserver{
List<Widget> pages = List<Widget>();
... ... @@ -48,6 +48,7 @@ class HomePageState extends State<HomePage>{
// TODO: implement initState
super.initState();
LogUtil.v("home_initState");
WidgetsBinding.instance.addObserver(this);
_currIndex=widget.initialIndex;
pages
..add(ChangeNotifierProvider<MessageModel>(
... ... @@ -70,9 +71,10 @@ class HomePageState extends State<HomePage>{
getUntreatedMessage();
});
UpdateModel updateModel=new UpdateModel();
updateModel.checkUpdate(context);
updateModel.checkUpdate(context,showToast: false);
});
initPlatformState();
}
//初始化信鸽推送
... ... @@ -135,14 +137,20 @@ class HomePageState extends State<HomePage>{
/// 上海:tpns.sh.tencent.com
// XgFlutterPlugin().configureClusterDomainName("tpns.hk.tencent.com");
/// 设置OPPO AppKey 和 AppSecret
XgFlutterPlugin().getXgAndroidApi().enableOppoNotification();
XgFlutterPlugin().getXgAndroidApi().setOppoPushAppId(appId:"30260281");
XgFlutterPlugin().getXgAndroidApi().setOppoPushAppKey(appKey: "9b7e372f93794593953f93f118619570");
// 设置小米 AppID 和 AppKey。
XgFlutterPlugin().getXgAndroidApi().setMiPushAppId(appId:"2882303761518639456");
XgFlutterPlugin().getXgAndroidApi().setMiPushAppKey(appKey: "5231863961456");
XgFlutterPlugin().getXgAndroidApi().enableOtherPush();
if(Platform.isAndroid){
/// 设置OPPO AppKey 和 AppSecret
if(await XgFlutterPlugin().getXgAndroidApi().isOppoRom()){
XgFlutterPlugin().getXgAndroidApi().enableOppoNotification();
XgFlutterPlugin().getXgAndroidApi().setOppoPushAppId(appId:"30260281");
XgFlutterPlugin().getXgAndroidApi().setOppoPushAppKey(appKey: "9b7e372f93794593953f93f118619570");
}
// 设置小米 AppID 和 AppKey。
if(await XgFlutterPlugin().getXgAndroidApi().isMiuiRom()){
XgFlutterPlugin().getXgAndroidApi().setMiPushAppId(appId:"2882303761518639456");
XgFlutterPlugin().getXgAndroidApi().setMiPushAppKey(appKey: "5231863961456");
}
XgFlutterPlugin().getXgAndroidApi().enableOtherPush();
}
/// 启动TPNS服务
XgFlutterPlugin().startXg("1600012876", "INUIMFK21WGH");
}
... ... @@ -175,6 +183,17 @@ class HomePageState extends State<HomePage>{
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
// TODO: implement didChangeAppLifecycleState
super.didChangeAppLifecycleState(state);
switch(state){
case AppLifecycleState.resumed://应用前台可见
getUntreatedMessage();
break;
}
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return new Scaffold(
... ... @@ -264,5 +283,6 @@ class HomePageState extends State<HomePage>{
timer.cancel();
}
XgFlutterPlugin().stopXg();
WidgetsBinding.instance.removeObserver(this);
}
}
... ...
... ... @@ -31,7 +31,7 @@ class MessageDialogItem extends StatelessWidget {
child: Stack(
children: <Widget>[
Container(
height: ScreenUtil().setWidth(280),
height: ScreenUtil().setWidth(290),
margin: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(39),vertical: ScreenUtil().setWidth(12)),
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(12),
... ...
... ... @@ -32,7 +32,7 @@ class MessageItem extends StatelessWidget {
child: Stack(
children: <Widget>[
Container(
height: ScreenUtil().setWidth(280),
height: ScreenUtil().setWidth(290),
margin: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(39),vertical: ScreenUtil().setWidth(12)),
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(12),
... ...
... ... @@ -45,8 +45,8 @@ class ContactModel{
phoneNum=contact.phones.first.value.trim();
}
Map<String,String> callLog={
"phoneNum":"$phoneNum",
"sid":"154",
"phoneNum":"${phoneNum.trim()}",
"sid":Provider.of<UserModel>(context,listen: false).user.sellerid,
"deviceId":"dhgajkhdgahghsdghdkgahd",
"phoneDate":"${DateTime.now().millisecondsSinceEpoch}",
"callType":"2",
... ...
... ... @@ -25,7 +25,7 @@ class UpdateModel {
int _progress; //下载进度
Function _setState;
//检查更新
checkUpdate(BuildContext context) async {
checkUpdate(BuildContext context,{showToast=true}) async {
String deviceId = await Utils.getUUID();
UserModel userModel = Provider.of<UserModel>(context, listen: false);
int versionCode = await Utils.getCurrBuildNum();
... ... @@ -42,7 +42,9 @@ class UpdateModel {
.request<List>(context, Method.get, HttpUrl.check_update, data: params)
.catchError((error) {
print(error.toString());
Utils.showToast("当前已是最新版本");
if(showToast){
Utils.showToast("当前已是最新版本");
}
});
if (baseResp!=null&&baseResp.code == Constant.status_success) {
LogUtil.v(baseResp.data);
... ... @@ -56,10 +58,15 @@ class UpdateModel {
});
showUpdateDialog(context, version);
}else{
Utils.showToast(baseResp?.msg??"当前已是最新版本");
if(showToast){
Utils.showToast(baseResp?.msg??"当前已是最新版本");
}
}
}else{
Utils.showToast(baseResp?.msg??"当前已是最新版本");
if(showToast){
Utils.showToast(baseResp?.msg??"当前已是最新版本");
}
}
// if(Platform.isAndroid){
//
... ...