From 8ad675c5d73ad6fb60d1f249acbe5e915298ac44 Mon Sep 17 00:00:00 2001 From: SnickerSun Date: Thu, 20 Jun 2024 22:43:33 +0800 Subject: [PATCH] =?utf8?q?Revert=20"=E5=A2=9E=E5=8A=A0=E4=BF=A1=E6=81=AF?= =?utf8?q?=E5=BC=B9=E7=AA=97=EF=BC=8C=E6=9C=AA=E5=AE=8C=E5=96=84"?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This reverts commit 00e364d062b7964fa669752758e14d0a4328183d. --- .../broadcast/include/broadcast_feature.h | 1 - .../broadcast/src/broadcast_implement.c | 1 - .../service/msg_center/CMakeLists.txt | 2 - .../include/notify/message_notification.h | 35 ---- .../msg_center/src/msg_center_customer.cpp | 20 +- .../src/notify/findwatch_notification.cpp | 1 - .../src/notify/message_notification.cpp | 198 ------------------ 7 files changed, 1 insertion(+), 257 deletions(-) delete mode 100644 code/sdk/application/wearable/service/msg_center/include/notify/message_notification.h delete mode 100644 code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp diff --git a/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h b/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h index 7f0757d1c..1c94cd48d 100644 --- a/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h +++ b/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h @@ -87,7 +87,6 @@ typedef enum { TOPIC_EVENT_FIND_WATCH, //查找手表 TOPIC_EVENT_CANCEL_FIND_WATCH,//取消查找 TOPIC_EVENT_DRINKREMINDER,//喝水提醒 - TOPIC_EVENT_MESSAGENOTE, //消息通知 TOPIC_END_NUM = 20000, } TopicNum; diff --git a/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c b/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c index c8194eb57..a9e59252a 100644 --- a/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c +++ b/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c @@ -65,7 +65,6 @@ static const TopicToCore topicToCoreArray[] = { {TOPIC_EVENT_FIND_WATCH,A_CORE_MASK, 1},//查找手表 {TOPIC_EVENT_CANCEL_FIND_WATCH,A_CORE_MASK, 1}, {TOPIC_EVENT_DRINKREMINDER,A_CORE_MASK, 1}, - {TOPIC_EVENT_MESSAGENOTE,A_CORE_MASK, 1}, #ifdef SUPPORT_CAT1_MODEM {TOPIC_EVENT_CAT1_INCOMMING, A_CORE_MASK, 1}, {TOPIC_EVENT_CAT1_CALLCONNTED, A_CORE_MASK, 1}, diff --git a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt index 0fe23e29a..a58b970bd 100644 --- a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt +++ b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt @@ -166,7 +166,6 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/drinkReminder_notification.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/sedentaryReminder_notification.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/transmitting.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/message_notification.cpp ) else() set(SOURCES @@ -181,7 +180,6 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/drinkReminder_notification.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/sedentaryReminder_notification.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/transmitting.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/message_notification.cpp ) endif() diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/message_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/message_notification.h deleted file mode 100644 index 977cc2cd5..000000000 --- a/code/sdk/application/wearable/service/msg_center/include/notify/message_notification.h +++ /dev/null @@ -1,35 +0,0 @@ -/*** - * @Date: 2024-06-20 09:43:23 - * @LastEditors: Caisking 3449750381@qq.com - * @LastEditTime: 2024-06-20 09:47:45 - * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/service/msg_center/include/notify/message_notification.h - */ -#ifndef MESSAGE_NOTIFICATION -#define MESSAGE_NOTIFICATION - -#include "BaseView.h" -namespace OHOS -{ - UIViewGroup *CreateMessageView(void); - void FreeMessageView(void); - - class MessageViewEventListener : public UIView::OnTouchListener,public UIView::OnDragListener - { - public: - static MessageViewEventListener &GetInstance(); - bool OnRelease(UIView &view, const ReleaseEvent &event) override; - bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnDragEnd(UIView& view, const DragEvent& event) override; - - private: - MessageViewEventListener(); - ~MessageViewEventListener(); - MessageViewEventListener(const MessageViewEventListener &) = delete; - const MessageViewEventListener &operator=(const MessageViewEventListener &) = delete; - bool X_DRAG_FLAG{false}; - - }; - -} - -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index 09a47e673..5a65e5f71 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -29,7 +29,6 @@ #include "power_display_service.h" #include "cat1_server.h" #include "testchanging.h" -#include "message_notification.h" #include "testcat1.h" #include "testold.h" #include "testhrsenson.h" @@ -78,6 +77,7 @@ const PriorityMapper PRI_MAPPER[] = { {TOPIC_EVENT_HFP_WATCH_ACTIVE, PRIORITY_ONE}, {TOPIC_EVENT_HFP_WATCH_TO_PHONE, PRIORITY_ONE}, {TOPIC_EVENT_HFP_PHONE_TO_WATCH, PRIORITY_ONE}, + #ifdef SUPPORT_CAT1_MODEM {TOPIC_EVENT_CAT1_INCOMMING, PRIORITY_ONE}, {TOPIC_EVENT_CAT1_CALLCONNTED, PRIORITY_ONE}, @@ -105,7 +105,6 @@ const PriorityMapper PRI_MAPPER[] = { {TOPIC_EVENT_FIND_WATCH,PRIORITY_TWO}, {TOPIC_EVENT_CANCEL_FIND_WATCH,PRIORITY_TWO}, {TOPIC_EVENT_DRINKREMINDER,PRIORITY_TWO}, - {TOPIC_EVENT_MESSAGENOTE,PRIORITY_TWO}, }; static bool CheckPriority(const Topic topic) @@ -178,7 +177,6 @@ void MsgCenterSubscribe() MsgCenterSubscribeTopic(TOPIC_EVENT_FIND_WATCH); MsgCenterSubscribeTopic(TOPIC_EVENT_CANCEL_FIND_WATCH); MsgCenterSubscribeTopic(TOPIC_EVENT_DRINKREMINDER); - MsgCenterSubscribeTopic(TOPIC_EVENT_MESSAGENOTE); } static OHOS::UIViewGroup* ShowAlarmNotify(void) @@ -254,12 +252,6 @@ static OHOS::UIViewGroup* showtransmitNotify(void) return OHOS::transmittingShow(); } -/*显示消息提醒*/ -static OHOS::UIViewGroup* showMessageNotify(void) -{ - return OHOS::CreateMessageView(); -} - void MsgCenterNotifyAlarmProc(const Topic topic, Request* req) { unused(req); @@ -916,15 +908,6 @@ void MsgCenterNotifyDrinkReminderProc(const Topic topic, Request* req) NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); NotificationManager::GetInstance()->ShowNotify(showDrinkReminderNotify, (uint16_t)topic, true); } -//消息通知 -void MsgCenterNotifyMessageProc(const Topic topic, Request* req) -{ - unused(topic); - unused(req); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyMessageProc !"); - NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); - NotificationManager::GetInstance()->ShowNotify(showDrinkReminderNotify, (uint16_t)topic, true); -} void MsgCenterNotifyActivityProc(const Topic topic, Request* req) { unused(topic); @@ -1109,7 +1092,6 @@ static MsgCenterNotifyTable g_msgCenterNotifyTable[] = { {TOPIC_EVENT_FIND_WATCH,MsgCenterNotifyFindWatchProc}, {TOPIC_EVENT_CANCEL_FIND_WATCH,MsgCenterNotifyCanCelFindWatchProc}, {TOPIC_EVENT_DRINKREMINDER,MsgCenterNotifyDrinkReminderProc}, - {TOPIC_EVENT_MESSAGENOTE,MsgCenterNotifyMessageProc}, }; static MsgCenterNotifyTable *MsgCenterGetNotifyTblCb(uint8_t idx) diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp index 56a798ede..0302310a6 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp @@ -1,4 +1,3 @@ - /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-25 17:33:47 diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp deleted file mode 100644 index b2ff7d1e5..000000000 --- a/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp +++ /dev/null @@ -1,198 +0,0 @@ -#include "notification_manager.h" -#include "wearable_log.h" -#include "components/ui_button.h" -#include -#include "ui_service.h" -#include -#include "bleEvent.h" -#include "components/ui_label_ext.h" -#include "uicomponents/UIComponents.h" -#include "message/include/MessageModel.h" -#include "message_notification.h" -#include "string" -namespace OHOS -{ - - UIViewGroup *MessageGroupView{nullptr}; - - UILabel *titleLabel{nullptr}; // 标题 - UILabel *timeLabel{nullptr}; // 时间 - UILabel *messageLabel{nullptr}; // 详细label - UILabelButtonExt *deleteButton{nullptr}; // 删除按键 - - static std::string titleStr, timeStr, messageStr; - -#define DELETEBUTTON "delete_button" - - MessageViewEventListener::MessageViewEventListener() - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MessageViewEventListener::MessageViewEventListener"); - } - - MessageViewEventListener::~MessageViewEventListener() - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MessageViewEventListener::~MessageViewEventListener"); - } - - MessageViewEventListener &MessageViewEventListener::GetInstance() - { - static MessageViewEventListener instance; - return instance; - } - bool MessageViewEventListener::OnRelease(UIView &view, const ReleaseEvent &event) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MessageViewEventListener::OnRelease"); - UNUSED(event); - if (strcmp(view.GetViewId(), DELETEBUTTON) == 0) - { - NotificationManager::GetInstance()->StopNotify(); - } - - return true; - } - bool MessageViewEventListener::OnDrag(UIView &view, const DragEvent &event) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MessageViewEventListener::OnDrag"); - UNUSED(view); - return true; - } - - bool MessageViewEventListener::OnDragEnd(UIView &view, const DragEvent &event) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MessageViewEventListener::OnDragEnd"); - if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) - { - NotificationManager::GetInstance()->StopNotify(); - } - return true; - } - - /*创建信息弹窗*/ - UIViewGroup *CreateMessageView(void) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateMessageView"); - MessageGroupView = new UIViewGroup(); - if (MessageGroupView == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateMessageView] MessageGroupView new fail!!"); - return nullptr; - } - MessageGroupView->SetPosition(0, 0, 466, 466); - MessageGroupView->SetViewId("messagenotify"); - MessageGroupView->SetTouchable(true); - MessageGroupView->SetDraggable(true); - UIView::OnDragListener *dragListener = static_cast(&MessageViewEventListener::GetInstance()); - if (dragListener == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateMessageView] dragListener new fail!!"); - return nullptr; - } - MessageGroupView->SetOnDragListener(dragListener); - /*获取最新message*/ - MessageData *data = MessageModel::GetInstance().GetNewestData(); - if (data != nullptr) - { - titleStr = data->labelTitle; - timeStr = data->labelTime; - messageStr = data->labelDetails; - } - /*初始化label*/ - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitView"); - /* -------------------------------------------------------------------------- */ - titleLabel = new UILabel(); - if (titleLabel == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "titleLabel:: new UILabel fail"); - return nullptr; // 内存分配失败,返回 - } - titleLabel->SetPosition(83, 60, 300, 35); - titleLabel->SetText(titleStr.c_str()); - titleLabel->SetStyle(STYLE_TEXT_FONT, 30); - titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); - titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - titleLabel->SetVisible(true); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "titleLabel is ok!"); - /* -------------------------------------------------------------------------- */ - timeLabel = new UILabel(); - if (timeLabel == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "timeLabel:: new UILabel fail"); - return nullptr; // 内存分配失败,返回 - } - timeLabel->SetPosition(73, 104, 320, 33); - timeLabel->SetViewId("timeLabel"); - timeLabel->SetText(timeStr.c_str()); - timeLabel->SetTextColor(Color::Gray()); - timeLabel->SetStyle(STYLE_TEXT_FONT, 28); - timeLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28); - timeLabel->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); - timeLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - timeLabel->SetVisible(true); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "timeLabel is ok!"); - /* -------------------------------------------------------------------------- */ - /*初始化消息内容*/ - messageLabel = new UILabel(); - if (messageLabel == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "messageLabel:: new UILabel fail"); - return nullptr; // 内存分配失败,返回 - } - messageLabel->SetPosition(53, 170, 360, 144); - messageLabel->SetViewId("messageLabel"); - messageLabel->SetText(messageStr.c_str()); - messageLabel->SetTextColor(Color::Gray()); - messageLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - timeLabel->SetLineBreakMode(UILabel::LINE_BREAK_CLIP); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "messageLabel is ok"); - - /*加载清除按键*/ - InitButtonExt(deleteButton, 0, 366, 466, 100, DELETEBUTTON, STR_CLOSE, 30); - const char *buttonImgSrc = "/user/res/466x100button.bin"; - deleteButton->SetImageSrc(buttonImgSrc, buttonImgSrc); - UIView::OnTouchListener *TouchListener = static_cast(&MessageViewEventListener::GetInstance()); - if (TouchListener == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateMessageView] TouchListener new fail!!"); - return nullptr; - } - deleteButton->SetOnTouchListener(TouchListener); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "deleteButton"); - /* -------------------------------------------------------------------------- */ - MessageGroupView->Add(titleLabel); - MessageGroupView->Add(timeLabel); - MessageGroupView->Add(messageLabel); - MessageGroupView->Add(deleteButton); - - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Create MessageGroupView succeed!!"); - - return MessageGroupView; - } - /*释放消息弹窗视图*/ - void FreeMessageView(void) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FreeMessageView(void)"); - if (MessageGroupView != nullptr) - { - MessageGroupView->RemoveAll(); - - delete titleLabel; - titleLabel = nullptr; - - delete timeLabel; - timeLabel = nullptr; - - delete messageLabel; - messageLabel = nullptr; - - delete deleteButton; - deleteButton = nullptr; - - RootView::GetInstance()->Remove(MessageGroupView); - delete MessageGroupView; - MessageGroupView = nullptr; - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Free MessageView succeed!!"); - } - return; - } -} \ No newline at end of file -- 2.17.1