Skip to content

Commit 971800a

Browse files
committed
Finish 1.3.0
2 parents b9ed341 + db711f8 commit 971800a

File tree

4 files changed

+17
-41
lines changed

4 files changed

+17
-41
lines changed

.jitpack.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- openjdk11

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Version 1.2.1
2+
> 2021-11-11
3+
- Refactor to use Kotlin Flows since listeners
4+
- Jitpack: use java 11
5+
16
# Version 1.2.1
27
- Changed WifiMonitor.start to monitor
38
- Removed stop method
@@ -21,4 +26,4 @@
2126
# Version 1.1.0
2227
> 2021-06-09
2328
- Expose `WifiLiveData`
24-
- Remove RxJava dependency
29+
- Remove RxJava dependency

README.md

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,15 @@
44
Allows you to watch for wi-fi changes on an Android device.
55

66
```kotlin
7-
class WiFiViewModel(context: Context) : ViewModel() {
8-
val values = WifiLiveData(
9-
WifiMonitor.WifiMonitorBuilder()
10-
.context(context)
11-
.build()
12-
)
13-
}
14-
15-
class MainActivity : AppCompatActivity() {
16-
override fun onCreate(savedInstanceState: Bundle?) {
17-
super.onCreate(savedInstanceState)
18-
setContentView(R.layout.activity_main)
19-
20-
val viewModel = WiFiViewModel(this)
7+
val wifiMonitor = WifiMonitor.Builder()
8+
.listener(wifiListener)
9+
.wifiManager(wifiManager)
10+
.permissionChecker(permissionChecker)
11+
.build(context)
2112

22-
viewModel.values.observe(this) {
23-
println(it.band)
24-
println(it.bssid)
25-
println(it.state.name)
26-
}
13+
val callbackFlow = wifiMonitor.monitor()
2714

28-
// Or more simply
29-
val monitorFlow = WifiMonitor.WifiMonitorBuilder()
30-
.context(context)
31-
.build()
32-
.monitor()
33-
34-
// Or without passing the context
35-
val monitorFlow = WifiMonitor.WifiMonitorBuilder()
36-
.listener(wifiListener)
37-
.wifiManager(wifiManager)
38-
.permissionChecker(permissionChecker)
39-
.build()
40-
.monitor()
41-
42-
// last known information
43-
monitorFlow.first()
44-
}
45-
}
15+
// use the flow as you like
4616

4717
```
4818

@@ -83,4 +53,4 @@ When the wi-fi is connected and your user didn't grant the `ACCESS_FINE_LOCATION
8353
When the phone is not connected to any Wi-Fi.
8454

8555
#### `UNKNOWN`
86-
When the library could not recognize the Wi-Fi state.
56+
When the library could not recognize the Wi-Fi state.

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ org.gradle.jvmargs=-Xmx1536m
22
android.useAndroidX=true
33
android.enableJetifier=true
44
kotlin.code.style=official
5-
version_code=8
6-
version_name=1.1.1
5+
version_code=9
6+
version_name=1.3.0

0 commit comments

Comments
 (0)