Skip to content

Commit cdd8931

Browse files
committed
Update: scoped storage 대응
1 parent 9ba83dd commit cdd8931

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

Diff for: data-github/src/main/kotlin/io/github/jisungbin/gitmessengerbot/data/github/repo/GithubRepoRepositoryImpl.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ package io.github.jisungbin.gitmessengerbot.data.github.repo
1111

1212
import io.github.jisungbin.gitmessengerbot.common.constant.GithubConstant
1313
import io.github.jisungbin.gitmessengerbot.common.core.Storage
14-
import io.github.jisungbin.gitmessengerbot.common.exception.DataGithubException
1514
import io.github.jisungbin.gitmessengerbot.common.extension.toModel
1615
import io.github.jisungbin.gitmessengerbot.data.github.api.GithubRepoService
1716
import io.github.jisungbin.gitmessengerbot.data.github.mapper.toDomain
@@ -31,7 +30,7 @@ import retrofit2.Retrofit
3130
class GithubRepoRepositoryImpl(retrofit: Retrofit) : GithubRepoRepository {
3231
private val api = retrofit.create(GithubRepoService::class.java)
3332
private val githubData: GithubData = Storage.read(GithubConstant.DataPath, null)?.toModel()
34-
?: throw DataGithubException("GithubConfig.DataPath 데이터가 null 이에요.")
33+
?: /*throw DataGithubException("GithubConfig.DataPath 데이터가 null 이에요.")*/ GithubData() // TODO: null 대응 (ScopedStorage 대응)
3534

3635
override suspend fun getFileContent(
3736
repoName: String,

Diff for: presentation/src/main/kotlin/io/github/jisungbin/gitmessengerbot/activity/main/MainActivity.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class MainActivity : ComponentActivity() {
119119

120120
if (Storage.isScoped) {
121121
AlertDialog.Builder(this)
122-
.setMessage(R.string.activity_main_dialog_android_11_notice_title)
122+
.setTitle(R.string.activity_main_dialog_android_11_notice_title)
123123
.setMessage(R.string.activity_main_dialog_android_11_notice_message)
124124
.setPositiveButton(R.string.close, null)
125125
.show()

Diff for: presentation/src/main/kotlin/io/github/jisungbin/gitmessengerbot/activity/main/dashboard/script/header.kt

+12-6
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ import io.github.jisungbin.gitmessengerbot.activity.imageviewer.ImageViewActivit
6666
import io.github.jisungbin.gitmessengerbot.common.constant.GithubConstant
6767
import io.github.jisungbin.gitmessengerbot.common.constant.IntentConstant
6868
import io.github.jisungbin.gitmessengerbot.common.core.Storage
69-
import io.github.jisungbin.gitmessengerbot.common.exception.PresentationException
7069
import io.github.jisungbin.gitmessengerbot.common.extension.toModel
7170
import io.github.jisungbin.gitmessengerbot.domain.github.model.user.GithubData
7271
import io.github.jisungbin.gitmessengerbot.theme.colors
@@ -115,9 +114,9 @@ fun Header(searchField: MutableState<TextFieldValue>) {
115114

116115
val app by AppConfig.app.collectAsState()
117116
val backgroundService = Intent(context, BackgroundService::class.java)
118-
val githubJson = Storage.read(GithubConstant.DataPath, null)
119-
?: throw PresentationException("GithubConfig.DataPath의 값이 null 이에요.")
120-
val githubData: GithubData = githubJson.toModel()
117+
val githubJson =
118+
Storage.read(GithubConstant.DataPath, null) // TODO: null 처리 (ScopedStorage 대응해서)
119+
val githubData: GithubData = githubJson?.toModel() ?: GithubData(userName = "User")
121120
var searching by remember { mutableStateOf(false) }
122121

123122
ConstraintLayout(
@@ -208,6 +207,7 @@ fun Header(searchField: MutableState<TextFieldValue>) {
208207
style = TextStyle(fontFamily = defaultFontFamily, fontSize = 15.sp)
209208
)
210209
Switch(
210+
modifier = Modifier.height(20.dp),
211211
checked = app.power,
212212
colors = SwitchDefaults.colors(
213213
checkedThumbColor = Color.White,
@@ -240,7 +240,10 @@ fun Header(searchField: MutableState<TextFieldValue>) {
240240
text = Bot.getAllScripts().size.toString(),
241241
style = TextStyle(fontFamily = defaultFontFamily, fontSize = 25.sp)
242242
)
243-
Text(text = "", style = TextStyle(fontFamily = defaultFontFamily, fontSize = 15.sp))
243+
Text(
244+
text = "",
245+
style = TextStyle(fontFamily = defaultFontFamily, fontSize = 15.sp)
246+
)
244247
}
245248
}
246249
MenuBox(
@@ -255,7 +258,10 @@ fun Header(searchField: MutableState<TextFieldValue>) {
255258
text = Bot.getRunnableScripts().size.toString(),
256259
style = TextStyle(fontFamily = defaultFontFamily, fontSize = 25.sp)
257260
)
258-
Text(text = "", style = TextStyle(fontFamily = defaultFontFamily, fontSize = 15.sp))
261+
Text(
262+
text = "",
263+
style = TextStyle(fontFamily = defaultFontFamily, fontSize = 15.sp)
264+
)
259265
}
260266
}
261267
MenuBox(

0 commit comments

Comments
 (0)