mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 07:01:24 +00:00
commit
0914b5a5c5
@ -1615,6 +1615,8 @@ void SubwindowOhos::OpenCustomDialog(const PromptDialogAttr& dialogAttr, std::fu
|
||||
|
||||
void SubwindowOhos::CloseCustomDialog(const int32_t dialogId)
|
||||
{
|
||||
TAG_LOGI(AceLogTag::ACE_SUB_WINDOW, "close custom dialog with id, childContainerId_ is %{public}d",
|
||||
childContainerId_);
|
||||
auto aceContainer = Platform::AceContainer::GetContainer(childContainerId_);
|
||||
CHECK_NULL_VOID(aceContainer);
|
||||
auto context = DynamicCast<NG::PipelineContext>(aceContainer->GetPipelineContext());
|
||||
@ -1627,6 +1629,8 @@ void SubwindowOhos::CloseCustomDialog(const int32_t dialogId)
|
||||
|
||||
void SubwindowOhos::CloseCustomDialog(const WeakPtr<NG::UINode>& node, std::function<void(int32_t)>&& callback)
|
||||
{
|
||||
TAG_LOGI(AceLogTag::ACE_SUB_WINDOW, "close custom dialog with node, childContainerId_ is %{public}d",
|
||||
childContainerId_);
|
||||
auto aceContainer = Platform::AceContainer::GetContainer(childContainerId_);
|
||||
CHECK_NULL_VOID(aceContainer);
|
||||
auto context = DynamicCast<NG::PipelineContext>(aceContainer->GetPipelineContext());
|
||||
|
@ -150,6 +150,7 @@ void SubwindowManager::DeleteHotAreas(int32_t instanceId, int32_t nodeId)
|
||||
// get the subwindow which overlay node in, not current
|
||||
subwindow = GetSubwindow(instanceId >= MIN_SUBCONTAINER_ID ? GetParentContainerId(instanceId) : instanceId);
|
||||
} else {
|
||||
TAG_LOGW(AceLogTag::ACE_SUB_WINDOW, "Fail to get the subwindow which overlay node in, so get the current one.");
|
||||
subwindow = GetCurrentWindow();
|
||||
}
|
||||
if (subwindow) {
|
||||
@ -169,6 +170,8 @@ const RefPtr<Subwindow> SubwindowManager::GetSubwindow(int32_t instanceId)
|
||||
if (result != subwindowMap_.end()) {
|
||||
return result->second;
|
||||
} else {
|
||||
TAG_LOGW(AceLogTag::ACE_SUB_WINDOW, "Fail to find subwindow in subwindowMap_, instanceId is %{public}d.",
|
||||
instanceId);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -180,6 +183,8 @@ const RefPtr<Subwindow> SubwindowManager::GetToastSubwindow(int32_t instanceId)
|
||||
if (result != toastWindowMap_.end()) {
|
||||
return result->second;
|
||||
}
|
||||
TAG_LOGW(AceLogTag::ACE_SUB_WINDOW, "Fail to find subwindow in toastWindowMap_, instanceId is %{public}d.",
|
||||
instanceId);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -190,6 +195,8 @@ const RefPtr<Subwindow> SubwindowManager::GetSystemToastWindow(int32_t instanceI
|
||||
if (result != systemToastWindowMap_.end()) {
|
||||
return result->second;
|
||||
}
|
||||
TAG_LOGW(AceLogTag::ACE_SUB_WINDOW, "Fail to find subwindow in systemToastWindowMap_, instanceId is %{public}d.",
|
||||
instanceId);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -202,7 +209,7 @@ const RefPtr<Subwindow> SubwindowManager::GetOrCreateSubwindow(int32_t instanceI
|
||||
|
||||
subwindow = Subwindow::CreateSubwindow(instanceId);
|
||||
if (!subwindow) {
|
||||
TAG_LOGE(AceLogTag::ACE_SUB_WINDOW, "create sub window failed");
|
||||
TAG_LOGE(AceLogTag::ACE_SUB_WINDOW, "Create sub window failed, instanceId is %{public}d.", instanceId);
|
||||
return nullptr;
|
||||
}
|
||||
AddSubwindow(instanceId, subwindow);
|
||||
@ -218,6 +225,8 @@ int32_t SubwindowManager::GetDialogSubwindowInstanceId(int32_t SubwindowId)
|
||||
return it->first;
|
||||
}
|
||||
}
|
||||
TAG_LOGW(AceLogTag::ACE_SUB_WINDOW, "Fail to get parentContainerId of subwindow in subwindowMap_,"
|
||||
"subwindowId is %{public}d.", SubwindowId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -407,6 +416,7 @@ void SubwindowManager::HidePopupNG(int32_t targetId, int32_t instanceId)
|
||||
// get the subwindow which overlay node in, not current
|
||||
subwindow = GetSubwindow(instanceId >= MIN_SUBCONTAINER_ID ? GetParentContainerId(instanceId) : instanceId);
|
||||
} else {
|
||||
TAG_LOGW(AceLogTag::ACE_SUB_WINDOW, "Fail to get the subwindow which overlay node in, so get the current one.");
|
||||
subwindow = GetCurrentWindow();
|
||||
}
|
||||
|
||||
@ -491,6 +501,7 @@ void SubwindowManager::SetHotAreas(const std::vector<Rect>& rects, int32_t nodeI
|
||||
// get the subwindow which overlay node in, not current
|
||||
subwindow = GetSubwindow(instanceId >= MIN_SUBCONTAINER_ID ? GetParentContainerId(instanceId) : instanceId);
|
||||
} else {
|
||||
TAG_LOGW(AceLogTag::ACE_SUB_WINDOW, "Fail to get the subwindow which overlay node in, so get the current one.");
|
||||
subwindow = GetCurrentWindow();
|
||||
}
|
||||
|
||||
@ -624,6 +635,8 @@ const RefPtr<Subwindow> SubwindowManager::GetDialogSubwindow(int32_t instanceId)
|
||||
if (result != dialogSubwindowMap_.end()) {
|
||||
return result->second;
|
||||
} else {
|
||||
TAG_LOGW(AceLogTag::ACE_SUB_WINDOW, "Fail to get subwindow in dialogSubwindowMap_, instanceId is %{public}d",
|
||||
instanceId);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -1015,6 +1028,8 @@ void SubwindowManager::HideSubWindowNG()
|
||||
}
|
||||
if (subwindow) {
|
||||
subwindow->HideSubWindowNG();
|
||||
} else {
|
||||
TAG_LOGW(AceLogTag::ACE_SUB_WINDOW, "fail to hide subwindow, subwindow is null.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1034,6 +1049,8 @@ void SubwindowManager::HideToastSubWindowNG()
|
||||
}
|
||||
if (subwindow) {
|
||||
subwindow->HideSubWindowNG();
|
||||
} else {
|
||||
TAG_LOGW(AceLogTag::ACE_SUB_WINDOW, "fail to hide toast subwindow, subwindow is null.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1104,7 +1121,7 @@ void SubwindowManager::HideSystemTopMostWindow()
|
||||
if (subwindow) {
|
||||
subwindow->HideSubWindowNG();
|
||||
} else {
|
||||
TAG_LOGD(AceLogTag::ACE_SUB_WINDOW, "can not find systemTopMost window when hide window");
|
||||
TAG_LOGW(AceLogTag::ACE_SUB_WINDOW, "can not find systemTopMost window when hide window");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1124,7 +1141,7 @@ void SubwindowManager::ClearToastInSystemSubwindow()
|
||||
if (subwindow) {
|
||||
subwindow->ClearToast();
|
||||
} else {
|
||||
TAG_LOGD(AceLogTag::ACE_SUB_WINDOW, "can not find systemTopMost window when clear system toast");
|
||||
TAG_LOGW(AceLogTag::ACE_SUB_WINDOW, "can not find systemTopMost window when clear system toast");
|
||||
}
|
||||
}
|
||||
void SubwindowManager::OnWindowSizeChanged(int32_t instanceId, Rect windowRect, WindowSizeChangeReason reason)
|
||||
|
@ -49,7 +49,10 @@ void CustomDialogControllerModelNG::SetOpenDialog(DialogProperties& dialogProper
|
||||
};
|
||||
|
||||
auto executor = context->GetTaskExecutor();
|
||||
CHECK_NULL_VOID(executor);
|
||||
if (!executor) {
|
||||
TAG_LOGE(AceLogTag::ACE_DIALOG, "Task executor is null.");
|
||||
return;
|
||||
}
|
||||
auto task = ParseOpenDialogTask(
|
||||
currentId, controller, dialogProperties, dialogs, std::move(buildFunc), overlayManager);
|
||||
executor->PostTask(task, TaskExecutor::TaskType::UI, "ArkUIDialogShowCustomDialog");
|
||||
|
@ -2560,34 +2560,38 @@ void OverlayManager::OpenCustomDialog(const DialogProperties& dialogProps, std::
|
||||
RefPtr<UINode> customNode;
|
||||
bool showComponentContent = false;
|
||||
if (!callback) {
|
||||
TAG_LOGE(AceLogTag::ACE_OVERLAY, "Parameters of OpenCustomDialog are incomplete because of no callback.");
|
||||
TAG_LOGE(AceLogTag::ACE_DIALOG, "Parameters of OpenCustomDialog are incomplete because of no callback.");
|
||||
return;
|
||||
}
|
||||
if (dialogProps.customBuilder) {
|
||||
TAG_LOGD(AceLogTag::ACE_OVERLAY, "open custom dialog with custom builder.");
|
||||
TAG_LOGD(AceLogTag::ACE_DIALOG, "open custom dialog with custom builder.");
|
||||
NG::ScopedViewStackProcessor builderViewStackProcessor(Container::CurrentId());
|
||||
dialogProps.customBuilder();
|
||||
customNode = NG::ViewStackProcessor::GetInstance()->Finish();
|
||||
if (!customNode) {
|
||||
TAG_LOGE(AceLogTag::ACE_DIALOG, "Fail to build custom node.");
|
||||
callback(-1);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
auto contentNode = dialogProps.contentNode.Upgrade();
|
||||
if (!contentNode) {
|
||||
TAG_LOGE(AceLogTag::ACE_DIALOG, "Content of custom dialog is null");
|
||||
callback(ERROR_CODE_DIALOG_CONTENT_ERROR);
|
||||
return;
|
||||
}
|
||||
if (GetDialogNodeWithExistContent(contentNode)) {
|
||||
TAG_LOGW(AceLogTag::ACE_DIALOG, "Content of custom dialog already existed.");
|
||||
callback(ERROR_CODE_DIALOG_CONTENT_ALREADY_EXIST);
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AceLogTag::ACE_OVERLAY, "OpenCustomDialog ComponentContent id: %{public}d", contentNode->GetId());
|
||||
TAG_LOGD(AceLogTag::ACE_DIALOG, "OpenCustomDialog ComponentContent id: %{public}d", contentNode->GetId());
|
||||
customNode = RebuildCustomBuilder(contentNode);
|
||||
showComponentContent = true;
|
||||
}
|
||||
auto dialog = DialogView::CreateDialogNode(dialogProps, customNode);
|
||||
if (!dialog) {
|
||||
TAG_LOGE(AceLogTag::ACE_DIALOG, "Fail to create dialog node.");
|
||||
callback(showComponentContent ? ERROR_CODE_DIALOG_CONTENT_ERROR : -1);
|
||||
return;
|
||||
}
|
||||
@ -2626,12 +2630,12 @@ void OverlayManager::CloseCustomDialog(const int32_t dialogId)
|
||||
DeleteDialogHotAreas(tmpNode);
|
||||
CloseDialogInner(tmpNode);
|
||||
} else {
|
||||
TAG_LOGE(AceLogTag::ACE_OVERLAY, "not find dialog when no dialog id");
|
||||
TAG_LOGE(AceLogTag::ACE_DIALOG, "not find dialog when no dialog id");
|
||||
}
|
||||
} else {
|
||||
iter = dialogMap_.find(dialogId);
|
||||
if (iter == dialogMap_.end()) {
|
||||
TAG_LOGE(AceLogTag::ACE_OVERLAY, "not find dialog by id %{public}d", dialogId);
|
||||
TAG_LOGE(AceLogTag::ACE_DIALOG, "not find dialog by id %{public}d", dialogId);
|
||||
return;
|
||||
}
|
||||
RefPtr<FrameNode> tmpDialog = (*iter).second;
|
||||
@ -2644,15 +2648,16 @@ void OverlayManager::CloseCustomDialog(const int32_t dialogId)
|
||||
void OverlayManager::CloseCustomDialog(const WeakPtr<NG::UINode>& node, std::function<void(int32_t)> &&callback)
|
||||
{
|
||||
if (!callback) {
|
||||
TAG_LOGE(AceLogTag::ACE_OVERLAY, "Parameters of CloseCustomDialog are incomplete because of no callback.");
|
||||
TAG_LOGE(AceLogTag::ACE_DIALOG, "Parameters of CloseCustomDialog are incomplete because of no callback.");
|
||||
return;
|
||||
}
|
||||
auto contentNode = node.Upgrade();
|
||||
if (!contentNode) {
|
||||
TAG_LOGE(AceLogTag::ACE_DIALOG, "Content of custom dialog is null");
|
||||
callback(ERROR_CODE_DIALOG_CONTENT_ERROR);
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AceLogTag::ACE_OVERLAY, "CloseCustomDialog ComponentContent id: %{public}d", contentNode->GetId());
|
||||
TAG_LOGD(AceLogTag::ACE_DIALOG, "CloseCustomDialog ComponentContent id: %{public}d", contentNode->GetId());
|
||||
auto dialogNode = GetDialogNodeWithExistContent(contentNode);
|
||||
if (!dialogNode) {
|
||||
dialogNode = SubwindowManager::GetInstance()->GetSubwindowDialogNodeWithExistContent(contentNode);
|
||||
@ -2663,7 +2668,7 @@ void OverlayManager::CloseCustomDialog(const WeakPtr<NG::UINode>& node, std::fun
|
||||
callback(ERROR_CODE_NO_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGE(AceLogTag::ACE_DIALOG, "CloseCustomDialog failed because cannot find dialog.");
|
||||
callback(ERROR_CODE_DIALOG_CONTENT_NOT_FOUND);
|
||||
}
|
||||
|
||||
@ -2671,15 +2676,16 @@ void OverlayManager::UpdateCustomDialog(
|
||||
const WeakPtr<NG::UINode>& node, const DialogProperties& dialogProps, std::function<void(int32_t)> &&callback)
|
||||
{
|
||||
if (!callback) {
|
||||
TAG_LOGE(AceLogTag::ACE_OVERLAY, "Parameters of UpdateCustomDialog are incomplete because of no callback.");
|
||||
TAG_LOGE(AceLogTag::ACE_DIALOG, "Parameters of UpdateCustomDialog are incomplete because of no callback.");
|
||||
return;
|
||||
}
|
||||
auto contentNode = node.Upgrade();
|
||||
if (!contentNode) {
|
||||
TAG_LOGE(AceLogTag::ACE_DIALOG, "Content of custom dialog is null");
|
||||
callback(ERROR_CODE_DIALOG_CONTENT_ERROR);
|
||||
return;
|
||||
}
|
||||
TAG_LOGD(AceLogTag::ACE_OVERLAY, "UpdateCustomDialog ComponentContent id: %{public}d", contentNode->GetId());
|
||||
TAG_LOGD(AceLogTag::ACE_DIALOG, "UpdateCustomDialog ComponentContent id: %{public}d", contentNode->GetId());
|
||||
auto dialogNode = GetDialogNodeWithExistContent(contentNode);
|
||||
if (!dialogNode) {
|
||||
dialogNode = SubwindowManager::GetInstance()->GetSubwindowDialogNodeWithExistContent(contentNode);
|
||||
@ -2702,7 +2708,7 @@ void OverlayManager::UpdateCustomDialog(
|
||||
callback(ERROR_CODE_NO_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGE(AceLogTag::ACE_DIALOG, "UpdateCustomDialog failed because cannot find dialog.");
|
||||
callback(ERROR_CODE_DIALOG_CONTENT_NOT_FOUND);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user