Purpose: Platform support
Open, Needs TriagePublic

Description

Platforms like Android have their own content sharing feature, it would be lovely to have a way to use e.g. Android Share Intents

broulik created this task.Nov 23 2019, 5:06 PM
vkrause renamed this task from Platform support to Purpose: Platform support.Nov 23 2019, 5:40 PM
nicolasfella added a subscriber: nicolasfella.EditedJan 2 2020, 11:31 PM

There's multiple ways in which I can imagine this working on Android.

  1. We could query the system for share targets, fill the AlternativesModel with the results and use the existing Qt Quick UI
  2. We create a new ShareDialog thing that opens the native share dialog on Android or our own implementation otherwise
  1. has the advantage of more flexibility. It could also power the widgets-based menu or custom implementations
  2. is a more ready-made solution that is more aligned with what other Android apps have. Also it could support other platform that have native share dialog

Those options are not mutually exclusive though

Proof of concept for 2): https://invent.kde.org/nicolasfella/sharetest

I'm usure where to put it. It's on a higher abstraction level than purpose. On Android Purpose isn't used at all in it and with the current dependencies Purpose is a pain to build on Android. Therefore I'd like to avoid needing to build purpose when building it for Android. One way to do this is having it in the purpose repo and ifdefing everything else out on Android. Another possibility would be having it in another (new?) repo

nicolasfella moved this task from Backlog to In Progress on the KF6 board.Jan 4 2020, 1:39 AM

Isn't this exactly the platform abstraction vs. platform implementation conflict? Ie. can (or should) Purpose cover both sides of this? If not, we probably want something separate doing the platform abstraction, with Purpose providing the implementation on the Plasma platform (and others not having their own implementation, probably).

ervin moved this task from In Progress to Needs Input on the KF6 board.Mar 27 2021, 1:56 PM
ervin moved this task from Needs Input to In Discussion on the KF6 board.Mar 28 2021, 9:11 AM
ervin moved this task from In Discussion to Backlog on the KF6 board.Mar 28 2021, 10:05 AM
ognarb added a subscriber: ognarb.EditedNov 1 2021, 1:11 PM

One way to do this is having it in the purpose repo and ifdefing everything else out on Android.

I think this would be the way forward. We should probably also deprecate most of the existing QML public API (and move it to a private internal api) and instead abstract everything inside a QQC2.Action and QQC2.MenuItem, similarly to how this is done in the QtWidget part of Purpose.

This would make it possible to have an unified handling for sharing stuff from QML and also very easy to use. Instead of that we currently have, that is depending on the app very different. I started working on the action-based approach here: https://invent.kde.org/graphics/koko/-/merge_requests/103. It doesn't include yet the Android part but from an API user point of view, this is very easy to use.

One 'disadvantage' is that this makes Purpose depend on Kirigami and KNotifications on Linux. I'm not sure this is a real problem considering the current state dependency wise of Purpose.

ognarb claimed this task.Nov 1 2021, 1:11 PM

One 'disadvantage' is that this makes Purpose depend on Kirigami and KNotifications on Linux. I'm not sure this is a real problem considering the current state dependency wise of Purpose.

Purpose already directly depends on KNotifications and Kirigami

One idea that came up in the past was a Job-based API, i.e. something like ShareFileJob. This way the API would be agnostic of the actual UI and implementation. We could still have an action-based UI on top of that. We also could allow to customize the UI parts that are done as part of the execution using the UIDelegate pattern we have e.g. in KIO jobs

ognarb added a comment.Nov 1 2021, 6:41 PM

> One 'disadvantage' is that this makes Purpose depend on Kirigami and KNotifications on Linux. I'm not sure this is a real problem considering the current state dependency wise of Purpose.

Purpose already directly depends on KNotifications and Kirigami

Oh nice, not sure why I was under the impression Purpose wasn't using Kirigami yet.

One idea that came up in the past was a Job-based API, i.e. something like ShareFileJob. This way the API would be agnostic of the actual UI and implementation. We could still have an action-based UI on top of that. We also could allow to customize the UI parts that are done as part of the execution using the UIDelegate pattern we have e.g. in KIO jobs

I'm not sure having a UI agnostic job is a good idea. A Job+UIDelegate sounds like something hard to represent as a Kirigami.Action with sub-actions since we need the model. This pattern sounds more adapted to poping a dialog. Shall I try to move my code from Koko to purpose, add the android support using your POC and then open the corresponding MRs for NeoChat and Koko. It's probably easier to review APIs in a MR.

Before we further discuss API for this I would like to discuss https://invent.kde.org/frameworks/purpose/-/issues/1