Kiwix-android: In browser Hosting books shows after unselecting

Created on 18 Oct 2020  路  13Comments  路  Source: kiwix/kiwix-android

Describe the bug
After unselecting a book on the phone it still shows on the browser.

Expected behavior
It should show books which are selecting.

Steps to reproduce the behavior:

  1. Start the server on HostFragment
  2. Open into your browser and start the server
  3. stop the sever on the phone
  4. Unselect one book
  5. Start the server again
  6. Refresh the browser see the unselect book

Environment

  • Version of Kiwix Android : develop
bug

All 13 comments

@gouri-panda Do you plan to work on it, I may take it up if there is a green check from your end

@s-ayush2903 Sure,go ahead!

@kelson42 Do you want this to be closed(via PR), as implementing it will remove the changes introduced in #1569 for #1556 & #1557. I have no problem in implementing it, just waiting for approval from your end as this targets the previously raised(now closed) issues and corresponding PR.

@s-ayush2903 I don't think it has any bearing on those tickets. There is a bug and the current selection of the screen is not being hosted appropriately. It instead just defaults to hosting all regardless of the selection, or something to that effect

It works like this: At first, by default, it shows all the books for hosting(which was requested in #1556) and in the next runs, it displays the persisted content which was shown in the first run despite the selection(which was demanded in #1557)

That is not the bug. Read through the steps again. Only the things I have selected should be hosted. Those tickets are just about preserving the selection across launches of the screen, not about sending the correct selection to the server. Are you loading the URL in a browser?

@s-ayush2903 Are you planning to work on this?

Yeah, it is in my list

Okay, so on diagnosing, the call from the corresponding method works as expected, but the problem is that the server UI isn't being updated, means the server caches the previously hosted books despite the new list of books sent to it.
|Logs that show only the selected books are being sent to server|
|--|
|cap|

keep following the data

  @Override public int onStartCommand(@NonNull Intent intent, int flags, int startId) {
    switch (intent.getAction()) {

      case ACTION_START_SERVER:
        if (webServerHelper.startServerHelper(
          intent.getStringArrayListExtra(SELECTED_ZIM_PATHS_KEY))) {
          zimHostCallbacks.onServerStarted(ServerUtils.getSocketAddress());
          startForegroundNotificationHelper();
          Toast.makeText(this, R.string.server_started_successfully_toast_message,
            Toast.LENGTH_SHORT).show();
        } else {
          zimHostCallbacks.onServerFailedToStart();
        }

        break;

What do you mean, can you please throw some light?

startService is called with the action ACTION_START_SERVER so I pasted the code in HotspotService that gets invoked by this call. If you have eliminated the possibility that we are sending bad data then the error must lie somewhere where we receive the data

We are always sending the correct data to the server, no problem in internal communication of data occurs, the problem is that in the server end, it always builds on the top of previous files. Like if I sent file-A, and then next time on removing selection of file-A from application and adding file-B restart the server and then reload the server, then at the server it will display file-A and file-B, both.
|Supporting Logs|
|--|
|buildsOnTop|

  • So to solve this problem, I believe, we should remove all the content from the server when we turn off hotspot and hence server.
Was this page helpful?
0 / 5 - 0 ratings