mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1014150 - Sync clients and tabs when refreshing Remote Tabs and when Sending Tab to Device. r=rnewman
Both collections impact the state of your remote tabs, so we should update both when we want your tabs.
This commit is contained in:
parent
cc0165806f
commit
c03d4a23f9
@ -25,6 +25,8 @@ import org.mozilla.gecko.sync.SyncConfiguration;
|
||||
import org.mozilla.gecko.sync.SyncConstants;
|
||||
import org.mozilla.gecko.sync.repositories.NullCursorException;
|
||||
import org.mozilla.gecko.sync.repositories.android.ClientsDatabaseAccessor;
|
||||
import org.mozilla.gecko.sync.repositories.android.FennecTabsRepository;
|
||||
import org.mozilla.gecko.sync.repositories.android.FennecTabsRepository.FennecTabsRepositorySession;
|
||||
import org.mozilla.gecko.sync.repositories.domain.ClientRecord;
|
||||
import org.mozilla.gecko.sync.setup.SyncAccounts;
|
||||
import org.mozilla.gecko.sync.setup.activities.LocaleAware.LocaleAwareActivity;
|
||||
@ -46,7 +48,7 @@ import android.widget.Toast;
|
||||
|
||||
public class SendTabActivity extends LocaleAwareActivity {
|
||||
private interface TabSender {
|
||||
static final String[] CLIENTS_STAGE = new String[] { SyncClientsEngineStage.COLLECTION_NAME };
|
||||
public static final String[] STAGES_TO_SYNC = new String[] { "clients", "tabs" };
|
||||
|
||||
/**
|
||||
* @return Return null if the account isn't correctly initialized. Return
|
||||
@ -55,9 +57,9 @@ public class SendTabActivity extends LocaleAwareActivity {
|
||||
String getAccountGUID();
|
||||
|
||||
/**
|
||||
* Sync this account, specifying only clients as the engine to sync.
|
||||
* Sync this account, specifying only clients and tabs as the engines to sync.
|
||||
*/
|
||||
void syncClientsStage();
|
||||
void sync();
|
||||
}
|
||||
|
||||
private static class FxAccountTabSender implements TabSender {
|
||||
@ -79,8 +81,8 @@ public class SendTabActivity extends LocaleAwareActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncClientsStage() {
|
||||
fxAccount.requestSync(FirefoxAccounts.FORCE, CLIENTS_STAGE, null);
|
||||
public void sync() {
|
||||
fxAccount.requestSync(FirefoxAccounts.FORCE, STAGES_TO_SYNC, null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,8 +109,8 @@ public class SendTabActivity extends LocaleAwareActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncClientsStage() {
|
||||
SyncAdapter.requestImmediateSync(this.account, CLIENTS_STAGE);
|
||||
public void sync() {
|
||||
SyncAdapter.requestImmediateSync(this.account, STAGES_TO_SYNC);
|
||||
}
|
||||
}
|
||||
|
||||
@ -302,7 +304,7 @@ public class SendTabActivity extends LocaleAwareActivity {
|
||||
}
|
||||
|
||||
Logger.info(LOG_TAG, "Requesting immediate clients stage sync.");
|
||||
sender.syncClientsStage();
|
||||
sender.sync();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -319,7 +319,9 @@ public class SyncClientsEngineStage extends AbstractSessionManagingSyncStage {
|
||||
// We can be disabled just for this sync.
|
||||
boolean enabledThisSync = session.isEngineLocallyEnabled(STAGE_NAME);
|
||||
if (!enabledThisSync) {
|
||||
// These log messages look best when they match the messages in ServerSyncStage.
|
||||
Logger.debug(LOG_TAG, "Stage " + STAGE_NAME + " disabled just for this sync.");
|
||||
Logger.info(LOG_TAG, "Skipping stage " + STAGE_NAME + ".");
|
||||
session.advance();
|
||||
return;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import android.view.ViewGroup;
|
||||
*/
|
||||
public class RemoteTabsContainerPanel extends GeckoSwipeRefreshLayout
|
||||
implements TabsPanel.PanelView {
|
||||
private static final String[] STAGES_TO_SYNC_ON_REFRESH = new String[] { "tabs" };
|
||||
private static final String[] STAGES_TO_SYNC_ON_REFRESH = new String[] { "clients", "tabs" };
|
||||
|
||||
/**
|
||||
* Refresh indicators (the swipe-to-refresh "laser show" and the spinning
|
||||
|
Loading…
Reference in New Issue
Block a user