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

add webxdc selfAddr/notify/href/ratelimit APIs (M2/M3) #4366

Closed
6 tasks done
r10s opened this issue Nov 27, 2024 · 10 comments
Closed
6 tasks done

add webxdc selfAddr/notify/href/ratelimit APIs (M2/M3) #4366

r10s opened this issue Nov 27, 2024 · 10 comments
Assignees
Labels
blocker This issue is blocking a new release webxdc

Comments

@r10s
Copy link
Member

r10s commented Nov 27, 2024

the following task are open to complete M2/M3 proposal desktop-sided:

  • change window.webxdc.selfAddr to "self_addr" property returned by dc_msg_get_webxdc_info()

  • add and set window.webxdc.sendUpdateInterval to "send_update_interval" property returned by dc_msg_get_webxdc_info()

  • add and set window.webxdc.sendUpdateMaxSize to "send_update_max_size" property returned by dc_msg_get_webxdc_info()

  • when tapping an webxdc-info-message (dc_msg_get_info_type() returns DC_INFO_WEBXDC_INFO_MESSAGE), open the webxdc-app directly, do not move up (instead, the app menu should provide "Show in Chat, cmp add "show in chat" to webxdc menu deltachat-android#3447, but that can also be done later)

  • when opening the webxdc-app from a webxdc-info-message, check dc_msg_get_webxdc_href(). if set, open the app with sth://base/HREF instead of sth://base/index.html
    if the app is already open, make sure, the location is changed (probably the same way), in any case, JavaScript's location properties should be set appropriate and hashchange should be fired as needed

  • listen to event DC_EVENT_INCOMING_WEBXDC_NOTIFY. on receiving, add a notification with text set to "APPNAME: TEXT"; TEXT comes from the event. note, that the msg_id from the event may refer to a webxdc-instance or a webxdc-info-message (in the latter case, use get_parent() to get the instance)

jsonrpc types should be similar; if sth. is missing there, this is another task.

for reference, new spec is available already at https://github.com/webxdc/website/tree/next-main/src-docs/spec (

finally, make sure, the webxdc app does not exit when descr is left out, see #4359

corresponding Android / iOS PR: deltachat/deltachat-android#3438 , deltachat/deltachat-android#3449, deltachat/deltachat-ios#2412

@r10s r10s converted this from a draft issue Nov 27, 2024
@r10s r10s changed the title add webxdc selfAddr/notify/href/ratelimit APIs on Desktop (M2/M3) add webxdc selfAddr/notify/href/ratelimit APIs (M2/M3) Nov 27, 2024
@r10s r10s added webxdc blocker This issue is blocking a new release labels Nov 27, 2024
@Simon-Laux
Copy link
Member

note for person implementing this: for updating/changing webxdc href/url the location change needs to be done in the iframe.

@WofWca
Copy link
Collaborator

WofWca commented Nov 28, 2024

when tapping an webxdc-info-message, open the webxdc-app directly

IDK about the security of this. Do we want to open apps without the user expecting it?

@r10s
Copy link
Member Author

r10s commented Nov 28, 2024

thanks for the thought!

however, it has an app icon etc, no network etc. it is fine to start directly. if that is unexpected for existing users, ppl will learn it. also, the old indirection has barely prevented ppl from opening the app, when they already tapped curiously the info-message :)

@nicodh nicodh self-assigned this Nov 28, 2024
@link2xt link2xt pinned this issue Nov 29, 2024
This was referenced Nov 30, 2024
@r10s r10s moved this from Todo to In Progress in Webxdc PUSH M2/M3 Dec 3, 2024
nicodh added a commit that referenced this issue Dec 10, 2024
resolves #4366

- add new param isWebxdcInfo to DcNotification
- openWebxdc on click
nicodh added a commit that referenced this issue Dec 11, 2024
resolves #4366

- add new param isWebxdcInfo to DcNotification
- openWebxdc on click
@nicodh
Copy link
Contributor

nicodh commented Dec 11, 2024

that the msg_id from the event may refer to a webxdc-instance or a webxdc-info-message (in the latter case, use get_parent() to get the instance)

It seems that in case of an added webxdc message (not webxdc info message) no DC_EVENT_INCOMING_WEBXDC_NOTIFY is fired but just a DC_EVENT_INCOMING_MSG
Is that on purpose or a bug?

@r10s
Copy link
Member Author

r10s commented Dec 11, 2024

that is on purpose, DC_EVENT_INCOMING_WEBXDC_NOTIFY is really only triggere by the webxdx-js-code, not by a delta-user adding an app

@nicodh
Copy link
Contributor

nicodh commented Dec 12, 2024

So in which case the msg_id would refer to a webxdc-instance?

@nicodh
Copy link
Contributor

nicodh commented Dec 12, 2024

Another question: should the notification show the icon of the webxdc app or the user profile (if any) or the default icon? As you see in #4400 I assumed the first

@nicodh
Copy link
Contributor

nicodh commented Dec 12, 2024

In general it feels a bit wrong: the summary text comes from the event data, then we have to fetch getMessageNotificationInfo() method to get the chat name, the webxdcinfo message itself to get the parent message ID and then the parent message to get the app name. A getMessageNotificationInfo could already provide the appropriate texts for a WebxdcInfoMessage.
But getMessageNotificationInfo is a convenience method that exists only in jsonrpc right?

@nicodh
Copy link
Contributor

nicodh commented Dec 12, 2024

So in which case the msg_id would refer to a webxdc-instance?

Found it in the docs:
Sometimes no webxdc-info-message is added to the chat and yet a notification is sent; in this case the msg_id of the webxdc instance is returned.

@Simon-Laux
Copy link
Member

But getMessageNotificationInfo is a convenience method that exists only in jsonrpc right?

yes it is just a convenience method, so feel free to add what you want to it in core/jsonrpc

@nicodh nicodh closed this as completed in d90e328 Dec 16, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Webxdc PUSH M2/M3 Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker This issue is blocking a new release webxdc
Projects
Status: Done
Development

No branches or pull requests

4 participants