|
@@ -25,6 +25,7 @@ import statusBarManager from '@hms.pcService.statusBarManager';
|
|
|
import StatusBarViewExtensionAbility from '@hms.pcService.StatusBarViewExtensionAbility';
|
|
import StatusBarViewExtensionAbility from '@hms.pcService.StatusBarViewExtensionAbility';
|
|
|
import { SpiderMan } from '@simplepeng/spider-man';
|
|
import { SpiderMan } from '@simplepeng/spider-man';
|
|
|
import { smartMobilityCommon } from '@kit.CarKit';
|
|
import { smartMobilityCommon } from '@kit.CarKit';
|
|
|
|
|
+import { url } from '@kit.ArkTS';
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 主Ability类,继承自UIAbility
|
|
* 主Ability类,继承自UIAbility
|
|
@@ -36,7 +37,21 @@ import { smartMobilityCommon } from '@kit.CarKit';
|
|
|
export default class EntryAbility extends UIAbility {
|
|
export default class EntryAbility extends UIAbility {
|
|
|
// UI上下文对象,用于获取窗口信息
|
|
// UI上下文对象,用于获取窗口信息
|
|
|
private uiContext?: UIContext;
|
|
private uiContext?: UIContext;
|
|
|
|
|
+ private mKnockItem: string = '';//碰一碰分享接收索引
|
|
|
private awareness: smartMobilityCommon.SmartMobilityAwareness = smartMobilityCommon.getSmartMobilityAwareness();
|
|
private awareness: smartMobilityCommon.SmartMobilityAwareness = smartMobilityCommon.getSmartMobilityAwareness();
|
|
|
|
|
+
|
|
|
|
|
+ private getKnockPath(want: Want): string {
|
|
|
|
|
+ let uri = want?.uri;
|
|
|
|
|
+ let knockItem: string = '';
|
|
|
|
|
+ // Parse the parameters to obtain the app linking
|
|
|
|
|
+ if (uri) {
|
|
|
|
|
+ let urlObject = url.URL.parseURL(want?.uri);
|
|
|
|
|
+ LogUtil.info('onecold urlObject= '+urlObject.toJSON());
|
|
|
|
|
+ knockItem = urlObject.params.get('videoIndex') as string;
|
|
|
|
|
+ LogUtil.info('onecold getKnockPath= '+knockItem);
|
|
|
|
|
+ }
|
|
|
|
|
+ return knockItem;
|
|
|
|
|
+ }
|
|
|
/**
|
|
/**
|
|
|
* 窗口尺寸变化回调函数
|
|
* 窗口尺寸变化回调函数
|
|
|
* @param windowSize 新的窗口尺寸对象
|
|
* @param windowSize 新的窗口尺寸对象
|
|
@@ -54,8 +69,8 @@ export default class EntryAbility extends UIAbility {
|
|
|
let heightBp: HeightBreakpoint = this.uiContext!.getWindowHeightBreakpoint();
|
|
let heightBp: HeightBreakpoint = this.uiContext!.getWindowHeightBreakpoint();
|
|
|
AppStorage.setOrCreate('currentHeightBreakpoint', heightBp);
|
|
AppStorage.setOrCreate('currentHeightBreakpoint', heightBp);
|
|
|
// 记录尺寸变化日志
|
|
// 记录尺寸变化日志
|
|
|
- LogUtil.info('pura onWindowSizeChange currentHeightBreakpoint= '+heightBp);
|
|
|
|
|
- LogUtil.info( 'pura onWindowSizeChange currentWidthBreakpoint= '+widthBp);
|
|
|
|
|
|
|
+ // LogUtil.info('pura onWindowSizeChange currentHeightBreakpoint= '+heightBp);
|
|
|
|
|
+ // LogUtil.info( 'pura onWindowSizeChange currentWidthBreakpoint= '+widthBp);
|
|
|
AppStorage.setOrCreate('windowWidth', windowSize.width);
|
|
AppStorage.setOrCreate('windowWidth', windowSize.width);
|
|
|
AppStorage.setOrCreate('windowHeight', windowSize.height);
|
|
AppStorage.setOrCreate('windowHeight', windowSize.height);
|
|
|
if(windowSize.width > windowSize.height){
|
|
if(windowSize.width > windowSize.height){
|
|
@@ -63,8 +78,8 @@ export default class EntryAbility extends UIAbility {
|
|
|
}else{
|
|
}else{
|
|
|
AppStorage.setOrCreate('isLandscape', false);
|
|
AppStorage.setOrCreate('isLandscape', false);
|
|
|
}
|
|
}
|
|
|
- LogUtil.info('hicar onWindowSizeChange width= '+windowSize.width);
|
|
|
|
|
- LogUtil.info( 'hicar onWindowSizeChange height= '+windowSize.height);
|
|
|
|
|
|
|
+ // LogUtil.info('hicar onWindowSizeChange width= '+windowSize.width);
|
|
|
|
|
+ // LogUtil.info( 'hicar onWindowSizeChange height= '+windowSize.height);
|
|
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -87,7 +102,7 @@ export default class EntryAbility extends UIAbility {
|
|
|
setTimeout(async ()=>{
|
|
setTimeout(async ()=>{
|
|
|
this.loadDoWant(want)
|
|
this.loadDoWant(want)
|
|
|
await this.handleParam(want)
|
|
await this.handleParam(want)
|
|
|
- },1000)
|
|
|
|
|
|
|
+ },2000)
|
|
|
|
|
|
|
|
this.handleWeChatCallIfNeed(want)
|
|
this.handleWeChatCallIfNeed(want)
|
|
|
|
|
|
|
@@ -110,8 +125,17 @@ export default class EntryAbility extends UIAbility {
|
|
|
|
|
|
|
|
//处理其他app点击其他应用打开播放器播放视频或者音频
|
|
//处理其他app点击其他应用打开播放器播放视频或者音频
|
|
|
loadDoWant(want: Want){
|
|
loadDoWant(want: Want){
|
|
|
-
|
|
|
|
|
|
|
+ console.info('onecold KnockController 碰一碰 want ='+JSON.stringify(want));
|
|
|
let uri = want.uri;
|
|
let uri = want.uri;
|
|
|
|
|
+ // console.info('onecold KnockController 碰一碰 want.type ='+want.type);
|
|
|
|
|
+ // console.info('onecold KnockController 碰一碰 want.uri ='+want.uri);
|
|
|
|
|
+ // console.info('onecold KnockController 碰一碰 want.action ='+want.action);
|
|
|
|
|
+ // console.info('onecold KnockController 碰一碰 want.parameters ='+want.parameters);
|
|
|
|
|
+ // console.info('onecold KnockController 碰一碰 want.entities ='+want.entities);
|
|
|
|
|
+ // console.info('onecold KnockController 碰一碰 want.fds ='+want.fds);
|
|
|
|
|
+ // console.info('onecold KnockController 碰一碰 want.bundleName ='+want.bundleName);
|
|
|
|
|
+ // console.info('onecold KnockController 碰一碰 want.abilityName ='+want.abilityName);
|
|
|
|
|
+ // console.info('onecold KnockController 碰一碰 want.deviceId ='+want.deviceId);
|
|
|
if (uri == null || uri == undefined|| StrUtil.isEmpty(uri)) {
|
|
if (uri == null || uri == undefined|| StrUtil.isEmpty(uri)) {
|
|
|
console.info('uri is invalid');
|
|
console.info('uri is invalid');
|
|
|
return;
|
|
return;
|
|
@@ -205,6 +229,12 @@ export default class EntryAbility extends UIAbility {
|
|
|
windowClass.on('avoidAreaChange', this.onAvoidAreaChange)
|
|
windowClass.on('avoidAreaChange', this.onAvoidAreaChange)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ //碰一碰分享的跳转
|
|
|
|
|
+ let pageUrl: string = 'pages/Index';
|
|
|
|
|
+ if (this.mKnockItem && this.mKnockItem !== '') {
|
|
|
|
|
+ AppStorage.setOrCreate('videoIndex', Number.parseInt(this.mKnockItem));
|
|
|
|
|
+ // pageUrl = 'pages/VideoPlay';
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
AppStorage.setOrCreate('windowStage',windowStage);
|
|
AppStorage.setOrCreate('windowStage',windowStage);
|
|
|
|
|
|
|
@@ -229,8 +259,13 @@ export default class EntryAbility extends UIAbility {
|
|
|
|
|
|
|
|
AppStorage.setOrCreate('windowWidth', data.getWindowProperties().windowRect.width);
|
|
AppStorage.setOrCreate('windowWidth', data.getWindowProperties().windowRect.width);
|
|
|
AppStorage.setOrCreate('windowHeight', data.getWindowProperties().windowRect.height);
|
|
AppStorage.setOrCreate('windowHeight', data.getWindowProperties().windowRect.height);
|
|
|
- LogUtil.info('hicar getMainWindow width= '+data.getWindowProperties().windowRect.width);
|
|
|
|
|
- LogUtil.info( 'hicar getMainWindow height= '+data.getWindowProperties().windowRect.height);
|
|
|
|
|
|
|
+ if(data.getWindowProperties().windowRect.width > data.getWindowProperties().windowRect.height){
|
|
|
|
|
+ AppStorage.setOrCreate('isLandscape', true);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ AppStorage.setOrCreate('isLandscape', false);
|
|
|
|
|
+ }
|
|
|
|
|
+ // LogUtil.info('hicar getMainWindow width= '+data.getWindowProperties().windowRect.width);
|
|
|
|
|
+ // LogUtil.info( 'hicar getMainWindow height= '+data.getWindowProperties().windowRect.height);
|
|
|
}).catch((err: BusinessError) => {
|
|
}).catch((err: BusinessError) => {
|
|
|
console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`);
|
|
console.error(`Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`);
|
|
|
});
|
|
});
|