Skip to content

Commit

Permalink
Update: scoped storage 대응
Browse files Browse the repository at this point in the history
  • Loading branch information
jisungbin committed Nov 30, 2021
1 parent cdd8931 commit 325320a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import retrofit2.Retrofit
class GithubRepoRepositoryImpl(retrofit: Retrofit) : GithubRepoRepository {
private val api = retrofit.create(GithubRepoService::class.java)
private val githubData: GithubData = Storage.read(GithubConstant.DataPath, null)?.toModel()
?: /*throw DataGithubException("GithubConfig.DataPath 데이터가 null 이에요.")*/ GithubData() // TODO: null 대응 (ScopedStorage 대응)
?: /*throw DataGithubException("GithubConfig.DataPath 데이터가 null 이에요.")*/ GithubData() // TODO: null 대응 (ScopedStorage 고려해서)

override suspend fun getFileContent(
repoName: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ import io.github.jisungbin.gitmessengerbot.activity.editor.js.mvi.JsEditorMviSta
import io.github.jisungbin.gitmessengerbot.activity.editor.js.mvi.MviJsEditorSuccessType
import io.github.jisungbin.gitmessengerbot.common.constant.GithubConstant
import io.github.jisungbin.gitmessengerbot.common.core.Storage
import io.github.jisungbin.gitmessengerbot.common.exception.PresentationException
import io.github.jisungbin.gitmessengerbot.common.extension.runIf
import io.github.jisungbin.gitmessengerbot.common.extension.toBase64
import io.github.jisungbin.gitmessengerbot.common.extension.toModel
Expand Down Expand Up @@ -201,7 +200,7 @@ private fun DrawerLayout(

val repoName = script.name
val gitUser: GithubData = Storage.read(GithubConstant.DataPath, null)?.toModel()
?: throw PresentationException("GithubConfig.DataPath 데이터가 null 이에요.")
?: GithubData() // TODO: null 대응 (ScopedStorage 고려해서)
val repoPath = "script.${script.lang.getScriptSuffix()}"
val repoDescription = GithubConstant.DefaultRepoDescription // TODO
val repoBranch = AppConfig.appValue.gitDefaultBranch // TODO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ fun Header(searchField: MutableState<TextFieldValue>) {
val app by AppConfig.app.collectAsState()
val backgroundService = Intent(context, BackgroundService::class.java)
val githubJson =
Storage.read(GithubConstant.DataPath, null) // TODO: null 처리 (ScopedStorage 대응해서)
Storage.read(GithubConstant.DataPath, null) // TODO: null 처리 (ScopedStorage 고려해서)
val githubData: GithubData = githubJson?.toModel() ?: GithubData(userName = "User")
var searching by remember { mutableStateOf(false) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import io.github.jisungbin.gitmessengerbot.common.constant.GithubConstant
import io.github.jisungbin.gitmessengerbot.common.core.Storage
import io.github.jisungbin.gitmessengerbot.common.exception.PresentationException
import io.github.jisungbin.gitmessengerbot.common.extension.toModel
import io.github.jisungbin.gitmessengerbot.di.qualifier.AouthRetrofit
import io.github.jisungbin.gitmessengerbot.di.qualifier.SignedRetrofit
Expand All @@ -43,8 +42,8 @@ object RetrofitModule {
private class AuthInterceptor : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
var builder = chain.request().newBuilder()
val githubData: GithubData = Storage.read(GithubConstant.DataPath, null)?.toModel()
?: throw PresentationException("GithubConfig.DataPath 값이 null 이에요.")
val githubData: GithubData =
Storage.read(GithubConstant.DataPath, null)?.toModel() ?: GithubData() // TODO: null 대응 (ScopedStorage 고려해서)
builder = builder
.addHeader("Authorization", "token ${githubData.aouthToken}")
.addHeader("Accept", "application/json")
Expand Down

0 comments on commit 325320a

Please sign in to comment.