| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import { BuildATSplashAdView } from 'anythink_sdk'
- import { windowHelper } from '../../../utils/arkts/utils/WindowHelper'
- import { tkStartAd, TkStartAd } from '../utils/TkStartAd'
- @Component
- export struct TkStartAdComp {
- @BuilderParam @Require placeholderComponent: () => void
- @State private tkStartAd: TkStartAd = tkStartAd
- @State private isLoaded: boolean = false
- aboutToAppear(): void {
- const id = setTimeout(() => {
- this.tkStartAd.showAd = false
- }, 5000)
- this.tkStartAd.loadedCallBack = () => {
- if (this.tkStartAd.splashAd.isAdReady()) {
- this.isLoaded = true
- }
- clearTimeout(id)
- }
- this.tkStartAd.onAdClosed = () => {
- this.tkStartAd.showAd = false
- }
- }
- build() {
- if (this.tkStartAd.showAd) {
- Stack() {
- Column() {
- this.placeholderComponent()
- }
- .width('100%')
- .height('100%')
- .backgroundColor(Color.White)
- .justifyContent(FlexAlign.Center)
- if (this.isLoaded) {
- BuildATSplashAdView(this.tkStartAd.splashAd, { windowStage: windowHelper.windowStage })
- }
- }
- }
- }
- }
|