Skip to content

Instantly share code, notes, and snippets.

@t4kemyh4nd
Created August 27, 2021 05:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t4kemyh4nd/ce133b28168838e2978982be6e5e7ad8 to your computer and use it in GitHub Desktop.
Save t4kemyh4nd/ce133b28168838e2978982be6e5e7ad8 to your computer and use it in GitHub Desktop.
public String invoke(String str, String str2, String str3, String str4) {
if (!this.mPM.isValid(this.mPageContext.getUrl())) {
return new Response(203).toString();
}
Request request = new Request();
request.setAction(str2);
request.setRawParams(str3);
request.setPageContext(this.mPageContext);
request.setView(this.mView);
request.setNativeInterface(this.mNativeInterface);
try {
HybridFeature lookupFeature = this.mFM.lookupFeature(str);
HybridFeature.Mode invocationMode = lookupFeature.getInvocationMode(request);
if (invocationMode == HybridFeature.Mode.SYNC) {
Response invoke = lookupFeature.invoke(request);
callback(invoke, this.mPageContext, str4);
return invoke.toString();
} else if (invocationMode == HybridFeature.Mode.ASYNC) {
sPool.execute(new AsyncInvocation(lookupFeature, request, str4));
return new Response(2).toString();
} else {
request.setCallback(new Callback(this, this.mPageContext, str4));
sPool.execute(new AsyncInvocation(lookupFeature, request, str4));
return new Response(3).toString();
}
} catch (HybridException e) {
Response response = e.getResponse();
callback(response, this.mPageContext, str4);
return response.toString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment