dkrivoruchko / ScreenStream

ScreenStream Android App
https://screenstream.io
MIT License
1.56k stars 320 forks source link

How to show dialog on particular different route in server? #147

Closed jayesh83 closed 3 years ago

jayesh83 commented 3 years ago

Hi @dkrivoruchko It's been nice talking to you. You were really helpful and quick in earlier issues I opened #143 . Thanks for that

Now, I'm trying to implement a remote access control feature in-app, where I use ScreenStream for streaming.

I've created new rout in data.httpserver.HttpServerRxHandler file i.e. uri == HttpServerFiles.ROOT_ADDRESS + HttpServerFiles.ALLOW_REMOTE_ACCESS

On the hit of this route, I want to show the dialog in-app module somewhere that says if you want to allow remote access or not by this particular client

Question:

What I know/tried?

How to particularly go about implementing my requirement, I'm not getting, Can you help me with that?

jayesh83 commented 3 years ago

I'll create PR on the successful implementation of Remote Control.

dkrivoruchko commented 3 years ago

Hi. Current version of HttpServerRxHandler has only one way communication: from AppStateMachine to HttpServerRxHandler. Keep in mind that nothing in data module has access to Android UI and because of Android restrictions we cannot show any dialog when app is minimized. In order to show user a dialog and send back user decision many things need to be implemented/updated. My first idea is to add some command channel from HttpServerRxHandler to AppService which can show user a notification with questions. Letting client to know a user choice and WebSocket configuration is a simple one - just response on request with json containing either configuration or deny. Open questions are WebSocket and remote control itself - I have no experience in this.

Bottom line - if you show me working code for remote control from web browser to android system - I will update ScreeenStream for requesting control permissions and response with WebSocket config (maybe with WebSocket too, if there will be time for this).

jayesh83 commented 3 years ago

Hi @dkrivoruchko Coming to the bottom line, remember we've talked on the issue before #143 where I've mentioned that I'm actually making this app to app and not app to browser.

I've working code for remote control in app to app & not browser to app. So sorry for that matter

jayesh83 commented 3 years ago

Yeah as you talked about this one way communication from AppStateMachine to HttpServerRxHandler and nothing in the data module has access to Android UI, I completely understood that.

But as you said add some command channel from HttpServerRxHandler to AppService. Can you explain exatly how to go for it?

As I believe I need to update AppStateMachine add state there and update StateToEventMatrix as well.

So can you talk about exactly in what flow I should go?

jayesh83 commented 3 years ago

@dkrivoruchko Can you please elaborate the changes I need to make?

dkrivoruchko commented 3 years ago

There is no simple answer and I'm unsure if AppStateMachine or StateToEventMatrix requiere any change. Do you have code for android control in app to app? Can I have a look on part of it? How this apps talk to each other?

jayesh83 commented 3 years ago

Yeah! It is against NDA as developing for my company but I can give you an overall idea. we can connect over meet

jayesh83 commented 3 years ago

I'll close the issue then. Feel free to reopen, to start a discussion again