mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-23 04:33:54 -04:00
Flip logic in ACTION_START_SERVER
This commit is contained in:
parent
c547d8bb66
commit
f0975b0d23
@ -96,21 +96,22 @@ public class HotspotService extends Service implements HotspotStateListener {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ACTION_START_SERVER:
|
case ACTION_START_SERVER:
|
||||||
if (!webServerHelper.startServerHelper(
|
if (webServerHelper.startServerHelper(
|
||||||
intent.getStringArrayListExtra(SELECTED_ZIM_PATHS_KEY))) {
|
intent.getStringArrayListExtra(SELECTED_ZIM_PATHS_KEY))) {
|
||||||
zimHostCallbacks.onServerFailedToStart();
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
stopForeground(true);
|
|
||||||
stopSelf();
|
|
||||||
notificationManager.cancel(HOTSPOT_NOTIFICATION_ID);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
zimHostCallbacks.onServerStarted(ServerUtils.getSocketAddress());
|
zimHostCallbacks.onServerStarted(ServerUtils.getSocketAddress());
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||||
startForegroundNotificationHelper();
|
startForegroundNotificationHelper();
|
||||||
}
|
}
|
||||||
Toast.makeText(this, R.string.server_started__successfully_toast_message,
|
Toast.makeText(this, R.string.server_started__successfully_toast_message,
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
zimHostCallbacks.onServerFailedToStart();
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
stopForeground(true);
|
||||||
|
stopSelf();
|
||||||
|
notificationManager.cancel(HOTSPOT_NOTIFICATION_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user