!36645 [新需求]: 路由跳转事件添加打点

Merge pull request !36645 from llzr/navi
This commit is contained in:
openharmony_ci 2024-07-04 12:27:38 +00:00 committed by Gitee
commit 9303822d18
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 28 additions and 2 deletions

View File

@ -183,4 +183,14 @@ void UiSessionManager::ReportInspectorTreeValue(const std::string& data)
}
}
}
void UiSessionManager::OnRouterChange(const std::string& path, const std::string& event)
{
if (GetRouterChangeEventRegistered()) {
auto value = InspectorJsonUtil::Create(true);
value->Put("path", path.c_str());
value->Put("event", event.c_str());
ReportRouterChangeEvent(value->ToString());
}
}
} // namespace OHOS::Ace

View File

@ -15,6 +15,9 @@
#include "core/components_ng/pattern/navigation/navigation_group_node.h"
#if !defined(PREVIEW) && !defined(ACE_UNITTEST)
#include "interfaces/inner_api/ui_session/ui_session_manager.h"
#endif
#include "base/log/ace_checker.h"
#include "base/log/ace_performance_check.h"
#include "base/memory/ace_type.h"
@ -588,6 +591,9 @@ void NavigationGroupNode::TransitionWithPop(const RefPtr<FrameNode>& preNode, co
SetNeedSetInvisible(false);
}
isOnAnimation_ = true;
#if !defined(PREVIEW) && !defined(ACE_UNITTEST)
UiSessionManager::GetInstance().OnRouterChange(navigationPathInfo_, "navigationPopPage");
#endif
}
void NavigationGroupNode::TransitionWithPush(const RefPtr<FrameNode>& preNode, const RefPtr<FrameNode>& curNode,
@ -767,6 +773,9 @@ void NavigationGroupNode::TransitionWithPush(const RefPtr<FrameNode>& preNode, c
nodeMap, endTime - startTime, navigation->GetNavigationPathInfo());
});
}
#if !defined(PREVIEW) && !defined(ACE_UNITTEST)
UiSessionManager::GetInstance().OnRouterChange(navigationPathInfo_, "navigationPushPage");
#endif
}
std::shared_ptr<AnimationUtils::Animation> NavigationGroupNode::BackButtonAnimation(

View File

@ -17,12 +17,15 @@
#include <unordered_map>
#if !defined(PREVIEW) && !defined(ACE_UNITTEST)
#include "interfaces/inner_api/ui_session/ui_session_manager.h"
#endif
#include "base/geometry/ng/size_t.h"
#include "base/log/ace_checker.h"
#include "base/log/ace_performance_check.h"
#include "base/perfmonitor/perf_monitor.h"
#include "base/perfmonitor/perf_constants.h"
#include "base/memory/referenced.h"
#include "base/perfmonitor/perf_constants.h"
#include "base/perfmonitor/perf_monitor.h"
#include "base/utils/time_util.h"
#include "base/utils/utils.h"
#include "core/animation/page_transition_common.h"
@ -188,6 +191,9 @@ bool StageManager::PushPage(const RefPtr<FrameNode>& node, bool needHideLast, bo
CHECK_NULL_RETURN(pageInfo, false);
auto pagePath = pageInfo->GetFullPath();
ACE_SCOPED_TRACE_COMMERCIAL("Router Main Page: %s", pagePath.c_str());
#if !defined(PREVIEW) && !defined(ACE_UNITTEST)
UiSessionManager::GetInstance().OnRouterChange(pagePath, "routerPushPage");
#endif
}
if (needTransition) {
pipeline->FlushPipelineImmediately();

View File

@ -71,6 +71,7 @@ public:
void SaveInspectorTreeFunction(InspectorFunction&& function);
void SetClickEventRegistered(bool status);
void SetSearchEventRegistered(bool status);
void OnRouterChange(const std::string& path, const std::string& event);
void SetRouterChangeEventRegistered(bool status);
void SetComponentChangeEventRegistered(bool status);
bool GetClickEventRegistered();