From 28fb6dfe9d5fc27ff12b6e181e93f45750261930 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 4 Feb 2021 17:05:18 +0100 Subject: [PATCH] add method to get preferred web instance out of link this is a preference that can be put in the link --- src/open/clients/Element.js | 5 +++++ src/open/clients/Fractal.js | 2 ++ src/open/clients/Nheko.js | 2 ++ src/open/clients/Quaternion.js | 2 ++ src/open/clients/Tensor.js | 2 ++ src/open/clients/Weechat.js | 2 ++ 6 files changed, 15 insertions(+) diff --git a/src/open/clients/Element.js b/src/open/clients/Element.js index b9a4b1d..a3d3830 100644 --- a/src/open/clients/Element.js +++ b/src/open/clients/Element.js @@ -88,4 +88,9 @@ export class Element { canInterceptMatrixToLinks(platform) { return platform === Platform.Android; } + + getPreferredWebInstance(link) { + const idx = trustedWebInstances.indexOf(link.webInstances[this.id]) + return idx === -1 ? undefined : trustedWebInstances[idx]; + } } diff --git a/src/open/clients/Fractal.js b/src/open/clients/Fractal.js index 4c860ee..2f6e856 100644 --- a/src/open/clients/Fractal.js +++ b/src/open/clients/Fractal.js @@ -48,4 +48,6 @@ export class Fractal { return [new FlathubLink("org.gnome.Fractal")]; } } + + getPreferredWebInstance(link) {} } diff --git a/src/open/clients/Nheko.js b/src/open/clients/Nheko.js index 0aa35ad..fe25f34 100644 --- a/src/open/clients/Nheko.js +++ b/src/open/clients/Nheko.js @@ -50,4 +50,6 @@ export class Nheko { return [new FlathubLink("io.github.NhekoReborn.Nheko")]; } } + + getPreferredWebInstance(link) {} } diff --git a/src/open/clients/Quaternion.js b/src/open/clients/Quaternion.js index ce6a184..0240821 100644 --- a/src/open/clients/Quaternion.js +++ b/src/open/clients/Quaternion.js @@ -47,4 +47,6 @@ export class Quaternion { return [new FlathubLink("com.github.quaternion")]; } } + + getPreferredWebInstance(link) {} } diff --git a/src/open/clients/Tensor.js b/src/open/clients/Tensor.js index ce22116..d85ef9b 100644 --- a/src/open/clients/Tensor.js +++ b/src/open/clients/Tensor.js @@ -47,4 +47,6 @@ export class Tensor { return [new FDroidLink("io.davidar.tensor")]; } } + + getPreferredWebInstance(link) {} } diff --git a/src/open/clients/Weechat.js b/src/open/clients/Weechat.js index 49ceb7a..e8f6158 100644 --- a/src/open/clients/Weechat.js +++ b/src/open/clients/Weechat.js @@ -46,4 +46,6 @@ export class Weechat { } getInstallLinks(platform) {} + + getPreferredWebInstance(link) {} }