generated from semicolondsm/Semicolon_Repository_Generator
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/169_github_implement' into develop
# Conflicts: # app/src/main/java/com/xquare/xquare_android/XquareApplication.kt # app/src/main/java/com/xquare/xquare_android/feature/profile/ProfileScreen.kt # app/src/main/java/com/xquare/xquare_android/feature/profile/ProfileViewModel.kt # data/src/main/java/com/xquare/data/remote/datasource/attachment/AttachmentRemoteDataSourceImpl.kt # data/src/main/java/com/xquare/data/repository/attachment/AttachmentRepositoryImpl.kt # di/src/main/java/com/xquare/di/NetworkModule.kt
- Loading branch information
Showing
67 changed files
with
1,020 additions
and
302 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
37 changes: 37 additions & 0 deletions
37
app/src/main/java/com/xquare/xquare_android/MainActivityViewModel.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.xquare.xquare_android | ||
|
||
import com.xquare.domain.entity.github.GithubOAuthEntity | ||
import com.xquare.domain.usecase.github.FetchGithubOAuthCheckUseCase | ||
import com.xquare.domain.usecase.github.FetchGithubOAuthUseCase | ||
import com.xquare.xquare_android.base.BaseViewModel | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.delay | ||
import kotlinx.coroutines.runBlocking | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class MainActivityViewModel @Inject constructor( | ||
private val fetchGithubOAuthUseCase: FetchGithubOAuthUseCase, | ||
private val fetchGithubOAuthCheckUseCase: FetchGithubOAuthCheckUseCase | ||
) : BaseViewModel<MainActivityViewModel.Event>() { | ||
|
||
fun registerGithubUser(githubOAuthEntity: GithubOAuthEntity) { | ||
execute( | ||
job = { | ||
val connected = fetchGithubOAuthCheckUseCase.execute(Unit).is_connected | ||
|
||
if (!connected) { | ||
fetchGithubOAuthUseCase.execute(githubOAuthEntity) | ||
} | ||
}, | ||
onSuccess = { emitEvent(Event.OAuthSuccess) }, | ||
onFailure = { emitEvent(Event.OAuthFailure) } | ||
) | ||
} | ||
|
||
sealed class Event { | ||
object OAuthSuccess : Event() | ||
object OAuthFailure : Event() | ||
} | ||
} |
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
Oops, something went wrong.