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 @@
*/
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
));
})
}
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/pages/Index.ets
浏览文件 @
02a6eeb8
...
...
@@ -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)
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/pages/PageThree.ets
浏览文件 @
02a6eeb8
...
...
@@ -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() {
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityotherrely/entry/src/main/ets/shareextensionability/ActsShareExtensionAbility.ts
浏览文件 @
02a6eeb8
...
...
@@ -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
)
{
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/UIExtensionAbility/UIExtAbility.ts
浏览文件 @
02a6eeb8
...
...
@@ -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
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/pages/Index.ets
浏览文件 @
02a6eeb8
...
...
@@ -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%')
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/pages/Page.ets
浏览文件 @
02a6eeb8
...
...
@@ -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%')
}
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/pages/PageThree.ets
浏览文件 @
02a6eeb8
...
...
@@ -18,7 +18,6 @@ let storage = LocalStorage.GetShared();
@Entry(storage)
@Component
struct Index3 {
build() {
Row() {
Column() {
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/entry/src/main/ets/shareextensionability/ActsShareExtensionAbility.ts
浏览文件 @
02a6eeb8
...
...
@@ -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
)
{
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/feature/src/main/ets/featureability/FeatureAbility.ts
浏览文件 @
02a6eeb8
...
...
@@ -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
)
{
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilityself/feature/src/main/ets/shareextensionability/FeatureShareExtensionAbility.ts
浏览文件 @
02a6eeb8
...
...
@@ -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
'
,
...
...
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
浏览文件 @
02a6eeb8
...
...
@@ -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
'
);
...
...
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
...
...
@@ -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
ability/ability_runtime/shareextensionability/actsshareextensionabilitytest/entry/src/main/ets/testability/pages/Index.ets
浏览文件 @
02a6eeb8
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录