Merge remote-tracking branch 'origin/main'

This commit is contained in:
Juja2025 2025-02-19 15:05:55 +03:00
commit 645b7c7103
5 changed files with 17 additions and 17 deletions

View File

@ -13,7 +13,6 @@
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:usesCleartextTraffic="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.UiTemplate"

View File

@ -1,6 +1,6 @@
package ru.myitschool.work.core
object Constants {
const val SERVER_ADDRESS = "http://10.0.2.2:8080"
// const val SERVER_ADDRESS = "https://nto.den4iksop.org"
// const val SERVER_ADDRESS = "http://10.0.2.2:8080"
const val SERVER_ADDRESS = "https://nto.den4iksop.org"
}

View File

@ -2,11 +2,13 @@ package ru.myitschool.work.ui.entrylist
import androidx.fragment.app.viewModels
import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.navigation.fragment.findNavController
import dagger.hilt.android.AndroidEntryPoint
import ru.myitschool.work.R
import ru.myitschool.work.databinding.FragmentEntryListBinding
import ru.myitschool.work.databinding.FragmentLoginBinding
@ -15,7 +17,7 @@ import ru.myitschool.work.ui.login.LoginViewModel
import ru.myitschool.work.ui.profile.ProfileDestination
import ru.myitschool.work.ui.profile.ProfileViewModel
import ru.myitschool.work.utils.collectWhenStarted
@AndroidEntryPoint
class EntryListFragment : Fragment(R.layout.fragment_entry_list) {
private var _binding: FragmentEntryListBinding? = null
@ -34,17 +36,15 @@ class EntryListFragment : Fragment(R.layout.fragment_entry_list) {
binding.floatingActionButton2.setOnClickListener { viewModel.closeEntryList() }
}
private fun subscribe(){
viewModel.action.collectWhenStarted(this){ action ->
when(action) {
is EntryListViewModel.Action.OpenProfile -> {
findNavController().navigate(LoginDestination) {
popUpTo<ProfileDestination> { inclusive = true }
private fun subscribe() {
viewModel.action.collectWhenStarted(this) { action ->
when (action) {
is EntryListViewModel.Action.OpenProfile -> {
findNavController().navigate(LoginDestination) {
popUpTo<ProfileDestination> { inclusive = true }
}
}
}
}
}
}
}

View File

@ -25,8 +25,8 @@ class EntryListViewModel @Inject constructor(
private val _action = MutablePublishFlow<Action>()
val action = _action.asSharedFlow()
private val _state = MutableStateFlow<State>(initialState)
val state = _state.asStateFlow()
// private val _state = MutableStateFlow<State>(initialState)
// val state = _state.asStateFlow()
fun closeEntryList(){
viewModelScope.launch {
@ -41,6 +41,6 @@ class EntryListViewModel @Inject constructor(
companion object {
val initialState = State.Loading
// val initialState = State.Loading
}
}

View File

@ -60,6 +60,7 @@ class ProfileFragment : Fragment(R.layout.fragment_profile) {
binding.position.text = state.position
binding.lastEntry.text = state.lastEntry
if (state.admin){
//TODO Приделать админские штучки
binding.fullname.text = state.fullname + " admin"
}else{
binding.fullname.text = state.fullname