Skip to content

Commit

Permalink
fix(android): prevent script loading on future resumes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Mathews committed Apr 9, 2019
1 parent ad78c3e commit c5c640c
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public abstract class TiLaunchActivity extends TiBaseActivity
*/
public abstract String getUrl();

private boolean hasLoadedScript = false;

/**
* The JavaScript URL that should be ran for the given TiJSActivity derived class name.
* Will only return a result if given activity class was launched at least once.
Expand Down Expand Up @@ -175,7 +177,11 @@ public boolean isJSActivity()
@Override
protected void onResume()
{
loadScript();
// Prevent script from loading on future resumes
if (!hasLoadedScript) {
hasLoadedScript = true;
loadScript();
}
super.onResume();
}

Expand Down

0 comments on commit c5c640c

Please sign in to comment.