Skip to content

Commit

Permalink
Fixed play button visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
sirekanian committed Dec 30, 2023
1 parent 5bd7e1f commit bca1899
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
12 changes: 8 additions & 4 deletions app/src/main/java/org/sirekanyan/outline/ui/AboutDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import org.sirekanyan.outline.BuildConfig
import org.sirekanyan.outline.R
import org.sirekanyan.outline.ext.logDebug
import org.sirekanyan.outline.ext.showToast
import org.sirekanyan.outline.isDebugBuild
import org.sirekanyan.outline.isPlayFlavor
import org.sirekanyan.outline.ui.icons.IconOpenInNew
import org.sirekanyan.outline.ui.icons.IconPlayStore

Expand Down Expand Up @@ -79,10 +81,12 @@ fun AboutDialogContent(onDismiss: () -> Unit) {
context.showToast("Email is copied")
}
}
val playUri = "https://play.google.com/store/apps/details?id=${context.packageName}"
AboutItem(IconPlayStore, "Rate on Play Store") {
context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(playUri)))
onDismiss()
if (isPlayFlavor() || isDebugBuild()) {
val playUri = "https://play.google.com/store/apps/details?id=${context.packageName}"
AboutItem(IconPlayStore, "Rate on Play Store") {
context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(playUri)))
onDismiss()
}
}
},
)
Expand Down
37 changes: 17 additions & 20 deletions app/src/main/java/org/sirekanyan/outline/ui/DrawerContent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import org.sirekanyan.outline.SelectedPage
import org.sirekanyan.outline.app
import org.sirekanyan.outline.ext.rememberFlowAsState
import org.sirekanyan.outline.isDebugBuild
import org.sirekanyan.outline.isPlayFlavor

@Composable
fun DrawerContent(state: MainState) {
Expand Down Expand Up @@ -128,28 +127,26 @@ private fun DrawerSheetContent(state: MainState, insets: PaddingValues) {
},
)
}
if (isPlayFlavor() || isDebugBuild()) {
Divider(Modifier.padding(vertical = 8.dp))
val context = LocalContext.current
if (isDebugBuild()) {
val debugDao = remember { context.app().debugDao }
val scope = rememberCoroutineScope()
DrawerItem(
icon = Icons.Default.Warning,
label = "Reset database",
onClick = {
scope.launch(IO) {
debugDao.reset()
}
},
)
}
Divider(Modifier.padding(vertical = 8.dp))
val context = LocalContext.current
if (isDebugBuild()) {
val debugDao = remember { context.app().debugDao }
val scope = rememberCoroutineScope()
DrawerItem(
icon = Icons.Default.Info,
label = "About",
onClick = { state.dialog = AboutDialog },
icon = Icons.Default.Warning,
label = "Reset database",
onClick = {
scope.launch(IO) {
debugDao.reset()
}
},
)
}
DrawerItem(
icon = Icons.Default.Info,
label = "About",
onClick = { state.dialog = AboutDialog },
)
}
}

Expand Down

0 comments on commit bca1899

Please sign in to comment.