Fixed some bugs with restoring/initializing tabs when new intents were received and browser was killed by background
This commit is contained in:
parent
87ae1eb8fe
commit
1685a13df3
@ -382,9 +382,11 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
}
|
||||
|
||||
if (isPanicTrigger(getIntent())) {
|
||||
setIntent(null);
|
||||
panicClean();
|
||||
} else {
|
||||
mPresenter.setupTabs(getIntent(), isIncognito());
|
||||
setIntent(null);
|
||||
mProxyUtils.checkForProxy(BrowserActivity.this);
|
||||
}
|
||||
}
|
||||
@ -1161,6 +1163,12 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
mProxyUtils.onStart(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
mTabsManager.shutdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
@ -112,11 +112,11 @@ public class TabsManager {
|
||||
return;
|
||||
}
|
||||
|
||||
String dataString = null;
|
||||
String url = null;
|
||||
if (intent != null) {
|
||||
dataString = intent.getDataString();
|
||||
url = intent.getDataString();
|
||||
}
|
||||
final String url = dataString;
|
||||
Log.d(TAG, "URL from intent: " + url);
|
||||
mCurrentTab = null;
|
||||
if (mPreferenceManager.getRestoreLostTabsEnabled()) {
|
||||
restoreLostTabs(url, activity, subscriber);
|
||||
@ -130,8 +130,8 @@ public class TabsManager {
|
||||
|
||||
}
|
||||
|
||||
private void restoreLostTabs(final String url, final Activity activity,
|
||||
final Subscriber subscriber) {
|
||||
private void restoreLostTabs(@Nullable final String url, @NonNull final Activity activity,
|
||||
@NonNull final Subscriber subscriber) {
|
||||
restoreState().subscribeOn(Schedulers.worker())
|
||||
.observeOn(Schedulers.main()).subscribe(new OnSubscribe<Bundle>() {
|
||||
@Override
|
||||
@ -212,6 +212,7 @@ public class TabsManager {
|
||||
tab.onDestroy();
|
||||
}
|
||||
mTabList.clear();
|
||||
mIsInitialized = false;
|
||||
mCurrentTab = null;
|
||||
}
|
||||
|
||||
@ -393,6 +394,7 @@ public class TabsManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
FileUtils.deleteBundleInStorage(mApp, BUNDLE_STORAGE);
|
||||
subscriber.onComplete();
|
||||
}
|
||||
});
|
||||
|
@ -52,12 +52,9 @@ public class BrowserPresenter {
|
||||
});
|
||||
}
|
||||
|
||||
public void setupTabs(Intent intent, boolean isIncognito) {
|
||||
public void setupTabs(@Nullable Intent intent, boolean isIncognito) {
|
||||
mTabsModel.initializeTabs((Activity) mView, intent, isIncognito)
|
||||
.subscribe(new OnSubscribe<Void>() {
|
||||
@Override
|
||||
public void onNext(Void item) {}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
// At this point we always have at least a tab in the tab manager
|
||||
|
Loading…
Reference in New Issue
Block a user