This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class WiFiConnectUseCase(context: Context) { | |
| private var wifiManager = | |
| context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager | |
| private val connectivityManager = | |
| context.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | |
| private val wifiSSID = "My Network" | |
| private val wifiPassword = "password1234" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class WiFiConnectLegacyUseCase(private val context: Context) { | |
| private var wifiManager = | |
| context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager | |
| private val connectivityManager = | |
| context.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | |
| private val wifiSSID = "My Network" | |
| private val wifiPassword = "password1234" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class WiFiDisconnectUseCase(context: Context) { | |
| private var wifiManager = | |
| context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager | |
| private val connectivityManager = | |
| context.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | |
| private val wifiSSID = "My Network" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class WiFiScanUseCase(private val context: Context) { | |
| private val wifiManager = | |
| context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager | |
| private val wifiSSID = "My Network" | |
| operator fun invoke(): Completable { | |
| return startScanning() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class WifiConnectionViewModel( | |
| private val context: Context, | |
| wifiScanUseCase: WiFiScanUseCase, | |
| private val wifiConnectUseCase: WiFiConnectDockUseCase, | |
| private val wifiConnectLegacyUseCase: WiFiConnectDockLegacyUseCase, | |
| private val wifiDisconnectUseCase: WiFiDisconnectDockUseCase | |
| ) : ViewModel() { | |
| private val disposables = CompositeDisposable(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget | |
| plugins { | |
| kotlin("multiplatform") | |
| id("com.android.library") | |
| } | |
| android { | |
| compileSdkVersion(29) | |
| defaultConfig { | |
| minSdkVersion(21) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plugins { | |
| id("com.android.application") | |
| kotlin("android") | |
| kotlin("android.extensions") | |
| kotlin("kapt") | |
| id("androidx.navigation.safeargs.kotlin") | |
| } | |
| android { | |
| compileSdkVersion(Versions.compile_sdk) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Top-level build file where you can add configuration options common to all sub-projects/modules. | |
| buildscript { | |
| repositories { | |
| google() | |
| jcenter() | |
| } | |
| dependencies { | |
| classpath("com.android.tools.build:gradle:3.6.3") | |
| classpath(kotlin("gradle-plugin", "1.3.71")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| include(":shared", ":androidApp") | |
| rootProject.name = "xxx" | |
| enableFeaturePreview("GRADLE_METADATA") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun isWiFiEnabled(): Boolean { | |
| val wifiManager = applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager | |
| return wifiManager.isWifiEnabled | |
| } |
OlderNewer