-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 설정 화면의 가장 첫번째 화면 구현
- Loading branch information
Showing
14 changed files
with
571 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,4 +81,5 @@ class ActivityViewModelModule { | |
getBuildingReviewsUseCase | ||
) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 28 additions & 4 deletions
32
app/src/main/java/com/ftw/hometerview/ui/main/mypage/MyPageViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,31 @@ | ||
package com.ftw.hometerview.ui.main.mypage | ||
|
||
import androidx.lifecycle.ViewModel | ||
import com.ftw.domain.entity.Company | ||
import com.ftw.domain.entity.User | ||
import com.ftw.domain.usecase.user.GetCachedUserUseCase | ||
import com.ftw.hometerview.dispatcher.Dispatcher | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.flow.* | ||
import kotlinx.coroutines.launch | ||
|
||
class MyPageViewModel : ViewModel() { | ||
// TODO: Implement the ViewModel | ||
} | ||
class MyPageViewModel ( | ||
dispatcher: Dispatcher, | ||
private val getCachedUserUseCase: GetCachedUserUseCase | ||
) { | ||
|
||
private val _user: MutableStateFlow<User> = MutableStateFlow(User.NONE) | ||
val user: StateFlow<User> = _user.asStateFlow() | ||
|
||
init { | ||
CoroutineScope(dispatcher.ui()).launch { | ||
flow { | ||
emit(getCachedUserUseCase()) | ||
} | ||
.catch { emit(User("", Company.NONE)) } | ||
.collect { | ||
_user.value = it | ||
} | ||
|
||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/ftw/hometerview/ui/updatenickname/UpdateNicknameActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.ftw.hometerview.ui.updatenickname | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import com.ftw.hometerview.R | ||
|
||
class UpdateNicknameActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_update_nick_name) | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
app/src/main/java/com/ftw/hometerview/ui/updatenickname/UpdateNicknameViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.ftw.hometerview.ui.updatenickname | ||
|
||
import com.ftw.domain.entity.Company | ||
import com.ftw.domain.entity.LocationReview | ||
import com.ftw.domain.entity.User | ||
import com.ftw.domain.usecase.review.GetLocationReviewsUseCase | ||
import com.ftw.domain.usecase.user.GetCachedUserUseCase | ||
import com.ftw.hometerview.dispatcher.Dispatcher | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.flow.MutableStateFlow | ||
import kotlinx.coroutines.flow.StateFlow | ||
import kotlinx.coroutines.flow.asStateFlow | ||
import kotlinx.coroutines.flow.catch | ||
import kotlinx.coroutines.flow.flow | ||
import kotlinx.coroutines.launch | ||
|
||
class UpdateNicknameViewModel( | ||
dispatcher: Dispatcher, | ||
private val getCachedUserUseCase: GetCachedUserUseCase | ||
) { | ||
|
||
private val _user: MutableStateFlow<User> = MutableStateFlow(User.NONE) | ||
val user: StateFlow<User> = _user.asStateFlow() | ||
|
||
init { | ||
CoroutineScope(dispatcher.ui()).launch { | ||
flow { | ||
emit(getCachedUserUseCase()) | ||
} | ||
.catch { emit(User("", Company.NONE)) } | ||
.collect { | ||
_user.value = it | ||
} | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".ui.updatenickname.UpdateNicknameActivity" | ||
> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
</layout> |
Oops, something went wrong.