Skip to content
This repository was archived by the owner on Dec 18, 2022. It is now read-only.

Commit d6a2390

Browse files
committed
clean up start/stop foreground method and add documentation
1 parent 31d107b commit d6a2390

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

topl-service/src/main/java/io/matthewnelson/topl_service/notification/ServiceNotification.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,20 +490,29 @@ class ServiceNotification internal constructor(
490490
internal var inForeground = false
491491
private set
492492

493+
/**
494+
* Sends [TorService] to the Foreground.
495+
*
496+
* @return `true` if sent to Foreground, `false` if no action taken
497+
* */
493498
@Synchronized
494499
internal fun startForeground(torService: BaseService): Boolean {
495500
return if (!inForeground) {
496501
notificationBuilder?.let {
497502
torService.startForeground(notificationID, it.build())
498503
inForeground = true
499-
return true
500504
}
501-
false
505+
inForeground
502506
} else {
503507
false
504508
}
505509
}
506510

511+
/**
512+
* Sends [TorService] to the Background.
513+
*
514+
* @return `true` if sent to Background, `false` if no action taken
515+
* */
507516
@Synchronized
508517
internal fun stopForeground(torService: BaseService): Boolean {
509518
return if (inForeground) {

0 commit comments

Comments
 (0)