feat: add suggest screen

This commit is contained in:
2024-01-20 14:51:13 +07:00
parent b726ae3c7c
commit 9fcdac4edb
14 changed files with 447 additions and 39 deletions

View File

@@ -57,6 +57,12 @@ export class LumeStorage {
public async init() {
const settings = await this.getAllSettings();
const account = await this.getActiveAccount();
if (account) {
this.currentUser = account;
this.interests = await this.getInterests();
}
for (const item of settings) {
if (item.value.length > 10) {
@@ -65,20 +71,6 @@ export class LumeStorage {
this.settings[item.key] = !!parseInt(item.value);
}
}
const account = await this.getActiveAccount();
if (account) {
this.currentUser = account;
const interests = await this.getInterests();
if (interests) {
interests.hashtags = interests.hashtags.map((item: string) =>
item.replace("#", "").toLowerCase(),
);
this.interests = interests;
}
}
}
async #keyring_save(key: string, value: string) {
@@ -430,7 +422,10 @@ export class LumeStorage {
const results: { key: string; value: string }[] = await this.#db.select(
"SELECT * FROM settings WHERE key = 'interests' ORDER BY id DESC LIMIT 1;",
);
if (!results.length) return null;
if (!results[0].value.length) return null;
return JSON.parse(results[0].value) as Interests;
}