Clean up and removed loggings

This commit is contained in:
s-ayush2903 2020-12-11 05:04:08 +05:30
parent 1e7566bf78
commit d66e2001da
No known key found for this signature in database
GPG Key ID: B4341DD08B2371CB
5 changed files with 2 additions and 42 deletions

View File

@ -46,20 +46,6 @@ class ServiceModule {
fun providesIpAddressCallbacks(service: Service): 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
@ServiceScope
fun providesHotspotNotificationManager(

View File

@ -18,14 +18,9 @@
package org.kiwix.kiwixmobile.nav.destination.library
import android.util.Log
import org.kiwix.kiwixlib.Library
import javax.inject.Inject
private const val TAG = "LibraryFactory"
class LibraryFactory @Inject constructor() : Library() {
fun createKiwixLibrary(): Library {
Log.d(TAG, "createKiwixLibrary: instance check of Library from factory: { ${Library()} } ")
return Library()
}
fun createKiwixLibrary(): Library = Library()
}

View File

@ -33,15 +33,13 @@ class KiwixServer @Inject constructor(kiwixLibraryFactory: LibraryFactory) {
fun createKiwixServer(selectedBooksPath: ArrayList<String>): JNIKiwixServer? {
kiwixLibrary = libFactory.createKiwixLibrary()
// kiwixLibrary.addBook(selectedBooksPath)
for (path in selectedBooksPath) {
try {
var isBookAdded: Boolean = kiwixLibrary.addBook(path)
} 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)
}
}

View File

@ -71,27 +71,10 @@ public class WebServerHelper {
private boolean startAndroidWebServer(ArrayList<String> selectedBooksPath) {
if (!isServerStarted) {
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;
//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();
server.setPort(ServerUtils.port);
updateServerState(server.start());
Log.d(TAG, "startAndroidWebServer: checking server instance:{ " + server + " }");
Log.d(TAG, "Server status" + isServerStarted);
}
return isServerStarted;

View File

@ -139,7 +139,6 @@ class ZimHostFragment : BaseFragment(), ZimHostCallbacks, ZimHostContract.View {
startServerButton.setOnClickListener {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P || checkCoarseLocationAccessPermission()) {
// bindService()
startStopServer()
}
}
@ -212,7 +211,6 @@ class ZimHostFragment : BaseFragment(), ZimHostCallbacks, ZimHostContract.View {
}
private fun stopServer() {
// unbindService()
requireActivity().startService(createHotspotIntent(ACTION_STOP_SERVER))
}