Skip to content

Commit

Permalink
Fixed bug in 1.6.0 webext upgrade process where old log entries were …
Browse files Browse the repository at this point in the history
…being migrated.

Fixed small styling issue with header.
  • Loading branch information
nero120 committed Apr 29, 2022
1 parent 6e807d0 commit 4e48319
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ export class AndroidV160UpgradeProviderService extends V160UpgradeProviderServic
}

upgradeApp(upgradingFromVersion?: string): ng.IPromise<void> {
// Get current native storage items
// Migrate items in native storage to new store
return this.getAllFromNativeStorage().then((cachedData) => {
// Initialise store
return this.storeSvc
.init()
.then(() => {
Expand All @@ -60,11 +59,10 @@ export class AndroidV160UpgradeProviderService extends V160UpgradeProviderServic
const syncInfo: Partial<ApiXbrowsersyncSyncInfo> = {
serviceType: ApiServiceType.xBrowserSync
};

// Add settings from previous version to store
return this.$q
.all(
Object.keys(cachedData).map((key) => {
// Ignore items that should not be migrated
if (key === 'appVersion' || key === 'password' || key === 'traceLog') {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,57 +36,54 @@ export class WebExtV160UpgradeProviderService extends V160UpgradeProviderService
}

upgradeApp(upgradingFromVersion?: string): ng.IPromise<void> {
// Initialise IndexedDB data storage
return (
this.storeSvc
.init()
// Convert local storage items to IndexedDB
.then(() => browser.storage.local.get())
.then((cachedData) => {
if (!cachedData || Object.keys(cachedData).length === 0) {
return;
}
// Migrate items in local storage to new IndexedDB store
return this.storeSvc
.init()
.then(() => browser.storage.local.get())
.then((cachedData) => {
if (!cachedData || Object.keys(cachedData).length === 0) {
return;
}

const syncInfo: Partial<ApiXbrowsersyncSyncInfo> = {
serviceType: ApiServiceType.xBrowserSync
};

return this.$q
.all(
Object.keys(cachedData).map((key) => {
if (key === 'password') {
return;
}

// Upgrade sync settings
switch (key) {
case 'serviceUrl':
syncInfo.serviceUrl = cachedData[key];
return;
case 'syncId':
syncInfo.id = cachedData[key];
return;
case 'syncVersion':
syncInfo.version = cachedData[key];
return;
default:
}

return this.storeSvc.set(key, cachedData[key]);
})
)
.then(() => {
if (!syncInfo.id) {
const syncInfo: Partial<ApiXbrowsersyncSyncInfo> = {
serviceType: ApiServiceType.xBrowserSync
};
return this.$q
.all(
Object.keys(cachedData).map((key) => {
// Ignore items that should not be migrated
if (key === 'password' || key === 'traceLog') {
return;
}
if (!syncInfo.serviceUrl) {
syncInfo.serviceUrl = Globals.URL.DefaultServiceUrl;

// Upgrade sync settings
switch (key) {
case 'serviceUrl':
syncInfo.serviceUrl = cachedData[key];
return;
case 'syncId':
syncInfo.id = cachedData[key];
return;
case 'syncVersion':
syncInfo.version = cachedData[key];
return;
default:
}
return this.storeSvc.set(StoreKey.SyncInfo, syncInfo);
});
})
.then(() => browser.storage.local.clear())
.then(() => super.upgradeApp())
);

return this.storeSvc.set(key, cachedData[key]);
})
)
.then(() => {
if (!syncInfo.id) {
return;
}
if (!syncInfo.serviceUrl) {
syncInfo.serviceUrl = Globals.URL.DefaultServiceUrl;
}
return this.storeSvc.set(StoreKey.SyncInfo, syncInfo);
});
})
.then(() => browser.storage.local.clear())
.then(() => super.upgradeApp());
}
}
2 changes: 2 additions & 0 deletions src/styles/partials/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
.header-panel {
align-items: center;
display: flex;
flex: 0 0 auto;
font-size: 1.3rem;
justify-content: space-between;
margin-bottom: 0.75rem;
Expand Down Expand Up @@ -129,6 +130,7 @@
border-width: 0;
color: var(--color-well-text);
margin-bottom: 0.75rem;
overflow: hidden;
padding: 1rem 1.25rem;

a {
Expand Down

0 comments on commit 4e48319

Please sign in to comment.