kiwix / kiwix-apple

Kiwix for iOS & macOS
https://apple.kiwix.org
GNU Lesser General Public License v3.0
471 stars 70 forks source link

[REGRESSION] Opening app with ZIM doesnt open ZIM #962

Open rgaudin opened 2 weeks ago

rgaudin commented 2 weeks ago

When opening Kiwix by double-cliking a ZIM file or using open command, the App starts and displays the last viewed ZIM.

I am expecting the clicked ZIM to be opened instead

rgaudin commented 2 weeks ago

macOS 14.6.1 / Kiwix 3.5.1

kelson42 commented 2 weeks ago

@rgaudin @BPerlakiH Do we know if this is a regression?

rgaudin commented 2 weeks ago

Well we had #699 and #850

kelson42 commented 2 weeks ago

OK, so this is a regression. To be fixed in priority!

BPerlakiH commented 1 week ago

I managed to reliably reproduce it. There are 2 ways to exit the macOS application: 1) closing all windows (one by one), either via the red X system button (top left corner of the window) or pressing CMD+W on each window. Once the last window is closed, the app will exit. 2) Regardless of the amount of windows open, pressing CMD+Q, will exit the app immediatelly.

So what is the difference? In case 1) we close the window, and delete the tab / window data, as the user closed it, so it's no longer needed. In case 2) we save data from the windows, in order to restore it on next launch. This mechanism of restoring the windows is not fully working. There's a built in SwiftUI way to handle this specific feature, but so far it was working only for so called "Document based app".

kelson42 commented 1 week ago

@BPerlakiH We should secure that both ways of quitting trigger the same quit() procedure where we do our stuff.

BPerlakiH commented 1 week ago

So the way I see it is: We can have multiple windows, therefore closing a window, and deleting (not storing) any data related to that, is the correct behaviour.

For these reasons, I am proposing, to remove this semi-working window restore solution we have, and by that we fix this specific bug.

Then create a new issue, to implement the windows management for macOS properly. It's really an edge case, since the only way to use this feature is to use CMD+Q or from the App Menu choose Quit Kiwix.

Screenshot 2024-09-07 at 11 50 29

IMHO and from my "user perspective", the application not "remembering" my "windows" is not a deal breaker, more important is to be able to quickly find content (such as "global search"), or as in this case getting to the content of the ZIM file from Finder.

rgaudin commented 1 day ago

Don't know how that's possible as the fixing PR was tested by me and worked but using released 3.5.2, it's not working.

kelson42 commented 23 hours ago

@BPerlakiH Top Prio. Would be really great if you find a way to ensure this is the last time we reopen the issue? image

BPerlakiH commented 10 hours ago

Don't know how that's possible as the fixing PR was tested by me and worked but using released 3.5.2, it's not working.

I have double checked it, and downloaded the App Store version, and it works for opening ZIM files, both when the app is closed, and when the app is already opened.

Maybe worth to double check if you don't have another copy of an older application, or clear the folder before installing.

rgaudin commented 10 hours ago

I checked before reopening and I don't. I am using the DMG distributed version though.

On a second thought, I find it unreasonable to prevent users from having multiple versions on the app anyway. Double-clicking a ZIM ends up launching on app, so that app has been found by the system and was probably passed the filename. If there's a macOS bug regarding this, we should gather evidence online or open a ticket upstream

BPerlakiH commented 8 hours ago

Ok, we narrowed it down during our call with @rgaudin , it seems to be a macOS Sequoia (15.0) issue.