|
@@ -7,7 +7,7 @@ import { CommonConstants } from '../common/constants/CommonConstants';
|
|
|
import { VideoItem } from '../viewmodel/VideoItem';
|
|
import { VideoItem } from '../viewmodel/VideoItem';
|
|
|
import ScreenUtil from '../common/util/ScreenUtil';
|
|
import ScreenUtil from '../common/util/ScreenUtil';
|
|
|
import { Utility } from '../common/util/Utility';
|
|
import { Utility } from '../common/util/Utility';
|
|
|
-import { emitter } from '@kit.BasicServicesKit';
|
|
|
|
|
|
|
+import { BusinessError, emitter } from '@kit.BasicServicesKit';
|
|
|
import { common } from '@kit.AbilityKit';
|
|
import { common } from '@kit.AbilityKit';
|
|
|
import { AdSlot, AdSlotBuilder,
|
|
import { AdSlot, AdSlotBuilder,
|
|
|
CSJAdCreator,
|
|
CSJAdCreator,
|
|
@@ -25,6 +25,8 @@ import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant';
|
|
|
import { SettingPage } from './SettingPage';
|
|
import { SettingPage } from './SettingPage';
|
|
|
import { deviceInfo } from '@kit.BasicServicesKit';
|
|
import { deviceInfo } from '@kit.BasicServicesKit';
|
|
|
import { resourceManager } from '@kit.LocalizationKit';
|
|
import { resourceManager } from '@kit.LocalizationKit';
|
|
|
|
|
+import { systemShare } from '@kit.ShareKit';
|
|
|
|
|
+import { uniformTypeDescriptor } from '@kit.ArkData';
|
|
|
|
|
|
|
|
const TAG = 'NewIndex'; // 日志标签
|
|
const TAG = 'NewIndex'; // 日志标签
|
|
|
|
|
|
|
@@ -41,7 +43,7 @@ struct NewIndex{
|
|
|
|
|
|
|
|
/** 应用包名 */
|
|
/** 应用包名 */
|
|
|
@State bundleName:string = ''
|
|
@State bundleName:string = ''
|
|
|
-
|
|
|
|
|
|
|
+ @State appName:string = ''
|
|
|
/** 是否显示侧边抽屉菜单 */
|
|
/** 是否显示侧边抽屉菜单 */
|
|
|
@Provide isShowDrawer:boolean = false;
|
|
@Provide isShowDrawer:boolean = false;
|
|
|
/** 抽屉菜单 X 轴偏移量,用于手势滑动动画 */
|
|
/** 抽屉菜单 X 轴偏移量,用于手势滑动动画 */
|
|
@@ -161,6 +163,9 @@ struct NewIndex{
|
|
|
|
|
|
|
|
async aboutToAppear() {
|
|
async aboutToAppear() {
|
|
|
Utility.enableFullScreen()
|
|
Utility.enableFullScreen()
|
|
|
|
|
+ Utility.getAppName(getContext(this)).then((appName:string)=>{
|
|
|
|
|
+ this.appName = appName
|
|
|
|
|
+ })
|
|
|
this.breakpointSystem.register();
|
|
this.breakpointSystem.register();
|
|
|
let params = router.getParams() as Record<string, Object>;
|
|
let params = router.getParams() as Record<string, Object>;
|
|
|
this.videoLocalList = params.videoList as VideoItem[];
|
|
this.videoLocalList = params.videoList as VideoItem[];
|
|
@@ -413,6 +418,10 @@ async aboutToAppear() {
|
|
|
params: { titleName: '隐私政策', webUrl: CommonConstants.NEW_YS_HW }
|
|
params: { titleName: '隐私政策', webUrl: CommonConstants.NEW_YS_HW }
|
|
|
});
|
|
});
|
|
|
break
|
|
break
|
|
|
|
|
+
|
|
|
|
|
+ case MainViewModel.MENU_SHARE:
|
|
|
|
|
+ this.gotoShare()
|
|
|
|
|
+ break
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -429,6 +438,28 @@ async aboutToAppear() {
|
|
|
.edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
|
|
.edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ gotoShare(){
|
|
|
|
|
+ let shareData: systemShare.SharedData = new systemShare.SharedData({
|
|
|
|
|
+ utd: uniformTypeDescriptor.UniformDataType.TEXT,
|
|
|
|
|
+ content: 'https://appgallery.huawei.com/app/detail?id='+this.bundleName,
|
|
|
|
|
+ title: this.appName, // 不传title字段时,显示content
|
|
|
|
|
+ description: '精心雕琢的无损音乐播放器',
|
|
|
|
|
+ // thumbnail: new Uint8Array() // 推荐传入适合的缩略图 不传则显示默认text图标
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 进行分享面板显示
|
|
|
|
|
+ let controller: systemShare.ShareController = new systemShare.ShareController(shareData);
|
|
|
|
|
+ let context = getContext(this) as common.UIAbilityContext;
|
|
|
|
|
+ controller.show(context, {
|
|
|
|
|
+ selectionMode: systemShare.SelectionMode.SINGLE,
|
|
|
|
|
+ previewMode: systemShare.SharePreviewMode.DETAIL,
|
|
|
|
|
+ }).then(() => {
|
|
|
|
|
+ console.info('ShareController show success.');
|
|
|
|
|
+ }).catch((error: BusinessError) => {
|
|
|
|
|
+ console.error(`ShareController show error. code: ${error.code}, message: ${error.message}`);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* ================== 穿山甲广告相关 ==================
|
|
* ================== 穿山甲广告相关 ==================
|
|
|
*/
|
|
*/
|