Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

Mobile app support #59

Open
turt2live opened this issue Jul 18, 2017 · 15 comments
Open

Mobile app support #59

turt2live opened this issue Jul 18, 2017 · 15 comments
Milestone

Comments

@turt2live
Copy link
Owner

element-hq/riot-meta#3

@turt2live
Copy link
Owner Author

The mobile apps now have integration managers, although they cannot be changed away from the hardcoded manager :(

@aaronraimist
Copy link

Adding this here so I can link to it later for other people who ask

People have tried and it doesn't work. Dimension is not mobile friendly and tries to use APIs that don't exist

https://matrix.to/#/!mPYrVomQESEYWWudQw:matrix.org/$154868655613786wsmXO:t2l.io?via=t2l.io&via=matrix.org&via=t2bot.io

@turt2live
Copy link
Owner Author

I'm going to consider this no longer pending upstream support: The mobile apps do support integration managers, but are obviously going to fall behind on riot-web on this front. Hoping to make Dimension mobile-capable for when https://github.com/matrix-org/matrix-doc/issues/1286 gets turned into a proposal.

@Bubu
Copy link

Bubu commented Jul 4, 2020

Opened this for riotX a while ago:: element-hq/element-android#1497

@rakshazi
Copy link

Hello, element android shows dimension page, i can select widgets, but when I try to send anything, it shows something like "you didn't select any stickers, want to select now?" message

@nosshar
Copy link

nosshar commented Nov 5, 2021

Thanks I got some experience in web development. Spent few hours digging into problem.
Project creates the database, so start with:

sqlite3 data/dimension.db
select * from dimension_scalar_tokens;
1|@kornell:<my server is here>|<here is the scalar_token value>|1|

Now take scalar token and this page going to work just fine:

https://<my server is here>/widgets/stickerpicker?widgetId=stickerpicker&scalar_token=<scalar token>

Also after sacrificing the virgin and trying several magic spells I selected a random room, and created/updated an event named "m.widgets" with the following content:

{
    "stickerpicker": {
        "content": {
            "type": "m.stickerpicker",
            "url": "https://<my server is here>/widgets/stickerpicker?widgetId=stickerpicker&scalar_token=<scalar token>",
            "name": "Stickerpicker",
            "data": {}
        },
        "sender": "@kornell:<my server is here>",
        "state_key": "stickerpicker",
        "type": "m.widget",
        "id": "stickerpicker"
    }
}

This works for Element Desktop.
For Element Android (official application):

  1. I can't change the integration endpoint
  2. in spite of 1) I can see my stickers (also see the request in nginx access.log [it seems to be cached so called once per application start])
  3. when I click on sticker nothing happens. At all. Application closes widget pop-up, no errors, no messages in logs (nginx access.log/error.log)

@nosshar
Copy link

nosshar commented Nov 5, 2021

Well, another one sacrificed virgin to make it work properly on Android but here it is.
I used dockerized solution, so all I had are webpacked and minimized JS.
Opened (inside the container):

/home/node/matrix-dimension/build/web/main.<some hash>.js

Added a function:

function kprocess(input) {
  input.data.content.body = input.data.description;
  return input;
}

Found the following code:

console.log("[Dimension] Sending fromWidget: ",i),window.opener.postMessage(i,"*")

And replaced it with:

console.log("[Dimension] Sending fromWidget: ",i)/*KORNELL*/,window.opener.postMessage(kprocess(i),"*")

So all the problem is about missing property [Object].data.content.body in the object broadcasted via postMessage.

How I found that?
I took a look at what https://github.com/maunium/stickerpicker broadcasting.
Then I just compared two objects (correct one which leads to sticker to be sent and the object created by dimension).
After several tries I found this exact property extesion technique working.

p.s. it's dirty to make any changes in the container itself and I probably should have contribute in repo, but I suppose it's important to have this investigation at least, it reveals the rootcause of the problem

@TheTimeWalker
Copy link
Contributor

Thanks, though that as far as I have found out. Note the very old commit from me: 74ba8d7

As far as I know, Element Android doesn't work well with Dimension's sticker picker widget at all. At least from my side, I get a "There was a problem authenticating" error which I unfortunately still couldn't find the root cause to it.

@nosshar
Copy link

nosshar commented Nov 6, 2021

Luckily something had been updated and now it works.
See both of my my comments.
Set up stickers for a friend (non-admin) on a private matrix node.
As admin I can import stickers from telegram, enable/disable packs, other users can enble/disable active packs for themselves and use them on Desktop/Android.
One restriction though - didn't find a way to provide integration manager configuration for Android (config.json overridden properties),- it leads to lacking functionality to manage active sticker packs on mobile device (but can be managed on Desktop).

@nosshar
Copy link

nosshar commented Nov 6, 2021

As of commit I think I just missed this change bacause started with dockerized image and didn't build the project myself on a server.

@sevmonster
Copy link

FYI, everything works on Android now except sticker picker authentication. Integration manager can be selected with client well-known:

{
    "m.homeserver": {
        "base_url": "https://matrix.example.com",
        "server_name": "example.com"
    },
    "m.integrations": {
        "managers": [{
            "api_url": "https://dimension.example.com/api/v1/scalar",
            "ui_url": "https://dimension.example.com/element"
        }]
    }
}

So no need to build custom Android release with updated config.json.

@turbotorsten
Copy link

Is there any way to get sticker picker authenticaton to work by now?

@nataraj-hates-MS-for-stealing-github
Copy link

nataraj-hates-MS-for-stealing-github commented Sep 9, 2022

FYI, everything works on Android now except sticker picker authentication. Integration manager can be selected with client well-known:

Sorry, may I ask for exact instruction? I should put this json to be availabe via https://myserver.tld/.well-known/matrix/client url?

And this will allow to use all integration services, except sticker packs in mobile version?

Do I really need to specify m.homeserver url there? Is it really needed?

@turbotorsten
Copy link

Sorry, may I ask for exact instruction? I should put this json to be availabe via https://myserver.tld/.well-known/matrix/client url?

Yes. All you have to change in the file sevmonster posted is replacing the example.com domains with the domains you chose in your case.
Once you did that you will see that dimension is auto detected as integration manager in the app.
This doesn't fix the issue that sticker picker authentification will not work. I am currently fixing that by manually applying a fix to the element-android apps source.

@Ryonez
Copy link

Ryonez commented Sep 13, 2022

Does the authentication issue here also prevent dimension widgets from being added on mobile?

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

No branches or pull requests

10 participants