Поменяли сервер бекенда, исправлен краш со списком

This commit is contained in:
v228a 2025-02-19 14:52:37 +03:00
parent 5f9cade3c0
commit 9925b37422
5 changed files with 17 additions and 17 deletions

View File

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

View File

@ -1,6 +1,6 @@
package ru.myitschool.work.core package ru.myitschool.work.core
object Constants { object Constants {
const val SERVER_ADDRESS = "http://10.0.2.2:8080" // const val SERVER_ADDRESS = "http://10.0.2.2:8080"
// const val SERVER_ADDRESS = "https://nto.den4iksop.org" 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 androidx.fragment.app.viewModels
import android.os.Bundle import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import dagger.hilt.android.AndroidEntryPoint
import ru.myitschool.work.R import ru.myitschool.work.R
import ru.myitschool.work.databinding.FragmentEntryListBinding import ru.myitschool.work.databinding.FragmentEntryListBinding
import ru.myitschool.work.databinding.FragmentLoginBinding 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.ProfileDestination
import ru.myitschool.work.ui.profile.ProfileViewModel import ru.myitschool.work.ui.profile.ProfileViewModel
import ru.myitschool.work.utils.collectWhenStarted import ru.myitschool.work.utils.collectWhenStarted
@AndroidEntryPoint
class EntryListFragment : Fragment(R.layout.fragment_entry_list) { class EntryListFragment : Fragment(R.layout.fragment_entry_list) {
private var _binding: FragmentEntryListBinding? = null private var _binding: FragmentEntryListBinding? = null
@ -34,17 +36,15 @@ class EntryListFragment : Fragment(R.layout.fragment_entry_list) {
binding.floatingActionButton2.setOnClickListener { viewModel.closeEntryList() } binding.floatingActionButton2.setOnClickListener { viewModel.closeEntryList() }
} }
private fun subscribe(){ private fun subscribe() {
viewModel.action.collectWhenStarted(this){ action -> viewModel.action.collectWhenStarted(this) { action ->
when(action) { when (action) {
is EntryListViewModel.Action.OpenProfile -> { is EntryListViewModel.Action.OpenProfile -> {
findNavController().navigate(LoginDestination) { findNavController().navigate(LoginDestination) {
popUpTo<ProfileDestination> { inclusive = true } popUpTo<ProfileDestination> { inclusive = true }
} }
} }
} }
} }
} }
} }

View File

@ -25,8 +25,8 @@ class EntryListViewModel @Inject constructor(
private val _action = MutablePublishFlow<Action>() private val _action = MutablePublishFlow<Action>()
val action = _action.asSharedFlow() val action = _action.asSharedFlow()
private val _state = MutableStateFlow<State>(initialState) // private val _state = MutableStateFlow<State>(initialState)
val state = _state.asStateFlow() // val state = _state.asStateFlow()
fun closeEntryList(){ fun closeEntryList(){
viewModelScope.launch { viewModelScope.launch {
@ -41,6 +41,6 @@ class EntryListViewModel @Inject constructor(
companion object { 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.position.text = state.position
binding.lastEntry.text = state.lastEntry binding.lastEntry.text = state.lastEntry
if (state.admin){ if (state.admin){
//TODO Приделать админские штучки
binding.fullname.text = state.fullname + " admin" binding.fullname.text = state.fullname + " admin"
}else{ }else{
binding.fullname.text = state.fullname binding.fullname.text = state.fullname