Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
4d17bfd
feat: layout
jvsena42 Apr 28, 2025
85b312c
feat: navigation
jvsena42 Apr 28, 2025
7b1cd2d
Merge branch 'refactor/lightning-repository' into feat/tags-edit-invoice
jvsena42 Apr 28, 2025
6382f9b
feat: add and remove tag logic
jvsena42 Apr 28, 2025
9520cb9
refactor: adapt attachTagsToActivity method
jvsena42 Apr 28, 2025
5d8ef33
feat: apply tags WIP
jvsena42 Apr 28, 2025
ed3c6fb
Merge branch 'master' into feat/tags-edit-invoice
jvsena42 Apr 28, 2025
c4b0fa5
Merge branch 'master' into feat/tags-edit-invoice
jvsena42 Apr 29, 2025
039b539
feat: implement InvoiceTag table
jvsena42 Apr 29, 2025
7136d5b
feat: implement InvoiceTag table
jvsena42 Apr 29, 2025
8526b34
feat: create saveInvoice method
jvsena42 Apr 29, 2025
3d00881
feat: create searchInvoice method
jvsena42 Apr 29, 2025
59e1e0b
feat: create deleteInvoice method
jvsena42 Apr 29, 2025
a15cef9
feat: implement deleteAllInvoices method
jvsena42 Apr 29, 2025
624fa1d
feat: create deleteExpiredInvoices method
jvsena42 Apr 29, 2025
3da0512
feat: create deleteExpiredInvoices method
jvsena42 Apr 29, 2025
e8017d6
feat: save invoice with tags
jvsena42 Apr 29, 2025
2841c69
feat: attach invoice to tags
jvsena42 Apr 29, 2025
9a16cba
fix: extract payment hash
jvsena42 Apr 29, 2025
dc50387
fix: skip saveInvoiceWithTags with empty tags
jvsena42 Apr 29, 2025
2883e7d
fix: clear tag
jvsena42 Apr 29, 2025
3e68d09
fix: move description state to viewmodel
jvsena42 Apr 29, 2025
b2b7cd4
fix: reset wallet state
jvsena42 Apr 29, 2025
2643c9b
feat: add todo
jvsena42 Apr 30, 2025
0094c2d
fix: handle activity delay
jvsena42 Apr 30, 2025
884041e
feat: delete invoice after success
jvsena42 Apr 30, 2025
8766537
feat: schema changes
jvsena42 Apr 30, 2025
f3b9da1
refactor: extract method handleTags
jvsena42 May 1, 2025
1d08f28
refactor: move attachTagsToActivity to repository
jvsena42 May 1, 2025
aaf3e58
refactor: split attachTagsToActivity method in smaller parts
jvsena42 May 1, 2025
b4f2a26
feat: Keep screen on and set brightness to max while ReceiveQrScreen …
jvsena42 May 1, 2025
bbc0275
Merge pull request #120 from synonymdev/feat/qr-screen-time
ovitrif May 1, 2025
be65dfe
Merge branch 'master' into feat/tags-edit-invoice
jvsena42 May 1, 2025
c9c4257
feat: wrap method in executeWhenNodeRunning
jvsena42 May 1, 2025
d0171d4
feat: remove comment
jvsena42 May 1, 2025
9c9e591
Merge branch 'master' into feat/tags-edit-invoice
jvsena42 May 1, 2025
9c01144
Merge branch 'feat/tags-edit-invoice' into feat/wait-for-node-start
jvsena42 May 1, 2025
2ebc5e4
Merge pull request #121 from synonymdev/feat/wait-for-node-start
ovitrif May 2, 2025
41ddbd5
fix: add executeWhenNodeRunning in stop method
jvsena42 May 2, 2025
0055cf0
fix: wait for node stops before wipe the storage
jvsena42 May 2, 2025
4fa6eb1
fix: get time from system
jvsena42 May 2, 2025
a28c764
refactor: replace toHexString with toHex
jvsena42 May 2, 2025
489aab7
refactor: replace toHexString with toHex
jvsena42 May 2, 2025
1e61ccf
fix: expiration calculation
jvsena42 May 2, 2025
c9e283f
fix: use address as fallback
jvsena42 May 2, 2025
07eccd8
fix: rollback change
jvsena42 May 2, 2025
82bb7a0
fix: migration
jvsena42 May 2, 2025
49f5b79
refactor rename method resetWalletState
jvsena42 May 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/schemas/to.bitkit.data.AppDb/1.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'ea0d5b36d92a5a3fb1523c3064686f7d')"
]
}
}
}
66 changes: 66 additions & 0 deletions app/schemas/to.bitkit.data.AppDb/2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"formatVersion": 1,
"database": {
"version": 2,
"identityHash": "548162ed64d13ae0bed807c23709b850",
"entities": [
{
"tableName": "config",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`walletIndex` INTEGER NOT NULL, PRIMARY KEY(`walletIndex`))",
"fields": [
{
"fieldPath": "walletIndex",
"columnName": "walletIndex",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"walletIndex"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "invoice_tag",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`paymentHash` TEXT NOT NULL, `tags` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, PRIMARY KEY(`paymentHash`))",
"fields": [
{
"fieldPath": "paymentHash",
"columnName": "paymentHash",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "tags",
"columnName": "tags",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "createdAt",
"columnName": "createdAt",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"paymentHash"
]
},
"indices": [],
"foreignKeys": []
}
],
"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, '548162ed64d13ae0bed807c23709b850')"
]
}
}
10 changes: 9 additions & 1 deletion app/src/main/java/to/bitkit/data/AppDb.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.room.Database
import androidx.room.Query
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import androidx.room.Upsert
import androidx.sqlite.db.SupportSQLiteDatabase
import androidx.work.CoroutineWorker
Expand All @@ -15,17 +16,24 @@ import androidx.work.WorkerParameters
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.Flow
import to.bitkit.BuildConfig
import to.bitkit.data.dao.InvoiceTagDao
import to.bitkit.data.entities.ConfigEntity
import to.bitkit.data.entities.InvoiceTagEntity
import to.bitkit.data.typeConverters.StringListConverter
import to.bitkit.env.Env

