Skip to content

Commit 8a173a8

Browse files
committed
[#101] Minor grammar concerns
1 parent a85bd09 commit 8a173a8

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

app/src/main/java/co/nimblehq/compose/crypto/ui/screens/home/HomeViewModel.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class HomeViewModel @Inject constructor(
5252
dispatchers: DispatchersProvider,
5353
private val getMyCoinsUseCase: GetMyCoinsUseCase,
5454
private val getTrendingCoinsUseCase: GetTrendingCoinsUseCase,
55-
private val getConnectionStatsUseCase: GetConnectionStatsUseCase,
55+
private val getConnectionStatusUseCase: GetConnectionStatusUseCase,
5656
) : BaseViewModel(dispatchers), Input, Output {
5757

5858
override val input = this
@@ -92,7 +92,7 @@ class HomeViewModel @Inject constructor(
9292
loadData()
9393
// TODO remove in integration ticket
9494
execute {
95-
getConnectionStatsUseCase()
95+
getConnectionStatusUseCase()
9696
.collect {
9797
_hasConnection.emit(it)
9898
}

app/src/test/java/co/nimblehq/compose/crypto/ui/screens/home/HomeScreenTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ class HomeScreenTest : BaseViewModelTest() {
5555
private val mockGetTrendingCoinsUseCase = mockk<GetTrendingCoinsUseCase>()
5656

5757
// TODO remove in integration ticket
58-
private val mockGetConnectionStatsUseCase = mockk<GetConnectionStatsUseCase>()
58+
private val mockGetConnectionStatusUseCase = mockk<GetConnectionStatusUseCase>()
5959

6060
private lateinit var viewModel: HomeViewModel
6161

6262
private var appDestination: AppDestination? = null
6363

6464
@Before
6565
fun setUp() {
66-
every { mockGetConnectionStatsUseCase() } returns flowOf(null)
66+
every { mockGetConnectionStatusUseCase() } returns flowOf(null)
6767
composeAndroidTestRule.activity.setContent {
6868
HomeScreen(
6969
viewModel = viewModel,
@@ -220,7 +220,7 @@ class HomeScreenTest : BaseViewModelTest() {
220220
dispatchers = testDispatcherProvider,
221221
getMyCoinsUseCase = mockGetMyCoinsUseCase,
222222
getTrendingCoinsUseCase = mockGetTrendingCoinsUseCase,
223-
getConnectionStatsUseCase = mockGetConnectionStatsUseCase
223+
getConnectionStatusUseCase = mockGetConnectionStatusUseCase
224224
)
225225
}
226226
}

app/src/test/java/co/nimblehq/compose/crypto/ui/screens/home/HomeViewModelTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class HomeViewModelTest : BaseViewModelTest() {
2525
private lateinit var viewModel: HomeViewModel
2626

2727
// TODO remove in integration ticket
28-
private val mockGetConnectionStatsUseCase = mockk<GetConnectionStatsUseCase>()
28+
private val mockGetConnectionStatusUseCase = mockk<GetConnectionStatusUseCase>()
2929

3030
@Before
3131
fun setUp() {
@@ -146,7 +146,7 @@ class HomeViewModelTest : BaseViewModelTest() {
146146
testDispatcherProvider,
147147
mockGetMyCoinsUseCase,
148148
mockGetTrendingCoinsUseCase,
149-
mockGetConnectionStatsUseCase
149+
mockGetConnectionStatusUseCase
150150
)
151151
}
152152
}

data/src/main/java/co/nimblehq/compose/crypto/data/repository/GlobalRepositoryImpl.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class GlobalRepositoryImpl(
1010
context: Context
1111
) : GlobalRepository {
1212

13-
private var connectionStatus: MutableStateFlow<Boolean?> = MutableStateFlow(null)
13+
private var isNetworkConnected: MutableStateFlow<Boolean?> = MutableStateFlow(null)
1414

1515
private val networkRequest = NetworkRequest.Builder()
1616
.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
@@ -22,7 +22,7 @@ class GlobalRepositoryImpl(
2222
// network is available for use
2323
override fun onAvailable(network: Network) {
2424
super.onAvailable(network)
25-
connectionStatus.value = true
25+
isNetworkConnected.value = true
2626
}
2727

2828
// Network capabilities have changed for the network
@@ -32,15 +32,15 @@ class GlobalRepositoryImpl(
3232
) {
3333
super.onCapabilitiesChanged(network, networkCapabilities)
3434
val unmetered = networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED)
35-
if(unmetered) {
36-
connectionStatus.value = true
35+
if (unmetered) {
36+
isNetworkConnected.value = true
3737
}
3838
}
3939

4040
// lost network connection
4141
override fun onLost(network: Network) {
4242
super.onLost(network)
43-
connectionStatus.value = false
43+
isNetworkConnected.value = false
4444
}
4545
}
4646

@@ -49,5 +49,5 @@ class GlobalRepositoryImpl(
4949
connectivityManager.requestNetwork(networkRequest, networkCallback)
5050
}
5151

52-
override fun getConnectionStatus(): Flow<Boolean?> = connectionStatus
52+
override fun getConnectionStatus(): Flow<Boolean?> = isNetworkConnected
5353
}

domain/src/main/java/co/nimblehq/compose/crypto/domain/usecase/GetConnectionStatsUseCase.kt renamed to domain/src/main/java/co/nimblehq/compose/crypto/domain/usecase/GetConnectionStatusUseCase.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import co.nimblehq.compose.crypto.domain.repository.GlobalRepository
44
import kotlinx.coroutines.flow.Flow
55
import javax.inject.Inject
66

7-
class GetConnectionStatsUseCase @Inject constructor(private val repository: GlobalRepository) {
7+
class GetConnectionStatusUseCase @Inject constructor(private val repository: GlobalRepository) {
88
operator fun invoke(): Flow<Boolean?> = repository.getConnectionStatus()
99
}

0 commit comments

Comments
 (0)