matrix-dimension icon indicating copy to clipboard operation
matrix-dimension copied to clipboard

Mobile app support

Open turt2live opened this issue 7 years ago • 15 comments

https://github.com/vector-im/riot-meta/issues/3

turt2live avatar Jul 18 '17 15:07 turt2live

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

turt2live avatar Dec 12 '17 16:12 turt2live

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

aaronraimist avatar Feb 02 '19 18:02 aaronraimist

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.

turt2live avatar Mar 25 '19 00:03 turt2live

Opened this for riotX a while ago:: https://github.com/vector-im/riotX-android/issues/1497

Bubu avatar Jul 04 '20 23:07 Bubu

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

rakshazi avatar Jan 22 '21 21:01 rakshazi

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 avatar Nov 05 '21 18:11 nosshar

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

nosshar avatar Nov 05 '21 19:11 nosshar

Thanks, though that as far as I have found out. Note the very old commit from me: https://github.com/turt2live/matrix-dimension/pull/296/commits/74ba8d795b5499c175c9f5d308a4b9711fb5d2c8

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.

TheTimeWalker avatar Nov 06 '21 00:11 TheTimeWalker

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 avatar Nov 06 '21 09:11 nosshar

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.

nosshar avatar Nov 06 '21 09:11 nosshar

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.

sevmonster avatar Apr 23 '22 01:04 sevmonster

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

turbotorsten avatar May 22 '22 18:05 turbotorsten

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?

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.

turbotorsten avatar Sep 11 '22 16:09 turbotorsten

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

Ryonez avatar Sep 13 '22 09:09 Ryonez