xugenyuan

ref |> 优化App内链处理方法

@@ -17,3 +17,5 @@ export { RouterJumpInterceptor, JumpInterceptorAction } from './src/main/ets/rou @@ -17,3 +17,5 @@ export { RouterJumpInterceptor, JumpInterceptorAction } from './src/main/ets/rou
17 export { AppInnerLink } from './src/main/ets/utils/AppInnerLink' 17 export { AppInnerLink } from './src/main/ets/utils/AppInnerLink'
18 18
19 export { ContentType } from './src/main/ets/common/ContentType' 19 export { ContentType } from './src/main/ets/common/ContentType'
  20 +
  21 +export { AppInnerLinkGenerator } from "./src/main/ets/utils/AppInnerLinkGenerator"
1 import { ContentDetailDTO, ContentDTO, FrontLinkObject } from 'wdBean/Index'; 1 import { ContentDetailDTO, ContentDTO, FrontLinkObject } from 'wdBean/Index';
2 -import { BreakpointSystem } from 'wdKit/Index';  
3 -import { ContentType } from 'wdRouter/Index'; 2 +import { ContentType } from '../common/ContentType';
4 3
5 -export class DeepLinkUtil { 4 +export class AppInnerLinkGenerator {
6 5
7 private static DEEP_LINK_PREFIX = "rmrbapp://rmrb.app/openwith" 6 private static DEEP_LINK_PREFIX = "rmrbapp://rmrb.app/openwith"
8 7
9 static generateDeepLinkWithConent(content: ContentDetailDTO): string { 8 static generateDeepLinkWithConent(content: ContentDetailDTO): string {
10 9
11 - return DeepLinkUtil.generate(content.newsType, content.newsId +'', content.reLInfo?.relId, content.newsLinkUrl) 10 + return AppInnerLinkGenerator.generate(content.newsType, content.newsId +'', content.reLInfo?.relId, content.newsLinkUrl)
12 } 11 }
13 12
14 static generateDeepLinkWithProgram(content: ContentDTO) { 13 static generateDeepLinkWithProgram(content: ContentDTO) {
15 14
16 - return DeepLinkUtil.generate(Number(content.objectType), content.objectId +'', content.relId, content.linkUrl) 15 + return AppInnerLinkGenerator.generate(Number(content.objectType), content.objectId +'', content.relId, content.linkUrl)
17 } 16 }
18 17
19 static generateDeepLinkWithFrontObjectLink(content: FrontLinkObject) { 18 static generateDeepLinkWithFrontObjectLink(content: FrontLinkObject) {
20 - return DeepLinkUtil.generate(Number(content.newsType), content.newsId +'', content.newsRelId + '', content.linkUrl) 19 + return AppInnerLinkGenerator.generate(Number(content.newsType), content.newsId +'', content.newsRelId + '', content.linkUrl)
21 } 20 }
22 21
23 private static generate(contentType: number, contentId?: string, relId?: string, link?: string): string { 22 private static generate(contentType: number, contentId?: string, relId?: string, link?: string): string {
24 - let deeplink = DeepLinkUtil.DEEP_LINK_PREFIX 23 + let deeplink = AppInnerLinkGenerator.DEEP_LINK_PREFIX
25 24
26 let pubParam = `&contentId=${contentId}&relId=${relId}&skipType=1` 25 let pubParam = `&contentId=${contentId}&relId=${relId}&skipType=1`
27 26
1 1
2 export { WDShare } from './src/main/ets/WDShare' 2 export { WDShare } from './src/main/ets/WDShare'
3 -  
4 -export { DeepLinkUtil } from "./src/main/ets/utils/DeepLinkUtil"  
@@ -2,7 +2,10 @@ import { ContentDetailDTO, ContentDTO, PageInfoDTO, ShareInfoDTO, TopicInfo } fr @@ -2,7 +2,10 @@ import { ContentDetailDTO, ContentDTO, PageInfoDTO, ShareInfoDTO, TopicInfo } fr
2 import { SharePosterItemBean } from 'wdBean/src/main/ets/bean/detail/SharePosterItemBean'; 2 import { SharePosterItemBean } from 'wdBean/src/main/ets/bean/detail/SharePosterItemBean';
3 import { ShareScene, ShareType, WDShareBase } from 'wdShareBase/Index'; 3 import { ShareScene, ShareType, WDShareBase } from 'wdShareBase/Index';
4 import { ShareContentType } from 'wdShareBase/src/main/ets/Constant'; 4 import { ShareContentType } from 'wdShareBase/src/main/ets/Constant';
5 -import { DeepLinkUtil } from './utils/DeepLinkUtil'; 5 +import { bundleManager } from '@kit.AbilityKit';
  6 +import { hilog } from '@kit.PerformanceAnalysisKit';
  7 +import { BusinessError } from '@kit.BasicServicesKit';
  8 +import { AppInnerLinkGenerator } from 'wdRouter';
6 9
7 export class WDShare { 10 export class WDShare {
8 11
@@ -18,7 +21,7 @@ export class WDShare { @@ -18,7 +21,7 @@ export class WDShare {
18 title: content.shareInfo.shareTitle, 21 title: content.shareInfo.shareTitle,
19 desc: content.shareInfo.shareSummary, 22 desc: content.shareInfo.shareSummary,
20 link: content.shareInfo.shareUrl, 23 link: content.shareInfo.shareUrl,
21 - deeplink:DeepLinkUtil.generateDeepLinkWithConent(content), 24 + deeplink:AppInnerLinkGenerator.generateDeepLinkWithConent(content),
22 } 25 }
23 }) 26 })
24 } 27 }
@@ -34,7 +37,7 @@ export class WDShare { @@ -34,7 +37,7 @@ export class WDShare {
34 title: program.shareInfo.shareTitle, 37 title: program.shareInfo.shareTitle,
35 desc: program.shareInfo.shareSummary, 38 desc: program.shareInfo.shareSummary,
36 link: program.shareInfo.shareUrl, 39 link: program.shareInfo.shareUrl,
37 - deeplink:DeepLinkUtil.generateDeepLinkWithProgram(program), 40 + deeplink:AppInnerLinkGenerator.generateDeepLinkWithProgram(program),
38 } 41 }
39 }) 42 })
40 } 43 }
1 import { CompInfoBean, ContentDTO, PageInfoBean } from 'wdBean/Index'; 1 import { CompInfoBean, ContentDTO, PageInfoBean } from 'wdBean/Index';
2 import { MorningEveningViewModel } from 'wdComponent/Index'; 2 import { MorningEveningViewModel } from 'wdComponent/Index';
3 import { CrptoUtils, FileUtils, Logger } from 'wdKit/Index'; 3 import { CrptoUtils, FileUtils, Logger } from 'wdKit/Index';
4 -import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork/Index';  
5 -import { DeepLinkUtil } from 'wdShare/Index'  
6 -import { FormNewspaperPaperType, FormNewspaperPaperInfo, FormNewspaperPaperContent, 4 +import { FormNewspaperPaperType, FormNewspaperPaperContent,
7 FormNewspaperData } from "../dailynewspaperwidget/common/NewspaperWidgetData" 5 FormNewspaperData } from "../dailynewspaperwidget/common/NewspaperWidgetData"
8 import { http } from '@kit.NetworkKit'; 6 import { http } from '@kit.NetworkKit';
9 import fs from '@ohos.file.fs'; 7 import fs from '@ohos.file.fs';
10 import { BusinessError } from '@kit.BasicServicesKit'; 8 import { BusinessError } from '@kit.BasicServicesKit';
11 import { JSON } from '@kit.ArkTS'; 9 import { JSON } from '@kit.ArkTS';
  10 +import { AppInnerLinkGenerator } from 'wdRouter';
