|
@@ -10,7 +10,6 @@ import io.legado.app.constant.AppConst
|
|
|
import io.legado.app.constant.EventBus
|
|
import io.legado.app.constant.EventBus
|
|
|
import io.legado.app.constant.IntentAction
|
|
import io.legado.app.constant.IntentAction
|
|
|
import io.legado.app.constant.PreferKey
|
|
import io.legado.app.constant.PreferKey
|
|
|
-import io.legado.app.ui.main.MainActivity
|
|
|
|
|
import io.legado.app.utils.*
|
|
import io.legado.app.utils.*
|
|
|
import io.legado.app.web.HttpServer
|
|
import io.legado.app.web.HttpServer
|
|
|
import io.legado.app.web.WebSocketServer
|
|
import io.legado.app.web.WebSocketServer
|
|
@@ -61,6 +60,7 @@ class WebService : BaseService() {
|
|
|
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
|
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
|
|
when (intent?.action) {
|
|
when (intent?.action) {
|
|
|
IntentAction.stop -> stopSelf()
|
|
IntentAction.stop -> stopSelf()
|
|
|
|
|
+ "copyHostAddress" -> sendToClip(hostAddress)
|
|
|
else -> upWebServer()
|
|
else -> upWebServer()
|
|
|
}
|
|
}
|
|
|
return super.onStartCommand(intent, flags, startId)
|
|
return super.onStartCommand(intent, flags, startId)
|
|
@@ -114,7 +114,7 @@ class WebService : BaseService() {
|
|
|
.setContentTitle(getString(R.string.web_service))
|
|
.setContentTitle(getString(R.string.web_service))
|
|
|
.setContentText(notificationContent)
|
|
.setContentText(notificationContent)
|
|
|
.setContentIntent(
|
|
.setContentIntent(
|
|
|
- activityPendingIntent<MainActivity>("webService")
|
|
|
|
|
|
|
+ servicePendingIntent<WebService>("copyHostAddress")
|
|
|
)
|
|
)
|
|
|
builder.addAction(
|
|
builder.addAction(
|
|
|
R.drawable.ic_stop_black_24dp,
|
|
R.drawable.ic_stop_black_24dp,
|