redesign and readme
This commit is contained in:
commit
1ae503ff41
@ -77,7 +77,11 @@ class UserServiceST(
|
||||
if (!tokenManager.hasTokens()) {
|
||||
throw RuntimeException("access token is null")
|
||||
}
|
||||
return userRepository.getInfo(tokenManager.authTokenPair!!.accessToken)
|
||||
val result = userRepository.getInfo(tokenManager.authTokenPair!!.accessToken)
|
||||
result.map { dto ->
|
||||
saveUserDTO(dto)
|
||||
}
|
||||
return result
|
||||
}
|
||||
suspend fun getInfoByLogin(login: String): Result<UserDTO>{
|
||||
if (!tokenManager.hasTokens()) {
|
||||
|
@ -31,8 +31,8 @@ class ProfileFragment : Fragment(R.layout.fragment_profile) {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
_binding = FragmentProfileBinding.bind(view)
|
||||
checkForAdmin()
|
||||
|
||||
checkForAdmin()
|
||||
binding.swipeRefresh.setOnRefreshListener {
|
||||
if (getIsMe()) refreshData() else showData(getUserDto()!!);
|
||||
}
|
||||
@ -57,7 +57,6 @@ class ProfileFragment : Fragment(R.layout.fragment_profile) {
|
||||
waitForQRScanResult()
|
||||
} else {
|
||||
showData(getUserDto()!!)
|
||||
|
||||
Log.d("ProfileFragment", "set login")
|
||||
viewModel.visitListStateFromLogin.collectWithLifecycle(this) { data ->
|
||||
adapter.submitData(data)
|
||||
@ -74,11 +73,9 @@ class ProfileFragment : Fragment(R.layout.fragment_profile) {
|
||||
|
||||
if (userDTO.roles.any { it.name == "ROLE_ADMIN" }) {
|
||||
binding.buttonSearch.visibility = View.VISIBLE
|
||||
binding.rightsUsingSmartphone.text = "Пропуск действителен"
|
||||
}
|
||||
if (userDTO.roles.any { it.name == "ROLE_USER" }) {
|
||||
binding.rightsUsingSmartphone.text = "Пропуск действителен"
|
||||
}
|
||||
Log.d("1234", userDTO.isACSBlocked.toString())
|
||||
binding.rightsUsingSmartphone.text = if (userDTO.isACSBlocked) "Пропуск недействителен" else "Пропуск действителен"
|
||||
}
|
||||
|
||||
private fun hideButtons() {
|
||||
@ -113,6 +110,7 @@ class ProfileFragment : Fragment(R.layout.fragment_profile) {
|
||||
}
|
||||
Log.d("ProfileFragment", userDTO.login)
|
||||
setAvatar(userDTO.photo)
|
||||
checkForAdmin()
|
||||
}
|
||||
|
||||
private fun refreshData() {
|
||||
@ -172,6 +170,7 @@ class ProfileFragment : Fragment(R.layout.fragment_profile) {
|
||||
if (state is ProfileViewModel.State.Show) {
|
||||
val userDto: UserDTO = state.item
|
||||
showMyData(userDto)
|
||||
checkForAdmin()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user