You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
auto appInstance = g_objectManager->GetJsObjectByJavaObject(AppJavaObjectID);
44
+
if (appInstance.IsEmpty())
45
+
{
46
+
ExceptionUtil::GetInstance()->ThrowExceptionToJava(tc, "NativeScript application not initialized correctly. Missing the global app object initialization.");
47
+
returnnullptr;
48
+
}
49
+
50
+
string createActivityMethodName = "getActivity";
51
+
auto createActivityFunction = appInstance->Get(ConvertToV8String(createActivityMethodName.c_str()));
52
+
53
+
if (createActivityFunction.IsEmpty() || !createActivityFunction->IsFunction())
54
+
{
55
+
ExceptionUtil::GetInstance()->ThrowExceptionToJava(tc, "NativeScript application not initialized correctly. No function 'createActivity' found on the application object.");
56
+
returnnullptr;
57
+
}
58
+
59
+
auto jsResult = NativeScriptRuntime::CallJSMethod(env, appInstance, createActivityMethodName, packagedArgs, tc);
60
+
auto jsInstance = jsResult.As<Object>();
61
+
if (jsInstance.IsEmpty() || jsInstance->IsNull() || jsInstance->IsUndefined())
62
+
{
63
+
ExceptionUtil::GetInstance()->ThrowExceptionToJava(tc, "NativeScript application not initialized correctly. getActivity method returned invalid value.");
64
+
returnnullptr;
65
+
}
66
+
67
+
auto jsActivity = g_objectManager->GetJsObjectByJavaObject(objectId);
auto proxyClassName = g_objectManager->GetClassName(javaObject);
379
+
//
380
+
if (proxyClassName == "com/tns/NativeScriptActivity")
381
381
{
382
-
auto appInstance = g_objectManager->GetJsObjectByJavaObject(AppJavaObjectID);
383
-
if (appInstance.IsEmpty())
384
-
{
385
-
ExceptionUtil::GetInstance()->ThrowExceptionToJava(tc, "NativeScript application not initialized correctly. Missing the global app object initialization.");
386
-
returnnullptr;
387
-
}
388
-
389
-
string createActivityMethodName = "getActivity";
390
-
auto createActivityFunction = appInstance->Get(ConvertToV8String(createActivityMethodName.c_str()));
391
-
392
-
if (createActivityFunction.IsEmpty() || !createActivityFunction->IsFunction())
393
-
{
394
-
ExceptionUtil::GetInstance()->ThrowExceptionToJava(tc, "NativeScript application not initialized correctly. No function 'createActivity' found on the application object.");
0 commit comments