Open lrq3000 opened 1 year ago
Hey hey! I think for this we might not need the android side of things. There is a browser event for the back button press:
document.addEventListener('backbutton', function(){
if(menu is visible) {
//Hide the menu
//This is also working fine
return false;
}
I can have a look at this!
Oh so you mean this way it would be implemented not only in Android but as a feature for all versions of Super Productivity? That would be awesome yes!
In Android, this is the function that is called:
webView.goBack()
I am not sure what the goBack()
method exactly does, hopefully it will account for DOM manipulated backbutton and so it will work transparently, but if not we can easily fix that later with a callback to force call your event listener.
So I checked this and it turns out that the backbutton
event is not a native browser event. Sorry for the confusion! So we need to go the originally proposed route. For the interface I would add two things:
androidInterface.onBackButtonPress$ = new Subject();
Which can be used at other places to close the navigation etc.
Which should be triggered via
callJSInterfaceFunctionIfExists(
"next",
"onBackButtonPress$"
)
And then it's probably good to have another function:
triggerBackButton(): void;
that will trigger the native backbutton behavior (e.g. close the app).
What do you think? I can write the javascript part if you would provide the android side of things.
The same thing happens when selecting a task. Hitting the back button should idiomatically close the task view, same as touching the X button in the top right, but it changes the page instead.
@johannesjo Oh I'm terribly sorry, I missed your message above! Yes of course if you implement a function in TypeScript that I can callback similarly to what we didi for the folder path for the sync feature then i can implement that in Android!
Though i may be unable to do it right now because i don't have a computer for development but I should be able to find a solution soon :-)
@lrq3000 No worries! Let me know if I can help you somehow with the development computer thingy (you can write to contact@super-productivity.com for further discussion :)).
@johannesjo thank you very much, that's very kind! :D
I came across this issue and I seem to be experiencing the same problem. I wanted to know where this issue currently stands and if there have been any more insights or related issues since the last discussion here.
Correct me if I am mistaken @lrq3000 but I think currently no one is working on this.
:ghost: Brief Description
When a side panel is opened, such as the side navigation bar or the task bar or notes bar, pressing the Back button on the Android interface should close the side panel, but instead the panel is ignored and the app goes to the previous page in history or it closes down if on the Today page.
:tophat: workflow configuration
Android 11 in AVD emulator.
:heavy_plus_sign: Additional context
As usual, I can work on the Android side. But here the web app needs to be modified to add required callbacks: one to hide each bar + one to query the state of each bar. But I'm very inexperienced with typescript.
I tried to register a new callback inside
android-interface.ts
:But the calls fail (the showToast() work fine).
Also I would need access to selectIsShow*.
If somebody can implement these changes or suggest how to do so, I would be happy to fix this issue in the Android app, so that we get a fully functional native behavior with the back button (extending the work of #27).