GithubHelp home page GithubHelp logo

Comments (5)

knopp avatar knopp commented on July 24, 2024 1

You can copy the Info.plist template from NativeShell, put it somewhere in your project and then reference it in build.rs:

let options = AppBundleOptions {
...
   info_plist_template: Some("resources/Info.plist".into()), // assuming you placed it in resources/Info.plist
...
}

from nativeshell.

knopp avatar knopp commented on July 24, 2024

Generally file associations are registered in Info.plist file. There's quite a bit of documentation about this online. However handling the file open notification will require some rust code right now.

I haven't tested this particular thing so it's possible that some things won't work. In general you will get a method called (application:openFiles:) or (application:openURLs:) on your NSApplicationDelegate. NativeShell exposes NSApplicationDelegate to rust, so you don't need to write any objc bindings.

Create a struct and let it implement the ApplicationDelegate trait. In the trait, override application_open_urls method. Then register your delegate

context.get().unwrap().application_delegate_manager.borrow().set_delegate(my_app_delegate);

At this point your should get notification when your application was asked to open URLs. After that you might need to use platform channels to let the dart code know that it should open the file.

from nativeshell.

knopp avatar knopp commented on July 24, 2024

I'll try to find some time to make a working example of this.

from nativeshell.

wilsonowilson avatar wilsonowilson commented on July 24, 2024

Thanks for the tips! But how do we edit the Info.plist file?

from nativeshell.

prateekmedia avatar prateekmedia commented on July 24, 2024

@knopp Can this be made multi-platform like for windows and linux too.

from nativeshell.

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.