From 03816c1224dfb6b4ed15fc0ca0299777a6d4f4f3 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Tue, 29 Sep 2020 16:57:08 +0100 Subject: [PATCH] Add multiple platforms to Element client --- src/clients/Element.ts | 7 +++---- src/clients/Fractal.tsx | 2 +- src/clients/Nheko.tsx | 2 +- src/clients/Weechat.tsx | 2 +- src/clients/index.ts | 2 +- src/clients/types.ts | 2 +- src/components/ClientList.tsx | 22 ++++++++++++---------- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/clients/Element.ts b/src/clients/Element.ts index 2550840..0693ede 100644 --- a/src/clients/Element.ts +++ b/src/clients/Element.ts @@ -24,7 +24,7 @@ import { import { LinkKind } from '../parser/types'; import logo from '../imgs/element.svg'; -const Element: LinkedClient = { +export const Element: LinkedClient = { kind: ClientKind.LINKED_CLIENT, name: 'Element', author: 'Element', @@ -32,7 +32,7 @@ const Element: LinkedClient = { homepage: 'https://element.io', maturity: Maturity.STABLE, description: 'Fully-featured Matrix client for the Web', - platform: Platform.Desktop, + platforms: [Platform.Desktop, Platform.Android, Platform.iOS], experimental: false, clientId: ClientId.Element, toUrl: (link) => { @@ -69,7 +69,7 @@ export const ElementDevelop: LinkedClient = { homepage: 'https://element.io', maturity: Maturity.STABLE, description: 'Fully-featured Matrix client for the Web', - platform: Platform.Desktop, + platforms: [Platform.Desktop], experimental: true, clientId: ClientId.ElementDevelop, toUrl: (link) => { @@ -95,4 +95,3 @@ export const ElementDevelop: LinkedClient = { }, linkSupport: () => true, }; -export default Element; diff --git a/src/clients/Fractal.tsx b/src/clients/Fractal.tsx index 058b4d6..bd0f068 100644 --- a/src/clients/Fractal.tsx +++ b/src/clients/Fractal.tsx @@ -30,7 +30,7 @@ const Fractal: TextClient = { homepage: 'https://github.com/poljar/weechat-matrix', maturity: Maturity.BETA, experimental: false, - platform: Platform.Desktop, + platforms: [Platform.Desktop], clientId: ClientId.Fractal, toInviteString: (link) => { switch (link.kind) { diff --git a/src/clients/Nheko.tsx b/src/clients/Nheko.tsx index 22f8045..1195716 100644 --- a/src/clients/Nheko.tsx +++ b/src/clients/Nheko.tsx @@ -30,7 +30,7 @@ const Nheko: TextClient = { homepage: 'https://github.com/Nheko-Reborn/nheko', maturity: Maturity.BETA, experimental: false, - platform: Platform.Desktop, + platforms: [Platform.Desktop], clientId: ClientId.Nheko, toInviteString: (link) => { switch (link.kind) { diff --git a/src/clients/Weechat.tsx b/src/clients/Weechat.tsx index 86b0a98..105a979 100644 --- a/src/clients/Weechat.tsx +++ b/src/clients/Weechat.tsx @@ -30,7 +30,7 @@ const Weechat: TextClient = { homepage: 'https://github.com/poljar/weechat-matrix', maturity: Maturity.LATE_BETA, experimental: false, - platform: Platform.Desktop, + platforms: [Platform.Desktop], clientId: ClientId.WeeChat, toInviteString: (link) => { switch (link.kind) { diff --git a/src/clients/index.ts b/src/clients/index.ts index 16cf69d..a00cd71 100644 --- a/src/clients/index.ts +++ b/src/clients/index.ts @@ -16,7 +16,7 @@ limitations under the License. import { Client } from './types'; -import Element, { ElementDevelop } from './Element'; +import { Element, ElementDevelop } from './Element'; import Weechat from './Weechat'; import Nheko from './Nheko'; import Fractal from './Fractal'; diff --git a/src/clients/types.ts b/src/clients/types.ts index 5a93f15..3278f96 100644 --- a/src/clients/types.ts +++ b/src/clients/types.ts @@ -62,7 +62,7 @@ export interface ClientDescription { homepage: string; logo: string; description: string; - platform: Platform; + platforms: Platform[]; maturity: Maturity; clientId: ClientId; experimental: boolean; diff --git a/src/components/ClientList.tsx b/src/components/ClientList.tsx index 4d23d37..64dbebc 100644 --- a/src/components/ClientList.tsx +++ b/src/components/ClientList.tsx @@ -47,16 +47,18 @@ const ClientList: React.FC = ({ link, rememberSelection }: IProps) => { showClient = true; } - switch (client.platform) { - case Platform.Desktop: - showClient = showClient || !(uaResults as any).mobile; - break; - case Platform.iOS: - showClient = showClient || (uaResults as any).ios; - break; - case Platform.Android: - showClient = showClient || (uaResults as any).android; - break; + for (const platform of client.platforms) { + switch (platform) { + case Platform.Desktop: + showClient = showClient || !(uaResults as any).mobile; + break; + case Platform.iOS: + showClient = showClient || (uaResults as any).ios; + break; + case Platform.Android: + showClient = showClient || (uaResults as any).android; + break; + } } if (!showExperimentalClients && client.experimental) {