Skip to content

Commit 278dc44

Browse files
committed
show airpods name in notification
1 parent c6863a8 commit 278dc44

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

android/app/src/main/java/me/kavishdevar/aln/services/AirPodsService.kt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class AirPodsService: Service() {
148148
notificationManager.createNotificationChannel(notificationChannel)
149149
val notification = NotificationCompat.Builder(this, "background_service_status")
150150
.setSmallIcon(R.drawable.airpods)
151-
.setContentTitle("AirPods are not connected")
151+
.setContentTitle("AirPods not connected")
152152
.setCategory(Notification.CATEGORY_SERVICE)
153153
.setPriority(NotificationCompat.PRIORITY_LOW)
154154
.setOngoing(true)
@@ -261,24 +261,24 @@ class AirPodsService: Service() {
261261

262262
updatedNotification = NotificationCompat.Builder(this, "background_service_status")
263263
.setSmallIcon(R.drawable.airpods)
264-
.setContentTitle("""AirPods${batteryList?.find { it.component == BatteryComponent.LEFT }?.let {
265-
// if (it.status != BatteryStatus.DISCONNECTED) {
264+
.setContentTitle("""$airpodsName${batteryList?.find { it.component == BatteryComponent.LEFT }?.let {
265+
if (it.status != BatteryStatus.DISCONNECTED) {
266266
" L:${if (it.status == BatteryStatus.CHARGING) "" else ""} ${it.level}%"
267-
// } else {
268-
// ""
269-
// }
267+
} else {
268+
""
269+
}
270270
} ?: ""}${batteryList?.find { it.component == BatteryComponent.RIGHT }?.let {
271-
// if (it.status != BatteryStatus.DISCONNECTED) {
271+
if (it.status != BatteryStatus.DISCONNECTED) {
272272
" R:${if (it.status == BatteryStatus.CHARGING) "" else ""} ${it.level}%"
273-
// } else {
274-
// ""
275-
// }
273+
} else {
274+
""
275+
}
276276
} ?: ""}${batteryList?.find { it.component == BatteryComponent.CASE }?.let {
277-
// if (it.status != BatteryStatus.DISCONNECTED) {
277+
if (it.status != BatteryStatus.DISCONNECTED) {
278278
" C:${if (it.status == BatteryStatus.CHARGING) "" else ""} ${it.level}%"
279-
// } else {
280-
// ""
281-
// }
279+
} else {
280+
""
281+
}
282282
} ?: ""}""")
283283
.setCategory(Notification.CATEGORY_SERVICE)
284284
.setPriority(NotificationCompat.PRIORITY_LOW)
@@ -288,7 +288,7 @@ class AirPodsService: Service() {
288288
} else {
289289
updatedNotification = NotificationCompat.Builder(this, "background_service_status")
290290
.setSmallIcon(R.drawable.airpods)
291-
.setContentTitle("AirPods are not connected")
291+
.setContentTitle("AirPods not connected")
292292
.setCategory(Notification.CATEGORY_SERVICE)
293293
.setPriority(NotificationCompat.PRIORITY_LOW)
294294
.setOngoing(true)

0 commit comments

Comments
 (0)