Skip to content

Commit 1868159

Browse files
committed
make connectivity service impl and walled check cache singleton
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
1 parent 9b44aac commit 1868159

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

app/src/main/java/com/nextcloud/client/network/ConnectivityServiceImpl.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ class ConnectivityServiceImpl(
3636
) : ConnectivityService {
3737

3838
companion object {
39-
var instance: ConnectivityServiceImpl? = null
40-
41-
// todo: remove
42-
private var initCount = 0
4339
private const val TAG = "ConnectivityServiceImpl"
4440
private const val CONNECTIVITY_CHECK_ROUTE = "/index.php/204"
4541
}
@@ -70,13 +66,9 @@ class ConnectivityServiceImpl(
7066
}
7167
// endregion
7268

73-
74-
7569
init {
76-
initCount += 1
7770
connectivityManager.registerDefaultNetworkCallback(networkCallback)
7871
updateConnectivity()
79-
Log_OC.d(TAG, "connectivity service constructed: " + initCount)
8072
}
8173

8274
// region overridden methods

app/src/main/java/com/nextcloud/client/network/WalledCheckCache.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
*/
99
package com.nextcloud.client.network
1010

11-
import com.nextcloud.client.core.Clock
11+
import com.nextcloud.client.core.ClockImpl
1212
import javax.inject.Inject
1313
import javax.inject.Singleton
1414

1515
@Singleton
16-
class WalledCheckCache @Inject constructor(private val clock: Clock) {
16+
class WalledCheckCache @Inject constructor() {
17+
private val clock = ClockImpl()
18+
1719
private var connectivityCache = mutableMapOf<ConnectivityKey, Connectivity>()
1820
private val walledStatusCache = mutableMapOf<ConnectivityKey, Pair<Long, Boolean>>()
1921

0 commit comments

Comments
 (0)