Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
liyubing
2024-06-07 11:23:54 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
ea59eb916dd1585d6a4f18ef5a163889a5dcba9d
ea59eb91
2 parents
e5b9dff1
5ff07358
Merge remote-tracking branch 'origin/main'
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
339 additions
and
69 deletions
sight_harmony/commons/wdKit/Index.ets
sight_harmony/commons/wdKit/src/main/ets/utils/CrptoUtils.ets
sight_harmony/commons/wdKit/src/main/ets/utils/FileUtils.ets
sight_harmony/commons/wdRouter/src/main/ets/router/Action2Page.ets
sight_harmony/commons/wdRouter/src/main/ets/utils/AppInnerLink.ets
sight_harmony/commons/wdRouter/src/main/ets/utils/ProcessUtils.ets
sight_harmony/features/wdBean/src/main/ets/bean/content/Params.ts
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card17Component.ets
sight_harmony/features/wdShare/src/main/ets/utils/DeepLinkUtil.ets
sight_harmony/products/phone/src/main/ets/dailynewspaperformability/DailyNewspaperFormAbility.ets
sight_harmony/products/phone/src/main/ets/dailynewspaperformability/NewspaperDataFetcher.ets
sight_harmony/products/phone/src/main/ets/dailynewspaperwidget/common/NewspaperWidgetData.ets
sight_harmony/products/phone/src/main/ets/dailynewspaperwidget/pages/DailyNewspaperWidgetCard.ets
sight_harmony/products/phone/src/main/ets/startupmanager/StartupManager.ets
sight_harmony/products/phone/src/main/resources/base/profile/form_config.json
sight_harmony/commons/wdKit/Index.ets
View file @
ea59eb9
...
...
@@ -68,3 +68,7 @@ export { FastClickUtil } from './src/main/ets/utils/FastClickUtil';
// export { PublicPopupDialogView } from "./src/main/ets/pubComps/dialog/PublicPopupDialogView"
export { PublicDialogManager, CloseAction } from "./src/main/ets/pubComps/dialog/PublicDialogManager"
export { CrptoUtils } from "./src/main/ets/utils/CrptoUtils"
export { FileUtils } from "./src/main/ets/utils/FileUtils"
\ No newline at end of file
...
...
sight_harmony/commons/wdKit/src/main/ets/utils/CrptoUtils.ets
0 → 100644
View file @
ea59eb9
import cryptoFramework from '@ohos.security.cryptoFramework';
import buffer from '@ohos.buffer';
export class CrptoUtils {
static md5(message: string) : Promise<string> {
return CrptoUtils.mdFunc(message, 'MD5')
}
static mdFunc(message: string, algoName: string = 'MD5'): Promise<string> {
return new Promise<string>(async (reslove, fail) => {
try {
let md = cryptoFramework.createMd(algoName);
// 数据量较少时,可以只做一次update,将数据全部传入,接口未对入参长度做限制
await md.update({ data: new Uint8Array(buffer.from(message, 'utf-8').buffer) });
let mdResult = await md.digest();
// console.info('Md result:' + mdResult.data);
// const string = mdResult.data.map((charCode, index, array) => {
// return String.fromCharCode(charCode)
// }).join("")
let string = "";
for (let i = 0; i < mdResult.data.length; i++) {
string += mdResult.data[i].toString(16).padStart(2, "0")
}
// const string = mdResult.data.join('')
reslove(string)
} catch (e) {
fail(e)
}
})
}
}
...
...
sight_harmony/commons/wdKit/src/main/ets/utils/FileUtils.ets
0 → 100644
View file @
ea59eb9
import fs from '@ohos.file.fs';
import { BusinessError } from '@kit.BasicServicesKit';
export class FileUtils {
// 文件是否存在,忽略错误
static fileExsit(path: string) : Promise<boolean> {
return new Promise((reslove, fail) => {
fs.stat(path).then(() => {
reslove(true)
}).catch((error: BusinessError) => {
if (error.code = 13900002) {
reslove(false)
} else {
reslove(true)
}
})
});
}
static makeDirIfNotExsit(path: string) : Promise<void> {
return new Promise((reslove, fail) => {
fs.stat(path).then(() => {
reslove()
}).catch((error: BusinessError) => {
if (error.code = 13900002) {
fs.mkdirSync(path)
}
reslove()
})
})
}
}
\ No newline at end of file
...
...
sight_harmony/commons/wdRouter/src/main/ets/router/Action2Page.ets
View file @
ea59eb9
...
...
@@ -49,9 +49,9 @@ export function registerRouter() {
// })
Action2Page.register("JUMP_DETAIL_PAGE", (action: Action) => {
if (action.params?.detailPageType == 2
|| action.params?.detailPageType == 6
) {
if (action.params?.detailPageType == 2) {
return WDRouterPage.detailPlayLiveCommon
} else if (action.params?.detailPageType ==
7 || action.params?.detailPageType == 8
) {
} else if (action.params?.detailPageType ==
1
) {
return WDRouterPage.detailVideoListPage
} else if (action.params?.detailPageType == 9) {
//图集详情页
...
...
@@ -59,16 +59,19 @@ export function registerRouter() {
} else if (action.params?.detailPageType == 14 || action.params?.detailPageType == 15) {
//动态详情页
return WDRouterPage.dynamicDetailPage
} else if (action.params?.detailPageType == 17) {
return WDRouterPage.multiPictureDetailPage
} else if (action.params?.detailPageType == 13) {
return WDRouterPage.audioDetail
} else if (action.params?.detailPageType == 18) {
} else if (action.params?.detailPageType == 30) {
return WDRouterPage.themeListPage
} else if (action.params?.detailPageType == 8) {
return WDRouterPage.imageTextDetailPage
}
//TODO: 以下两个最好改为pageID方式,以上都是有具体内容类型 对应详情页面
else if (action.params?.detailPageType == 18) {
return WDRouterPage.multiPictureListPage
} else if (action.params?.detailPageType == 19) {
return WDRouterPage.videoPlayPage
}else if (action.params?.detailPageType == 30) {
return WDRouterPage.themeListPage
}
return WDRouterPage.detailPlayVodPage
})
...
...
sight_harmony/commons/wdRouter/src/main/ets/utils/AppInnerLink.ets
View file @
ea59eb9
...
...
@@ -3,6 +3,7 @@ import App from '@system.app'
import { Action, Params } from 'wdBean/Index'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { Logger } from 'wdKit/Index'
import { ContentType } from '../common/ContentType'
import { WDRouterRule } from '../router/WDRouterRule'
import { ProcessUtils } from './ProcessUtils'
...
...
@@ -111,13 +112,13 @@ export class AppInnerLink {
}
private static contentTypeWithType(type?: string) : number | undefined {
switch (type) {
case "video": return 1
case "dynamic": return 14
case "live": return 2
case "audio": return 13
case "picture": return 9
case "article": return 8
case "ask": return 16
case "video": return ContentType.Video
case "dynamic": return ContentType.DynamicImageText
case "live": return ContentType.Live
case "audio": return ContentType.Audio
case "picture": return ContentType.Pictures
case "article": return ContentType.ImageText
case "ask": return ContentType.Ask
}
return
}
...
...
sight_harmony/commons/wdRouter/src/main/ets/utils/ProcessUtils.ets
View file @
ea59eb9
...
...
@@ -304,7 +304,7 @@ export class ProcessUtils {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType:
7
,
detailPageType:
1
,
contentID: content?.objectId,
extra: {
relType: content?.relType,
...
...
@@ -382,7 +382,7 @@ export class ProcessUtils {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType:
17
,
detailPageType:
9
,
contentID: content?.objectId,
extra: {
relType: content?.relType,
...
...
sight_harmony/features/wdBean/src/main/ets/bean/content/Params.ts
View file @
ea59eb9
...
...
@@ -10,16 +10,13 @@ export interface Params {
// 详情页类型
// 1.点播详情页
// 2.直播详情页
// 3.图文详情页
// 4.全民播详情页
// 5.欢喜详情页
// 6.挂件详情页
// 7.沉浸式竖屏详情页
// 8.专辑竖屏详情页
// 13.音频详情页
// 17.多图(图集)详情页
// 18.大图列表页
// 19.单个视频播放页
// 8.图文详情页
// 9.多图(图集)详情页
// 14和15 动态详情页
// 13 音频详情页
// 30 金刚位
// 18.大图列表页 - 图片预览 ------ 需要变更待定
// 19.单个视频播放页 - 视频播放 ----- 需要变更待定
detailPageType
?:
number
;
// 详情页类型
liveStyle
?:
number
;
// 直播类型:0横屏,1竖屏
creatorId
?:
string
;
//号主id
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card17Component.ets
View file @
ea59eb9
...
...
@@ -116,7 +116,7 @@ export struct Card17Component {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType:
17
,
detailPageType:
9
,
contentID: this.contentDTO.objectId,
extra: {
relType: this.contentDTO.relType,
...
...
sight_harmony/features/wdShare/src/main/ets/utils/DeepLinkUtil.ets
View file @
ea59eb9
...
...
@@ -4,7 +4,7 @@ import { ContentType } from 'wdRouter/Index';
export class DeepLinkUtil {
private static DEEP_LINK_PREFIX = "rmrbapp:rmrb.app/openwith"
private static DEEP_LINK_PREFIX = "rmrbapp:
//
rmrb.app/openwith"
static generateDeepLinkWithConent(content: ContentDetailDTO): string {
...
...
@@ -23,7 +23,7 @@ export class DeepLinkUtil {
private static generate(contentType: number, contentId?: string, relId?: string, link?: string): string {
let deeplink = DeepLinkUtil.DEEP_LINK_PREFIX
let pubParam = `&contentId=${contentId}
}
&relId=${relId}&skipType=1`
let pubParam = `&contentId=${contentId}&relId=${relId}&skipType=1`
let type: ContentType = Number(contentType)
switch (type) {
...
...
@@ -38,7 +38,7 @@ export class DeepLinkUtil {
deeplink += "?type=article&subType=h5"
deeplink += "&url=" + encodeURIComponent(link)
} else {
deeplink += "type=article&subType=h5_template_article"
deeplink += "
?
type=article&subType=h5_template_article"
}
break
case ContentType.DynamicImageText:
...
...
sight_harmony/products/phone/src/main/ets/dailynewspaperformability/DailyNewspaperFormAbility.ets
View file @
ea59eb9
import { formBindingData, FormExtensionAbility, formInfo, formProvider } from '@kit.FormKit';
import { Want } from '@kit.AbilityKit';
import { Logger, NetworkManager, SPHelper, StringUtils } from 'wdKit/Index';
import {
FileUtils,
Logger, NetworkManager, SPHelper, StringUtils } from 'wdKit/Index';
import { BusinessError } from '@kit.BasicServicesKit';
import {
FormDataType,
NewspaperDataFetcher } from './NewspaperDataFetcher';
import { NewspaperDataFetcher } from './NewspaperDataFetcher';
import { JSON } from '@kit.ArkTS';
import { FormNewspaperPaperType } from '../dailynewspaperwidget/common/NewspaperWidgetData';
import { FormNewspaper
Data, FormNewspaper
PaperType } from '../dailynewspaperwidget/common/NewspaperWidgetData';
import { HostEnum, HostManager, WDHttp } from 'wdNetwork/Index';
import fs from '@ohos.file.fs';
const TAG = "DailyNewspaperFormAbility"
export default class DailyNewspaperFormAbility extends FormExtensionAbility {
lastDatas: Record<string, FormNewspaperData> = {}
onAddForm(want: Want) {
Logger.debug(TAG, "onAddForm with " + JSON.stringify(want))
...
...
@@ -20,18 +23,11 @@ export default class DailyNewspaperFormAbility extends FormExtensionAbility {
let isTempCard = want.parameters[formInfo.FormParam.TEMPORARY_KEY] as boolean
if (isTempCard === false) { // 如果为常态卡片,直接进行信息持久化
Logger.debug(TAG, "开始刷新数据");
NewspaperDataFetcher.refreshDailyPaper().then((data) => {
let formData = formBindingData.createFormBindingData(data);
formProvider.updateForm(formId, formData).catch((err: BusinessError) => {
Logger.debug(TAG, ` xFailed to updateForm. Code: ${err.code}, message: ${err.message}`);
});
})
this.fetchAndRefreshData(formId)
}
}
let obj: Form
DataType = {}
let obj: Form
NewspaperData = {} as FormNewspaperData
obj.paperType = FormNewspaperPaperType.unknown
let formData = formBindingData.createFormBindingData(obj);
return formData;
...
...
@@ -45,13 +41,9 @@ export default class DailyNewspaperFormAbility extends FormExtensionAbility {
onUpdateForm(formId: string) {
// 若卡片支持定时更新/定点更新/卡片使用方主动请求更新功能,则提供方需要重写该方法以支持数据更新
Logger.debug(TAG, 'onUpdateForm ' + formId);
NewspaperDataFetcher.refreshDailyPaper().then((data) => {
let formData = formBindingData.createFormBindingData(data);
formProvider.updateForm(formId, formData).catch((err: BusinessError) => {
Logger.debug(TAG, ` xFailed to updateForm. Code: ${err.code}, message: ${err.message}`);
});
})
this.initApp()
this.fetchAndRefreshData(formId)
}
onFormEvent(formId: string, message: string) {
...
...
@@ -61,7 +53,9 @@ export default class DailyNewspaperFormAbility extends FormExtensionAbility {
onRemoveForm(formId: string) {
// 当对应的卡片删除时触发的回调,入参是被删除的卡片ID
Logger.debug(TAG, 'onRemoveForm');
Logger.debug(TAG, 'onRemoveForm / formId: ' + formId);
let data = this.lastDatas[formId]
NewspaperDataFetcher.closeFilesWith(data)
}
// onConfigurationUpdate(config: Configuration) {
...
...
@@ -75,6 +69,32 @@ export default class DailyNewspaperFormAbility extends FormExtensionAbility {
return formInfo.FormState.READY;
}
fetchAndRefreshData(formId: string) {
Logger.debug(TAG, "开始刷新数据");
NewspaperDataFetcher.refreshDailyPaper().then(async (data) => {
let formData = formBindingData.createFormBindingData(data);
formProvider.updateForm(formId, formData).then(() => {
this.lastDatas[formId] = data
}).catch((err: BusinessError) => {
Logger.debug(TAG, ` xFailed to updateForm. Code: ${err.code}, message: ${err.message}`);
});
let fileDir = this.context.getApplicationContext().filesDir + "/widget-daily-newspaper"
await FileUtils.makeDirIfNotExsit(fileDir)
NewspaperDataFetcher.dealWithPictures(data, formId, fileDir, (data) => {
Logger.debug(TAG, `refresh ui with new pictuers`);
let formData = formBindingData.createFormBindingData(data);
formProvider.updateForm(formId, formData).then(() => {
this.lastDatas[formId] = data
}).catch((err: BusinessError) => {
Logger.error(TAG, ` xFailed to updateForm. Code: ${err.code}, message: ${err.message}`);
});
})
})
}
initApp() {
// KV存储
SPHelper.init(this.context);
...
...
sight_harmony/products/phone/src/main/ets/dailynewspaperformability/NewspaperDataFetcher.ets
View file @
ea59eb9
import { CompInfoBean, ContentDTO, PageInfoBean } from 'wdBean/Index';
import { MorningEveningViewModel } from 'wdComponent/Index';
import { Logger } from 'wdKit/Index';
import {
CrptoUtils, FileUtils,
Logger } from 'wdKit/Index';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork/Index';
import { DeepLinkUtil } from 'wdShare/Index'
import { FormNewspaperPaperType, FormNewspaperPaperInfo, FormNewspaperPaperContent } from "../dailynewspaperwidget/common/NewspaperWidgetData"
import { FormNewspaperPaperType, FormNewspaperPaperInfo, FormNewspaperPaperContent,
FormNewspaperData } from "../dailynewspaperwidget/common/NewspaperWidgetData"
import { http } from '@kit.NetworkKit';
import fs from '@ohos.file.fs';
import { BusinessError } from '@kit.BasicServicesKit';
import { JSON } from '@kit.ArkTS';
const TAG = "NewspaperDataFetcher"
export type FormDataType = Record<string, FormNewspaperPaperType | FormNewspaperPaperInfo | FormNewspaperPaperContent[]>
//
export type FormDataType = Record<string, FormNewspaperPaperType | FormNewspaperPaperInfo | FormNewspaperPaperContent[]>
export class NewspaperDataFetcher {
public static async refreshDailyPaper(): Promise<FormDataType> {
return new Promise<FormDataType>(async (reslove, fail) => {
public static async refreshDailyPaper(): Promise<FormNewspaperData> {
return new Promise<FormNewspaperData>(async (reslove, fail) => {
let data: Form
DataType = { 'paperType': FormNewspaperPaperType.unknown }
let data: Form
NewspaperData = new FormNewspaperData()
data.paperInfo = { showLeftImage: false }
try {
let page: PageInfoBean = await MorningEveningViewModel.getDailyPaperTopic()
data.paperType = page.topicInfo?.
frontFlag
|| FormNewspaperPaperType.unknown
data.paperType = page.topicInfo?.
topicPattern
|| FormNewspaperPaperType.unknown
let currentTime = new Date().getTime()
let compInfo = await MorningEveningViewModel.getMorningEveningCompInfo(
...
...
@@ -29,7 +34,7 @@ export class NewspaperDataFetcher {
page.topicInfo?.topicId
)
if (page.topicInfo.frontLinkObject) {
if (page.topicInfo
?.frontFlag && page.topicInfo
.frontLinkObject) {
data.paperInfo.showLeftImage = true
data.paperInfo.leftImageUrl = page.topicInfo.frontLinkObject.coverUrl
data.paperInfo.leftTitle = page.topicInfo.frontLinkObject.title
...
...
@@ -60,7 +65,7 @@ export class NewspaperDataFetcher {
})
}
static fakeData(): Form
DataType
{
static fakeData(): Form
NewspaperData
{
let data : FormNewspaperPaperContent = {
title: "标题标题标题标题标题标题标题标题",
coverUrl: "https://"
...
...
@@ -72,6 +77,135 @@ export class NewspaperDataFetcher {
leftTitle: "leftTitleleftTitleleftTitleleftTitleleftTitleleftTitle"
},
"paperContents": [data, data, data]
} as FormNewspaperData
}
static dealWithPictures(data: FormNewspaperData, formId: string ,tempDir: string, refreshCallback:(data: FormNewspaperData) => void) {
let donwloadCount = data.paperContents.filter((value) => {
return value.coverUrl && value.coverUrl.length > 0
}).length
let fileFDs: Record<string, string | number> = {};
if (data.paperInfo.leftImageUrl) {
donwloadCount += 1
CrptoUtils.md5(data.paperInfo.leftImageUrl).then((md5String) => {
const fileName = formId + "file" + md5String;
const filePath = tempDir + "/" + fileName
NewspaperDataFetcher.downloadUrlToPath(data.paperInfo.leftImageUrl!, filePath).then(() => {
let file = fs.openSync(filePath)
fileFDs[fileName] = file.fd
data.paperInfo.localLeftImageFileName = fileName
data.formImages = fileFDs
if (--donwloadCount == 0) { refreshCallback(data) }
}).catch((e : BusinessError) => {
Logger.debug(TAG, "download file failed.");
if (--donwloadCount == 0) { refreshCallback(data) }
})
}).catch((e: BusinessError) => {
if (--donwloadCount == 0) { refreshCallback(data) }
})
}
for (let index = 0; index < data.paperContents.length; index++) {
const content = data.paperContents[index];
if (!content.coverUrl || content.coverUrl.length == 0) {
continue
}
CrptoUtils.md5(content.coverUrl).then((md5String) => {
const fileName = formId + "file" + md5String;
const filePath = tempDir + "/" + fileName
NewspaperDataFetcher.downloadUrlToPath(content.coverUrl!, filePath).then(() => {
Logger.debug(TAG, "open file for display ");
let file = fs.openSync(filePath)
fileFDs[fileName] = file.fd
data.paperContents[index].localCoverFileName = fileName
data.formImages = fileFDs
if (--donwloadCount == 0) { refreshCallback(data) }
}).catch((e : BusinessError) => {
Logger.debug(TAG, "download file failed." + JSON.stringify(e));
if (--donwloadCount == 0) { refreshCallback(data) }
})
}).catch((e: BusinessError) => {
if (--donwloadCount == 0) { refreshCallback(data) }
})
}
}
static closeFilesWith(data?: FormNewspaperData) {
if (data && data.formImages) {
for (const obj of Object.entries(data.formImages)) {
const fileName = obj[0]
let fd: number = obj[1] as number
fs.close(fd)
}
}
}
static downloadUrlToPath(url: string, toFilePath: string): Promise<void> {
Logger.debug(TAG, "will donwload url:" + url + " ======> " + toFilePath);
return new Promise((reslove, fail) => {
FileUtils.fileExsit(toFilePath).then((exsit: boolean) => {
if (exsit) {
Logger.debug(TAG, "file is exsit. " + toFilePath);
reslove()
return
}
NewspaperDataFetcher.downloadUrlToPathWithout(url, toFilePath).then(() => {
reslove()
}).catch((e: BusinessError) => {
fail(e)
})
}).catch((e: BusinessError) => {
NewspaperDataFetcher.downloadUrlToPathWithout(url, toFilePath).then(() => {
reslove()
}).catch((e: BusinessError) => {
fail(e)
})
})
})
}
static downloadUrlToPathWithout(url: string, toFilePath: string): Promise<void> {
Logger.debug(TAG, "will donwload url:" + url + " ======> " + toFilePath);
return new Promise((reslove, fail) => {
let httpRequest = http.createHttp()
httpRequest.request(url, (err, data) => {
if (!err && data.responseCode == http.ResponseCode.OK) {
let imgFile = fs.openSync(toFilePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
let wroteLength = 0
fs.write(imgFile.fd, data.result as ArrayBuffer).then((writeLen: number) => {
Logger.debug(TAG, "write data to file succeed and size is:" + writeLen);
wroteLength = writeLen
}).catch((err: BusinessError) => {
Logger.error(TAG, "write data to file failed with error message: " + err.message + ", error code: " + err.code);
}).finally(() => {
fs.closeSync(imgFile);
httpRequest.destroy()
wroteLength > 0 ? reslove() : fail("failed")
});
return
}
httpRequest.destroy()
fail("failed")
});
})
}
}
\ No newline at end of file
...
...
sight_harmony/products/phone/src/main/ets/dailynewspaperwidget/common/NewspaperWidgetData.ets
View file @
ea59eb9
...
...
@@ -11,6 +11,8 @@ export class FormNewspaperPaperInfo {
showLeftImage: boolean = false
leftImageUrl?: string
localLeftImageFileName?: ResourceStr // 传递图片用
localLeftImageFileFD? : number // 传递图片用
leftTitle?: string
leftDeepLink?: string
...
...
@@ -20,5 +22,15 @@ export class FormNewspaperPaperInfo {
export class FormNewspaperPaperContent {
title: string = ""
coverUrl?: string
localCoverFileName?: ResourceStr // 传递图片用
localCoverFileFD? : number // 传递图片用
deepLink: string = ""
}
export class FormNewspaperData {
paperType: FormNewspaperPaperType = FormNewspaperPaperType.unknown
paperInfo: FormNewspaperPaperInfo = {} as FormNewspaperPaperInfo
paperContents: FormNewspaperPaperContent[] = []
formImages: Record<string, string | number> = {}
}
\ No newline at end of file
...
...
sight_harmony/products/phone/src/main/ets/dailynewspaperwidget/pages/DailyNewspaperWidgetCard.ets
View file @
ea59eb9
...
...
@@ -43,8 +43,8 @@ struct DailyNewspaperWidgetCard {
@Builder leftImageView() {
Stack({ alignContent: Alignment.Bottom }) {
Image(this.paperInfo.leftImageUrl)
// Image($r("app.media.desktop_card_comp_place_holder_16_9"))
Image("memory://" + this.paperInfo.localLeftImageFileName)
// Image(this.paperInfo.leftImageUrl)
.alt($r("app.media.desktop_card_comp_place_holder_16_9"))
.objectFit(ImageFit.Cover)
.aspectRatio(87/116)
...
...
@@ -109,8 +109,8 @@ struct ContentCellView {
bottom: this.hasImage ? 0 : 6})
if (this.hasImage) {
Image(this.content.coverUrl)
// Image($r("app.media.desktop_card_comp_place_holder_3_4"))
Image("memory://" + this.content.localCoverFileName)
// Image(this.content.coverUrl)
.alt($r("app.media.desktop_card_comp_place_holder_3_4"))
.objectFit(ImageFit.Cover)
.height(40)
...
...
@@ -151,14 +151,12 @@ function jumpWithDeepLink(deepLink: string, component: Object) {
if (deepLink.length == 0) {
return
}
const deepLinkKey: string = NewspaperWidgetCommon.JumpParam.DeepLinkKey
const fromDailyNewspaperKey: string = NewspaperWidgetCommon.JumpParam.FromNewspaperWidgetKey
postCardAction(component, {
action: NewspaperWidgetCommon.PosterCardAction.ActionRouter,
abilityName: NewspaperWidgetCommon.PosterCardAction.MainAbilityName,
params: {
deepLinkKey: deepLink,
fromDailyNewspaperKey: true
"newspaper.widget.jump.deeplink": deepLink,
"newspaper.widget.jump.fromNewspaperWidget": 1
}
});
}
\ No newline at end of file
...
...
sight_harmony/products/phone/src/main/ets/startupmanager/StartupManager.ets
View file @
ea59eb9
...
...
@@ -12,13 +12,14 @@ import { DeviceUtil,
UmengStats } from 'wdKit/Index'
import { LoginModule } from 'wdLogin/Index'
import { HostEnum, HostManager, WDHttp } from 'wdNetwork/Index'
import { registerRouter } from 'wdRouter/Index'
import {
AppInnerLink,
registerRouter } from 'wdRouter/Index'
import { TrackingModule } from 'wdTracking/Index'
import { JSON } from '@kit.ArkTS'
import app from '@system.app'
import { GetuiPush, HWLocationUtils } from 'wdHwAbility/Index'
import { ImageKnife, ImageKnifeGlobal } from '@ohos/imageknife'
import { webview } from '@kit.ArkWeb'
import { NewspaperWidgetCommon } from '../dailynewspaperwidget/common/NewspaperWidgetCommon'
const TAG = "[StartupManager]"
...
...
@@ -26,6 +27,7 @@ const TAG = "[StartupManager]"
export class StartupManager {
private context?: common.UIAbilityContext
private lastStartupWant?: Want
private constructor() {
}
...
...
@@ -74,10 +76,14 @@ export class StartupManager {
// 通知栏点击后启动
GetuiPush.sharedInstance().onWant(want)
Logger.debug(TAG, "App onCreate: finised")
this.lastStartupWant = want
}
appOnNewWant(want: Want, launchParam: AbilityConstant.LaunchParam) {
GetuiPush.sharedInstance().onNewWant(want)
this.dealWithDeepLink(want)
}
appOnDestory() {
...
...
@@ -124,6 +130,10 @@ export class StartupManager {
//TODO:
// 提前初始化webview
webview.WebviewController.initializeWebEngine()
if (this.lastStartupWant && this.dealWithDeepLink(this.lastStartupWant)) {
this.lastStartupWant = undefined
}
resolve()
})
}
...
...
@@ -195,4 +205,20 @@ export class StartupManager {
private initOthers() {
}
private dealWithDeepLink(want: Want): boolean {
if (!want.parameters) {
return false
}
let deepLink = want.parameters[NewspaperWidgetCommon.JumpParam.DeepLinkKey] as string
if (deepLink && deepLink.length) {
AppInnerLink.jumpWithLink(deepLink)
return true
}
return false
}
}
...
...
sight_harmony/products/phone/src/main/resources/base/profile/form_config.json
View file @
ea59eb9
...
...
@@ -14,8 +14,8 @@
"isDynamic"
:
true
,
"isDefault"
:
true
,
"updateEnabled"
:
true
,
"scheduledUpdateTime"
:
"10:30"
,
"updateDuration"
:
1
,
"scheduledUpdateTime"
:
"18:26"
,
"updateDuration"
:
4
,
"defaultDimension"
:
"2*4"
,
"supportDimensions"
:
[
"2*4"
...
...
Please
register
or
login
to post a comment