12 11
13 const TAG = "NewspaperDataFetcher" 12 const TAG = "NewspaperDataFetcher"
14 13
@@ -38,7 +37,7 @@ export class NewspaperDataFetcher { @@ -38,7 +37,7 @@ export class NewspaperDataFetcher {
38 data.paperInfo.showLeftImage = true 37 data.paperInfo.showLeftImage = true
39 data.paperInfo.leftImageUrl = page.topicInfo.frontLinkObject.coverUrl 38 data.paperInfo.leftImageUrl = page.topicInfo.frontLinkObject.coverUrl
40 data.paperInfo.leftTitle = page.topicInfo.frontLinkObject.title 39 data.paperInfo.leftTitle = page.topicInfo.frontLinkObject.title
41 - data.paperInfo.leftDeepLink = DeepLinkUtil.generateDeepLinkWithFrontObjectLink(page.topicInfo.frontLinkObject) 40 + data.paperInfo.leftDeepLink = AppInnerLinkGenerator.generateDeepLinkWithFrontObjectLink(page.topicInfo.frontLinkObject)
42 } 41 }
43 42
44 let contents: ContentDTO[] = compInfo.compList[0].operDataList as ContentDTO[] 43 let contents: ContentDTO[] = compInfo.compList[0].operDataList as ContentDTO[]
@@ -47,7 +46,7 @@ export class NewspaperDataFetcher { @@ -47,7 +46,7 @@ export class NewspaperDataFetcher {
47 let content : FormNewspaperPaperContent = { 46 let content : FormNewspaperPaperContent = {
48 title: contentDTO.newsTitle, 47 title: contentDTO.newsTitle,
49 coverUrl: contentDTO.coverUrl, 48 coverUrl: contentDTO.coverUrl,
50 - deepLink: DeepLinkUtil.generateDeepLinkWithProgram(contentDTO) 49 + deepLink: AppInnerLinkGenerator.generateDeepLinkWithProgram(contentDTO)
51 } 50 }
52 return content 51 return content
53 }) 52 })