Skip to content

Commit

Permalink
(legacy) Replace home screen with migration prompt (#658)
Browse files Browse the repository at this point in the history
Legacy channels have now all been closed, and the legacy app
can only be used to import closed legacy channels for users
who uninstalled the app.

The settings menu has also been cleaned up.
  • Loading branch information
dpad85 authored Dec 2, 2024
1 parent 4e67934 commit e3905b7
Show file tree
Hide file tree
Showing 13 changed files with 267 additions and 337 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package fr.acinq.phoenix.android.settings

import android.widget.Toast
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
Expand All @@ -26,8 +27,10 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
Expand Down Expand Up @@ -60,7 +63,7 @@ fun SettingsView(
val nc = navController
val context = LocalContext.current
val scope = rememberCoroutineScope()
var debugClickCount by remember { mutableStateOf(0) }
var debugClickCount by remember { mutableIntStateOf(0) }
val notices = noticesViewModel.notices
val notifications = business.notificationsManager.notifications.collectAsState()

Expand All @@ -78,6 +81,23 @@ fun SettingsView(
)
}

if (debugClickCount > 10) {
LaunchedEffect(key1 = Unit) {
Toast.makeText(context, "Debug mode enabled", Toast.LENGTH_SHORT).show()
}
// -- debug
CardHeader(text = "DEBUG")
Card {
MenuButton(
text = "Switch to legacy app (DEBUG)",
icon = R.drawable.ic_settings,
onClick = {
scope.launch { LegacyPrefsDatastore.saveStartLegacyApp(context, LegacyAppStatus.Required.Expected) }
},
)
}
}

// -- general
CardHeader(text = stringResource(id = R.string.settings_general_title))
Card {
Expand Down Expand Up @@ -125,23 +145,6 @@ fun SettingsView(
)
}

if (debugClickCount > 10) {
// -- debug
CardHeader(text = "DEBUG")
Card {
Button(
text = "Switch to legacy app (DEBUG)",
icon = R.drawable.ic_user,
onClick = {
scope.launch {
LegacyPrefsDatastore.saveStartLegacyApp(context, LegacyAppStatus.Required.Expected)
}
},
modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Start
)
}
}

Spacer(Modifier.height(32.dp))
}
}
Loading

0 comments on commit e3905b7

Please sign in to comment.