Commit d9d921f0014066ab5e7fb085a01ac4855c63bd4a

Authored by wdn127929
1 parent 05210897

订单超时语音播报,升级版本导致声音不播放

@@ -215,65 +215,64 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -215,65 +215,64 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
215 bus.on('refresh_token', (arg) { 215 bus.on('refresh_token', (arg) {
216 initPlatformState(); 216 initPlatformState();
217 }); 217 });
218 - getSellerVersion();  
219 -  
220 - initPlatformState();  
221 - _getTableList();  
222 - _getSellerById();  
223 -  
224 - List<PullMarketingByUidSunModel> data =  
225 - Provider.of<UserModel>(context, listen: false)  
226 - .pullMarketingByUidSunModel;  
227 - if (data != null && Utils.getAuthority(context, '全店任务')) {  
228 - if (data.length > 0) {  
229 - Future.delayed(Duration(milliseconds: 300), () {  
230 - DialogUtil.cupertinoAlertDialog(context,  
231 - title: "全店任务",  
232 - content: "管理员发布了新的任务,请立即查看并完成任务",  
233 - lTitle: "稍后提醒",  
234 - rTitle: "立即查看", lCallback: () {  
235 - print("稍后提醒");  
236 - // 30分钟后重新弹窗  
237 - _startTimerSeller();  
238 - }, rCallback: () {  
239 - _endTimerSeller();  
240 - if (data.length == 1) {  
241 - //进入营销详情  
242 - NavigatorUtil.goSellerMyMarketingRecordsDetailPage(  
243 - context, data[0].mid,  
244 - fromNotify: true);  
245 - } else {  
246 - //进入我的客情首页  
247 - NavigatorUtil.goMyCustomerPage(context);  
248 - }  
249 - });  
250 - });  
251 - }  
252 - }  
253 - if (widget.initialIndex == 0 ||  
254 - widget.initialIndex == 1 && needRefreshTemp == false) return;  
255 - _initNotification();  
256 - Future.delayed(Duration(milliseconds: 30000), () {  
257 - //30000  
258 - ContactModel.getInstance().uploadLocalContact(context);  
259 - UserModel usermodel = Provider.of<UserModel>(context, listen: false);  
260 -  
261 - if (needUpdate && !usermodel.downLoading) {  
262 - UpdateModelMy updateModel = new UpdateModelMy();  
263 - updateModel.checkUpdate(context, (version) {  
264 - updateModel.showUpdateDialog(context, version);  
265 - }, showToast: false);  
266 - }  
267 - }); 218 + getSellerVersion();
  219 +
  220 + initPlatformState();
  221 + _getTableList();
  222 + _getSellerById();
268 223
269 - if (Utils.getAuthority(context, '消息中心')) {  
270 - timer = Timer.periodic(Duration(minutes: 3), (_) {  
271 - _getAllUnMessages(); 224 + List<PullMarketingByUidSunModel> data =
  225 + Provider.of<UserModel>(context, listen: false)
  226 + .pullMarketingByUidSunModel;
  227 + if (data != null && Utils.getAuthority(context, '全店任务')) {
  228 + if (data.length > 0) {
  229 + Future.delayed(Duration(milliseconds: 300), () {
  230 + DialogUtil.cupertinoAlertDialog(context,
  231 + title: "全店任务",
  232 + content: "管理员发布了新的任务,请立即查看并完成任务",
  233 + lTitle: "稍后提醒",
  234 + rTitle: "立即查看", lCallback: () {
  235 + print("稍后提醒");
  236 + // 30分钟后重新弹窗
  237 + _startTimerSeller();
  238 + }, rCallback: () {
  239 + _endTimerSeller();
  240 + if (data.length == 1) {
  241 + //进入营销详情
  242 + NavigatorUtil.goSellerMyMarketingRecordsDetailPage(
  243 + context, data[0].mid,
  244 + fromNotify: true);
  245 + } else {
  246 + //进入我的客情首页
  247 + NavigatorUtil.goMyCustomerPage(context);
  248 + }
  249 + });
272 }); 250 });
273 } 251 }
  252 + }
  253 + if (widget.initialIndex == 0 ||
  254 + widget.initialIndex == 1 && needRefreshTemp == false) return;
  255 + _initNotification();
  256 + Future.delayed(Duration(milliseconds: 30000), () {
  257 + //30000
  258 + ContactModel.getInstance().uploadLocalContact(context);
  259 + UserModel usermodel = Provider.of<UserModel>(context, listen: false);
  260 +
  261 + if (needUpdate && !usermodel.downLoading) {
  262 + UpdateModelMy updateModel = new UpdateModelMy();
  263 + updateModel.checkUpdate(context, (version) {
  264 + updateModel.showUpdateDialog(context, version);
  265 + }, showToast: false);
  266 + }
  267 + });
274 268
275 - _getUnMsgNum();  
276 - 269 + if (Utils.getAuthority(context, '消息中心')) {
  270 + timer = Timer.periodic(Duration(minutes: 3), (_) {
  271 + _getAllUnMessages();
  272 + });
  273 + }
  274 +
  275 + _getUnMsgNum();
