Add goida
This commit is contained in:
parent
9efbe25bcb
commit
cb3974bf6b
2 changed files with 51 additions and 0 deletions
|
|
@ -32,8 +32,10 @@ import com.sergay.hhu67.pw.app.ui.components.*
|
||||||
import com.sergay.hhu67.pw.app.ui.viewmodel.AppTab
|
import com.sergay.hhu67.pw.app.ui.viewmodel.AppTab
|
||||||
import com.sergay.hhu67.pw.app.ui.viewmodel.ContentState
|
import com.sergay.hhu67.pw.app.ui.viewmodel.ContentState
|
||||||
import com.sergay.hhu67.pw.app.ui.viewmodel.MainViewModel
|
import com.sergay.hhu67.pw.app.ui.viewmodel.MainViewModel
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -47,6 +49,29 @@ fun MainAppScreen(vm: MainViewModel) {
|
||||||
|
|
||||||
val exoPlayer = remember { ExoPlayer.Builder(ctx).build() }
|
val exoPlayer = remember { ExoPlayer.Builder(ctx).build() }
|
||||||
|
|
||||||
|
LaunchedEffect(vm.patriotModeActive) {
|
||||||
|
if (vm.patriotModeActive) {
|
||||||
|
vm.isAudioPlaying = false
|
||||||
|
exoPlayer.stop()
|
||||||
|
|
||||||
|
val patriotUrl = "https://sergay.hhu67.pw/api/get/audio/5e4fa0b0b66f9dcff9af7c9952e0939c.mp3"
|
||||||
|
val mediaItem = MediaItem.fromUri(patriotUrl)
|
||||||
|
|
||||||
|
repeat(2) {
|
||||||
|
exoPlayer.setMediaItem(mediaItem)
|
||||||
|
exoPlayer.prepare()
|
||||||
|
exoPlayer.play()
|
||||||
|
while (exoPlayer.isPlaying || exoPlayer.playbackState != ExoPlayer.STATE_ENDED) {
|
||||||
|
delay(500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vm.showPatriotDialog = true
|
||||||
|
delay(2000)
|
||||||
|
exitProcess(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val imageLoader = remember {
|
val imageLoader = remember {
|
||||||
ImageLoader.Builder(ctx)
|
ImageLoader.Builder(ctx)
|
||||||
.components {
|
.components {
|
||||||
|
|
@ -124,6 +149,17 @@ fun MainAppScreen(vm: MainViewModel) {
|
||||||
modifier = Modifier.padding(NavigationDrawerItemDefaults.ItemPadding)
|
modifier = Modifier.padding(NavigationDrawerItemDefaults.ItemPadding)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
HorizontalDivider()
|
||||||
|
NavigationDrawerItem(
|
||||||
|
label = { Text("ПАТРИОТ🇷🇺", color = Color.Red, style = MaterialTheme.typography.titleMedium) },
|
||||||
|
selected = false,
|
||||||
|
onClick = {
|
||||||
|
scope.launch { drawerState.close() }
|
||||||
|
vm.startPatriotMode()
|
||||||
|
},
|
||||||
|
icon = { Icon(Icons.Default.Star, contentDescription = null, tint = Color.Red) },
|
||||||
|
modifier = Modifier.padding(NavigationDrawerItemDefaults.ItemPadding)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
|
|
@ -415,4 +451,12 @@ fun MainAppScreen(vm: MainViewModel) {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vm.showPatriotDialog) {
|
||||||
|
AlertDialog(
|
||||||
|
onDismissRequest = {},
|
||||||
|
title = { Text("ПОТОУЖНОСТЬ ЗАШКАЛИВАЕТ", style = MaterialTheme.typography.headlineLarge, color = Color.Red) },
|
||||||
|
confirmButton = {}
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,9 @@ class MainViewModel(appContext: Context) : ViewModel() {
|
||||||
var quotesTotalCount by mutableIntStateOf(0)
|
var quotesTotalCount by mutableIntStateOf(0)
|
||||||
var quotesCurrentPage by mutableIntStateOf(0)
|
var quotesCurrentPage by mutableIntStateOf(0)
|
||||||
|
|
||||||
|
var patriotModeActive by mutableStateOf(false)
|
||||||
|
var showPatriotDialog by mutableStateOf(false)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
if (isAuthenticated) {
|
if (isAuthenticated) {
|
||||||
checkRoleAndRestore()
|
checkRoleAndRestore()
|
||||||
|
|
@ -276,6 +279,10 @@ class MainViewModel(appContext: Context) : ViewModel() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun startPatriotMode() {
|
||||||
|
patriotModeActive = true
|
||||||
|
}
|
||||||
|
|
||||||
fun deleteBotPhrase(id: Int) {
|
fun deleteBotPhrase(id: Int) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue