Skip to content

Commit

Permalink
fix no update bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
bapaws committed Mar 22, 2023
1 parent 6f967a4 commit df3c847
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
15 changes: 15 additions & 0 deletions lib/app/data/db/service_tokens_dao.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ class ServiceTokensDao {
service_provider_id TEXT
);
''');

// format data
final string = await rootBundle.loadString(
'assets/files/service_tokens.json',
);
final List list = json.decode(utf8.decode(base64.decode(string)));
final Batch batch = db.batch();
for (final map in list) {
batch.insert(
table,
map,
conflictAlgorithm: ConflictAlgorithm.ignore,
);
}
await batch.commit();
}

static Future<void> onUpgrade(
Expand Down
13 changes: 13 additions & 0 deletions lib/app/data/db/service_vendors_dao.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ class ServiceVendorsDao {
block INTEGER DEFAULT 0
);
''');

// format data
final string = await rootBundle.loadString(
'assets/files/service_vendors.json',
);
final List list = json.decode(utf8.decode(base64.decode(string)));
for (final map in list) {
await db.insert(
table,
map,
conflictAlgorithm: ConflictAlgorithm.ignore,
);
}
}

static Future<void> onUpgrade(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: answer
version: 1.1.0+12
version: 1.1.1+16
publish_to: none
description: A new Flutter project.
environment:
Expand Down

0 comments on commit df3c847

Please sign in to comment.