Commit 997ea0d68218d443e6de4f570982b79eb17d59c3

Authored by liangchengyou
1 parent 01e73e19

feat:绘本闪退问题修复

ios/Runner/XSMessageMehtodChannel.swift
@@ -21,18 +21,28 @@ class XSMessageMehtodChannel: NSObject,SSOralEvaluatingManagerDelegate { @@ -21,18 +21,28 @@ class XSMessageMehtodChannel: NSObject,SSOralEvaluatingManagerDelegate {
21 21
22 //配置评测信息 22 //配置评测信息
23 func setEvaluateConfig(dict:Dictionary<String, Any>) { 23 func setEvaluateConfig(dict:Dictionary<String, Any>) {
24 - let appKey = dict["appKey"] as? String ?? ""  
25 - let secretKey = dict["secretKey"] as? String ?? ""  
26 - let userId = dict["userId"] as? String ?? "guest"  
27 - let frontTime = dict["frontTime"] as? String ?? "3"  
28 - let backTime = dict["frontTime"] as? String ?? "3" 24 + var appKey = "a418"
  25 + var secretKey = "c11163aa6c834a028da4a4b30955be99"
  26 + var service = "wss://api.cloud.ssapi.cn"
  27 + var userId = "guest"
  28 + var frontTime = "3"
  29 + var backTime = "3"
  30 + if (!dict.keys.isEmpty) {
  31 + appKey = dict["appKey"] as? String ?? ""
  32 + secretKey = dict["secretKey"] as? String ?? ""
  33 + userId = dict["userId"] as? String ?? "guest"
  34 + frontTime = dict["frontTime"] as? String ?? "3"
  35 + backTime = dict["frontTime"] as? String ?? "3"
  36 + service = dict["service"] as? String ?? ""
  37 + }
29 let config = SSOralEvaluatingManagerConfig.init() 38 let config = SSOralEvaluatingManagerConfig.init()
30 config.vad = true 39 config.vad = true
31 config.isOutputLog = false 40 config.isOutputLog = false
32 - config.appKey = appKey //"a418"  
33 - config.secretKey = secretKey //"1a16f31f2611bf32fb7b3fc38f5b2c81"' 41 + config.appKey = appKey
  42 + config.secretKey = secretKey
34 config.frontTime = Double(frontTime)! 43 config.frontTime = Double(frontTime)!
35 config.backTime = Double(backTime)! 44 config.backTime = Double(backTime)!
  45 + config.setValue(service, forKey: "service")
36 SSOralEvaluatingManager.register(config) 46 SSOralEvaluatingManager.register(config)
37 SSOralEvaluatingManager.share().register(.line, userId: userId) 47 SSOralEvaluatingManager.share().register(.line, userId: userId)
38 SSOralEvaluatingManager.share().delegate = self 48 SSOralEvaluatingManager.share().delegate = self
lib/common/core/app_consts.dart
  1 +import 'package:flutter/foundation.dart';
  2 +
1 class AppConsts { 3 class AppConsts {
2 /// 隐私协议 4 /// 隐私协议
3 static const String userPrivacyPolicyUrl = 'http://page.kouyuxingqiu.com/wowenglishuserregister.html'; 5 static const String userPrivacyPolicyUrl = 'http://page.kouyuxingqiu.com/wowenglishuserregister.html';
@@ -7,4 +9,9 @@ class AppConsts { @@ -7,4 +9,9 @@ class AppConsts {
7 9
8 /// 与第三方共享协议 10 /// 与第三方共享协议
9 static const String userTermSdkUrl = 'http://page.kouyuxingqiu.com/term_sdk.html'; 11 static const String userTermSdkUrl = 'http://page.kouyuxingqiu.com/term_sdk.html';
  12 +
  13 + /// 先声SDK
  14 + static const String xsAppKey = kDebugMode?'t418':'a418';
  15 + static const String xsAppSecretKey = kDebugMode?'1a16f31f2611bf32fb7b3fc38f5b2c81':'c11163aa6c834a028da4a4b30955be99';
  16 + static const String xsAppService = kDebugMode?'':'"wss://api.cloud.ssapi.cn';
10 } 17 }
lib/pages/home/home_page.dart
@@ -62,8 +62,8 @@ class _HomePageView extends StatelessWidget { @@ -62,8 +62,8 @@ class _HomePageView extends StatelessWidget {
62 if (state.type == 5) { 62 if (state.type == 5) {
63 title = 'bonus'; 63 title = 'bonus';
64 } 64 }
65 - debugPrint(videoUrl);  
66 - if (videoUrl.isEmpty) { 65 +
  66 + if (videoUrl.isEmpty && !videoUrl.contains('http')) {
67 return; 67 return;
68 } 68 }
69 pushNamed(AppRouteName.lookVideo,arguments: {'videoUrl':videoUrl,'title':title}); 69 pushNamed(AppRouteName.lookVideo,arguments: {'videoUrl':videoUrl,'title':title});
@@ -110,7 +110,6 @@ class _HomePageView extends StatelessWidget { @@ -110,7 +110,6 @@ class _HomePageView extends StatelessWidget {
110 } else { 110 } else {
111 return GestureDetector( 111 return GestureDetector(
112 onTap: () { 112 onTap: () {
113 - debugPrint('>>>>>>>类型${data?.courseType}');  
114 if (data!.lock!) { 113 if (data!.lock!) {
115 showToast('当前课程暂未解锁'); 114 showToast('当前课程暂未解锁');
116 return; 115 return;
lib/pages/practice/topic_picture_page.dart
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:flutter_bloc/flutter_bloc.dart'; 2 import 'package:flutter_bloc/flutter_bloc.dart';
3 import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 import 'package:flutter_screenutil/flutter_screenutil.dart';
  4 +import 'package:wow_english/common/core/app_consts.dart';
4 import 'package:wow_english/common/core/user_util.dart'; 5 import 'package:wow_english/common/core/user_util.dart';
5 import 'package:wow_english/common/extension/string_extension.dart'; 6 import 'package:wow_english/common/extension/string_extension.dart';
6 import 'package:wow_english/common/widgets/ow_image_widget.dart'; 7 import 'package:wow_english/common/widgets/ow_image_widget.dart';
@@ -26,9 +27,10 @@ class TopicPicturePage extends StatelessWidget { @@ -26,9 +27,10 @@ class TopicPicturePage extends StatelessWidget {
26 ..add(RequestDataEvent()) 27 ..add(RequestDataEvent())
27 ..add(XSVoiceInitEvent( 28 ..add(XSVoiceInitEvent(
28 { 29 {
29 - 'appKey':'a418',  
30 - 'secretKey':'1a16f31f2611bf32fb7b3fc38f5b2c81',  
31 - 'userId':UserUtil.getUser()!.id.toString() 30 + 'appKey':AppConsts.xsAppKey,
  31 + 'service':AppConsts.xsAppService,
  32 + 'secretKey':AppConsts.xsAppSecretKey,
  33 + 'userId':UserUtil.getUser()!.id.toString(),
32 } 34 }
33 )), 35 )),
34 child: _TopicPicturePage(), 36 child: _TopicPicturePage(),
lib/pages/repeataftercontent/repeat_after_content_page.dart
@@ -5,6 +5,7 @@ import &#39;package:wow_english/common/extension/string_extension.dart&#39;; @@ -5,6 +5,7 @@ import &#39;package:wow_english/common/extension/string_extension.dart&#39;;
5 import 'package:wow_english/pages/repeataftercontent/bloc/repeat_after_content_bloc.dart'; 5 import 'package:wow_english/pages/repeataftercontent/bloc/repeat_after_content_bloc.dart';
6 import 'package:wow_english/route/route.dart'; 6 import 'package:wow_english/route/route.dart';
7 7
  8 +import '../../common/core/app_consts.dart';
8 import '../../common/core/user_util.dart'; 9 import '../../common/core/user_util.dart';
9 import '../../utils/toast_util.dart'; 10 import '../../utils/toast_util.dart';
10 import 'widgets/repeat_video_widget.dart'; 11 import 'widgets/repeat_video_widget.dart';
@@ -22,9 +23,10 @@ class RepeatAfterContentPage extends StatelessWidget { @@ -22,9 +23,10 @@ class RepeatAfterContentPage extends StatelessWidget {
22 ..add(RequestDataEvent()) 23 ..add(RequestDataEvent())
23 ..add(XSVoiceInitEvent( 24 ..add(XSVoiceInitEvent(
24 { 25 {
25 - 'appKey':'a418',  
26 - 'secretKey':'1a16f31f2611bf32fb7b3fc38f5b2c81',  
27 - 'userId':UserUtil.getUser()!.id.toString() 26 + 'appKey':AppConsts.xsAppKey,
  27 + 'service':AppConsts.xsAppService,
  28 + 'secretKey':AppConsts.xsAppSecretKey,
  29 + 'userId':UserUtil.getUser()!.id.toString(),
28 } 30 }
29 )), 31 )),
30 child: _RepeatAfterContentPage(), 32 child: _RepeatAfterContentPage(),