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
王士厅
2024-08-09 17:21:05 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
4448d2c2d61e0073365a56ba7f63aceffa046752
4448d2c2
2 parents
bb22b8cf
3bae1556
Merge branch 'main' of
http://192.168.1.42/developOne/harmonyPool
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
137 additions
and
90 deletions
sight_harmony/build-profile.json5
sight_harmony/commons/wdRouter/src/main/ets/utils/AppInnerLink.ets
sight_harmony/features/wdComponent/src/main/ets/components/H5NewsWebPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/ImageDownloadComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/PageComponent.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerTitleView.ets
sight_harmony/features/wdHwAbility/oh-package.json5
sight_harmony/features/wdHwAbility/src/main/ets/getuiPush/GT-HM-1.0.4.har
sight_harmony/features/wdHwAbility/src/main/ets/getuiPush/GTSDK-1.0.1.0.har
sight_harmony/features/wdHwAbility/src/main/ets/getuiPush/GetuiPush.ets
sight_harmony/features/wdLayout/Index.ets
sight_harmony/products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel.ets → sight_harmony/features/wdLogin/src/main/ets/bean/InterestsHobbiesModel.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/OneKeyLoginPage.ets
sight_harmony/products/phone/src/main/ets/pages/launchPage/LaunchInterestsHobbiesPage.ets
sight_harmony/products/phone/src/main/ets/startupmanager/StartupManager.ets
sight_harmony/products/phone/src/main/module.json5
sight_harmony/build-profile.json5
View file @
4448d2c
...
...
@@ -55,7 +55,8 @@
"buildProfileFields"
:
{
"BUILD_VERSION"
:
""
}
}
},
"strictMode"
:
{
"useNormalizedOHMUrl"
:
true
}
},
}
,
{
...
...
@@ -69,7 +70,8 @@
"buildProfileFields"
:
{
"BUILD_VERSION"
:
""
}
}
},
"strictMode"
:
{
"useNormalizedOHMUrl"
:
true
}
}
}
],
...
...
sight_harmony/commons/wdRouter/src/main/ets/utils/AppInnerLink.ets
View file @
4448d2c
import { url } from '@kit.ArkTS'
import { RetryHolderManager } from '@ohos/imageknife/src/main/ets/components/imageknife/holder/RetryHolderManager'
import App from '@system.app'
import { Action, Params } from 'wdBean/Index'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
...
...
@@ -17,12 +18,12 @@ export class AppInnerLink {
// 内链跳转
// 内链地址例如:rmrbapp://rmrb.app/openwith?type=article&subType=h5_template_article&contentId=30000762651&relId=500000038702&skipType=1&relType=1
static jumpWithLink(innerLink: string) {
static jumpWithLink(innerLink: string)
: boolean
{
let params = AppInnerLink.parseParams(innerLink)
if (!params) {
Logger.info(TAG, "跳转无效的链接地址 " + innerLink)
return
return
false
}
switch (params.skipType) {
...
...
@@ -48,8 +49,10 @@ export class AppInnerLink {
}
default: {
Logger.info(TAG, "跳转无效的链接地址 " + innerLink)
return false
}
}
return true
}
private static jumpParams(params: InnerLinkParam) {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/H5NewsWebPageComponent.ets
View file @
4448d2c
...
...
@@ -64,7 +64,7 @@ export struct H5NewsWebPageComponent {
Stack({ alignContent: Alignment.Top }){
Stack(){
Column(){
CustomTitleUI({ titleName: this.navTitle })
CustomTitleUI({ titleName: this.navTitle
,imgBack:false
})
WdWebComponent({
webviewControl: this.webviewControl,
webUrl: this.webUrl,
...
...
sight_harmony/features/wdComponent/src/main/ets/components/ImageDownloadComponent.ets
View file @
4448d2c
...
...
@@ -5,7 +5,12 @@ import { promptAction } from '@kit.ArkUI';
import { image } from '@kit.ImageKit';
import { photoAccessHelper } from '@kit.MediaLibraryKit';
import fs from '@ohos.file.fs';
import { NetworkUtil } from 'wdKit';
import { DateTimeUtils, NetworkUtil, PermissionUtil } from 'wdKit';
import { PrivacySettingModel } from '../model/PrivacySettingModel';
import { TrackConstants, TrackingButton } from 'wdTracking';
import { faceDetector } from '@kit.CoreVisionKit';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import fileIo from '@ohos.file.fs';
const PERMISSIONS: Array<Permissions> = [
'ohos.permission.READ_IMAGEVIDEO',
...
...
@@ -22,6 +27,8 @@ export struct ImageDownloadComponent {
@State photoAccessHelper: photoAccessHelper.PhotoAccessHelper | undefined = undefined; // 相册模块管理实例
@State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer
@Prop @Watch('onChangeUrl') url: string = ''
@State isGranted: boolean = false
@State name: string = ''
build() {
Column() {
...
...
@@ -34,14 +41,20 @@ export struct ImageDownloadComponent {
.backgroundColor(Color.Transparent)
.iconColor(Color.White)
.onClick(async () => {
console.info(`cj2024 onClick ${this.imageBuffer}`)
//
console.info(`cj2024 onClick ${this.imageBuffer}`)
if (this.imageBuffer !== undefined) {
await this.saveImage(this.imageBuffer);
promptAction.showToast({
message: $r('app.string.image_request_success'),
duration: 2000,
alignment:Alignment.Center
})
try {
await this.saveImage(this.imageBuffer);
promptAction.showToast({
message: $r('app.string.image_request_success'),
duration: 2000,
alignment: Alignment.Center
})
} catch (error) {
const err: BusinessError = error as BusinessError;
//console.info(`Failed to save photo. Code is ${err.code}, message is ${err.message}`);
promptAction.showToast({ message: '保存图片失败!' });
}
}
})
}
...
...
@@ -55,10 +68,11 @@ export struct ImageDownloadComponent {
// 有网络
this.onChangeUrl()
}
}
async onChangeUrl(): Promise<void> {
console.info(`cj2024 图片下载 ${this.url}`)
//
console.info(`cj2024 图片下载 ${this.url}`)
const context = getContext(this) as common.UIAbilityContext;
const atManager = abilityAccessCtrl.createAtManager();
await atManager.requestPermissionsFromUser(context, PERMISSIONS);
...
...
@@ -73,7 +87,7 @@ export struct ImageDownloadComponent {
let httpRequest = http.createHttp();
// 用于订阅HTTP响应头事件
httpRequest.on('headersReceive', (header: Object) => {
console.info('header: ' + JSON.stringify(header));
//
console.info('header: ' + JSON.stringify(header));
});
// 用于订阅HTTP流式响应数据接收事件
let res = new ArrayBuffer(0);
...
...
@@ -83,40 +97,40 @@ export struct ImageDownloadComponent {
resView.set(new Uint8Array(res));
resView.set(new Uint8Array(data), res.byteLength);
res = newRes;
// console.info('dataReceive res length: ' + res.byteLength);
//
//
console.info('dataReceive res length: ' + res.byteLength);
});
// 用于订阅HTTP流式响应数据接收完毕事件
httpRequest.on('dataEnd', () => {
this.transcodePixelMap(res);
// 判断网络获取到的资源是否为ArrayBuffer类型
console.info(`dataEnd getPicture ${res}`)
//
console.info(`dataEnd getPicture ${res}`)
if (res instanceof ArrayBuffer) {
console.info(`dataEnd getPicture`)
//
console.info(`dataEnd getPicture`)
this.imageBuffer = res as ArrayBuffer;
}
console.info('No more data in response, data receive end');
//
console.info('No more data in response, data receive end');
});
httpRequest.requestInStream(this.url,
(error: BusinessError, data: number) => {
if (error) {
// 下载失败时弹窗提示检查网络,不执行后续逻辑
promptAction.showToast({
message: $r('app.string.image_request_fail'),
duration: 2000
})
console.error(`http reqeust failed with. Code: ${error.code}, message: ${error.message}`);
return;
}
// 取消订阅HTTP响应头事件
httpRequest.off('headersReceive');
// 取消订阅HTTP流式响应数据接收事件
httpRequest.off('dataReceive');
// 取消订阅HTTP流式响应数据接收完毕事件
httpRequest.off('dataEnd');
// 当该请求使用完毕时,调用destroy方法主动销毁
httpRequest.destroy();
(error: BusinessError, data: number) => {
if (error) {
// 下载失败时弹窗提示检查网络,不执行后续逻辑
promptAction.showToast({
message: $r('app.string.image_request_fail'),
duration: 2000
})
//console.error(`http reqeust failed with. Code: ${error.code}, message: ${error.message}`);
return;
}
)
// 取消订阅HTTP响应头事件
httpRequest.off('headersReceive');
// 取消订阅HTTP流式响应数据接收事件
httpRequest.off('dataReceive');
// 取消订阅HTTP流式响应数据接收完毕事件
httpRequest.off('dataEnd');
// 当该请求使用完毕时,调用destroy方法主动销毁
httpRequest.destroy();
}
)
}
/**
...
...
@@ -147,13 +161,39 @@ export struct ImageDownloadComponent {
* @returns
*/
async saveImage(buffer: ArrayBuffer | string): Promise<void> {
console.info(`cj2024 saveImage buffer ${buffer}`)
//console.info(`cj2024 saveImage buffer ${buffer}`)
if (!this.isGranted) {
//跳转权限设置
// const permissionUtil = new PermissionUtil();
PermissionUtil.reqPermissionsFromUser(['ohos.permission.READ_MEDIA'], this).then((res) => {
this.isGranted = res;
});
} else {
// PermissionUtil.openPermissionsInSystemSettings(this);
}
const context = getContext(this) as common.UIAbilityContext; // 获取getPhotoAccessHelper需要的context
const helper = photoAccessHelper.getPhotoAccessHelper(context); // 获取相册管理模块的实例
const uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, 'jpg'); // 指定待创建的文件类型、后缀和创建选项,创建图片或视频资源
console.info(`cj2024 saveImage uri ${uri}`)
const file = await fs.open(uri, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
await fs.write(file.fd, buffer);
await fs.close(file.fd);
// const helper = photoAccessHelper.getPhotoAccessHelper(context); // 获取相册管理模块的实例
// const uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, 'jpg'); // 指定待创建的文件类型、后缀和创建选项,创建图片或视频资源
// //console.info(`cj2024 saveImage uri ${uri}`)
// const file = await fs.open(uri, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
// await fs.write(file.fd, buffer);
// await fs.close(file.fd);
let media = mediaLibrary.getMediaLibrary(context);
let publicPath = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_IMAGE);
let picName = DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_DEFAULT) + '.jpg'
// //console.info(`cj2024 saveImage time ${picName}`)
let asset = await media.createAsset(mediaLibrary.MediaType.IMAGE, picName, publicPath);
if (asset) {
let fd = await asset.open('rw');
await fileIo.write(fd, buffer);
await asset.close(fd);
promptAction.showToast({ message: '已保存至相册!' });
} else {
promptAction.showToast({ message: '保存图片失败!' });
throw new Error('Failed to create asset');
}
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/PageComponent.ets
View file @
4448d2c
...
...
@@ -174,10 +174,10 @@ export struct PageComponent {
pageHornAd() {
if (this.pageAdvModel.isShowAds) {
if (this.pageAdvModel.pageCornerAdv.matInfo != null) {
if (this.pageAdvModel.pageCornerAdv.matInfo != null
&& this.pageAdvModel.pageCornerAdv.matInfo.linkType != '2'
) {
// 广告中心的挂角广告
this.drawPageCornerAdvView(1, 1 == this.pageAdvModel.isRightAdv)
} else if (this.pageAdvModel.pageCornerContentInfo.advert != null) {
} else if (this.pageAdvModel.pageCornerContentInfo.advert != null
&& this.pageAdvModel.pageCornerContentInfo.advert.objectType != '6'
) {
// 展现中心的挂角广告业务
this.drawPageCornerAdvView(2, 1 == this.pageAdvModel.isRightAdv)
}
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerTitleView.ets
View file @
4448d2c
...
...
@@ -148,6 +148,7 @@ export struct PlayerTitleView {
private updateSummaryLines() {
this.summaryLines = Math.max(1, 4 - this.titleLines)
// console.info(`cj2024 titleLines = ${this.titleLines}`)
this.isOverLines = this.summary.length > this.clipText(this.summary, 14, this.summaryLines, this.windowWidth - 150 - vp2px(50)).length
}
...
...
@@ -306,7 +307,9 @@ export struct PlayerTitleView {
}
}
.onAreaChange((oldArea: Area, newArea: Area) => {
this.titleLines = Math.ceil((newArea.height as number) / 20) // 20是行高
//console.info(`cj2024 titleLines = ${newArea.height as number} line = ${(newArea.height as number) / 20}`)
this.titleLines = Math.floor((newArea.height as number) / 20)// 20是行高
//console.info(`cj2024 titleLines = ${this.titleLines}`)
this.updateSummaryLines()
})
.padding({
...
...
sight_harmony/features/wdHwAbility/oh-package.json5
View file @
4448d2c
...
...
@@ -7,7 +7,7 @@
"license"
:
"Apache-2.0"
,
"packageType"
:
"InterfaceHar"
,
"dependencies"
:
{
"library"
:
"file:./src/main/ets/getuiPush/GT
SDK-1.0.1.0
.har"
,
"library"
:
"file:./src/main/ets/getuiPush/GT
-HM-1.0.4
.har"
,
"wdConstant"
:
"file:../../commons/wdConstant"
,
"wdLogin"
:
"file:../../features/wdLogin"
,
"wdKit"
:
"file:../../commons/wdKit"
,
...
...
sight_harmony/features/wdHwAbility/src/main/ets/getuiPush/GT-HM-1.0.4.har
0 → 100644
View file @
4448d2c
No preview for this file type
sight_harmony/features/wdHwAbility/src/main/ets/getuiPush/GTSDK-1.0.1.0.har
deleted
100644 → 0
View file @
bb22b8c
No preview for this file type
sight_harmony/features/wdHwAbility/src/main/ets/getuiPush/GetuiPush.ets
View file @
4448d2c
...
...
@@ -48,7 +48,7 @@ export class GetuiPush {
}
init(context: common.UIAbilityContext) {
Logger.debug(TAG, "个推SDK开始初始化....")
const isOnlineEnv = HostManager.getHost() === HostEnum.HOST_PRODUCT
PushManager.initialize({
...
...
sight_harmony/features/wdLayout/Index.ets
View file @
4448d2c
...
...
@@ -8,4 +8,6 @@ export { WDComp } from "./src/main/ets/layout/WDComp"
export { Lego } from "./src/main/ets/lego/LegoService"
export { PageViewModel } from "./src/main/ets/viewmodel/PageViewModel"
\ No newline at end of file
export { PageViewModel } from "./src/main/ets/viewmodel/PageViewModel"
export * from "./src/main/etc/bean"
\ No newline at end of file
...
...
sight_harmony/
products/phone/src/main/ets/pages/viewModel
/InterestsHobbiesModel.ets → sight_harmony/
features/wdLogin/src/main/ets/bean
/InterestsHobbiesModel.ets
View file @
4448d2c
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
View file @
4448d2c
...
...
@@ -5,12 +5,12 @@ import { LoginViewModel } from './LoginViewModel'
import { LoginInputComponent } from './LoginInputComponent'
import { WDRouterPage } from 'wdRouter/src/main/ets/router/WDRouterPage';
import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule';
import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/src/main/ets/bean/content/Params'
import {InterestsHobbiesModel} from '../../../../../../../products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel'
import {InterestsHobbiesModel} from '../../bean/InterestsHobbiesModel'
import { TrackingPageBrowse, TrackConstants, TrackingButton, ParamType, Tracking } from 'wdTracking/Index'
import { window } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';
import { common } from '@kit.AbilityKit'
import { Params } from 'wdBean'
@Extend(Row)
function otherStyle() {
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/OneKeyLoginPage.ets
View file @
4448d2c
...
...
@@ -5,7 +5,7 @@ import HuaweiAuth from '../../utils/HuaweiAuth'
import { BusinessError } from '@kit.BasicServicesKit'
import { Logger, ToastUtils, CustomToast, EmitterUtils, EmitterEventId } from 'wdKit/Index'
import { LoginViewModel } from './LoginViewModel'
import {InterestsHobbiesModel} from '../../
../../../../../products/phone/src/main/ets/pages/viewModel
/InterestsHobbiesModel'
import {InterestsHobbiesModel} from '../../
bean
/InterestsHobbiesModel'
import { TrackConstants, TrackingButton, TrackingPageBrowse } from 'wdTracking/Index'
import { loginComponentManager, LoginWithHuaweiIDButton } from '@kit.AccountKit'
import { JSON } from '@kit.ArkTS'
...
...
sight_harmony/products/phone/src/main/ets/pages/launchPage/LaunchInterestsHobbiesPage.ets
View file @
4448d2c
import {InterestsHobbiesModel, InterestsList} from '
../viewModel
/InterestsHobbiesModel'
import {InterestsHobbiesModel, InterestsList} from '
wdLogin/src/main/ets/bean
/InterestsHobbiesModel'
import { WDRouterRule } from 'wdRouter';
import { WDRouterPage } from 'wdRouter';
import { NetworkUtil, SPHelper } from 'wdKit/Index';
...
...
sight_harmony/products/phone/src/main/ets/startupmanager/StartupManager.ets
View file @
4448d2c
...
...
@@ -252,16 +252,18 @@ export class StartupManager {
private dealWithDeepLink(want: Want): boolean {
if (!want.parameters) {
return false
// H5换端地址
let innerLink = want["uri"] as string
if (innerLink && innerLink.length) {
return AppInnerLink.jumpWithLink(innerLink)
}
let deepLink = want.parameters[NewspaperWidgetCommon.JumpParam.DeepLinkKey] as string
if (deepLink && deepLink.length) {
AppInnerLink.jumpWithLink(deepLink)
return true
if (want.parameters) {
// 桌面组件换端
let deepLink = want.parameters[NewspaperWidgetCommon.JumpParam.DeepLinkKey] as string
if (deepLink && deepLink.length) {
return AppInnerLink.jumpWithLink(deepLink)
}
}
return false
}
...
...
sight_harmony/products/phone/src/main/module.json5
View file @
4448d2c
...
...
@@ -29,7 +29,7 @@
"audioPlayback"
],
"skills"
:
[
{
{
//
App
Linking
跳转
"entities"
:
[
"entity.system.browsable"
],
...
...
@@ -37,11 +37,6 @@
"ohos.want.action.viewData"
],
"uris"
:
[
//
{
//
之前的
推送配置
//
"scheme"
:
'rmrbapp'
,
//
"host"
:
'rmrb.app'
,
//
'port'
:
'
8080
'
,
//
"path"
:
'openwith'
}
{
"scheme"
:
"https"
,
"host"
:
"pd-people-uat.pdnews.cn"
,
...
...
@@ -145,39 +140,39 @@
],
"domainVerify"
:
true
},
{
{
//
默认的
"entities"
:
[
"entity.system.home"
,
],
"actions"
:
[
"com.test.pushaction"
,
"action.system.home"
,
],
}
,
{
"uris"
:
[
{
//
推送配置
-
(播控中心共用)
"scheme"
:
'rmrbapp'
,
"host"
:
'rmrb.app'
,
'port'
:
'
8080
'
,
"path"
:
'openwith'
},
{
//
普通配置
-
暂时无法跳转
-
??
{
//
H5换端
"actions"
:
[
"ohos.want.action.viewData"
],
"uris"
:
[
{
"scheme"
:
"rmrbapp"
,
"host"
:
"rmrb.app"
,
"path"
:
"openwith"
},
//
{
//
分享用
-
正式环境地址
//
"scheme"
:
"https"
,
//
"host"
:
"www.peopleapp.com"
,
//
"pathStartWith"
:
"column"
//
},
//
{
//
分享用
-
测试环境地址
//
"scheme"
:
"https"
,
//
"host"
:
"pd-people-uat.pdnews.cn"
,
////
"pathStartWith"
:
"column"
//
}
]}
]},
{
//
推送
"actions"
:
[
"com.test.pushaction"
],
"uris"
:
[
{
"scheme"
:
'rmrbapp'
,
"host"
:
'rmrb.app'
,
'port'
:
'
8080
'
,
"path"
:
'openwith'
}
]
},
]
}
],
...
...
Please
register
or
login
to post a comment