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

changdetails

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