mirror of
https://github.com/openharmony/ace_ace_engine.git
synced 2026-07-19 22:54:50 -04:00
Description:Add onNewWant in js declarative engine.
Sig:SIG_ApplicationFramework Feature or BugFix: BugFix Binary Source: No Signed-off-by: zhangyafei.echo <zhangyafei12@huawei.com> Change-Id: I6dbb9216462ff5168586987ed813ece4d56330d9
This commit is contained in:
@@ -471,6 +471,7 @@ void AceAbility::OnNewWant(const Want& want)
|
||||
Ability::OnNewWant(want);
|
||||
std::string params = want.GetStringParam(START_PARAMS_KEY);
|
||||
Platform::AceContainer::OnNewRequest(abilityId_, params);
|
||||
Platform::AceContainer::OnNewWant(abilityId_);
|
||||
LOGI("AceAbility::OnNewWant called End");
|
||||
}
|
||||
|
||||
|
||||
@@ -362,6 +362,25 @@ void AceContainer::OnInactive(int32_t instanceId)
|
||||
}, TaskExecutor::TaskType::UI);
|
||||
}
|
||||
|
||||
void AceContainer::OnNewWant(int32_t instanceId)
|
||||
{
|
||||
std::string data = "";
|
||||
auto container = AceEngine::Get().GetContainer(instanceId);
|
||||
if (!container) {
|
||||
LOGE("container is null, OnNewWant failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
ContainerScope scope(instanceId);
|
||||
auto front = container->GetFrontend();
|
||||
if (!front) {
|
||||
LOGE("front is null, OnNewWant failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
front->OnNewWant(data);
|
||||
}
|
||||
|
||||
bool AceContainer::OnStartContinuation(int32_t instanceId)
|
||||
{
|
||||
auto container = AceEngine::Get().GetContainer(instanceId);
|
||||
|
||||
@@ -226,6 +226,7 @@ public:
|
||||
static void OnHide(int32_t instanceId);
|
||||
static void OnActive(int32_t instanceId);
|
||||
static void OnInactive(int32_t instanceId);
|
||||
static void OnNewWant(int32_t instanceId);
|
||||
static bool OnStartContinuation(int32_t instanceId);
|
||||
static std::string OnSaveData(int32_t instanceId);
|
||||
static bool OnRestoreData(int32_t instanceId, const std::string& data);
|
||||
|
||||
@@ -1339,6 +1339,20 @@ void JsiDeclarativeEngine::OnInactive()
|
||||
CallAppFunc("onInactive");
|
||||
}
|
||||
|
||||
void JsiDeclarativeEngine::OnNewWant(const std::string& data)
|
||||
{
|
||||
LOGI("JsiDeclarativeEngine OnNewWant called.");
|
||||
shared_ptr<JsRuntime> runtime = engineInstance_->GetJsRuntime();
|
||||
if (!runtime) {
|
||||
LOGE("OnNewWant failed, runtime is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
shared_ptr<JsValue> object = runtime->NewObject();
|
||||
std::vector<shared_ptr<JsValue>> argv = { object };
|
||||
CallAppFunc("onNewWant", argv);
|
||||
}
|
||||
|
||||
bool JsiDeclarativeEngine::OnStartContinuation()
|
||||
{
|
||||
LOGI("JsiDeclarativeEngine OnStartContinuation");
|
||||
|
||||
@@ -224,6 +224,8 @@ public:
|
||||
|
||||
void OnInactive() override;
|
||||
|
||||
void OnNewWant(const std::string& data) override;
|
||||
|
||||
bool OnStartContinuation() override;
|
||||
|
||||
void OnCompleteContinuation(int32_t code) override;
|
||||
|
||||
Reference in New Issue
Block a user