Giter Site home page Giter Site logo

Comments (4)

nothingkid avatar nothingkid commented on April 28, 2024 3

Added "minimizeApp" method to "app" plugin
#743

from capacitor-plugins.

phal0r avatar phal0r commented on April 28, 2024

I wanted to solve this problem for ionic react, but unfortunately there is no canGoBack() function, which could indicate, that we are on the first entry of the history stack. So even if capacitor would have a minimize function, it would not work well for ionic react.

At the same time I had a look at the cordova minimize plugin and the capacitor app plugin and I want to suggest the following:

Capacitor app plugin has built-in support for navigating back with the hardware back button on android. See: https://github.com/ionic-team/capacitor-plugins/blob/main/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java#L45

The app plugin could be enhanced with setters to enable minimizing or closing the app, if bridge.getWebView().canGoBack() returns false. This would be quite easy to achieve and would be transparent for any js framework and flavor, that is being used for development. Straightforward documentation and less traffic on the bridge as it is handled native completely. Thoughts on that?

from capacitor-plugins.

kawazoe avatar kawazoe commented on April 28, 2024

@phal0r The behavior of the back button does not always depend on the webview's ability to go back, but might depend on the ability of a specific router-outlet to go back. For instance, with multiple tabs, while the web view might be able to go back "across tabs", this is not necessarily desired. This is how I usually implement it in Angular. I am not familiar with routing in ionic react, but you probably have an equivalent feature, or the ability to save this information in your store.

Either way, the App.minimizeApp() API is still a must.

from capacitor-plugins.

ionitron-bot avatar ionitron-bot commented on April 28, 2024

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.

from capacitor-plugins.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.