提交 02a6eeb8 编写于 作者: X xinking129

changdetails

Signed-off-by: Nxinking129 <xinxin13@huawei.com>
上级 7364cc70
......@@ -14,7 +14,7 @@
*/
import UIAbility from '@ohos.app.ability.UIAbility';
import hilog from '@ohos.hilog';
import window from '@ohos.window';
import type window from '@ohos.window';
export default class EntryAbility extends UIAbility {
onCreate(want, launchParam) {
......@@ -28,8 +28,8 @@ export default class EntryAbility extends UIAbility {
parameters: {
'ability.want.params.uiExtensionType': 'share'
}
}).catch((err)=>{
console.info('====>ShareExtensionAbility_0100 err:'+ JSON.stringify(err));
}).catch((err) => {
console.info('====>ShareExtensionAbility_0100 err:' + JSON.stringify(err));
})
}
......
......@@ -26,6 +26,7 @@ struct Index {
'ability.want.params.uiExtensionType': 'share'
}
}
build() {
Row() {
Column() {
......@@ -33,9 +34,9 @@ struct Index {
.fontSize(50)
.fontWeight(FontWeight.Bold)
UIExtensionComponent(this.want)
.size({width:'100%',height:'100'})
.size({ width: '100%', height: '100' })
.backgroundColor(Color.Blue)
.border({width:5,color:Color.Red})
.border({ width: 5, color: Color.Red })
Button('StartAbilityForResult')
.fontSize(30)
.fontWeight(FontWeight.Bold)
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import commonEvent from '@ohos.commonEventManager'
import commonEvent from '@ohos.commonEventManager';
import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession';
let storage = LocalStorage.GetShared();
......@@ -21,7 +21,6 @@ let storage = LocalStorage.GetShared();
@Entry(storage)
@Component
struct PageThree {
build() {
Row() {
Column() {
......
......@@ -15,11 +15,13 @@
import ShareExtensionAbility from '@ohos.app.ability.ShareExtensionAbility';
import commonEventManager from '@ohos.commonEventManager';
var count = 0;
let count = 0;
const TIME_OUT = 500;
export default class ActsShareExtensionAbility extends ShareExtensionAbility {
storage: LocalStorage;
message: string;
onCreate() {
console.log('====>ActsShareExtensionAbility onCreate called');
count++;
......@@ -33,13 +35,15 @@ export default class ActsShareExtensionAbility extends ShareExtensionAbility {
'count': count
}
}
commonEventManager.publish('ACTS_TEST_FOREGROUND', options, function (){});
commonEventManager.publish('ACTS_TEST_FOREGROUND', options, function () {
});
}
onBackground() {
console.log('====>ActsShareExtensionAbility onBackground called');
count++;
commonEventManager.publish('ACTS_TEST_BACKGROUND', function (){});
commonEventManager.publish('ACTS_TEST_BACKGROUND', function () {
});
setTimeout(() => {
globalThis.session.terminateSelf();
}, TIME_OUT);
......@@ -66,7 +70,8 @@ export default class ActsShareExtensionAbility extends ShareExtensionAbility {
'count': count
}
}
commonEventManager.publish('ACTS_TEST_DESTROY', options, function (){});
commonEventManager.publish('ACTS_TEST_DESTROY', options, function () {
});
}
onSessionDestroy(session) {
......
......@@ -208,28 +208,28 @@ export default class UiExtAbility extends ShareExtensionAbility {
if (want.action === 'Acts_ShareExtensionAbility_context') {
console.info('=======>UIExtAbility onSessionCreate want.action == Acts_ShareExtensionAbility_context======>');
let commonEventData = {
parameters: {
context: this.context
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_context first publish err:' + JSON.stringify(err));
});
let commonEventData = {
parameters: {
context: this.context
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_context first publish err:' + JSON.stringify(err));
});
}
if (want.action === 'Acts_ShareExtensionAbility_2200') {
console.info('=======>UIExtAbility onSessionCreate want.action == Acts_ShareExtensionAbility_2200======>');
console.info('Acts_ShareExtensionAbility_2200 resourceManager: ' + this.context.resourceManager);
let commonEventData = {
parameters: {
resourceManager: this.context.resourceManager
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_2200 first publish err:' + JSON.stringify(err));
});
let commonEventData = {
parameters: {
resourceManager: this.context.resourceManager
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_2200 first publish err:' + JSON.stringify(err));
});
}
if (want.action === 'Acts_ShareExtensionAbility_2300') {
......@@ -237,105 +237,104 @@ export default class UiExtAbility extends ShareExtensionAbility {
console.info('Acts_ShareExtensionAbility_2300 applicationInfo: ' + this.context.applicationInfo);
let applicationInfo = this.context.applicationInfo;
let commonEventData = {
parameters: {
name: applicationInfo.name,
description_length: applicationInfo.description.length,
descriptionId: applicationInfo.descriptionId,
label: applicationInfo.label,
labelId: applicationInfo.labelId,
icon: applicationInfo.icon,
iconId: applicationInfo.iconId,
codePath: typeof (applicationInfo.codePath)
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_2300 first publish err:' + JSON.stringify(err));
});
parameters: {
name: applicationInfo.name,
description_length: applicationInfo.description.length,
descriptionId: applicationInfo.descriptionId,
label: applicationInfo.label,
labelId: applicationInfo.labelId,
icon: applicationInfo.icon,
iconId: applicationInfo.iconId,
codePath: typeof (applicationInfo.codePath)
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_2300 first publish err:' + JSON.stringify(err));
});
}
if (want.action === 'Acts_ShareExtensionAbility_2400') {
console.info('=======>UIExtAbility onSessionCreate want.action == Acts_ShareExtensionAbility_2400======>');
let commonEventData = {
parameters: {
cacheDir: this.context.cacheDir
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_2400 first publish err:' + JSON.stringify(err));
});
let commonEventData = {
parameters: {
cacheDir: this.context.cacheDir
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_2400 first publish err:' + JSON.stringify(err));
});
}
if (want.action === 'Acts_ShareExtensionAbility_2500') {
console.info('=======>UIExtAbility onSessionCreate want.action == Acts_ShareExtensionAbility_2500======>');
let commonEventData = {
parameters: {
tempDir: this.context.tempDir
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_2500 first publish err:' + JSON.stringify(err));
});
let commonEventData = {
parameters: {
tempDir: this.context.tempDir
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_2500 first publish err:' + JSON.stringify(err));
});
}
if (want.action === 'Acts_ShareExtensionAbility_2600') {
console.info('=======>UIExtAbility onSessionCreate want.action == Acts_ShareExtensionAbility_2600======>');
let commonEventData = {
parameters: {
filesDir: this.context.filesDir
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_2600 first publish err:' + JSON.stringify(err));
});
let commonEventData = {
parameters: {
filesDir: this.context.filesDir
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_2600 first publish err:' + JSON.stringify(err));
});
}
if (want.action === 'Acts_ShareExtensionAbility_2700') {
console.info('=======>UIExtAbility onSessionCreate want.action == Acts_ShareExtensionAbility_2700======>');
let commonEventData = {
parameters: {
databaseDir: this.context.databaseDir
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_2700 first publish err:' + JSON.stringify(err));
});
let commonEventData = {
parameters: {
databaseDir: this.context.databaseDir
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_2700 first publish err:' + JSON.stringify(err));
});
}
if (want.action === 'Acts_ShareExtensionAbility_2800') {
console.info('=======>UIExtAbility onSessionCreate want.action == Acts_ShareExtensionAbility_2800======>');
let commonEventData = {
parameters: {
preferencesDir: this.context.preferencesDir
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_2800 first publish err:' + JSON.stringify(err));
});
let commonEventData = {
parameters: {
preferencesDir: this.context.preferencesDir
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_2800 first publish err:' + JSON.stringify(err));
});
}
if (want.action === 'Acts_ShareExtensionAbility_2900') {
console.info('=======>UIExtAbility onSessionCreate want.action == Acts_ShareExtensionAbility_2900======>');
let commonEventData = {
parameters: {
bundleCodeDir: this.context.bundleCodeDir
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_2900 first publish err:' + JSON.stringify(err));
});
let commonEventData = {
parameters: {
bundleCodeDir: this.context.bundleCodeDir
}
};
commonEvent.publish('ACTS_CALL_EVENT', commonEventData, (err) => {
console.debug('====>Acts_ShareExtensionAbility_2900 first publish err:' + JSON.stringify(err));
});
}
if (want.action === 'Acts_ShareExtensionAbility_3000') {
var moduleContext = this.context.createModuleContext('entry');
let moduleContext = this.context.createModuleContext('entry');
let options = {
parameters: {
'bundleName': moduleContext.applicationInfo.name
......@@ -347,7 +346,7 @@ export default class UiExtAbility extends ShareExtensionAbility {
}
if (want.action === 'Acts_ShareExtensionAbility_3100') {
var moduleContext = this.context.createModuleContext('entry_test');
let moduleContext = this.context.createModuleContext('entry_test');
let options = {
parameters: {
'bundleName': moduleContext.applicationInfo.name
......@@ -360,7 +359,7 @@ export default class UiExtAbility extends ShareExtensionAbility {
if (want.action === 'Acts_ShareExtensionAbility_3200') {
try {
var moduleContext = this.context.createModuleContext('entry_assist');
let moduleContext = this.context.createModuleContext('entry_assist');
} catch {
console.log('createModuleContext err');
}
......@@ -376,7 +375,7 @@ export default class UiExtAbility extends ShareExtensionAbility {
if (want.action === 'Acts_ShareExtensionAbility_3300') {
try {
var moduleContext = this.context.createModuleContext('abc');
let moduleContext = this.context.createModuleContext('abc');
} catch {
console.log('createModuleContext err');
}
......@@ -392,7 +391,7 @@ export default class UiExtAbility extends ShareExtensionAbility {
if (want.action === 'Acts_ShareExtensionAbility_3400') {
try {
var moduleContext = this.context.createModuleContext(undefined);
let moduleContext = this.context.createModuleContext(undefined);
} catch {
console.log('createModuleContext err');
}
......@@ -407,7 +406,7 @@ export default class UiExtAbility extends ShareExtensionAbility {
}
if (want.action === 'Acts_ShareExtensionAbility_3500') {
var applicationContext = this.context.getApplicationContext();
let applicationContext = this.context.getApplicationContext();
let options = {
parameters: {
'applicationContext': applicationContext
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import Want from '@ohos.app.ability.Want';
import commonEventManager from '@ohos.commonEventManager'
import commonEventManager from '@ohos.commonEventManager';
@Entry
@Component
......@@ -27,6 +27,7 @@ struct Index {
'ability.want.params.uiExtensionType': 'share'
}
}
build() {
Row() {
Column() {
......@@ -34,9 +35,9 @@ struct Index {
.fontSize(50)
.fontWeight(FontWeight.Bold)
UIExtensionComponent(this.want)
.size({width:'100%',height:'100'})
.size({ width: '100%', height: '100' })
.backgroundColor(Color.Blue)
.border({width:5,color:Color.Red})
.border({ width: 5, color: Color.Red })
.onRemoteReady((proxy) => {
console.log('====>onRemoteReady will send data');
setTimeout(() => {
......@@ -47,7 +48,7 @@ struct Index {
});
}, 1000);
})
.onResult((data)=>{
.onResult((data) => {
let onResultEvent = 'ACTS_UIExtension_OnResult';
let options = {
parameters: {
......@@ -58,7 +59,7 @@ struct Index {
console.log('ACTS_UIExtension_OnResult');
});
})
.onReceive((data)=>{
.onReceive((data) => {
let onReceiveEvent = 'ACTS_UIExtension_OnReceive';
let options = {
parameters: {
......@@ -76,7 +77,8 @@ struct Index {
'err': err
}
}
commonEventManager.publish('ACTS_TEST_START_ERR', options, function (){});
commonEventManager.publish('ACTS_TEST_START_ERR', options, function () {
});
})
.onRelease((releaseCode) => {
console.log('====>UIExtensionComponent onRelease releaseCode: ' + JSON.stringify(releaseCode));
......@@ -85,7 +87,8 @@ struct Index {
'releaseCode': releaseCode
}
}
commonEventManager.publish('ACTS_TEST_RELEASE', options, function (){});
commonEventManager.publish('ACTS_TEST_RELEASE', options, function () {
});
})
}
.width('100%')
......
......@@ -38,8 +38,8 @@ struct Page {
let terminateSelfWithResultEvent = 'ACTS_UIExtension_TerminateSelfWithResult';
let sendDataEvent = 'ACTS_UIExtension_SendData';
var subscriber;
var subscribeInfo = {
let subscriber;
let subscribeInfo = {
events: [terminateSelfWithResultEvent, sendDataEvent]
};
commonEventManager.createSubscriber(subscribeInfo).then(async (data) => {
......@@ -90,9 +90,9 @@ struct Page {
.fontSize(30)
.fontWeight(FontWeight.Bold)
UIExtensionComponent(this.want)
.size({width:'100%',height:'100'})
.backgroundColor(Color.Blue)
.border({width:5,color:Color.Red})
.size({ width: '100%', height: '100' })
.backgroundColor(Color.Blue)
.border({ width: 5, color: Color.Red })
}
.width('100%')
}
......
......@@ -18,7 +18,6 @@ let storage = LocalStorage.GetShared();
@Entry(storage)
@Component
struct Index3 {
build() {
Row() {
Column() {
......
......@@ -15,11 +15,13 @@
import ShareExtensionAbility from '@ohos.app.ability.ShareExtensionAbility';
import commonEventManager from '@ohos.commonEventManager';
var count = 0;
let count = 0;
const TIME_OUT = 500;
export default class ActsShareExtensionAbility extends ShareExtensionAbility {
storage: LocalStorage;
message: string;
onCreate() {
console.log('====>ActsShareExtensionAbility onCreate called');
count++;
......@@ -33,13 +35,15 @@ export default class ActsShareExtensionAbility extends ShareExtensionAbility {
'count': count
}
}
commonEventManager.publish('ACTS_TEST_FOREGROUND', options, function (){});
commonEventManager.publish('ACTS_TEST_FOREGROUND', options, function () {
});
}
onBackground() {
console.log('====>ActsShareExtensionAbility onBackground called');
count++;
commonEventManager.publish('ACTS_TEST_BACKGROUND', function (){});
commonEventManager.publish('ACTS_TEST_BACKGROUND', function () {
});
setTimeout(() => {
globalThis.session.terminateSelf();
}, TIME_OUT);
......@@ -66,7 +70,8 @@ export default class ActsShareExtensionAbility extends ShareExtensionAbility {
'count': count
}
}
commonEventManager.publish('ACTS_TEST_DESTROY', options, function (){});
commonEventManager.publish('ACTS_TEST_DESTROY', options, function () {
});
}
onSessionDestroy(session) {
......
......@@ -14,7 +14,7 @@
*/
import UIAbility from '@ohos.app.ability.UIAbility';
import hilog from '@ohos.hilog';
import window from '@ohos.window';
import type window from '@ohos.window';
export default class FeatureAbility extends UIAbility {
onCreate(want, launchParam) {
......
......@@ -18,6 +18,7 @@ import commonEventManager from '@ohos.commonEventManager';
export default class FeatureShareExtensionAbility extends ShareExtensionAbility {
storage: LocalStorage;
message: string;
onCreate() {
}
......@@ -31,7 +32,8 @@ export default class FeatureShareExtensionAbility extends ShareExtensionAbility
onSessionCreate(want, session) {
console.log('====>FeatureShareExtensionAbility onSessionCreate called');
commonEventManager.publish('ACTS_FEATURE_CREATE', function (){});
commonEventManager.publish('ACTS_FEATURE_CREATE', function () {
});
if (want.action === 'Acts_ShareExtensionAbility_0400') {
this.context.startAbility({
bundleName: 'com.example.actsshareextensionabilitytest',
......
......@@ -16,8 +16,8 @@ import hilog from '@ohos.hilog';
import TestRunner from '@ohos.application.testRunner';
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
let abilityDelegator = undefined
let abilityDelegatorArguments = undefined
async function onAbilityCreateCallback() {
hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback');
......
......@@ -20,44 +20,44 @@ import testsuite from '../test/List.test';
import window from '@ohos.window';
export default class TestAbility extends UIAbility {
onCreate(want, launchParam) {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? '');
globalThis.context = this.context;
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onCreate(want, launchParam) {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? '');
globalThis.context = this.context;
let abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
let abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy');
}
onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy');
}
onWindowStageCreate(windowStage: window.WindowStage) {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate');
windowStage.loadContent('testability/pages/Index', (err, data) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s',
JSON.stringify(data) ?? '');
});
}
onWindowStageCreate(windowStage: window.WindowStage) {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate');
windowStage.loadContent('testability/pages/Index', (err, data) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s',
JSON.stringify(data) ?? '');
});
}
onWindowStageDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy');
}
onWindowStageDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy');
}
onForeground() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground');
}
onForeground() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground');
}
onBackground() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground');
}
onBackground() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground');
}
}
\ No newline at end of file
......@@ -20,29 +20,32 @@ struct Index {
aboutToAppear() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear');
}
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}
.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(() => {
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册