rokucommunity / vscode-brightscript-language

A Visual Studio Code extension for Roku's BrightScript language
MIT License
104 stars 41 forks source link

Enable ECP/Deep Linking #4

Open pixshatterer opened 5 years ago

pixshatterer commented 5 years ago

Is there a way to pass arguments to simulate deeplinking while debugging?

TwitchBronBron commented 5 years ago

Not currently, no. Would another launch.json setting work for you? The new setting could be called "deepLinkUrl". Something like this:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "brightscript",
            "request": "launch",
            "name": "BrightScript Debug: Launch",
            "host": "192.168.1.17",
            "deepLinkUrl": "http://192.168.1.17:8060/install/<channel_id>?contentID=<contentID>&mediaType=series",
            "password": "password",
            "rootDir": "${workspaceFolder}",
            "consoleOutput": "full",
            "stopOnEntry": false
        }
    ]
}
pixshatterer commented 5 years ago

that would be awesome! also, an unrelated question - the plugin is able to use a rokudeploy.json file while deploying? since it uses roku-deploy module, I wondered if that was the case.

TwitchBronBron commented 5 years ago

Yes, you should technically be able to use a rokudeploy.json file. I believe the files property doesn't work in rokudeploy.json when using this extension, and there may be a few others that get overridden by this extension.

However, an undocumented alternative to rokudeploy.json is that you can actually specify rokudeploy.json settings directly in your launch configuration. I pass the entire launch configuration object to rokudeploy, and it uses the options it knows about.

TwitchBronBron commented 5 years ago

I just wanted to give you an update. I started working on the "launch directly to deep link" concept a while back, and made some progress. Life just got busy. It's possible, and I'll try to get to it sometime soon...but just wanted to give an update saying that work has at least been started.

TwitchBronBron commented 5 years ago

@pixshatterer I just pushed this branch with my first attempt at supporting deep linking. Can you pull down the code and try it out and let me know how it goes?

pixshatterer commented 5 years ago

@TwitchBronBron sure! how would be the usage? it is still the "deepLinkUrl" property the one to use?

TwitchBronBron commented 5 years ago

Yep, that's the one! Use "deepLinkUrl". You can use the ${host} placeholder in that url if you don't want to duplicate the hostname, but I would test it out with a full url at first to make sure it's working.

TwitchBronBron commented 5 years ago

@pixshatterer Have you had a chance to look at this change yet? I'd love to get it merged into master, but I want to make sure it works for a proper roku app (not just my test apps) before I do.

TwitchBronBron commented 5 years ago

@pixshatterer @georgejecook @triwav @bvisin I just merged master into this branch, so it should have all of the latest changes now.

Does this work well enough for you all that it can be merged into master / is there anything else that needs done?

TwitchBronBron commented 5 years ago

The latest version of the branch has removed ${promptForContentId} and ${promptForMediaType} in favor of ${promptForQueryParams}. This should hopefully streamline the process a little bit.

timalacey commented 5 years ago

Anything stopping this from being merged into master?

TwitchBronBron commented 5 years ago

@timalacey I don't do any Roku development right now, so I need some actual Roku developers to test it out and validate it before I merge. If you're interested in trying it out, and don't want to figure out how to build the project locally, let me know and I can get you a vsix bundle with these changes included for you test out.

timalacey commented 5 years ago

Apologies for not getting back to you @TwitchBronBron

It works. I'm not too concerned with the 1.5 seconds lost due to the auto-run and then reacting to the /launch ECP. Your feature also works on older Roku's which Eclipse never did, so thanks.

pixshatterer commented 5 years ago

Apologies for not getting back to you @TwitchBronBron too! totally swamped with non-roku projects right now so I had no chance to check this out - I would say go ahead!

LasseDenecken commented 2 years ago

@TwitchBronBron I'm not able to get this to work with a clean vscode installation and without using brighterscript. Here is what I did:

  1. Installed vscode
  2. Installed the vscode-brightscript-language extension
  3. Created the most basic roku app (manifest, source/main.brs, components/AppScene.xml, components/AppScene.brs)
  4. Added the default launch.json (and changed the host)
  5. Added "deepLinkUrl": "http://${host}:8060/launch/dev?contentId=1&mediaType=episode"

The dev channel is being launched, but the expected relaunch with the deeplink-parameters is not happening. Did I miss something?

TwitchBronBron commented 2 years ago

Hmm. I'm having trouble getting this to work as well. This must have broken at some point. @chrisdp we might want to take this opportunity to revisit the ECP/Deep Linking logic in general. Perhaps inject the values on the first line of the main function?

triwav commented 2 years ago

I’m a strong proponent of that approach. The current method requires a restart of the application which is kind of clunky and has issues with the debug protocol as well I believe

TwitchBronBron commented 2 years ago

Do we need to worry about things like URL encoding?

chrisdp commented 2 years ago

No. The device runs one decode on the way in so we would inject as typed.

chrisdp commented 2 years ago

192 We should also update it so you can define a deeplink as such:

{
MediaType: string | string from enum( will get list),
ContentId: string
}
chrisdp commented 2 years ago

list of media types from Roku documentation:

movie
episode
season
series
shortFormVideo
special
live
LasseDenecken commented 2 years ago

@chrisdp besides the actual deeplinking, you can also run the unit-testing-framework via deeplink. Running tests has been mentioned in this issue: https://github.com/rokucommunity/vscode-brightscript-language/issues/53

simon-grantham commented 11 months ago

Actually something like this approach in launch.json would be more useful: "args": [ "mediaType=episode", "contentId=some_bunch_of_ids" ],

This way one could also set something like: "args": [ "my_Debugging_arg=my_Debugging_val" ]