Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
58d9321
fix(db): resolve Room warnings and SQL syntax errors
SeniorZhai May 21, 2026
8f490c6
fix(ui): replace deprecated Compose components and update Hilt imports
SeniorZhai May 21, 2026
aedb3cf
fix(crypto): address deprecation and naming warnings in crypto module
SeniorZhai May 21, 2026
161d817
fix(core): misc cleanup and annotation target fixes
SeniorZhai May 21, 2026
a795a67
fix(compose): add missing Column import in TextHighlight preview
SeniorZhai May 21, 2026
7cdc472
chore: remove unnecessary non-null assertions and safe calls
SeniorZhai May 21, 2026
048290d
chore: clean up redundant null assertions, conversions and elvis ops
SeniorZhai May 21, 2026
c82bd9a
chore(crypto): suppress EncryptedSharedPreferences/MasterKey deprecation
SeniorZhai May 21, 2026
822d1dd
chore: suppress deprecated PagedList warnings across affected files
SeniorZhai May 21, 2026
615238b
chore: suppress deprecation warnings across modules
SeniorZhai May 21, 2026
186cea2
chore: suppress deprecated override warnings
SeniorZhai May 21, 2026
1b3f99f
chore: add explicit annotation use-site targets
SeniorZhai May 21, 2026
9ae3867
chore: simplify always-true/false conditions
SeniorZhai May 21, 2026
16b4c1f
chore: clean up assorted warnings and suppress misleading ones
SeniorZhai May 21, 2026
b70223f
fix(forward): correct duplicate ShareCategory branch and clean redund…
SeniorZhai May 21, 2026
cc1c36c
chore: remove redundant null checks, safe calls and when else branches
SeniorZhai May 21, 2026
4de2adc
chore: remove redundant null safety and exhaustive when else
SeniorZhai May 21, 2026
e534e7e
chore: remove redundant conversions and unnecessary null safety
SeniorZhai May 21, 2026
7ded36b
fix(warnings): align override parameter names
SeniorZhai May 21, 2026
c797eb1
chore(member): remove unused notification sheet
SeniorZhai May 25, 2026
34da0c0
Merge branch 'master' into fix/compilation-warnings
crossle May 25, 2026
497c643
chore(warnings): clean up remaining compilation warnings
SeniorZhai May 25, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,6 @@ fun getTransactionResult(
if (firstTransaction == null) {
throw NullPointerException("The first transaction was not found")
} else {
return Pair(firstTransaction!!, secondTransaction)
return Pair(firstTransaction, secondTransaction)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import one.mixin.android.session.Session
import one.mixin.android.ui.home.web3.components.ActionButton
import one.mixin.android.util.getChainName
import one.mixin.android.vo.safe.TokenItem
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
import one.mixin.android.ui.wallet.WalletViewModel
import kotlinx.coroutines.launch
import one.mixin.android.ui.home.inscription.component.AutoSizeConstraint
Expand Down
34 changes: 18 additions & 16 deletions app/src/main/java/one/mixin/android/compose/TextHighlight.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package one.mixin.android.compose

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.text.ClickableText
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextLinkStyles
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.style.TextOverflow
Expand All @@ -27,7 +28,7 @@ fun HighlightStarLinkText(
onClick: (link: String) -> Unit,
) {
val annotatedString =
remember {
remember(source, links, highlightStyle, onClick) {
buildAnnotatedString {
var start: Int
var end: Int
Expand All @@ -50,27 +51,28 @@ fun HighlightStarLinkText(
kotlin.runCatching {
for (i in targets.indices) {
val (highlightStart, highlightEnd) = targets[i]
addStyle(
highlightStyle,
highlightStart,
highlightEnd,
)
addStringAnnotation(TAG_URL, annotation = links[i], highlightStart, highlightEnd)
val link = if (i < links.size) links[i] else ""
if (link.isNotEmpty()) {
addLink(
LinkAnnotation.Url(
url = link,
styles = TextLinkStyles(style = highlightStyle),
linkInteractionListener = {
onClick(link)
}
),
highlightStart,
highlightEnd,
)
}
}
}
}
}

ClickableText(
Text(
modifier = modifier,
text = annotatedString,
onClick = { position ->
annotatedString.getStringAnnotations(position, position).firstOrNull()?.let {
if (it.tag == TAG_URL) {
onClick(it.item)
}
}
},
style = textStyle,
)
}
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/java/one/mixin/android/compose/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@ class AppColors(
)

class AppDrawables(
@DrawableRes
@param:DrawableRes
val bgAlertCard: Int,

)
)

object MixinAppTheme {
val colors: AppColors
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/one/mixin/android/crypto/CryptoUtil.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@file:Suppress("NOTHING_TO_INLINE")
@file:Suppress("NOTHING_TO_INLINE", "DEPRECATION")

package one.mixin.android.crypto

Expand Down Expand Up @@ -328,6 +328,7 @@ fun storeValueInEncryptedPreferences(context: Context, alias: String, entropy: B
encryptedPrefs.edit(commit = true) { putString(alias, encodedKey) }
}

@Suppress("DEPRECATION")
fun removeValueFromEncryptedPreferences(context: Context, alias: String) {
runCatching {
val encryptedPrefs = EncryptedSharedPreferences.create(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION")

package one.mixin.android.crypto

import android.content.Context
Expand Down Expand Up @@ -323,6 +325,7 @@ object CryptoWalletHelper {
encryptedPrefs?.remove(walletId)
}

@Suppress("DEPRECATION")
fun clear(context: Context) {
context.deleteSharedPreferences(ENCRYPTED_WEB3_KEY)
}
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/java/one/mixin/android/crypto/db/SignalDatabase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ abstract class SignalDatabase : RoomDatabase() {

private val MIGRATION_2_3: Migration =
object : Migration(2, 3) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("DROP INDEX IF EXISTS index_sessions_address")
database.execSQL("ALTER TABLE sessions ADD COLUMN device INTEGER NOT NULL DEFAULT 1")
database.execSQL("CREATE UNIQUE INDEX index_sessions_address_device ON sessions (address, device)")
database.execSQL("UPDATE sessions SET address = substr(address, 1, 36), device = 1 WHERE length(address) = 38")
database.execSQL("ALTER TABLE ratchet_sender_keys ADD COLUMN message_id TEXT")
database.execSQL("ALTER TABLE ratchet_sender_keys ADD COLUMN created_at TEXT NOT NULL DEFAULT ''")
override fun migrate(db: SupportSQLiteDatabase) {
db.execSQL("DROP INDEX IF EXISTS index_sessions_address")
db.execSQL("ALTER TABLE sessions ADD COLUMN device INTEGER NOT NULL DEFAULT 1")
db.execSQL("CREATE UNIQUE INDEX index_sessions_address_device ON sessions (address, device)")
db.execSQL("UPDATE sessions SET address = substr(address, 1, 36), device = 1 WHERE length(address) = 38")
db.execSQL("ALTER TABLE ratchet_sender_keys ADD COLUMN message_id TEXT")
db.execSQL("ALTER TABLE ratchet_sender_keys ADD COLUMN created_at TEXT NOT NULL DEFAULT ''")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class MixinIdentityKeyStore(private val context: Context) : IdentityKeyStore {
return when (direction) {
IdentityKeyStore.Direction.SENDING -> isTrustedForSending(identityKey, dao.getIdentity(theirAddress))
IdentityKeyStore.Direction.RECEIVING -> true
else -> throw AssertionError("Unknown direction: $direction")
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/one/mixin/android/db/AppDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package one.mixin.android.db
import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.Query
import androidx.room.RewriteQueriesToDropUnusedColumns
import androidx.room.RoomWarnings
import one.mixin.android.db.BaseDao.Companion.ESCAPE_SUFFIX
import one.mixin.android.vo.App
Expand All @@ -11,6 +12,7 @@ import one.mixin.android.vo.ExploreApp
import one.mixin.android.vo.RecentUsedApp

@Dao
@RewriteQueriesToDropUnusedColumns
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
interface AppDao : BaseDao<App> {
companion object {
Expand All @@ -23,7 +25,7 @@ interface AppDao : BaseDao<App> {
"""
}

@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Query(
"""
$PREFIX_APP_ITEM
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/java/one/mixin/android/db/AssetDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,23 @@ interface AssetDao : BaseDao<Asset> {
@Query("SELECT * FROM assets WHERE asset_id = :id")
suspend fun simpleAsset(id: String): Asset?

@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Query("$PREFIX_ASSET_ITEM WHERE ae.hidden = 1 $POSTFIX_ASSET_ITEM")
fun hiddenAssetItems(): LiveData<List<AssetItem>>

@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Query("$PREFIX_ASSET_ITEM $POSTFIX_ASSET_ITEM_NOT_HIDDEN")
fun assetItemsNotHidden(): LiveData<List<AssetItem>>

@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Query("$PREFIX_ASSET_ITEM $POSTFIX_ASSET_ITEM")
fun assetItems(): LiveData<List<AssetItem>>

@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Query("""$PREFIX_ASSET_ITEM WHERE a1.asset_id IN (:assetIds) $POSTFIX_ASSET_ITEM """)
fun assetItems(assetIds: List<String>): LiveData<List<AssetItem>>

@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Query(
"""$PREFIX_ASSET_ITEM
WHERE a1.balance > 0
Expand All @@ -74,7 +74,7 @@ interface AssetDao : BaseDao<Asset> {
symbol: String,
): List<AssetItem>

@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Query(
"""$PREFIX_ASSET_ITEM
WHERE (a1.symbol LIKE '%' || :symbol || '%' $ESCAPE_SUFFIX OR a1.name LIKE '%' || :name || '%' $ESCAPE_SUFFIX)
Expand All @@ -88,15 +88,15 @@ interface AssetDao : BaseDao<Asset> {
symbol: String,
): List<AssetItem>

@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Query("$PREFIX_ASSET_ITEM WHERE a1.asset_id = :id")
fun assetItem(id: String): LiveData<AssetItem>

@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Query("$PREFIX_ASSET_ITEM WHERE a1.asset_id = :assetId")
suspend fun simpleAssetItem(assetId: String): AssetItem?

@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Query("$PREFIX_ASSET_ITEM WHERE a1.balance > 0 $POSTFIX_ASSET_ITEM")
fun assetItemsWithBalance(): LiveData<List<AssetItem>>

Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/one/mixin/android/db/CircleDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package one.mixin.android.db
import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.Query
import androidx.room.RewriteQueriesToDropUnusedColumns
import androidx.room.RoomWarnings
import androidx.room.Transaction
import androidx.room.Update
Expand All @@ -13,6 +14,7 @@ import one.mixin.android.vo.ConversationCircleManagerItem
import one.mixin.android.vo.ConversationMinimal

@Dao
@RewriteQueriesToDropUnusedColumns
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
interface CircleDao : BaseDao<Circle> {
@Transaction
Expand Down Expand Up @@ -106,7 +108,7 @@ interface CircleDao : BaseDao<Circle> {
@Query("SELECT * FROM circles WHERE circle_id = :circleId")
fun findCircleById(circleId: String): Circle?

@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Query(
"""
SELECT c.conversation_id AS conversationId, c.icon_url AS groupIconUrl, c.category AS category,
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/java/one/mixin/android/db/ConversationDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.lifecycle.LiveData
import androidx.paging.DataSource
import androidx.room.Dao
import androidx.room.Query
import androidx.room.RewriteQueriesToDropUnusedColumns
import androidx.room.RoomWarnings
import one.mixin.android.vo.Conversation
import one.mixin.android.vo.ConversationItem
Expand All @@ -14,6 +15,8 @@ import one.mixin.android.vo.GroupMinimal
import one.mixin.android.vo.ParticipantSessionMinimal

@Dao
@RewriteQueriesToDropUnusedColumns
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
interface ConversationDao : BaseDao<Conversation> {
companion object {
const val PREFIX_CONVERSATION_ITEM =
Expand All @@ -39,7 +42,7 @@ interface ConversationDao : BaseDao<Conversation> {
}

// Read SQL
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH, RoomWarnings.QUERY_MISMATCH)
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Query(
"""$PREFIX_CONVERSATION_ITEM
WHERE c.category IN ('CONTACT', 'GROUP')
Expand All @@ -48,7 +51,7 @@ interface ConversationDao : BaseDao<Conversation> {
)
fun conversationList(): DataSource.Factory<Int, ConversationItem>

@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH, RoomWarnings.QUERY_MISMATCH)
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Query(
"""
SELECT c.conversation_id AS conversationId, c.icon_url AS groupIconUrl, c.category AS category,
Expand Down Expand Up @@ -112,7 +115,7 @@ interface ConversationDao : BaseDao<Conversation> {
@Query("SELECT c.draft FROM conversations c WHERE c.conversation_id = :conversationId")
suspend fun getConversationDraftById(conversationId: String): String?

@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH, RoomWarnings.QUERY_MISMATCH)
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Query(
"SELECT c.conversation_id AS conversationId, c.icon_url AS groupIconUrl, c.category AS category, " +
"c.name AS groupName, c.status AS status, c.last_read_message_id AS lastReadMessageId, " +
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/one/mixin/android/db/MarketCoinDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package one.mixin.android.db

import androidx.room.Dao
import androidx.room.Query
import androidx.room.RewriteQueriesToDropUnusedColumns
import androidx.room.RoomWarnings
import one.mixin.android.db.TokenDao.Companion.PREFIX_ASSET_ITEM
import one.mixin.android.vo.market.MarketCoin
import one.mixin.android.vo.safe.TokenItem

@Dao
@RewriteQueriesToDropUnusedColumns
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
interface MarketCoinDao : BaseDao<MarketCoin> {
@Query("$PREFIX_ASSET_ITEM LEFT JOIN market_coins mc on mc.asset_id = a1.asset_id WHERE mc.coin_id = :coinId")
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/one/mixin/android/db/MarketDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import one.mixin.android.vo.market.Market
import one.mixin.android.vo.market.MarketItem

@Dao
@RewriteQueriesToDropUnusedColumns
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
interface MarketDao : BaseDao<Market> {
@Query("SELECT m.*, mf.is_favored FROM markets m LEFT JOIN market_favored mf on mf.coin_id = m.coin_id LEFT JOIN market_coins mc ON mc.coin_id = m.coin_id WHERE mc.asset_id = :assetId")
Expand Down
Loading