mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-11 12:53:11 +02:00
Prints Debug information when the app pauses.
This commit is contained in:
@@ -16,6 +16,7 @@ import androidx.compose.material.Surface
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
|
import com.vitorpamplona.amethyst.BuildConfig
|
||||||
import com.vitorpamplona.amethyst.LocalPreferences
|
import com.vitorpamplona.amethyst.LocalPreferences
|
||||||
import com.vitorpamplona.amethyst.ServiceManager
|
import com.vitorpamplona.amethyst.ServiceManager
|
||||||
import com.vitorpamplona.amethyst.service.model.ChannelCreateEvent
|
import com.vitorpamplona.amethyst.service.model.ChannelCreateEvent
|
||||||
@@ -27,6 +28,7 @@ import com.vitorpamplona.amethyst.service.notifications.PushNotificationUtils
|
|||||||
import com.vitorpamplona.amethyst.service.relays.Client
|
import com.vitorpamplona.amethyst.service.relays.Client
|
||||||
import com.vitorpamplona.amethyst.ui.components.DefaultMutedSetting
|
import com.vitorpamplona.amethyst.ui.components.DefaultMutedSetting
|
||||||
import com.vitorpamplona.amethyst.ui.navigation.Route
|
import com.vitorpamplona.amethyst.ui.navigation.Route
|
||||||
|
import com.vitorpamplona.amethyst.ui.navigation.debugState
|
||||||
import com.vitorpamplona.amethyst.ui.note.Nip47
|
import com.vitorpamplona.amethyst.ui.note.Nip47
|
||||||
import com.vitorpamplona.amethyst.ui.screen.AccountScreen
|
import com.vitorpamplona.amethyst.ui.screen.AccountScreen
|
||||||
import com.vitorpamplona.amethyst.ui.screen.AccountStateViewModel
|
import com.vitorpamplona.amethyst.ui.screen.AccountStateViewModel
|
||||||
@@ -91,6 +93,10 @@ class MainActivity : FragmentActivity() {
|
|||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
ServiceManager.pause()
|
ServiceManager.pause()
|
||||||
|
|
||||||
|
if (BuildConfig.DEBUG) {
|
||||||
|
debugState(this)
|
||||||
|
}
|
||||||
|
|
||||||
super.onPause()
|
super.onPause()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.vitorpamplona.amethyst.ui.navigation
|
package com.vitorpamplona.amethyst.ui.navigation
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
@@ -60,6 +61,8 @@ import com.vitorpamplona.amethyst.service.NostrAccountDataSource
|
|||||||
import com.vitorpamplona.amethyst.service.NostrChannelDataSource
|
import com.vitorpamplona.amethyst.service.NostrChannelDataSource
|
||||||
import com.vitorpamplona.amethyst.service.NostrChatroomDataSource
|
import com.vitorpamplona.amethyst.service.NostrChatroomDataSource
|
||||||
import com.vitorpamplona.amethyst.service.NostrChatroomListDataSource
|
import com.vitorpamplona.amethyst.service.NostrChatroomListDataSource
|
||||||
|
import com.vitorpamplona.amethyst.service.NostrCommunityDataSource
|
||||||
|
import com.vitorpamplona.amethyst.service.NostrDiscoveryDataSource
|
||||||
import com.vitorpamplona.amethyst.service.NostrHashtagDataSource
|
import com.vitorpamplona.amethyst.service.NostrHashtagDataSource
|
||||||
import com.vitorpamplona.amethyst.service.NostrHomeDataSource
|
import com.vitorpamplona.amethyst.service.NostrHomeDataSource
|
||||||
import com.vitorpamplona.amethyst.service.NostrSearchEventOrUserDataSource
|
import com.vitorpamplona.amethyst.service.NostrSearchEventOrUserDataSource
|
||||||
@@ -68,6 +71,7 @@ import com.vitorpamplona.amethyst.service.NostrSingleEventDataSource
|
|||||||
import com.vitorpamplona.amethyst.service.NostrSingleUserDataSource
|
import com.vitorpamplona.amethyst.service.NostrSingleUserDataSource
|
||||||
import com.vitorpamplona.amethyst.service.NostrThreadDataSource
|
import com.vitorpamplona.amethyst.service.NostrThreadDataSource
|
||||||
import com.vitorpamplona.amethyst.service.NostrUserProfileDataSource
|
import com.vitorpamplona.amethyst.service.NostrUserProfileDataSource
|
||||||
|
import com.vitorpamplona.amethyst.service.NostrVideoDataSource
|
||||||
import com.vitorpamplona.amethyst.service.checkNotInMainThread
|
import com.vitorpamplona.amethyst.service.checkNotInMainThread
|
||||||
import com.vitorpamplona.amethyst.service.model.PeopleListEvent
|
import com.vitorpamplona.amethyst.service.model.PeopleListEvent
|
||||||
import com.vitorpamplona.amethyst.service.relays.Client
|
import com.vitorpamplona.amethyst.service.relays.Client
|
||||||
@@ -462,6 +466,19 @@ fun AmethystIcon() {
|
|||||||
|
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
|
debugState(context)
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(R.drawable.amethyst),
|
||||||
|
null,
|
||||||
|
modifier = Modifier.size(40.dp),
|
||||||
|
tint = Color.Unspecified
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun debugState(context: Context) {
|
||||||
Client.allSubscriptions().map {
|
Client.allSubscriptions().map {
|
||||||
"$it ${
|
"$it ${
|
||||||
Client.getSubscriptionFilters(it)
|
Client.getSubscriptionFilters(it)
|
||||||
@@ -475,6 +492,8 @@ fun AmethystIcon() {
|
|||||||
NostrChannelDataSource.printCounter()
|
NostrChannelDataSource.printCounter()
|
||||||
NostrChatroomDataSource.printCounter()
|
NostrChatroomDataSource.printCounter()
|
||||||
NostrChatroomListDataSource.printCounter()
|
NostrChatroomListDataSource.printCounter()
|
||||||
|
NostrCommunityDataSource.printCounter()
|
||||||
|
NostrDiscoveryDataSource.printCounter()
|
||||||
NostrHashtagDataSource.printCounter()
|
NostrHashtagDataSource.printCounter()
|
||||||
NostrHomeDataSource.printCounter()
|
NostrHomeDataSource.printCounter()
|
||||||
NostrSearchEventOrUserDataSource.printCounter()
|
NostrSearchEventOrUserDataSource.printCounter()
|
||||||
@@ -483,6 +502,7 @@ fun AmethystIcon() {
|
|||||||
NostrSingleUserDataSource.printCounter()
|
NostrSingleUserDataSource.printCounter()
|
||||||
NostrThreadDataSource.printCounter()
|
NostrThreadDataSource.printCounter()
|
||||||
NostrUserProfileDataSource.printCounter()
|
NostrUserProfileDataSource.printCounter()
|
||||||
|
NostrVideoDataSource.printCounter()
|
||||||
|
|
||||||
Log.d("STATE DUMP", "Connected Relays: " + RelayPool.connectedRelays())
|
Log.d("STATE DUMP", "Connected Relays: " + RelayPool.connectedRelays())
|
||||||
|
|
||||||
@@ -492,13 +512,6 @@ fun AmethystIcon() {
|
|||||||
|
|
||||||
Log.d("STATE DUMP", "Notes: " + LocalCache.notes.filter { it.value.event != null }.size + "/" + LocalCache.notes.size)
|
Log.d("STATE DUMP", "Notes: " + LocalCache.notes.filter { it.value.event != null }.size + "/" + LocalCache.notes.size)
|
||||||
Log.d("STATE DUMP", "Users: " + LocalCache.users.filter { it.value.info?.latestMetadata != null }.size + "/" + LocalCache.users.size)
|
Log.d("STATE DUMP", "Users: " + LocalCache.users.filter { it.value.info?.latestMetadata != null }.size + "/" + LocalCache.users.size)
|
||||||
}
|
|
||||||
) {
|
Log.d("STATE DUMP", "Notes: " + LocalCache.notes.filter { it.value.event != null }.size + "/" + LocalCache.notes.size)
|
||||||
Icon(
|
|
||||||
painter = painterResource(R.drawable.amethyst),
|
|
||||||
null,
|
|
||||||
modifier = Modifier.size(40.dp),
|
|
||||||
tint = Color.Unspecified
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user