Skip to content

Commit

Permalink
쓸데없는거 지우기
Browse files Browse the repository at this point in the history
  • Loading branch information
JuTaK97 committed Aug 11, 2023
1 parent 9eb27ea commit 43b7fa5
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ interface UserRepository {

val firstBookmarkAlert: StateFlow<Boolean>

val rnConfig: StateFlow<Boolean>

// login with local id
suspend fun postSignIn(id: String, password: String)

Expand Down Expand Up @@ -95,8 +93,4 @@ interface UserRepository {
suspend fun setCompactMode(compact: Boolean)

suspend fun setFirstBookmarkAlertShown()

suspend fun setRNConfig(state: Boolean)

suspend fun rnUrl(): String
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class UserRepositoryImpl @Inject constructor(

override val firstBookmarkAlert = storage.firstBookmarkAlert.asStateFlow()

override val rnConfig: StateFlow<Boolean>
get() = storage.rnTempConfig.asStateFlow()

override suspend fun postSignIn(id: String, password: String) {
val response = api._postSignIn(PostSignInParams(id, password))
storage.prefKeyUserId.update(response.userId.toOptional())
Expand Down Expand Up @@ -271,14 +268,6 @@ class UserRepositoryImpl @Inject constructor(
storage.firstBookmarkAlert.update(false)
}

override suspend fun setRNConfig(state: Boolean) {
storage.rnTempConfig.update(state)
}

override suspend fun rnUrl(): String {
return api._getRemoteConfig().friends?.src?.get("android") ?: ""
}

private suspend fun getFirebaseToken(): String {
return suspendCoroutine { cont ->
FirebaseMessaging.getInstance().token.addOnCompleteListener(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ class RNModuleActivity : ReactActivity() {
.build()

rootView = ReactRootView(this@RNModuleActivity)
rootView?.startReactApplication(reactInstanceManager, "friends", Bundle().apply {
putString("x-access-token", rnViewModel.token)
putString("x-access-apikey", applicationContext.getString(R.string.api_key))
})
rootView?.startReactApplication(
reactInstanceManager, "friends",
Bundle().apply {
putString("x-access-token", rnViewModel.token)
putString("x-access-apikey", applicationContext.getString(R.string.api_key))
}
)
setContentView(rootView)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ class RNViewModel @Inject constructor(
try {
val bundleFile = File(application.applicationContext.cacheDir, "android.jsbundle")

val url = if (userRepository.rnConfig.value) {
"http://localhost:8081/index.bundle?platform=android"
} else {
userRepository.rnUrl()
}
val url = "http://localhost:8081/index.bundle?platform=android"
val urlConnection = URL(url).openConnection() as HttpURLConnection
urlConnection.connect()
val inputStream = urlConnection.inputStream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class UserViewModel @Inject constructor(

val firstBookmarkAlert: StateFlow<Boolean> = userRepository.firstBookmarkAlert

val rnConfig = userRepository.rnConfig

suspend fun fetchUserInfo() {
userRepository.fetchUserInfo()
}
Expand Down Expand Up @@ -162,8 +160,4 @@ class UserViewModel @Inject constructor(
suspend fun setFirstBookmarkAlertShown() {
userRepository.setFirstBookmarkAlertShown()
}

suspend fun toggleRNConfig() {
userRepository.setRNConfig(rnConfig.value.not())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ package com.wafflestudio.snutt2.views.logged_in.home.timetable
import android.app.Activity
import android.content.Intent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.material.Text
import androidx.compose.ui.Alignment
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
Expand All @@ -39,8 +38,9 @@ import com.wafflestudio.snutt2.components.compose.ComposableStatesWithScope
import com.wafflestudio.snutt2.components.compose.DrawerIcon
import com.wafflestudio.snutt2.components.compose.IconWithAlertDot
import com.wafflestudio.snutt2.components.compose.LectureListIcon
import com.wafflestudio.snutt2.components.compose.RNIcon
import com.wafflestudio.snutt2.components.compose.RingingAlarmIcon
import com.wafflestudio.snutt2.components.compose.ShareIcon
import com.wafflestudio.snutt2.components.compose.TipCloseIcon
import com.wafflestudio.snutt2.components.compose.TopBar
import com.wafflestudio.snutt2.components.compose.TrashIcon
import com.wafflestudio.snutt2.components.compose.clicks
Expand All @@ -51,16 +51,15 @@ import com.wafflestudio.snutt2.ui.SNUTTColors
import com.wafflestudio.snutt2.ui.SNUTTTypography
import com.wafflestudio.snutt2.views.LocalDrawerState
import com.wafflestudio.snutt2.views.LocalNavController
import com.wafflestudio.snutt2.views.LocalRemoteConfig
import com.wafflestudio.snutt2.views.LocalTableState
import com.wafflestudio.snutt2.views.NavigationDestination
import com.wafflestudio.snutt2.views.RNModuleActivity
import com.wafflestudio.snutt2.views.logged_in.home.TableListViewModel
import com.wafflestudio.snutt2.views.logged_in.home.settings.PoorSwitch
import com.wafflestudio.snutt2.views.logged_in.home.settings.UserViewModel
import com.wafflestudio.snutt2.views.logged_in.home.showTitleChangeDialog
import com.wafflestudio.snutt2.views.logged_in.vacancy_noti.VacancyViewModel
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File

@Composable
Expand Down Expand Up @@ -140,7 +139,7 @@ fun TimetablePage() {
}
},
)
RNIcon(
LectureListIcon(
modifier = Modifier
.size(30.dp)
.clicks {
Expand Down

0 comments on commit 43b7fa5

Please sign in to comment.