277 }); 276 });
278 } 277 }
279 278
@@ -1238,7 +1237,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -1238,7 +1237,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
1238 // _getAllUnMessages(); 1237 // _getAllUnMessages();
1239 }); 1238 });
1240 // } 1239 // }
1241 - 1240 +
1242 break; 1241 break;
1243 case AppLifecycleState.inactive: 1242 case AppLifecycleState.inactive:
1244 print('inactive'); 1243 print('inactive');
@@ -1263,6 +1262,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -1263,6 +1262,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
1263 _getAllUnMessages() { 1262 _getAllUnMessages() {
1264 MessageDialogModel messageModel = 1263 MessageDialogModel messageModel =
1265 Provider.of<MessageDialogModel>(context, listen: false); 1264 Provider.of<MessageDialogModel>(context, listen: false);
  1265 +
1266 messageModel.messages = []; 1266 messageModel.messages = [];
1267 1267
1268 getUntreatedMessage(() { 1268 getUntreatedMessage(() {
@@ -18,6 +18,7 @@ import 'package:provider/provider.dart'; @@ -18,6 +18,7 @@ import 'package:provider/provider.dart';
18 class MessageDialogModel extends ChangeNotifier { 18 class MessageDialogModel extends ChangeNotifier {
19 final AudioPlayer _player = AudioPlayer(); 19 final AudioPlayer _player = AudioPlayer();
20 20
  21 +
21 bool showMessageDialog = false; 22 bool showMessageDialog = false;
22 23
23 List<NewUnmessage> messages = []; //所有消息用于展示 24 List<NewUnmessage> messages = []; //所有消息用于展示
@@ -31,42 +32,54 @@ class MessageDialogModel extends ChangeNotifier { @@ -31,42 +32,54 @@ class MessageDialogModel extends ChangeNotifier {
31 32
32 /// 播放 33 /// 播放
33 void play(String message_type) { 34 void play(String message_type) {
  35 + _player.stop();
  36 +
34 switch (message_type) { 37 switch (message_type) {
35 case "10": //在线预订 38 case "10": //在线预订
36 - _player.play(UrlSource("tts_online.mp3")); 39 +
  40 + _player.play(AssetSource("tts_online.mp3"));
37 break; 41 break;
38 case "11": //取消在线预订 42 case "11": //取消在线预订
39 - _player.play(UrlSource("tts_cancel.mp3")); 43 +
  44 + _player.play(AssetSource("tts_cancel.mp3"));
40 break; 45 break;
41 case "12": 46 case "12":
42 //在线买单消息 去处理 跳转在线买单处理页面 47 //在线买单消息 去处理 跳转在线买单处理页面
43 - _player.play(UrlSource("tts_pre_pay.mp3")); 48 +
  49 + _player.play(AssetSource("tts_pre_pay.mp3"));
44 break; 50 break;
45 case "13": 51 case "13":
46 //在线买单消息 去查看 跳转在线买单详情页面 52 //在线买单消息 去查看 跳转在线买单详情页面
47 - _player.play(UrlSource("tts_pay.mp3")); 53 +
  54 + _player.play(AssetSource("tts_pay.mp3"));
48 break; 55 break;
49 case "14": 56 case "14":
50 //发票详情页面跳转 57 //发票详情页面跳转
51 - _player.play(UrlSource("tts_invoice.mp3")); 58 + _player.play(AssetSource("tts_invoice.mp3"));
  59 +
52 break; 60 break;
53 case "1": //提前点餐 61 case "1": //提前点餐
54 - _player.play(UrlSource("tts_order.mp3")); 62 + _player.play(AssetSource("tts_order.mp3"));
  63 +
55 break; 64 break;
56 case "15": //店内消息 65 case "15": //店内消息
57 66
58 break; 67 break;
59 case "16": //其他经理取消在线预订 68 case "16": //其他经理取消在线预订
60 - _player.play(UrlSource("tts_new.mp3")); 69 +
  70 + _player.play(AssetSource("tts_new.mp3"));
61 break; 71 break;
62 case "17": //充值会员 72 case "17": //充值会员
63 - _player.play(UrlSource("tts_recharge.mp3")); 73 +
  74 + _player.play(AssetSource("tts_recharge.mp3"));
64 break; 75 break;
65 case "18": //存酒过期 76 case "18": //存酒过期
66 - _player.play(UrlSource("tts_wine_remind.mp3")); 77 +
  78 + _player.play(AssetSource("tts_wine_remind.mp3"));
67 break; 79 break;
68 case "-1": //>3 80 case "-1": //>3
69 - _player.play(UrlSource("tts_all.mp3")); 81 +
  82 + _player.play(AssetSource("tts_all.mp3"));
70 break; 83 break;
71 } 84 }
72 } 85 }
@@ -70,49 +70,49 @@ packages: @@ -70,49 +70,49 @@ packages:
70 name: audioplayers 70 name: audioplayers
71 url: "https://pub.flutter-io.cn" 71 url: "https://pub.flutter-io.cn"
72 source: hosted 72 source: hosted
73 - version: "3.0.1" 73 + version: "4.1.0"
74 audioplayers_android: 74 audioplayers_android:
75 dependency: transitive 75 dependency: transitive
76 description: 76 description:
77 name: audioplayers_android 77 name: audioplayers_android
78 url: "https://pub.flutter-io.cn" 78 url: "https://pub.flutter-io.cn"
79 source: hosted 79 source: hosted
80 - version: "2.0.0" 80 + version: "3.0.2"
81 audioplayers_darwin: 81 audioplayers_darwin:
82 dependency: transitive 82 dependency: transitive
83 description: 83 description:
84 name: audioplayers_darwin 84 name: audioplayers_darwin
85 url: "https://pub.flutter-io.cn" 85 url: "https://pub.flutter-io.cn"
86 source: hosted 86 source: hosted
87 - version: "3.0.1" 87 + version: "4.1.0"
88 audioplayers_linux: 88 audioplayers_linux:
89 dependency: transitive 89 dependency: transitive
90 description: 90 description:
91 name: audioplayers_linux 91 name: audioplayers_linux
92 url: "https://pub.flutter-io.cn" 92 url: "https://pub.flutter-io.cn"
93 source: hosted 93 source: hosted
94 - version: "1.0.4" 94 + version: "2.1.0"
95 audioplayers_platform_interface: 95 audioplayers_platform_interface:
96 dependency: transitive 96 dependency: transitive
97 description: 97 description:
98 name: audioplayers_platform_interface 98 name: audioplayers_platform_interface
99 url: "https://pub.flutter-io.cn" 99 url: "https://pub.flutter-io.cn"
100 source: hosted 100 source: hosted
101 - version: "4.0.0" 101 + version: "5.0.1"
102 audioplayers_web: 102 audioplayers_web:
103 dependency: transitive 103 dependency: transitive
104 description: 104 description:
105 name: audioplayers_web 105 name: audioplayers_web
106 url: "https://pub.flutter-io.cn" 106 url: "https://pub.flutter-io.cn"
107 source: hosted 107 source: hosted
108 - version: "2.2.0" 108 + version: "3.1.0"
109 audioplayers_windows: 109 audioplayers_windows:
110 dependency: transitive 110 dependency: transitive
111 description: 111 description:
112 name: audioplayers_windows 112 name: audioplayers_windows
113 url: "https://pub.flutter-io.cn" 113 url: "https://pub.flutter-io.cn"
114 source: hosted 114 source: hosted
115 - version: "1.1.3" 115 + version: "2.0.2"
116 azlistview: 116 azlistview:
117 dependency: "direct main" 117 dependency: "direct main"
118 description: 118 description:
@@ -79,7 +79,8 @@ dependencies: @@ -79,7 +79,8 @@ dependencies:
79 # audioplayers: ^0.14.2 79 # audioplayers: ^0.14.2
80 # audioplayers: ^0.20.1 80 # audioplayers: ^0.20.1
81 81
82 - audioplayers: ^3.0.0 82 + # audioplayers: ^3.0.0
  83 + audioplayers: ^4.0.1
83 84
84 # 日历 85 # 日历
85 table_calendar: ^2.2.1 86 table_calendar: ^2.2.1
@@ -262,7 +263,7 @@ flutter: @@ -262,7 +263,7 @@ flutter:
262 # To add assets to your application, add an assets section, like this: 263 # To add assets to your application, add an assets section, like this:
263 assets: 264 assets:
264 - assets/ 265 - assets/
265 - - assets/tts_online.mp3 266 + # - assets/tts_online.mp3
266 # - assets/icon_sellercode.png 267 # - assets/icon_sellercode.png
267 # - assets/icon_account.png 268 # - assets/icon_account.png
268 # - assets/icon_pwd.png 269 # - assets/icon_pwd.png
@@ -303,6 +304,14 @@ flutter: @@ -303,6 +304,14 @@ flutter:
303 - assets/tts_online.mp3 304 - assets/tts_online.mp3
304 - assets/tts_cancel.mp3 305 - assets/tts_cancel.mp3
305 - assets/tts_all.mp3 306 - assets/tts_all.mp3
  307 + - assets/tts_invoice.mp3
  308 + - assets/tts_new.mp3
  309 + - assets/tts_order.mp3
  310 + - assets/tts_pay.mp3
  311 + - assets/tts_pre_pay.mp3
  312 + - assets/tts_recharge.mp3
  313 + - assets/tts_voice.mp3
  314 + - assets/tts_wine_remind.mp3
306 - assets/icon_sellercode.png 315 - assets/icon_sellercode.png
307 - assets/icon_account.png 316 - assets/icon_account.png
308 - assets/icon_pwd.png 317 - assets/icon_pwd.png