Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setAsDefaultProtocolClient not working in appx #83

Closed
dpalou opened this issue Jun 19, 2017 · 4 comments
Closed

setAsDefaultProtocolClient not working in appx #83

dpalou opened this issue Jun 19, 2017 · 4 comments

Comments

@dpalou
Copy link

dpalou commented Jun 19, 2017

Hello,

as the title says, setAsDefaultProtocolClient isn't working when creating an appx file, but it does in my .exe file.

In my Electron main file I have the following line:

app.setAsDefaultProtocolClient('moodlemobile');

I'm using electron-builder to package the app. I added a "protocols" attribute in my package.json and I included the moodlemobile protocol in there too. To package the app, I run:

build --dir

This creates a .exe file. If I run this .exe file, my app starts and it's able to capture links with moodlemobile:// protocol just fine. Everything works perfect.

After that, I run electron-windows-store to create an appx file. If I install this appx file and run the app, it does NOT capture the moodlemobile:// links, it's as if I didn't have the app installed. This is the command I'm using to create the appx:

electron-windows-store --input-directory .\dist\win-unpacked --output-directory .\build --flatten true -a .\resources\desktop -m .\AppXManifest.xml --package-name MoodleDesktop

I tried using the default manifest and it doesn't work either. Any ideas?

@dpalou
Copy link
Author

dpalou commented Jun 19, 2017

I was able to make it work by adding these lines in my manifest and overriding the default manifest created by electron-windows-store:

<Extensions>
    <uap:Extension Category="windows.protocol">
        <uap:Protocol Name="moodlemobile">
            <uap:DisplayName>Moodle Mobile URI Scheme</uap:DisplayName>
        </uap:Protocol>
    </uap:Extension>
</Extensions>

It could be interesting to support this using the command so people doesn't need to create their own manifest.

Anyway, I'm closing the issue :)

@dpalou dpalou closed this as completed Jun 19, 2017
@abardik
Copy link

abardik commented Jul 5, 2017

Hi @dpalou,

Is it possible to use your manifest extension with electron-builder?

Thank you.

@abardik
Copy link

abardik commented Jul 5, 2017

If you have installed electron-builder locally for a particular project, the quickest but not elegant way is to add Extensions section provided above to node_modules/electron-builder/templates/appx/appxmanifest.xml (it should be inserted inside Application section).

setAsDefaultProtocolClient call and an appropriate code to process the args are the same.

@dpalou
Copy link
Author

dpalou commented Jul 6, 2017

Hi @abardik,

I don't know if it's possible. We have our own manifest and we override the default one when we package the appx using electron-windows-store.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants