FIX: properly migrate old settings

This commit is contained in:
jason.wall 2017-01-25 23:20:20 -05:00
parent 632ee22189
commit e4044838c5
2 changed files with 26 additions and 0 deletions

View File

@ -1,5 +1,7 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
import {enableProdMode} from '@angular/core';
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);

View File

@ -128,8 +128,32 @@ export class SearchPage implements OnInit
u.user.items[i] = { qry: ci["data"].word, dict: ci.dict, type: ci.type };
else if (ci["data"].sn !== undefined)
u.user.items[i] = { qry: ci["data"].sn, dict: ci["prefix"] === 'G' ? 'grk' : 'heb', type: ci.type };
has_migrated = true;
}
}
for (let pg of u.user.saved_pages)
{
for (let i in pg.queries)
{
let ci = pg.queries[i];
if (ci["data"] !== undefined)
{
if (ci["data"].qry !== undefined)
pg.queries[i] = { qry: ci["data"].qry, dict: ci.dict, type: ci.type };
else if (ci["data"].ref !== undefined)
pg.queries[i] = { qry: ci["data"].ref, dict: ci.dict, type: ci.type };
else if (ci["data"].word !== undefined)
pg.queries[i] = { qry: ci["data"].word, dict: ci.dict, type: ci.type };
else if (ci["data"].sn !== undefined)
pg.queries[i] = { qry: ci["data"].sn, dict: ci["prefix"] === 'G' ? 'grk' : 'heb', type: ci.type };
has_migrated = true;
}
}
}
if (has_migrated)
this.userProfile.save(this.local);
}