Skip to content

Commit

Permalink
🔀 Merge pull request #71 from snuhcs-course/fix/backup
Browse files Browse the repository at this point in the history
fix/backup
  • Loading branch information
yjeong-k authored Nov 30, 2023
2 parents ab5ba6b + ae90d82 commit a997d71
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,24 +124,24 @@ class AccountSettingsViewModel @Inject internal constructor(
}
}

@RequiresApi(Build.VERSION_CODES.O)
private fun displayBackup() {
viewModelScope.launch {
settingsRepository.displayBackup().collect { result ->
when (result.code()) {
ResponseCode.SUCCESS.value -> {}
ResponseCode.NO_INTERNET_CONNECTION.value -> {
handleNoInternetConnection()
}
ResponseCode.SUCCESS.value -> { symbolListBackup() }
ResponseCode.NO_INTERNET_CONNECTION.value -> { handleNoInternetConnection() }
}
}
}
}

@RequiresApi(Build.VERSION_CODES.O)
private fun symbolListBackup() {
viewModelScope.launch {
settingsRepository.symbolListBackup().collect { result ->
when (result.code()) {
ResponseCode.SUCCESS.value -> {}
ResponseCode.SUCCESS.value -> { favoriteSymbolBackup() }

ResponseCode.NO_INTERNET_CONNECTION.value -> {
handleNoInternetConnection()
Expand All @@ -153,11 +153,12 @@ class AccountSettingsViewModel @Inject internal constructor(

}

@RequiresApi(Build.VERSION_CODES.O)
private fun favoriteSymbolBackup() {
viewModelScope.launch {
settingsRepository.favoriteSymbolBackup().collect { result ->
when (result.code()) {
ResponseCode.SUCCESS.value -> {}
ResponseCode.SUCCESS.value -> { weightTableBackup() }

ResponseCode.NO_INTERNET_CONNECTION.value -> {
handleNoInternetConnection()
Expand Down Expand Up @@ -193,9 +194,6 @@ class AccountSettingsViewModel @Inject internal constructor(
)
}
displayBackup()
symbolListBackup()
favoriteSymbolBackup()
weightTableBackup()
}

private fun handleNoInternetConnection() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,24 +94,25 @@ class BackupSettingsViewModel @Inject internal constructor(
}
}

@RequiresApi(Build.VERSION_CODES.O)
private fun displayBackup() {
viewModelScope.launch {
repository.displayBackup().collect { result ->
when (result.code()) {
ResponseCode.SUCCESS.value -> {}
ResponseCode.SUCCESS.value -> { symbolListBackup() }

ResponseCode.NO_INTERNET_CONNECTION.value -> { handleNoInternetConnection() }
}
}
}
}

@RequiresApi(Build.VERSION_CODES.O)
private fun symbolListBackup() {

viewModelScope.launch {
repository.symbolListBackup().collect { result ->
when (result.code()) {
ResponseCode.SUCCESS.value -> {}
ResponseCode.SUCCESS.value -> { favoriteSymbolBackup() }

ResponseCode.NO_INTERNET_CONNECTION.value -> { handleNoInternetConnection() }
}
Expand All @@ -121,11 +122,12 @@ class BackupSettingsViewModel @Inject internal constructor(

}

@RequiresApi(Build.VERSION_CODES.O)
private fun favoriteSymbolBackup() {
viewModelScope.launch {
repository.favoriteSymbolBackup().collect { result ->
when (result.code()) {
ResponseCode.SUCCESS.value -> {}
ResponseCode.SUCCESS.value -> { weightTableBackup() }

ResponseCode.NO_INTERNET_CONNECTION.value -> { handleNoInternetConnection() }
}
Expand All @@ -150,9 +152,6 @@ class BackupSettingsViewModel @Inject internal constructor(
fun backup() {
changeLoadingState()
displayBackup()
symbolListBackup()
favoriteSymbolBackup()
weightTableBackup()
}

private fun handleNoInternetConnection() {
Expand Down

0 comments on commit a997d71

Please sign in to comment.