mirror of
https://github.com/openharmony/ace_ace_engine.git
synced 2026-07-18 20:54:27 -04:00
!2295 Add onNewWant in JsiDeclarativeEngine
Merge pull request !2295 from 张亚菲/zyf
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);
|
||||
|
||||
@@ -1335,6 +1335,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