Showing
6 changed files
with
28 additions
and
8 deletions
| @@ -64,4 +64,6 @@ export class SpConstants{ | @@ -64,4 +64,6 @@ export class SpConstants{ | ||
| 64 | // 个推推送 | 64 | // 个推推送 |
| 65 | static GETUI_PUSH_CID = "cid" | 65 | static GETUI_PUSH_CID = "cid" |
| 66 | static GETUI_PUSH_DEVICE_TOKEN = "deviceToken" | 66 | static GETUI_PUSH_DEVICE_TOKEN = "deviceToken" |
| 67 | + //link | ||
| 68 | + static HAS_LINK="has_link" | ||
| 67 | } | 69 | } |
| 1 | -import { Logger } from 'wdKit' | 1 | +import { Logger, SPHelper, StringUtils } from 'wdKit' |
| 2 | import { Want } from '@kit.AbilityKit' | 2 | import { Want } from '@kit.AbilityKit' |
| 3 | import { url } from '@kit.ArkTS' | 3 | import { url } from '@kit.ArkTS' |
| 4 | import { AppInnerLinkGenerator } from './AppInnerLinkGenerator' | 4 | import { AppInnerLinkGenerator } from './AppInnerLinkGenerator' |
| @@ -6,6 +6,7 @@ import { ContentType } from '../common/ContentType' | @@ -6,6 +6,7 @@ import { ContentType } from '../common/ContentType' | ||
| 6 | import { AppInnerLink } from './AppInnerLink' | 6 | import { AppInnerLink } from './AppInnerLink' |
| 7 | import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork' | 7 | import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork' |
| 8 | import { ContentDetailDTO } from 'wdBean' | 8 | import { ContentDetailDTO } from 'wdBean' |
| 9 | +import { SpConstants } from 'wdConstant' | ||
| 9 | 10 | ||
| 10 | const TAG = "AppLinkingManager" | 11 | const TAG = "AppLinkingManager" |
| 11 | 12 | ||
| @@ -16,6 +17,7 @@ export class AppLinkingManager { | @@ -16,6 +17,7 @@ export class AppLinkingManager { | ||
| 16 | 17 | ||
| 17 | private hasEnterMain = false | 18 | private hasEnterMain = false |
| 18 | private lastUrlObj?: url.URL | 19 | private lastUrlObj?: url.URL |
| 20 | + private isJumpInnerLink:boolean = true | ||
| 19 | 21 | ||
| 20 | private static manager: AppLinkingManager | 22 | private static manager: AppLinkingManager |
| 21 | private constructor() { | 23 | private constructor() { |
| @@ -58,13 +60,19 @@ export class AppLinkingManager { | @@ -58,13 +60,19 @@ export class AppLinkingManager { | ||
| 58 | this.comsumeLastUriContent() | 60 | this.comsumeLastUriContent() |
| 59 | } | 61 | } |
| 60 | 62 | ||
| 61 | - comsumeLastUriContent() { | 63 | + comsumeLastUriContent(isJump:boolean = true) { |
| 64 | + this.isJumpInnerLink = isJump | ||
| 62 | Logger.debug(TAG, "尝试消费拉起链接: " + this.lastUrlObj?.toString()) | 65 | Logger.debug(TAG, "尝试消费拉起链接: " + this.lastUrlObj?.toString()) |
| 63 | if (!this.lastUrlObj) { | 66 | if (!this.lastUrlObj) { |
| 64 | return | 67 | return |
| 65 | } | 68 | } |
| 66 | let path = this.lastUrlObj?.pathname ?? "" | 69 | let path = this.lastUrlObj?.pathname ?? "" |
| 67 | 70 | ||
| 71 | + if(!this.isJumpInnerLink && StringUtils.isNotEmpty(path)){ | ||
| 72 | + SPHelper.default.save(SpConstants.HAS_LINK, true) | ||
| 73 | + return | ||
| 74 | + } | ||
| 75 | + | ||
| 68 | if (this.dealWithRMHArticle() | 76 | if (this.dealWithRMHArticle() |
| 69 | || this.dealWithNormalArticle() | 77 | || this.dealWithNormalArticle() |
| 70 | || this.dealWithCreator() | 78 | || this.dealWithCreator() |
| @@ -187,7 +195,9 @@ export class AppLinkingManager { | @@ -187,7 +195,9 @@ export class AppLinkingManager { | ||
| 187 | } | 195 | } |
| 188 | 196 | ||
| 189 | jumpInnerLink(innerLink: string) { | 197 | jumpInnerLink(innerLink: string) { |
| 190 | - Logger.debug(TAG, "即将跳转链接: " + innerLink) | ||
| 191 | - AppInnerLink.jumpWithLink(innerLink) | 198 | + if(this.isJumpInnerLink){ |
| 199 | + Logger.debug(TAG, "即将跳转链接: " + innerLink) | ||
| 200 | + AppInnerLink.jumpWithLink(innerLink) | ||
| 201 | + } | ||
| 192 | } | 202 | } |
| 193 | } | 203 | } |
| @@ -118,7 +118,6 @@ export struct MoreComponent { | @@ -118,7 +118,6 @@ export struct MoreComponent { | ||
| 118 | let contentDTO = MinePageDatasModel.dataTransform(rem,value, photos); | 118 | let contentDTO = MinePageDatasModel.dataTransform(rem,value, photos); |
| 119 | if(value.type != "13"){ | 119 | if(value.type != "13"){ |
| 120 | this.contentDTO.sameContentList.push(contentDTO) | 120 | this.contentDTO.sameContentList.push(contentDTO) |
| 121 | - console.log("ycg","123") | ||
| 122 | } | 121 | } |
| 123 | }) | 122 | }) |
| 124 | 123 |
| @@ -7,6 +7,7 @@ import { BusinessError } from '@ohos.base'; | @@ -7,6 +7,7 @@ import { BusinessError } from '@ohos.base'; | ||
| 7 | import { DeviceUtil, EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdKit'; | 7 | import { DeviceUtil, EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdKit'; |
| 8 | import { ConfigurationConstant } from '@kit.AbilityKit'; | 8 | import { ConfigurationConstant } from '@kit.AbilityKit'; |
| 9 | import { StartupManager } from '../startupmanager/StartupManager'; | 9 | import { StartupManager } from '../startupmanager/StartupManager'; |
| 10 | +import { AppLinkingManager } from 'wdRouter'; | ||
| 10 | 11 | ||
| 11 | let floatWindowClass: window.Window | null = null; | 12 | let floatWindowClass: window.Window | null = null; |
| 12 | const TAG = 'EntryAbility' | 13 | const TAG = 'EntryAbility' |
| @@ -19,7 +20,8 @@ export default class EntryAbility extends UIAbility { | @@ -19,7 +20,8 @@ export default class EntryAbility extends UIAbility { | ||
| 19 | StartupManager.sharedInstance().appAgreedProtocol() | 20 | StartupManager.sharedInstance().appAgreedProtocol() |
| 20 | } | 21 | } |
| 21 | Logger.info(TAG, 'Ability onCreate'); | 22 | Logger.info(TAG, 'Ability onCreate'); |
| 22 | - | 23 | + //只判断不跳转 |
| 24 | + AppLinkingManager.sharedInstance().comsumeLastUriContent(false) | ||
| 23 | // 还没深色模式需求,暂直接不跟随系统。 | 25 | // 还没深色模式需求,暂直接不跟随系统。 |
| 24 | this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT); | 26 | this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT); |
| 25 | 27 |
| @@ -59,7 +59,14 @@ struct LaunchPage { | @@ -59,7 +59,14 @@ struct LaunchPage { | ||
| 59 | this.timerId = setTimeout(() => { | 59 | this.timerId = setTimeout(() => { |
| 60 | this.isJumpToAdvertising = true; | 60 | this.isJumpToAdvertising = true; |
| 61 | 61 | ||
| 62 | - WDRouterRule.jumpWithPage(WDRouterPage.launchAdvertisingPage) | 62 | + let hasLink = SPHelper.default.getSync(SpConstants.HAS_LINK,false) |
| 63 | + if(hasLink){ | ||
| 64 | + SPHelper.default.deleteSync(SpConstants.HAS_LINK) | ||
| 65 | + WDRouterRule.jumpWithPage(WDRouterPage.mainPage) | ||
| 66 | + }else{ | ||
| 67 | + WDRouterRule.jumpWithPage(WDRouterPage.launchAdvertisingPage) | ||
| 68 | + } | ||
| 69 | + | ||
| 63 | 70 | ||
| 64 | // router.pushUrl({ | 71 | // router.pushUrl({ |
| 65 | // url: 'pages/LaunchAdvertisingPage' | 72 | // url: 'pages/LaunchAdvertisingPage' |
| @@ -214,7 +214,7 @@ export struct BottomNavigationComponent { | @@ -214,7 +214,7 @@ export struct BottomNavigationComponent { | ||
| 214 | }, | 214 | }, |
| 215 | onLoadListener:{ | 215 | onLoadListener:{ |
| 216 | onLoadFailed:(err)=>{ | 216 | onLoadFailed:(err)=>{ |
| 217 | - console.error("ycg","Load Failed Reason: " + err + " cost " + (new Date().getTime() ) + " milliseconds"); | 217 | + console.error("Load Failed Reason: " + err + " cost " + (new Date().getTime() ) + " milliseconds"); |
| 218 | } | 218 | } |
| 219 | } | 219 | } |
| 220 | }; | 220 | }; |
-
Please register or login to post a comment