@ -119,6 +119,7 @@ class App : Application(), libtailscale.AppContext {
app = Libtailscale . start ( dataDir , directFileDir . absolutePath , this )
Request . setApp ( app )
Notifier . setApp ( app )
Notifier . start ( applicationScope )
connectivityManager = this . getSystemService ( Context . CONNECTIVITY _SERVICE ) as ConnectivityManager
setAndRegisterNetworkCallbacks ( )
createNotificationChannel (
@ -141,9 +142,13 @@ class App : Application(), libtailscale.AppContext {
fun setWantRunning ( wantRunning : Boolean ) {
val callback : ( Result < Ipn . Prefs > ) -> Unit = { result ->
result . exceptionOrNull ( ) ?. let { error ->
Log . e ( TAG , " Set want running: failed to update preferences: ${error.message} " )
}
result . fold (
onSuccess = { _ ->
setTileStatus ( wantRunning )
} ,
onFailure = { error ->
Log . d ( " TAG " , " Set want running: failed to update preferences: ${error.message} " )
} )
}
Client ( applicationScope )
. editPrefs ( Ipn . MaskedPrefs ( ) . apply { WantRunning = wantRunning } , callback )