Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
02a6eeb8
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
02a6eeb8
编写于
8月 08, 2023
作者:
X
xinking129
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
changdetails
Signed-off-by:
N
xinking129
<
xinxin13@huawei.com
>
上级
7364cc70
变更
15
展开全部
显示空白变更内容
内联
并排
Showing
15 changed file
with
456 addition
and
436 deletion
+456
-436
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/entryability/EntryAbility.ts
...otherrely/entry/src/main/ets/entryability/EntryAbility.ts
+3
-3
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/pages/Index.ets
...ensionabilityotherrely/entry/src/main/ets/pages/Index.ets
+3
-2
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/pages/PageThree.ets
...onabilityotherrely/entry/src/main/ets/pages/PageThree.ets
+1
-2
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/shareextensionability/ActsShareExtensionAbility.ts
...in/ets/shareextensionability/ActsShareExtensionAbility.ts
+9
-4
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/UIExtensionAbility/UIExtAbility.ts
...elf/entry/src/main/ets/UIExtensionAbility/UIExtAbility.ts
+85
-86
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/pages/Index.ets
...reextensionabilityself/entry/src/main/ets/pages/Index.ets
+10
-7
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/pages/Page.ets
...areextensionabilityself/entry/src/main/ets/pages/Page.ets
+5
-5
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/pages/PageThree.ets
...tensionabilityself/entry/src/main/ets/pages/PageThree.ets
+0
-1
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/shareextensionability/ActsShareExtensionAbility.ts
...in/ets/shareextensionability/ActsShareExtensionAbility.ts
+9
-4
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/feature/src/main/ets/featureability/FeatureAbility.ts
...elf/feature/src/main/ets/featureability/FeatureAbility.ts
+1
-1
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/feature/src/main/ets/shareextensionability/FeatureShareExtensionAbility.ts
...ets/shareextensionability/FeatureShareExtensionAbility.ts
+3
-1
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...st/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+2
-2
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/test/Ability.test.ets
...nsionabilitytest/entry/src/main/ets/test/Ability.test.ets
+261
-257
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/testability/TestAbility.ets
...bilitytest/entry/src/main/ets/testability/TestAbility.ets
+35
-35
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/testability/pages/Index.ets
...bilitytest/entry/src/main/ets/testability/pages/Index.ets
+29
-26
未找到文件。
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/entryability/EntryAbility.ts
浏览文件 @
02a6eeb8
...
@@ -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
));
})
})
}
}
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/pages/Index.ets
浏览文件 @
02a6eeb8
...
@@ -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)
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/pages/PageThree.ets
浏览文件 @
02a6eeb8
...
@@ -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() {
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/shareextensionability/ActsShareExtensionAbility.ts
浏览文件 @
02a6eeb8
...
@@ -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
)
{
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/UIExtensionAbility/UIExtAbility.ts
浏览文件 @
02a6eeb8
...
@@ -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
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/pages/Index.ets
浏览文件 @
02a6eeb8
...
@@ -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%')
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/pages/Page.ets
浏览文件 @
02a6eeb8
...
@@ -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%')
}
}
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/pages/PageThree.ets
浏览文件 @
02a6eeb8
...
@@ -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() {
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/shareextensionability/ActsShareExtensionAbility.ts
浏览文件 @
02a6eeb8
...
@@ -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
)
{
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/feature/src/main/ets/featureability/FeatureAbility.ts
浏览文件 @
02a6eeb8
...
@@ -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
)
{
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/feature/src/main/ets/shareextensionability/FeatureShareExtensionAbility.ts
浏览文件 @
02a6eeb8
...
@@ -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
'
,
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
浏览文件 @
02a6eeb8
...
@@ -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
'
);
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/test/Ability.test.ets
浏览文件 @
02a6eeb8
此差异已折叠。
点击以展开。
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/testability/TestAbility.ets
浏览文件 @
02a6eeb8
...
@@ -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)
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/testability/pages/Index.ets
浏览文件 @
02a6eeb8
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录