Add rageskahe module
This commit is contained in:
parent
0644a5822f
commit
3f7a83c519
64 changed files with 3191 additions and 35 deletions
|
|
@ -9,8 +9,10 @@ import io.element.android.x.di.AppComponent
|
|||
import io.element.android.x.di.DaggerAppComponent
|
||||
import io.element.android.x.di.SessionComponentsOwner
|
||||
import io.element.android.x.initializer.CoilInitializer
|
||||
import io.element.android.x.initializer.CrashInitializer
|
||||
import io.element.android.x.initializer.MatrixInitializer
|
||||
import io.element.android.x.initializer.MavericksInitializer
|
||||
import io.element.android.x.initializer.TimberInitializer
|
||||
|
||||
class ElementXApplication : Application(), DaggerComponentOwner {
|
||||
|
||||
|
|
@ -25,6 +27,8 @@ class ElementXApplication : Application(), DaggerComponentOwner {
|
|||
appComponent = DaggerAppComponent.factory().create(applicationContext)
|
||||
sessionComponentsOwner = bindings<AppBindings>().sessionComponentsOwner()
|
||||
AppInitializer.getInstance(this).apply {
|
||||
initializeComponent(CrashInitializer::class.java)
|
||||
initializeComponent(TimberInitializer::class.java)
|
||||
initializeComponent(MatrixInitializer::class.java)
|
||||
initializeComponent(CoilInitializer::class.java)
|
||||
initializeComponent(MavericksInitializer::class.java)
|
||||
|
|
|
|||
|
|
@ -45,6 +45,9 @@ import com.ramcosta.composedestinations.spec.Route
|
|||
import io.element.android.x.core.compose.OnLifecycleEvent
|
||||
import io.element.android.x.designsystem.ElementXTheme
|
||||
import io.element.android.x.destinations.OnBoardingScreenNavigationDestination
|
||||
import io.element.android.x.features.rageshake.bugreport.BugReportScreen
|
||||
import io.element.android.x.features.rageshake.crash.ui.CrashDetectionScreen
|
||||
import io.element.android.x.features.rageshake.detection.RageshakeDetectionScreen
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import timber.log.Timber
|
||||
|
||||
|
|
@ -99,6 +102,7 @@ class MainActivity : ComponentActivity() {
|
|||
}
|
||||
|
||||
var isShowkaseButtonVisible by remember { mutableStateOf(BuildConfig.DEBUG) }
|
||||
var isBugReportVisible by remember { mutableStateOf(false) }
|
||||
|
||||
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.TopCenter) {
|
||||
MainContent(
|
||||
|
|
@ -109,6 +113,22 @@ class MainActivity : ComponentActivity() {
|
|||
onCloseClicked = { isShowkaseButtonVisible = false },
|
||||
onClick = { startActivity(Showkase.getBrowserIntent(this@MainActivity)) }
|
||||
)
|
||||
RageshakeDetectionScreen(
|
||||
onOpenBugReport = {
|
||||
isBugReportVisible = true
|
||||
}
|
||||
)
|
||||
CrashDetectionScreen(
|
||||
onOpenBugReport = {
|
||||
isBugReportVisible = true
|
||||
}
|
||||
)
|
||||
if (isBugReportVisible) {
|
||||
// TODO Improve the navigation, when pressing back here, it closes the app.
|
||||
BugReportScreen(
|
||||
onDone = { isBugReportVisible = false }
|
||||
)
|
||||
}
|
||||
}
|
||||
OnLifecycleEvent { _, event ->
|
||||
Timber.v("OnLifecycleEvent: $event")
|
||||
|
|
|
|||
|
|
@ -7,16 +7,20 @@ import com.ramcosta.composedestinations.annotation.RootNavGraph
|
|||
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
||||
import com.ramcosta.composedestinations.navigation.popUpTo
|
||||
import io.element.android.x.core.di.bindings
|
||||
import io.element.android.x.destinations.BugReportScreenNavigationDestination
|
||||
import io.element.android.x.destinations.ChangeServerScreenNavigationDestination
|
||||
import io.element.android.x.destinations.LoginScreenNavigationDestination
|
||||
import io.element.android.x.destinations.MessagesScreenNavigationDestination
|
||||
import io.element.android.x.destinations.OnBoardingScreenNavigationDestination
|
||||
import io.element.android.x.destinations.PreferencesScreenNavigationDestination
|
||||
import io.element.android.x.destinations.RoomListScreenNavigationDestination
|
||||
import io.element.android.x.di.AppBindings
|
||||
import io.element.android.x.features.login.LoginScreen
|
||||
import io.element.android.x.features.login.changeserver.ChangeServerScreen
|
||||
import io.element.android.x.features.messages.MessagesScreen
|
||||
import io.element.android.x.features.onboarding.OnBoardingScreen
|
||||
import io.element.android.x.features.preferences.PreferencesScreen
|
||||
import io.element.android.x.features.rageshake.bugreport.BugReportScreen
|
||||
import io.element.android.x.features.roomlist.RoomListScreen
|
||||
import io.element.android.x.matrix.core.RoomId
|
||||
|
||||
|
|
@ -72,6 +76,9 @@ fun RoomListScreenNavigation(navigator: DestinationsNavigator) {
|
|||
onRoomClicked = { roomId: RoomId ->
|
||||
navigator.navigate(MessagesScreenNavigationDestination(roomId = roomId.value))
|
||||
},
|
||||
onOpenSettings = {
|
||||
navigator.navigate(PreferencesScreenNavigationDestination())
|
||||
},
|
||||
onSuccessLogout = {
|
||||
sessionComponentsOwner.releaseActiveSession()
|
||||
navigator.navigate(OnBoardingScreenNavigationDestination) {
|
||||
|
|
@ -79,6 +86,10 @@ fun RoomListScreenNavigation(navigator: DestinationsNavigator) {
|
|||
inclusive = true
|
||||
}
|
||||
}
|
||||
},
|
||||
// Tmp entry point
|
||||
onOpenRageShake = {
|
||||
navigator.navigate(BugReportScreenNavigationDestination)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
@ -88,3 +99,20 @@ fun RoomListScreenNavigation(navigator: DestinationsNavigator) {
|
|||
fun MessagesScreenNavigation(roomId: String, navigator: DestinationsNavigator) {
|
||||
MessagesScreen(roomId = roomId, onBackPressed = navigator::navigateUp)
|
||||
}
|
||||
|
||||
@Destination
|
||||
@Composable
|
||||
fun BugReportScreenNavigation(navigator: DestinationsNavigator) {
|
||||
BugReportScreen(
|
||||
onDone = navigator::popBackStack
|
||||
)
|
||||
}
|
||||
|
||||
@Destination
|
||||
@Composable
|
||||
fun PreferencesScreenNavigation(navigator: DestinationsNavigator) {
|
||||
PreferencesScreen(
|
||||
onBackPressed = navigator::navigateUp
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package io.element.android.x.initializer
|
||||
|
||||
import android.content.Context
|
||||
import androidx.startup.Initializer
|
||||
import io.element.android.x.features.rageshake.crash.VectorUncaughtExceptionHandler
|
||||
|
||||
class CrashInitializer : Initializer<Unit> {
|
||||
|
||||
override fun create(context: Context) {
|
||||
VectorUncaughtExceptionHandler(context).activate()
|
||||
}
|
||||
|
||||
override fun dependencies(): List<Class<out Initializer<*>>> = emptyList()
|
||||
}
|
||||
|
|
@ -2,14 +2,18 @@ package io.element.android.x.initializer
|
|||
|
||||
import android.content.Context
|
||||
import androidx.startup.Initializer
|
||||
import io.element.android.x.BuildConfig
|
||||
import io.element.android.x.features.rageshake.logs.VectorFileLogger
|
||||
import timber.log.Timber
|
||||
|
||||
class TimberInitializer : Initializer<Unit> {
|
||||
|
||||
override fun create(context: Context) {
|
||||
Timber.plant(Timber.DebugTree())
|
||||
if (BuildConfig.DEBUG) {
|
||||
Timber.plant(Timber.DebugTree())
|
||||
}
|
||||
Timber.plant(VectorFileLogger(context))
|
||||
}
|
||||
|
||||
override fun dependencies(): List<Class<out Initializer<*>>> =
|
||||
listOf(TimberInitializer::class.java)
|
||||
override fun dependencies(): List<Class<out Initializer<*>>> = emptyList()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue