mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-11-22 08:16:23 +00:00
Add a toggleable chat transcript style alongside the existing matrix transcript. Bubbles mode renders text messages as classic messenger bubbles: own messages on the right, peers on the left, each bubble washed with the author's stable identity-derived peer colour so the speaker stays identifiable without changing any theme, surface, or background colours. - ChatUiMode preference (Matrix / Bubbles, default Bubbles) persisted via ChatUiModeManager, mirroring ThemePreferenceManager - BubbleTextMessageLayout: rounded bubble with a subtle tail on the speaker's side, width capped at 80% so long messages wrap; sender labels, grouping, timestamps, mentions, links, long-press, and the existing spring entry/placement animations are unchanged - Delivery status for own private messages moves beneath the bubble in bubbles mode so it never overlaps the tail - Chat style picker in About -> Settings reusing the ThemeChip pattern
82 lines
3.5 KiB
Kotlin
82 lines
3.5 KiB
Kotlin
package com.bitchat.android
|
||
|
||
import android.app.Application
|
||
import com.bitchat.android.nostr.RelayDirectory
|
||
import com.bitchat.android.ui.theme.ThemePreferenceManager
|
||
import com.bitchat.android.net.ArtiTorManager
|
||
|
||
/**
|
||
* Main application class for bitchat Android
|
||
*/
|
||
class BitchatApplication : Application() {
|
||
|
||
override fun onCreate() {
|
||
super.onCreate()
|
||
|
||
// Start the single process-wide power policy before transport components are constructed.
|
||
com.bitchat.android.mesh.PowerManager.getInstance(this).start()
|
||
|
||
// Initialize Tor first so any early network goes over Tor
|
||
try {
|
||
val torProvider = ArtiTorManager.getInstance()
|
||
torProvider.init(this)
|
||
} catch (_: Exception){}
|
||
|
||
// Initialize relay directory (loads assets/nostr_relays.csv)
|
||
RelayDirectory.initialize(this)
|
||
|
||
// Initialize LocationNotesManager dependencies early so sheet subscriptions can start immediately
|
||
try { com.bitchat.android.nostr.LocationNotesInitializer.initialize(this) } catch (_: Exception) { }
|
||
|
||
// Initialize favorites persistence early so MessageRouter/NostrTransport can use it on startup
|
||
try {
|
||
com.bitchat.android.favorites.FavoritesPersistenceService.initialize(this)
|
||
} catch (_: Exception) { }
|
||
|
||
// Restore private conversations before background transports can deliver new messages.
|
||
// AppStateStore merges any in-flight arrivals by message ID, so startup cannot replace
|
||
// newer transport state with an older database snapshot.
|
||
try {
|
||
com.bitchat.android.services.AppStateStore.initializeConversationPersistence(this)
|
||
} catch (_: Exception) { }
|
||
|
||
// Warm up Nostr identity to ensure npub is available for favorite notifications
|
||
try {
|
||
com.bitchat.android.nostr.NostrIdentityBridge.getCurrentNostrIdentity(this)
|
||
} catch (_: Exception) { }
|
||
|
||
// Initialize theme preference
|
||
ThemePreferenceManager.init(this)
|
||
|
||
// Initialize chat UI mode (matrix transcript vs bubbles)
|
||
com.bitchat.android.ui.theme.ChatUiModeManager.init(this)
|
||
|
||
// Initialize debug preference manager (persists debug toggles)
|
||
try { com.bitchat.android.ui.debug.DebugPreferenceManager.init(this) } catch (_: Exception) { }
|
||
|
||
// Initialize Wi‑Fi Aware controller with persisted default
|
||
try {
|
||
val enabled = com.bitchat.android.ui.debug.DebugPreferenceManager.getWifiAwareEnabled(false)
|
||
com.bitchat.android.wifiaware.WifiAwareController.initialize(this, enabled)
|
||
} catch (_: Exception) { }
|
||
|
||
// Initialize Geohash Registries for persistence
|
||
try {
|
||
com.bitchat.android.nostr.GeohashAliasRegistry.initialize(this)
|
||
com.bitchat.android.nostr.GeohashConversationRegistry.initialize(this)
|
||
} catch (_: Exception) { }
|
||
|
||
// Own relay connectivity, selected-channel subscriptions, and presence scheduling at the
|
||
// process level so closing the Activity does not disconnect Nostr.
|
||
try { com.bitchat.android.nostr.NostrBackgroundRuntime.initialize(this) } catch (_: Exception) { }
|
||
|
||
// Initialize mesh service preferences
|
||
try { com.bitchat.android.service.MeshServicePreferences.init(this) } catch (_: Exception) { }
|
||
|
||
// Proactively start the foreground service to keep mesh alive
|
||
try { com.bitchat.android.service.MeshForegroundService.start(this) } catch (_: Exception) { }
|
||
|
||
// TorManager already initialized above
|
||
}
|
||
}
|