xugenyuan

ref |> 启动性能优化2

1、调整个推、启动取匿名手机号登逻辑

2、调整部分log

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
@@ -18,7 +18,6 @@ export class AppUtils { @@ -18,7 +18,6 @@ export class AppUtils {
18 AppUtils.buildBuildModeName = BuildProfile.BUILD_MODE_NAME; 18 AppUtils.buildBuildModeName = BuildProfile.BUILD_MODE_NAME;
19 19
20 Logger.isDebug = !AppUtils.isProductRELEASE() 20 Logger.isDebug = !AppUtils.isProductRELEASE()
21 - // Logger.isDebug = false  
22 } 21 }
23 22
24 public static isProductRELEASE() { 23 public static isProductRELEASE() {
@@ -20,7 +20,7 @@ export class KVStoreHelper { @@ -20,7 +20,7 @@ export class KVStoreHelper {
20 } 20 }
21 21
22 static init(context: Context) { 22 static init(context: Context) {
23 - Logger.error(TAG, 'init') 23 + Logger.debug(TAG, 'init')
24 KVStoreHelper._context = context; 24 KVStoreHelper._context = context;
25 KVStoreHelper.default.createKVManager() 25 KVStoreHelper.default.createKVManager()
26 KVStoreHelper.default.createKVStore() 26 KVStoreHelper.default.createKVStore()
@@ -28,7 +28,7 @@ export class Logger { @@ -28,7 +28,7 @@ export class Logger {
28 */ 28 */
29 private static CHUNK_SIZE: number = 3500; 29 private static CHUNK_SIZE: number = 3500;
30 static isDebug: boolean = true; 30 static isDebug: boolean = true;
31 - static isCloseOptimzied: boolean = true; 31 + static isCloseOptimzied: boolean = false; // 正常用false,打开是为了暴露性能问题
32 32
33 /** 33 /**
34 * constructor. 34 * constructor.
@@ -53,7 +53,9 @@ export class PlayViewModel { @@ -53,7 +53,9 @@ export class PlayViewModel {
53 return 53 return
54 } 54 }
55 55
56 - Logger.info(TAG, JSON.stringify(data)) 56 + Logger.infoOptimize(TAG, () => {
  57 + return JSON.stringify(data)
  58 + })
57 this.newsTitle = data.newsTitle 59 this.newsTitle = data.newsTitle
58 this.editorName = data.editorName 60 this.editorName = data.editorName
59 this.newsSummary = data.newsSummary 61 this.newsSummary = data.newsSummary
@@ -87,7 +89,9 @@ export class PlayViewModel { @@ -87,7 +89,9 @@ export class PlayViewModel {
87 } 89 }
88 90
89 let contentDetailDTO: ContentDetailDTO = resDTO.data[0] 91 let contentDetailDTO: ContentDetailDTO = resDTO.data[0]
90 - Logger.info(TAG, JSON.stringify(contentDetailDTO)) 92 + Logger.infoOptimize(TAG, () => {
  93 + return JSON.stringify(contentDetailDTO)
  94 + })
91 this.newsTitle = contentDetailDTO.newsTitle 95 this.newsTitle = contentDetailDTO.newsTitle
92 this.editorName = contentDetailDTO.editorName 96 this.editorName = contentDetailDTO.editorName
93 this.newsSummary = contentDetailDTO.newsSummary 97 this.newsSummary = contentDetailDTO.newsSummary
@@ -146,7 +146,9 @@ export class GetuiPush { @@ -146,7 +146,9 @@ export class GetuiPush {
146 }, 146 },
147 //命令相应回复 147 //命令相应回复
148 onReceiveCommandResult: (result: GTCmdMessage) => { 148 onReceiveCommandResult: (result: GTCmdMessage) => {
149 - Logger.debug(TAG, "推送 Cmd Message = " + JSON.stringify(result)) 149 + Logger.debugOptimize(TAG, () => {
  150 + return "推送 Cmd Message = " + JSON.stringify(result)
  151 + })
150 this.dealWithCmdMessage(result) 152 this.dealWithCmdMessage(result)
151 }, 153 },
152 //sdk 收到透传消息 154 //sdk 收到透传消息
@@ -256,7 +256,9 @@ export class VoiceRecoginizer { @@ -256,7 +256,9 @@ export class VoiceRecoginizer {
256 } 256 }
257 257
258 async AsrInit(path:string, filePath:string): Promise<number> { 258 async AsrInit(path:string, filePath:string): Promise<number> {
259 - //console.log("AsrInit this is " + JSON.stringify(this)) 259 + Logger.debugOptimize(TAG, () => {
  260 + return "AsrInit this is " + JSON.stringify(this)
  261 + })
260 // console.info("AsrInit path: " + path); 262 // console.info("AsrInit path: " + path);
261 //获取工作路径, 这里获得当前nuisdk.aar中assets路径 263 //获取工作路径, 这里获得当前nuisdk.aar中assets路径
262 264
@@ -41,11 +41,12 @@ export class LoginModule { @@ -41,11 +41,12 @@ export class LoginModule {
41 41
42 HuaweiAuth.sharedInstance().registerEvents() 42 HuaweiAuth.sharedInstance().registerEvents()
43 43
44 - AccountManagerUtils.isLogin().then((login) => {  
45 - if (!login) {  
46 - HuaweiAuth.sharedInstance().rePrefetchAnonymousPhone()  
47 - }  
48 - }) 44 + // 这里启动不在预先取匿名手机号
  45 + // AccountManagerUtils.isLogin().then((login) => {
  46 + // if (!login) {
  47 + // HuaweiAuth.sharedInstance().rePrefetchAnonymousPhone()
  48 + // }
  49 + // })
49 RouterJumpInterceptor.register(WDRouterPage.loginPage, new LoginJumpHandler()) 50 RouterJumpInterceptor.register(WDRouterPage.loginPage, new LoginJumpHandler())
50 } 51 }
51 52
@@ -126,9 +126,11 @@ export class StartupManager { @@ -126,9 +126,11 @@ export class StartupManager {
126 126
127 this.initSensorData() 127 this.initSensorData()
128 128
  129 + setTimeout(() => {
129 this.initTingyun() 130 this.initTingyun()
130 131
131 this.initGeTuiPush() 132 this.initGeTuiPush()
  133 + }, 1000)
132 134
133 this.initUmengStat() 135 this.initUmengStat()
134 136