mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-27 04:25:22 +00:00
* persistence step 1 * fix build * messages in the background work, notifications not yet * app state store * DM icon shows up * notification launches when app is closed! * keep ui updated * lifecycle fixes * extensive logging, maybe revert later * send nickname in announcement * quit in notification * setting in about sheet * fix quit bitchat * lifecycle fixes * power mode based on background state * stats for both direciotns * fix graph persistence * better counting * count per device * only compute when debug sheet is open? untested * fix read receipts * fix read receipts fully * fix unread badge if messages have been read in focus * foreground promotion fix * fix app kill in notification * adjust to new tor * nice * about sheet design
22 lines
599 B
Kotlin
22 lines
599 B
Kotlin
package com.bitchat.android.services
|
|
|
|
import android.content.Context
|
|
import com.bitchat.android.ui.DataManager
|
|
|
|
/**
|
|
* Provides current user's nickname for announcements and leave messages.
|
|
* If no nickname saved, falls back to the provided peerID.
|
|
*/
|
|
object NicknameProvider {
|
|
fun getNickname(context: Context, myPeerID: String): String {
|
|
return try {
|
|
val dm = DataManager(context.applicationContext)
|
|
val nick = dm.loadNickname()
|
|
if (nick.isNullOrBlank()) myPeerID else nick
|
|
} catch (_: Exception) {
|
|
myPeerID
|
|
}
|
|
}
|
|
}
|
|
|