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.
This commit is contained in:
Jonas Schäfer
2021-01-29 09:20:45 +01:00
parent f4348600e2
commit 4044e857bc
4 changed files with 53 additions and 38 deletions

View File

@@ -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(

View File

@@ -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",

View File

@@ -17,11 +17,17 @@
<p>{% trans site_name=config["SITE_NAME"] %}You have been invited to chat on {{ site_name }} using Snikket, a secure, privacy-friendly chat app.{% endtrans %}</p>
{%- endif -%}
<h2>{% trans %}Get started{% endtrans %}</h2>
{%- if apple_store_url -%}
<p>{% trans %}Install the Snikket App on your Android or iOS device.{% endtrans %}</p>
{%- else -%}
<p>{% trans ios_info_url="https://snikket.org/faq/#is-there-an-ios-app" %}Install the Snikket App on your Android device (<a href="{{ ios_info_url }}" target="_blank" rel="noopener noreferrer">iOS coming soon!</a>).{% endtrans %}</p>
{%- endif -%}
<div class="install-buttons">
<ul>
<li><a href="{{ play_store_url }}"><img alt='{% trans %}Get it on Google Play{% endtrans %}' src='https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png' class="play"/></a></li>
{%- if apple_store_url -%}
<li><a href="{{ apple_store_url }}"><img alt='{% trans %}Download on the App Store{% endtrans %}' src="{{ apple_store_badge() }}" class="apple"></a></li>
{%- endif -%}
</ul>
{%- call standard_button("qrcode", "#qr-modal", class="primary", onclick="open_modal(this); return false;") -%}
{% trans %}Not on mobile?{% endtrans %}

View File

@@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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 (<a "
"href=\"%(ios_info_url)s\" target=\"_blank\" rel=\"noopener "
"noreferrer\">iOS coming soon!</a>)."
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</a>."
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 <em>QR code</em> 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 ""