mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-18 11:55:38 -04:00
Clean up and removed loggings
This commit is contained in:
parent
1e7566bf78
commit
d66e2001da
@ -46,20 +46,6 @@ class ServiceModule {
|
|||||||
fun providesIpAddressCallbacks(service: Service): IpAddressCallbacks =
|
fun providesIpAddressCallbacks(service: Service): IpAddressCallbacks =
|
||||||
service as IpAddressCallbacks
|
service as IpAddressCallbacks
|
||||||
|
|
||||||
// @Provides
|
|
||||||
// @ServiceScope
|
|
||||||
// fun providesLibrary(): Library = Library()
|
|
||||||
|
|
||||||
// @Provides
|
|
||||||
// @ServiceScope
|
|
||||||
// fun providesJNIKiwixServer(jniKiwixLibrary: Library): JNIKiwixServer =
|
|
||||||
// KiwixServer(jniKiwixLibrary)
|
|
||||||
|
|
||||||
// @Provides
|
|
||||||
// @ServiceScope
|
|
||||||
// fun providesKiwixLibraryFactory(): Library =
|
|
||||||
// LibraryFactory()
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@ServiceScope
|
@ServiceScope
|
||||||
fun providesHotspotNotificationManager(
|
fun providesHotspotNotificationManager(
|
||||||
|
@ -18,14 +18,9 @@
|
|||||||
|
|
||||||
package org.kiwix.kiwixmobile.nav.destination.library
|
package org.kiwix.kiwixmobile.nav.destination.library
|
||||||
|
|
||||||
import android.util.Log
|
|
||||||
import org.kiwix.kiwixlib.Library
|
import org.kiwix.kiwixlib.Library
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
private const val TAG = "LibraryFactory"
|
|
||||||
class LibraryFactory @Inject constructor() : Library() {
|
class LibraryFactory @Inject constructor() : Library() {
|
||||||
fun createKiwixLibrary(): Library {
|
fun createKiwixLibrary(): Library = Library()
|
||||||
Log.d(TAG, "createKiwixLibrary: instance check of Library from factory: { ${Library()} } ")
|
|
||||||
return Library()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -33,15 +33,13 @@ class KiwixServer @Inject constructor(kiwixLibraryFactory: LibraryFactory) {
|
|||||||
|
|
||||||
fun createKiwixServer(selectedBooksPath: ArrayList<String>): JNIKiwixServer? {
|
fun createKiwixServer(selectedBooksPath: ArrayList<String>): JNIKiwixServer? {
|
||||||
kiwixLibrary = libFactory.createKiwixLibrary()
|
kiwixLibrary = libFactory.createKiwixLibrary()
|
||||||
// kiwixLibrary.addBook(selectedBooksPath)
|
|
||||||
for (path in selectedBooksPath) {
|
for (path in selectedBooksPath) {
|
||||||
try {
|
try {
|
||||||
var isBookAdded: Boolean = kiwixLibrary.addBook(path)
|
var isBookAdded: Boolean = kiwixLibrary.addBook(path)
|
||||||
} catch (e: JNIKiwixException) {
|
} catch (e: JNIKiwixException) {
|
||||||
Log.v(TAG, "Couldn't add book $path")
|
Log.v(TAG, "Couldn't add book with path:{ $path }")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.d(TAG, "createKiwixServer: Library instance check in JNIKiwixServer: $kiwixLibrary ")
|
|
||||||
return JNIKiwixServer(kiwixLibrary)
|
return JNIKiwixServer(kiwixLibrary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,27 +71,10 @@ public class WebServerHelper {
|
|||||||
private boolean startAndroidWebServer(ArrayList<String> selectedBooksPath) {
|
private boolean startAndroidWebServer(ArrayList<String> selectedBooksPath) {
|
||||||
if (!isServerStarted) {
|
if (!isServerStarted) {
|
||||||
int DEFAULT_PORT = 8080;
|
int DEFAULT_PORT = 8080;
|
||||||
//Library kiwixLibrary = kiwixServer.getKiwixLibrary();
|
|
||||||
Log.d(TAG, "startAndroidWebServer: KiwixServer instance check: { " + kiwixServer + " }");
|
|
||||||
//Log.d(TAG,
|
|
||||||
// "startAndroidWebServer: library instance check in WSH: { " + kiwixLibrary + " }");
|
|
||||||
ServerUtils.port = DEFAULT_PORT;
|
ServerUtils.port = DEFAULT_PORT;
|
||||||
//for (String path : selectedBooksPath) {
|
|
||||||
// try {
|
|
||||||
// boolean isBookAdded = kiwixLibrary.addBook(path);
|
|
||||||
// Log.d(TAG, "startAndroidWebServer: LibName102: { "
|
|
||||||
// + kiwixLibrary
|
|
||||||
// + " }");
|
|
||||||
// Log.v(TAG, "isBookAdded: " + isBookAdded + path);
|
|
||||||
// } catch (JNIKiwixException e) {
|
|
||||||
// Log.v(TAG, "Couldn't add book " + path);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
server = kiwixServer.createKiwixServer(selectedBooksPath);
|
server = kiwixServer.createKiwixServer(selectedBooksPath);
|
||||||
//server = kiwixServer.createKiwixServer();
|
|
||||||
server.setPort(ServerUtils.port);
|
server.setPort(ServerUtils.port);
|
||||||
updateServerState(server.start());
|
updateServerState(server.start());
|
||||||
Log.d(TAG, "startAndroidWebServer: checking server instance:{ " + server + " }");
|
|
||||||
Log.d(TAG, "Server status" + isServerStarted);
|
Log.d(TAG, "Server status" + isServerStarted);
|
||||||
}
|
}
|
||||||
return isServerStarted;
|
return isServerStarted;
|
||||||
|
@ -139,7 +139,6 @@ class ZimHostFragment : BaseFragment(), ZimHostCallbacks, ZimHostContract.View {
|
|||||||
|
|
||||||
startServerButton.setOnClickListener {
|
startServerButton.setOnClickListener {
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P || checkCoarseLocationAccessPermission()) {
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P || checkCoarseLocationAccessPermission()) {
|
||||||
// bindService()
|
|
||||||
startStopServer()
|
startStopServer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,7 +211,6 @@ class ZimHostFragment : BaseFragment(), ZimHostCallbacks, ZimHostContract.View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun stopServer() {
|
private fun stopServer() {
|
||||||
// unbindService()
|
|
||||||
requireActivity().startService(createHotspotIntent(ACTION_STOP_SERVER))
|
requireActivity().startService(createHotspotIntent(ACTION_STOP_SERVER))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user