@Database(
entities = [
ConfigEntity::class,
InvoiceTagEntity::class
],
version = 1,
version = 2,
)

@TypeConverters(StringListConverter::class)
abstract class AppDb : RoomDatabase() {
abstract fun configDao(): ConfigDao
abstract fun invoiceTagDao(): InvoiceTagDao

companion object {
private val DB_NAME = "${BuildConfig.APPLICATION_ID}.${Env.network.name.lowercase()}.sqlite"
Expand Down
30 changes: 30 additions & 0 deletions app/src/main/java/to/bitkit/data/dao/InvoiceTagDao.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package to.bitkit.data.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import to.bitkit.data.entities.InvoiceTagEntity

@Dao
interface InvoiceTagDao {

@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun saveInvoice(invoiceTag: InvoiceTagEntity)

@Query("SELECT * FROM invoice_tag WHERE paymentHash = :paymentHash LIMIT 1")
suspend fun searchInvoice(paymentHash: String) : InvoiceTagEntity?

@Delete
suspend fun deleteInvoice(invoiceTag: InvoiceTagEntity)

@Query("DELETE FROM invoice_tag WHERE paymentHash = :paymentHash")
suspend fun deleteInvoiceByPaymentHash(paymentHash: String)

@Query("DELETE FROM invoice_tag")
suspend fun deleteAllInvoices()

@Query("DELETE FROM invoice_tag WHERE createdAt < :expirationTimeStamp")
suspend fun deleteExpiredInvoices(expirationTimeStamp: Long)
}
11 changes: 11 additions & 0 deletions app/src/main/java/to/bitkit/data/entities/InvoiceTagEntity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package to.bitkit.data.entities

import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity(tableName = "invoice_tag")
data class InvoiceTagEntity(
@PrimaryKey val paymentHash: String,
val tags: List<String>,
val createdAt: Long
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package to.bitkit.data.typeConverters

import androidx.room.TypeConverter

class StringListConverter {
@TypeConverter
fun fromString(value: String): List<String> {
return value.split(",").map { it.trim() }
}

@TypeConverter
fun fromList(list: List<String>): String {
return list.joinToString(",")
}
}
1 change: 1 addition & 0 deletions app/src/main/java/to/bitkit/models/NodeLifecycleState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ sealed class NodeLifecycleState {
fun isRunningOrStarting() = this is Running || this is Starting
fun isStarting() = this is Starting
fun isRunning() = this is Running
fun canRun() = this.isRunningOrStarting() || this is Initializing

val displayState: String
get() = when (this) {
Expand Down
Loading