From 4044e857bcaf0b61d107a3439c69e880c32c0007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=A4fer?= Date: Fri, 29 Jan 2021 09:20:45 +0100 Subject: [PATCH] Disable iOS app reference by default The app is not published yet, so we hide it by default. But we allow allow to set an environment variable to show the button with an appropriate link. --- snikket_web/__init__.py | 2 + snikket_web/invite.py | 5 +- snikket_web/templates/invite_view.html | 6 ++ snikket_web/translations/messages.pot | 78 ++++++++++++++------------ 4 files changed, 53 insertions(+), 38 deletions(-) diff --git a/snikket_web/__init__.py b/snikket_web/__init__.py index 18493f4..0f1a61a 100644 --- a/snikket_web/__init__.py +++ b/snikket_web/__init__.py @@ -143,6 +143,7 @@ class AppConfig: site_name = environ.var("") avatar_cache_ttl = environ.var(1800, converter=int) languages = environ.var(["de", "en"], converter=autosplit) + apple_store_url = environ.var("") _UPPER_CASE = "".join(map(chr, range(ord("A"), ord("Z")+1))) @@ -172,6 +173,7 @@ def create_app() -> quart.Quart: app.config["SNIKKET_DOMAIN"] = config.domain app.config["SITE_NAME"] = config.site_name or config.domain app.config["AVATAR_CACHE_TTL"] = config.avatar_cache_ttl + app.config["APPLE_STORE_URL"] = config.apple_store_url app.context_processor(proc) app.register_error_handler( diff --git a/snikket_web/invite.py b/snikket_web/invite.py index e5fb977..3aec470 100644 --- a/snikket_web/invite.py +++ b/snikket_web/invite.py @@ -7,6 +7,7 @@ import aiohttp import quart.flask_patch from quart import ( Blueprint, + current_app, render_template, redirect, url_for, @@ -68,9 +69,7 @@ async def view(id_: str) -> str: ), ) ) - apple_store_url = ( - "https://apps.apple.com/us/app/tigase-messenger/id1153516838" - ) + apple_store_url = current_app.config["APPLE_STORE_URL"] return await render_template( "invite_view.html", diff --git a/snikket_web/templates/invite_view.html b/snikket_web/templates/invite_view.html index 9c48f24..aff42e8 100644 --- a/snikket_web/templates/invite_view.html +++ b/snikket_web/templates/invite_view.html @@ -17,11 +17,17 @@

{% trans site_name=config["SITE_NAME"] %}You have been invited to chat on {{ site_name }} using Snikket, a secure, privacy-friendly chat app.{% endtrans %}

{%- endif -%}

{% trans %}Get started{% endtrans %}

+{%- if apple_store_url -%}

{% trans %}Install the Snikket App on your Android or iOS device.{% endtrans %}

+{%- else -%} +

{% trans ios_info_url="https://snikket.org/faq/#is-there-an-ios-app" %}Install the Snikket App on your Android device (iOS coming soon!).{% endtrans %}

+{%- endif -%}
{%- call standard_button("qrcode", "#qr-modal", class="primary", onclick="open_modal(this); return false;") -%} {% trans %}Not on mobile?{% endtrans %} diff --git a/snikket_web/translations/messages.pot b/snikket_web/translations/messages.pot index 531b6e8..40947ec 100644 --- a/snikket_web/translations/messages.pot +++ b/snikket_web/translations/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2021-01-28 18:53+0100\n" +"POT-Creation-Date: 2021-01-29 09:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -101,35 +101,35 @@ msgstr "" msgid "Main" msgstr "" -#: snikket_web/invite.py:86 +#: snikket_web/invite.py:85 msgid "Username" msgstr "" -#: snikket_web/invite.py:90 snikket_web/main.py:41 +#: snikket_web/invite.py:89 snikket_web/main.py:41 msgid "Password" msgstr "" -#: snikket_web/invite.py:94 +#: snikket_web/invite.py:93 msgid "Confirm password" msgstr "" -#: snikket_web/invite.py:98 +#: snikket_web/invite.py:97 msgid "The passwords must match" msgstr "" -#: snikket_web/invite.py:103 +#: snikket_web/invite.py:102 msgid "Create account" msgstr "" -#: snikket_web/invite.py:123 +#: snikket_web/invite.py:122 msgid "That username is already taken" msgstr "" -#: snikket_web/invite.py:127 +#: snikket_web/invite.py:126 msgid "Registration was declined for unknown reasons" msgstr "" -#: snikket_web/invite.py:131 +#: snikket_web/invite.py:130 msgid "The username is not valid" msgstr "" @@ -712,17 +712,17 @@ msgid "" msgstr "" #: snikket_web/templates/invite_register.html:14 -#: snikket_web/templates/invite_view.html:31 +#: snikket_web/templates/invite_view.html:37 msgid "App already installed?" msgstr "" #: snikket_web/templates/invite_register.html:16 -#: snikket_web/templates/invite_view.html:33 +#: snikket_web/templates/invite_view.html:39 msgid "Open the app" msgstr "" #: snikket_web/templates/invite_register.html:18 -#: snikket_web/templates/invite_view.html:35 +#: snikket_web/templates/invite_view.html:41 msgid "This button works only if you have the app installed already!" msgstr "" @@ -794,33 +794,41 @@ msgstr "" msgid "Get started" msgstr "" -#: snikket_web/templates/invite_view.html:20 +#: snikket_web/templates/invite_view.html:21 msgid "Install the Snikket App on your Android or iOS device." msgstr "" #: snikket_web/templates/invite_view.html:23 -msgid "Get it on Google Play" -msgstr "" - -#: snikket_web/templates/invite_view.html:24 -msgid "Download on the App Store" +#, python-format +msgid "" +"Install the Snikket App on your Android device (iOS coming soon!)." msgstr "" #: snikket_web/templates/invite_view.html:27 +msgid "Get it on Google Play" +msgstr "" + +#: snikket_web/templates/invite_view.html:29 +msgid "Download on the App Store" +msgstr "" + +#: snikket_web/templates/invite_view.html:33 msgid "Not on mobile?" msgstr "" -#: snikket_web/templates/invite_view.html:30 +#: snikket_web/templates/invite_view.html:36 msgid "" "After installation the app should automatically open and prompt you to " "create an account. If not, simply click the button below." msgstr "" -#: snikket_web/templates/invite_view.html:37 +#: snikket_web/templates/invite_view.html:43 msgid "Alternatives" msgstr "" -#: snikket_web/templates/invite_view.html:38 +#: snikket_web/templates/invite_view.html:44 #, python-format msgid "" "You can connect to Snikket using any XMPP-compatible software. If the " @@ -828,43 +836,43 @@ msgid "" "href=\"%(register_url)s\">register an account manually." msgstr "" -#: snikket_web/templates/invite_view.html:44 +#: snikket_web/templates/invite_view.html:50 msgid "Scan invite code" msgstr "" -#: snikket_web/templates/invite_view.html:47 -#: snikket_web/templates/invite_view.html:76 +#: snikket_web/templates/invite_view.html:53 +#: snikket_web/templates/invite_view.html:82 msgid "Close" msgstr "" -#: snikket_web/templates/invite_view.html:50 +#: snikket_web/templates/invite_view.html:56 msgid "" "You can transfer this invite to your mobile device by scanning a code " "with your camera. You can use either a QR scanner app or the Snikket app " "itself." msgstr "" -#: snikket_web/templates/invite_view.html:55 +#: snikket_web/templates/invite_view.html:61 msgid "Using a QR code scanner" msgstr "" -#: snikket_web/templates/invite_view.html:57 +#: snikket_web/templates/invite_view.html:63 msgid "Using the Snikket app" msgstr "" -#: snikket_web/templates/invite_view.html:62 +#: snikket_web/templates/invite_view.html:68 msgid "" "Use a QR code scanner on your mobile device to scan the code " "below:" msgstr "" -#: snikket_web/templates/invite_view.html:68 +#: snikket_web/templates/invite_view.html:74 msgid "" "Install the Snikket app on your mobile device, open it, and tap the " "'Scan' button at the top." msgstr "" -#: snikket_web/templates/invite_view.html:69 +#: snikket_web/templates/invite_view.html:75 msgid "" "Your camera will turn on. Point it at the square code below until it is " "within the highlighted square on your screen, and wait until the app " @@ -916,24 +924,24 @@ msgstr "" msgid "Your account" msgstr "" -#: snikket_web/templates/user_home.html:30 +#: snikket_web/templates/user_home.html:31 msgid "Edit profile" msgstr "" -#: snikket_web/templates/user_home.html:31 +#: snikket_web/templates/user_home.html:32 #: snikket_web/templates/user_passwd.html:32 msgid "Change password" msgstr "" -#: snikket_web/templates/user_home.html:36 +#: snikket_web/templates/user_home.html:38 msgid "Your Snikket" msgstr "" -#: snikket_web/templates/user_home.html:38 +#: snikket_web/templates/user_home.html:40 msgid "Manage users, invitations and circles of your Snikket service." msgstr "" -#: snikket_web/templates/user_home.html:40 +#: snikket_web/templates/user_home.html:42 msgid "Admin panel" msgstr ""