Skip to content

Commit

Permalink
chore: using getReactCurrentActivity instand getCurrentActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
wn-na committed Nov 16, 2024
1 parent baaa749 commit 259d6f1
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private Method getScreenCaptureCallback() {
if (Build.VERSION.SDK_INT < 34) {
return null;
}
return Utils.getMethod(getCurrentActivity().getClass(), "registerScreenCaptureCallback");
return Utils.getMethod(getReactCurrentActivity().getClass(), "registerScreenCaptureCallback");
}

public void createCaptureCallback() {
Expand Down Expand Up @@ -177,7 +177,7 @@ public void onHostResume() {
createCaptureCallback();
}
registerScreenCaptureCallback.invoke(
getCurrentActivity(),
getReactCurrentActivity(),
Utils.MainExecutor.INSTANCE,
(Object) screenCaptureCallback);
}
Expand All @@ -195,10 +195,10 @@ public void onHostDestroy() {
try {
if (Build.VERSION.SDK_INT >= 34) {
Method method = Utils.getMethod(
getCurrentActivity().getClass(),
getReactCurrentActivity().getClass(),
"unregisterScreenCaptureCallback");
if (method != null && screenCaptureCallback != null) {
method.invoke(getCurrentActivity(), (Object) screenCaptureCallback);
method.invoke(getReactCurrentActivity(), (Object) screenCaptureCallback);
}
}
} catch (Exception e) {
Expand Down

0 comments on commit 259d6f1

Please sign in to comment.