download template add

Signed-off-by: fangJinliang1 <fangjinliang1@huawei.com>
Change-Id: Ia9722eb0edc946a5c98248cd05b6036d09d7cc46
Signed-off-by: fangJinliang1 <fangjinliang1@huawei.com>
This commit is contained in:
fangJinliang1
2022-05-12 21:13:48 +08:00
parent 2dfe15259d
commit d88f5cccfa
8 changed files with 691 additions and 669 deletions
+4
View File
@@ -62,6 +62,10 @@ Note:If the text contains special characters, please escape them according to th
<filefilterlist>
<filefilter name="defaultFilter" desc="Files not to check">
<filteritem type="filename" name="*.hap|*.rpk" desc="valid and invalid bundle files for tests"/>
<filteritem type="filename" name="downloadTemplate.js" desc="generated file cannot add copyright header information"/>
</filefilter>
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies">
<filteritem type="filename" name="downloadTemplate.abc" desc="source code has been open source"/>
</filefilter>
</filefilterlist>
</oatconfig>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -33,7 +33,7 @@ ErrCode AnsSubscriberProxy::InnerTransact(
{
auto remote = Remote();
if (remote == nullptr) {
ANS_LOGW("[InnerTransact] fail: get Remote fail code %{public}u", code);
ANS_LOGE("[InnerTransact] fail: get Remote fail code %{public}u", code);
return ERR_DEAD_OBJECT;
}
@@ -43,11 +43,11 @@ ErrCode AnsSubscriberProxy::InnerTransact(
return ERR_OK;
}
case DEAD_OBJECT: {
ANS_LOGW("[InnerTransact] fail: ipcErr=%{public}d code %{public}d", err, code);
ANS_LOGE("[InnerTransact] fail: ipcErr=%{public}d code %{public}d", err, code);
return ERR_DEAD_OBJECT;
}
default: {
ANS_LOGW("[InnerTransact] fail: ipcErr=%{public}d code %{public}d", err, code);
ANS_LOGE("[InnerTransact] fail: ipcErr=%{public}d code %{public}d", err, code);
return ERR_ANS_TRANSACT_FAILED;
}
}
@@ -57,7 +57,7 @@ void AnsSubscriberProxy::OnConnected()
{
MessageParcel data;
if (!data.WriteInterfaceToken(AnsSubscriberProxy::GetDescriptor())) {
ANS_LOGW("[OnConnected] fail: write interface token failed.");
ANS_LOGE("[OnConnected] fail: write interface token failed.");
return;
}
@@ -65,7 +65,7 @@ void AnsSubscriberProxy::OnConnected()
MessageOption option = {MessageOption::TF_ASYNC};
ErrCode result = InnerTransact(ON_CONNECTED, option, data, reply);
if (result != ERR_OK) {
ANS_LOGW("[OnConnected] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
ANS_LOGE("[OnConnected] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
return;
}
}
@@ -74,7 +74,7 @@ void AnsSubscriberProxy::OnDisconnected()
{
MessageParcel data;
if (!data.WriteInterfaceToken(AnsSubscriberProxy::GetDescriptor())) {
ANS_LOGW("[OnDisconnected] fail: write interface token failed.");
ANS_LOGE("[OnDisconnected] fail: write interface token failed.");
return;
}
@@ -82,7 +82,7 @@ void AnsSubscriberProxy::OnDisconnected()
MessageOption option = {MessageOption::TF_ASYNC};
ErrCode result = InnerTransact(ON_DISCONNECTED, option, data, reply);
if (result != ERR_OK) {
ANS_LOGW("[OnDisconnected] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
ANS_LOGE("[OnDisconnected] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
return;
}
}
@@ -90,18 +90,18 @@ void AnsSubscriberProxy::OnDisconnected()
void AnsSubscriberProxy::OnConsumed(const sptr<Notification> &notification)
{
if (notification == nullptr) {
ANS_LOGW("[OnConsumed] fail: notification is nullptr.");
ANS_LOGE("[OnConsumed] fail: notification is nullptr.");
return;
}
MessageParcel data;
if (!data.WriteInterfaceToken(AnsSubscriberProxy::GetDescriptor())) {
ANS_LOGW("[OnConsumed] fail: write interface token failed.");
ANS_LOGE("[OnConsumed] fail: write interface token failed.");
return;
}
if (!data.WriteParcelable(notification)) {
ANS_LOGW("[OnConsumed] fail: write notification failed.");
ANS_LOGE("[OnConsumed] fail: write notification failed.");
return;
}
@@ -109,7 +109,7 @@ void AnsSubscriberProxy::OnConsumed(const sptr<Notification> &notification)
MessageOption option = {MessageOption::TF_ASYNC};
ErrCode result = InnerTransact(ON_CONSUMED, option, data, reply);
if (result != ERR_OK) {
ANS_LOGW("[OnConsumed] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
ANS_LOGE("[OnConsumed] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
return;
}
}
@@ -118,29 +118,29 @@ void AnsSubscriberProxy::OnConsumed(
const sptr<Notification> &notification, const sptr<NotificationSortingMap> &notificationMap)
{
if (notification == nullptr) {
ANS_LOGW("[OnConsumed] fail: notification is nullptr.");
ANS_LOGE("[OnConsumed] fail: notification is nullptr.");
return;
}
MessageParcel data;
if (!data.WriteInterfaceToken(AnsSubscriberProxy::GetDescriptor())) {
ANS_LOGW("[OnConsumed] fail: write interface token failed.");
ANS_LOGE("[OnConsumed] fail: write interface token failed.");
return;
}
if (!data.WriteParcelable(notification)) {
ANS_LOGW("[OnConsumed] fail: write notification failed.");
ANS_LOGE("[OnConsumed] fail: write notification failed.");
return;
}
if (!data.WriteBool(notificationMap != nullptr)) {
ANS_LOGW("[OnConsumed] fail: write existMap failed");
ANS_LOGE("[OnConsumed] fail: write existMap failed");
return;
}
if (notificationMap != nullptr) {
if (!data.WriteParcelable(notificationMap)) {
ANS_LOGW("[OnConsumed] fail: write notificationMap failed");
ANS_LOGE("[OnConsumed] fail: write notificationMap failed");
return;
}
}
@@ -149,7 +149,7 @@ void AnsSubscriberProxy::OnConsumed(
MessageOption option = {MessageOption::TF_ASYNC};
ErrCode result = InnerTransact(ON_CONSUMED_MAP, option, data, reply);
if (result != ERR_OK) {
ANS_LOGW("[OnConsumed] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
ANS_LOGE("[OnConsumed] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
return;
}
}
@@ -157,18 +157,18 @@ void AnsSubscriberProxy::OnConsumed(
void AnsSubscriberProxy::OnCanceled(const sptr<Notification> &notification)
{
if (notification == nullptr) {
ANS_LOGW("[OnCanceled] fail: notification is nullptr.");
ANS_LOGE("[OnCanceled] fail: notification is nullptr.");
return;
}
MessageParcel data;
if (!data.WriteInterfaceToken(AnsSubscriberProxy::GetDescriptor())) {
ANS_LOGW("[OnCanceled] fail: write interface token failed.");
ANS_LOGE("[OnCanceled] fail: write interface token failed.");
return;
}
if (!data.WriteParcelable(notification)) {
ANS_LOGW("[OnCanceled] fail: write notification failed.");
ANS_LOGE("[OnCanceled] fail: write notification failed.");
return;
}
@@ -176,7 +176,7 @@ void AnsSubscriberProxy::OnCanceled(const sptr<Notification> &notification)
MessageOption option = {MessageOption::TF_ASYNC};
ErrCode result = InnerTransact(ON_CANCELED, option, data, reply);
if (result != ERR_OK) {
ANS_LOGW("[OnCanceled] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
ANS_LOGE("[OnCanceled] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
return;
}
}
@@ -185,35 +185,35 @@ void AnsSubscriberProxy::OnCanceled(
const sptr<Notification> &notification, const sptr<NotificationSortingMap> &notificationMap, int32_t deleteReason)
{
if (notification == nullptr) {
ANS_LOGW("[OnCanceled] fail: notification is nullptr.");
ANS_LOGE("[OnCanceled] fail: notification is nullptr.");
return;
}
MessageParcel data;
if (!data.WriteInterfaceToken(AnsSubscriberProxy::GetDescriptor())) {
ANS_LOGW("[OnCanceled] fail: write interface token failed.");
ANS_LOGE("[OnCanceled] fail: write interface token failed.");
return;
}
if (!data.WriteParcelable(notification)) {
ANS_LOGW("[OnCanceled] fail: write notification failed.");
ANS_LOGE("[OnCanceled] fail: write notification failed.");
return;
}
if (!data.WriteBool(notificationMap != nullptr)) {
ANS_LOGW("[OnCanceled] fail: write existMap failed");
ANS_LOGE("[OnCanceled] fail: write existMap failed");
return;
}
if (notificationMap != nullptr) {
if (!data.WriteParcelable(notificationMap)) {
ANS_LOGW("[OnCanceled] fail: write notificationMap failed");
ANS_LOGE("[OnCanceled] fail: write notificationMap failed");
return;
}
}
if (!data.WriteInt32(deleteReason)) {
ANS_LOGW("[OnCanceled] fail: write deleteReason failed.");
ANS_LOGE("[OnCanceled] fail: write deleteReason failed.");
return;
}
@@ -221,7 +221,7 @@ void AnsSubscriberProxy::OnCanceled(
MessageOption option = {MessageOption::TF_ASYNC};
ErrCode result = InnerTransact(ON_CANCELED_MAP, option, data, reply);
if (result != ERR_OK) {
ANS_LOGW("[OnCanceled] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
ANS_LOGE("[OnCanceled] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
return;
}
}
@@ -229,18 +229,18 @@ void AnsSubscriberProxy::OnCanceled(
void AnsSubscriberProxy::OnUpdated(const sptr<NotificationSortingMap> &notificationMap)
{
if (notificationMap == nullptr) {
ANS_LOGW("[OnUpdated] fail: notificationMap is empty.");
ANS_LOGE("[OnUpdated] fail: notificationMap is empty.");
return;
}
MessageParcel data;
if (!data.WriteInterfaceToken(AnsSubscriberProxy::GetDescriptor())) {
ANS_LOGW("[OnUpdated] fail: write interface token failed.");
ANS_LOGE("[OnUpdated] fail: write interface token failed.");
return;
}
if (!data.WriteParcelable(notificationMap)) {
ANS_LOGW("[OnUpdated] fail: write notificationMap failed.");
ANS_LOGE("[OnUpdated] fail: write notificationMap failed.");
return;
}
@@ -248,7 +248,7 @@ void AnsSubscriberProxy::OnUpdated(const sptr<NotificationSortingMap> &notificat
MessageOption option = {MessageOption::TF_ASYNC};
ErrCode result = InnerTransact(ON_UPDATED, option, data, reply);
if (result != ERR_OK) {
ANS_LOGW("[OnUpdated] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
ANS_LOGE("[OnUpdated] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
return;
}
}
@@ -257,12 +257,12 @@ void AnsSubscriberProxy::OnDoNotDisturbDateChange(const sptr<NotificationDoNotDi
{
MessageParcel data;
if (!data.WriteInterfaceToken(AnsSubscriberProxy::GetDescriptor())) {
ANS_LOGW("[OnDoNotDisturbDateChange] fail: write interface token failed.");
ANS_LOGE("[OnDoNotDisturbDateChange] fail: write interface token failed.");
return;
}
if (!data.WriteParcelable(date)) {
ANS_LOGW("[OnDoNotDisturbDateChange] fail: write date failed");
ANS_LOGE("[OnDoNotDisturbDateChange] fail: write date failed");
return;
}
@@ -270,7 +270,7 @@ void AnsSubscriberProxy::OnDoNotDisturbDateChange(const sptr<NotificationDoNotDi
MessageOption option = {MessageOption::TF_ASYNC};
ErrCode result = InnerTransact(ON_DND_DATE_CHANGED, option, data, reply);
if (result != ERR_OK) {
ANS_LOGW("[OnDoNotDisturbDateChange] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
ANS_LOGE("[OnDoNotDisturbDateChange] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
return;
}
}
@@ -279,12 +279,12 @@ void AnsSubscriberProxy::OnEnabledNotificationChanged(const sptr<EnabledNotifica
{
MessageParcel data;
if (!data.WriteInterfaceToken(AnsSubscriberProxy::GetDescriptor())) {
ANS_LOGW("[OnEnabledNotificationChanged] fail: write interface token failed.");
ANS_LOGE("[OnEnabledNotificationChanged] fail: write interface token failed.");
return;
}
if (!data.WriteParcelable(callbackData)) {
ANS_LOGW("[OnEnabledNotificationChanged] fail: write callbackData failed");
ANS_LOGE("[OnEnabledNotificationChanged] fail: write callbackData failed");
return;
}
@@ -292,7 +292,7 @@ void AnsSubscriberProxy::OnEnabledNotificationChanged(const sptr<EnabledNotifica
MessageOption option = {MessageOption::TF_ASYNC};
ErrCode result = InnerTransact(ON_ENABLED_NOTIFICATION_CHANGED, option, data, reply);
if (result != ERR_OK) {
ANS_LOGW("[OnEnabledNotificationChanged] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
ANS_LOGE("[OnEnabledNotificationChanged] fail: transact ErrCode=ERR_ANS_TRANSACT_FAILED");
return;
}
}
@@ -1390,7 +1390,7 @@ bool NotificationRequest::ReadFromParcel(Parcel &parcel)
}
auto vsize = parcel.ReadUint64();
for (auto it = 0; it < vsize; ++it) {
for (uint64_t it = 0; it < vsize; ++it) {
auto member = parcel.ReadParcelable<NotificationActionButton>();
if (member == nullptr) {
ANS_LOGE("Failed to read actionButton");
+16
View File
@@ -54,6 +54,8 @@ ohos_shared_library("libans") {
defines = []
deps = [
":downloadTemplate.abc",
":downloadTemplate.js",
":external.json",
"${core_path}:ans_core",
"${frameworks_path}/ans/dialog/dialog_ui/js:dialog_js_files_etc",
@@ -97,3 +99,17 @@ ohos_prebuilt_etc("external.json") {
subsystem_name = "notification"
part_name = "ans_standard"
}
ohos_prebuilt_etc("downloadTemplate.abc") {
source = "//base/notification/ans_standard/services/ans/resource/downloadTemplate.abc"
relative_install_dir = "notification_template/assets/js"
subsystem_name = "notification"
part_name = "ans_standard"
}
ohos_prebuilt_etc("downloadTemplate.js") {
source = "//base/notification/ans_standard/services/ans/resource/downloadTemplate.js"
relative_install_dir = "notification_template/assets/js"
subsystem_name = "notification"
part_name = "ans_standard"
}
Binary file not shown.
@@ -0,0 +1,2 @@
(()=>{"use strict";var e={};(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0});const o="Template-DownloadTemplate";class i extends View{constructor(e,t,o){super(e,t),this.icon=null,this.__title=new ObservedPropertySimple("",this,"title"),this.__detailedInfo=new ObservedPropertySimple("",this,"detailedInfo"),this.__passTime=new ObservedPropertySimple(0,this,"passTime"),this.__fileName=new ObservedPropertySimple("",this,"fileName"),this.__progressValue=new ObservedPropertySimple(40,this,"progressValue"),this.__isShowDetailedInfo=new ObservedPropertySimple(!1,this,"isShowDetailedInfo"),this.updateWithValueParams(o)}updateWithValueParams(e){void 0!==e.icon&&(this.icon=e.icon),void 0!==e.title&&(this.title=e.title),void 0!==e.detailedInfo&&(this.detailedInfo=e.detailedInfo),void 0!==e.passTime&&(this.passTime=e.passTime),void 0!==e.fileName&&(this.fileName=e.fileName),void 0!==e.progressValue&&(this.progressValue=e.progressValue),void 0!==e.isShowDetailedInfo&&(this.isShowDetailedInfo=e.isShowDetailedInfo)}aboutToBeDeleted(){this.__title.aboutToBeDeleted(),this.__detailedInfo.aboutToBeDeleted(),this.__passTime.aboutToBeDeleted(),this.__fileName.aboutToBeDeleted(),this.__progressValue.aboutToBeDeleted(),this.__isShowDetailedInfo.aboutToBeDeleted(),SubscriberManager.Get().delete(this.id())}get title(){return this.__title.get()}set title(e){this.__title.set(e)}get detailedInfo(){return this.__detailedInfo.get()}set detailedInfo(e){this.__detailedInfo.set(e)}get passTime(){return this.__passTime.get()}set passTime(e){this.__passTime.set(e)}get fileName(){return this.__fileName.get()}set fileName(e){this.__fileName.set(e)}get progressValue(){return this.__progressValue.get()}set progressValue(e){this.__progressValue.set(e)}get isShowDetailedInfo(){return this.__isShowDetailedInfo.get()}set isShowDetailedInfo(e){this.__isShowDetailedInfo.set(e)}aboutToAppear(){console.log(`${o} ------\x3e aboutToAppear, icon: ${JSON.stringify(this.icon)}`),console.log(`${o} ------\x3e aboutToAppear, title: ${this.title}`),console.log(`${o} ------\x3e aboutToAppear, detailedInfo: ${this.detailedInfo}`),console.log(`${o} ------\x3e aboutToAppear, passTime: ${this.passTime}`),console.log(`${o} ------\x3e aboutToAppear, fileName: ${this.fileName}`),console.log(`${o} ------\x3e aboutToAppear, progressValue: ${this.progressValue}`)}render(){Flex.create({direction:FlexDirection.Column,alignItems:ItemAlign.Center,justifyContent:FlexAlign.Start}),Flex.width("100%"),Flex.margin({top:12,bottom:12}),Flex.border({width:1,color:Color.White,radius:30}),Flex.backgroundColor(Color.White),Column.create({space:10}),Column.alignItems(HorizontalAlign.Center),Column.width("100%"),Row.create({space:10}),Row.alignItems(VerticalAlign.Center),Row.align(Alignment.Start),Row.margin({bottom:12}),Row.width("100%"),If.create(),this.icon&&(If.branchId(0),Image.create(this.icon),Image.objectFit(ImageFit.Contain),Image.width(16),Image.height(16)),If.pop(),Text.create(this.title),Text.fontColor("#182431"),Text.fontSize("12"),Text.fontWeight(FontWeight.Regular),Text.align(Alignment.Start),Text.pop(),Text.create("已完成:"),Text.fontColor("#182431"),Text.fontSize("12"),Text.fontWeight(FontWeight.Regular),Text.pop(),Text.create(`${this.progressValue}%`),Text.fontColor("#182431"),Text.fontSize("12"),Text.fontWeight(FontWeight.Regular),Text.pop(),Text.create(`${this.passTime}分钟前`),Text.fontColor("#182431"),Text.fontSize("12"),Text.fontWeight(FontWeight.Regular),Text.pop(),Row.pop(),Flex.create({justifyContent:FlexAlign.SpaceBetween}),Flex.width("100%"),Row.create({space:5}),Row.flexShrink(0),Row.alignItems(VerticalAlign.Center),Row.align(Alignment.Start),Text.create("标题:正在接收"),Text.fontColor("#182431"),Text.fontSize("14"),Text.pop(),Text.create(this.fileName),Text.fontColor("#182431"),Text.fontSize("14"),Text.pop(),Row.pop(),Row.create(),Row.alignItems(VerticalAlign.Center),Row.align(Alignment.End),Row.onClick((()=>this.isShowDetailedInfo=!this.isShowDetailedInfo)),Text.create("文件详情"),Text.fontColor("#182431"),Text.fontSize("14"),Text.fontWeight(FontWeight.Regular),Text.pop(),Row.pop(),Flex.pop(),If.create(),this.isShowDetailedInfo&&(If.branchId(0),Row.create(),Row.alignItems(VerticalAlign.Center),Row.align(Alignment.Start),Row.width("100%"),Text.create(this.detailedInfo),Text.maxLines(3),Text.textOverflow({overflow:TextOverflow.Ellipsis}),Text.fontColor("#182431"),Text.fontSize("14"),Text.pop(),Row.pop()),If.pop(),Column.create(),Column.alignItems(HorizontalAlign.Start),Column.width("100%"),Progress.create({value:this.progressValue,total:100,style:ProgressStyle.Linear}),Progress.color(Color.Blue),Progress.value(this.progressValue),Progress.width("100%"),Column.pop(),Column.pop(),Flex.pop()}}t.default=i,loadDocument(new i("1",void 0,{}))})()})();
//# sourceMappingURL=../_releaseMap/pages/downloadTemplate.js.map