-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Making it so account data is stored in a database instead of multiple proto files - Removed different thread view options. Tree is not the only option --------- Co-authored-by: John Oberhauser <j.git-global@obez.io>
- Loading branch information
1 parent
a9db4c6
commit 24929c4
Showing
64 changed files
with
735 additions
and
787 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
plugins { | ||
id("social.firefly.android.library") | ||
alias(libs.plugins.kotlin.ksp) | ||
alias(libs.plugins.kotlinx.serialization) | ||
} | ||
|
||
android { | ||
namespace = "social.firefly.core.accounts" | ||
|
||
defaultConfig { | ||
ksp { | ||
arg("room.schemaLocation", "$projectDir/schemas") | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(project(":core:model")) | ||
|
||
implementation(libs.koin.android) | ||
|
||
implementation(libs.androidx.room.runtime) | ||
ksp(libs.androidx.room.compiler) | ||
implementation(libs.androidx.room) | ||
|
||
implementation(libs.kotlinx.serialization.json) | ||
} |
120 changes: 120 additions & 0 deletions
120
core/accounts/schemas/social.firefly.core.accounts.AccountsDatabase/1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
{ | ||
"formatVersion": 1, | ||
"database": { | ||
"version": 1, | ||
"identityHash": "fa0fd12964a2830e2fdd786ebac516aa", | ||
"entities": [ | ||
{ | ||
"tableName": "mastodonAccounts", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`accessToken` TEXT NOT NULL, `accountId` TEXT NOT NULL, `domain` TEXT NOT NULL, `avatarUrl` TEXT NOT NULL, `userName` TEXT NOT NULL, `defaultLanguage` TEXT NOT NULL, `serializedPushKeys` TEXT, `lastSeenHomeStatusId` TEXT, PRIMARY KEY(`accountId`))", | ||
"fields": [ | ||
{ | ||
"fieldPath": "accessToken", | ||
"columnName": "accessToken", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "accountId", | ||
"columnName": "accountId", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "domain", | ||
"columnName": "domain", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "avatarUrl", | ||
"columnName": "avatarUrl", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "userName", | ||
"columnName": "userName", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "defaultLanguage", | ||
"columnName": "defaultLanguage", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "serializedPushKeys", | ||
"columnName": "serializedPushKeys", | ||
"affinity": "TEXT", | ||
"notNull": false | ||
}, | ||
{ | ||
"fieldPath": "lastSeenHomeStatusId", | ||
"columnName": "lastSeenHomeStatusId", | ||
"affinity": "TEXT", | ||
"notNull": false | ||
} | ||
], | ||
"primaryKey": { | ||
"autoGenerate": false, | ||
"columnNames": [ | ||
"accountId" | ||
] | ||
}, | ||
"indices": [], | ||
"foreignKeys": [] | ||
}, | ||
{ | ||
"tableName": "activeAccount", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`key` INTEGER NOT NULL, `accountType` TEXT NOT NULL, `accountId` TEXT NOT NULL, PRIMARY KEY(`key`), FOREIGN KEY(`accountId`) REFERENCES `mastodonAccounts`(`accountId`) ON UPDATE CASCADE ON DELETE CASCADE )", | ||
"fields": [ | ||
{ | ||
"fieldPath": "key", | ||
"columnName": "key", | ||
"affinity": "INTEGER", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "accountType", | ||
"columnName": "accountType", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "accountId", | ||
"columnName": "accountId", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
} | ||
], | ||
"primaryKey": { | ||
"autoGenerate": false, | ||
"columnNames": [ | ||
"key" | ||
] | ||
}, | ||
"indices": [], | ||
"foreignKeys": [ | ||
{ | ||
"table": "mastodonAccounts", | ||
"onDelete": "CASCADE", | ||
"onUpdate": "CASCADE", | ||
"columns": [ | ||
"accountId" | ||
], | ||
"referencedColumns": [ | ||
"accountId" | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"views": [], | ||
"setupQueries": [ | ||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", | ||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'fa0fd12964a2830e2fdd786ebac516aa')" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
</manifest> |
24 changes: 24 additions & 0 deletions
24
core/accounts/src/main/kotlin/social/firefly/core/accounts/AccountsDatabase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package social.firefly.core.accounts | ||
|
||
import androidx.room.Database | ||
import androidx.room.RoomDatabase | ||
import social.firefly.core.accounts.dao.ActiveAccountDao | ||
import social.firefly.core.accounts.dao.MastodonAccountsDao | ||
import social.firefly.core.accounts.model.ActiveAccount | ||
import social.firefly.core.accounts.model.MastodonAccount | ||
|
||
@Database( | ||
entities = [ | ||
MastodonAccount::class, | ||
ActiveAccount::class, | ||
], | ||
version = 1, | ||
autoMigrations = [ | ||
|
||
], | ||
exportSchema = true | ||
) | ||
internal abstract class AccountsDatabase : RoomDatabase() { | ||
abstract fun mastodonAccountsDao(): MastodonAccountsDao | ||
abstract fun activeAccountsDao(): ActiveAccountDao | ||
} |
Oops, something went wrong.