mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-23 15:20:34 +00:00
onBackPressed默认返回true
Signed-off-by: zhangyuhang72 <zhangyuhang72@huawei.com> Change-Id: I99a324cef0b0965bb7bf01fd1f94f17c52bc7265
This commit is contained in:
parent
1531018e6c
commit
9c97443b44
@ -26,7 +26,7 @@ class Ability {
|
||||
onForeground(want) { }
|
||||
onBackground() { }
|
||||
onBackPressed() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
onPrepareToTerminate() {
|
||||
return false;
|
||||
|
@ -1547,7 +1547,7 @@ void Ability::OnBackground()
|
||||
bool Ability::OnBackPress()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITY, "call");
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Ability::OnPrepareTerminate()
|
||||
|
@ -548,10 +548,10 @@ bool JsAbility::OnBackPress()
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
auto env = jsRuntime_.GetNapiEnv();
|
||||
napi_value jsValue = CallObjectMethod("onBackPressed", nullptr, 0, true);
|
||||
bool ret = false;
|
||||
bool ret = true;
|
||||
if (!ConvertFromJsValue(env, jsValue, ret)) {
|
||||
TAG_LOGW(AAFwkTag::ABILITY, "Get js value failed");
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::ABILITY, "end, ret = %{public}d", ret);
|
||||
return ret;
|
||||
|
@ -620,10 +620,10 @@ bool JsUIAbility::OnBackPress()
|
||||
HandleScope handleScope(jsRuntime_);
|
||||
auto env = jsRuntime_.GetNapiEnv();
|
||||
napi_value jsValue = CallObjectMethod("onBackPressed", nullptr, 0, true);
|
||||
bool ret = false;
|
||||
bool ret = true;
|
||||
if (!ConvertFromJsValue(env, jsValue, ret)) {
|
||||
TAG_LOGE(AAFwkTag::UIABILITY, "Get js value failed.");
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::UIABILITY, "End ret is %{public}d.", ret);
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user