Add support for iOS AppStore

- iSorted Python imports in all the manifest files
- Some refactoring in plinth_extras

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati 2017-11-18 08:18:46 +05:30 committed by James Valleroy
parent bf33a1a492
commit 57c44f32e6
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
14 changed files with 42 additions and 27 deletions

View File

@ -17,9 +17,10 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.utils import format_lazy
from . import get_configured_domain_name
from plinth.templatetags.plinth_extras import Mobile_OS, Store from plinth.templatetags.plinth_extras import Mobile_OS, Store
from plinth.utils import format_lazy
from . import get_configured_domain_name
clients = [{ clients = [{
'name': 'name':

View File

@ -58,8 +58,8 @@ clients = [{
'extra security.'), 'extra security.'),
'platforms': [{ 'platforms': [{
'type': 'store', 'type': 'store',
'os': 'iOS', 'os': Mobile_OS.IOS.value,
'store_name': 'apple_store', 'store_name': Store.APP_STORE.value,
'url': 'https://itunes.apple.com/us/app/chatsecure' 'url': 'https://itunes.apple.com/us/app/chatsecure'
'/id464200063 ' '/id464200063 '
}] }]

View File

@ -17,9 +17,9 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth import cfg
from plinth.templatetags.plinth_extras import Desktop_OS from plinth.templatetags.plinth_extras import Desktop_OS
from plinth.utils import format_lazy from plinth.utils import format_lazy
from plinth import cfg
clients = [{ clients = [{
'name': 'name':

View File

@ -16,6 +16,7 @@
# #
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store
clients = [{ clients = [{

View File

@ -16,6 +16,7 @@
# #
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store
clients = [{ clients = [{

View File

@ -16,6 +16,7 @@
# #
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store
clients = [{ clients = [{
@ -38,9 +39,9 @@ clients = [{
'name': 'mumble' 'name': 'mumble'
}, { }, {
'type': 'store', 'type': 'store',
'os': 'iOS', 'os': Mobile_OS.IOS.value,
'os_version': '>=8.0', 'os_version': '>=8.0',
'store_name': 'apple_store', 'store_name': Store.APP_STORE.value,
'url': 'https://itunes.apple.com/us/app/mumble/id443472808' 'url': 'https://itunes.apple.com/us/app/mumble/id443472808'
}] }]
}, { }, {
@ -66,9 +67,9 @@ clients = [{
_('Mumblefly'), _('Mumblefly'),
'platforms': [{ 'platforms': [{
'type': 'store', 'type': 'store',
'os': 'iOS', 'os': Mobile_OS.IOS.value,
'os_version': '>=7.0', 'os_version': '>=7.0',
'store_name': 'apple_store', 'store_name': Store.APP_STORE.value,
'url': 'https://itunes.apple.com/dk/app/mumblefy/id858752232' 'url': 'https://itunes.apple.com/dk/app/mumblefy/id858752232'
}] }]
}] }]

View File

@ -16,6 +16,7 @@
# #
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store
clients = [{ clients = [{

View File

@ -16,6 +16,7 @@
# #
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.templatetags.plinth_extras import Mobile_OS, Store from plinth.templatetags.plinth_extras import Mobile_OS, Store
clients = [{ clients = [{

View File

@ -16,6 +16,7 @@
# #
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store
clients = [{ clients = [{
@ -39,8 +40,8 @@ clients = [{
'.jitsi.meet ' '.jitsi.meet '
}, { }, {
'type': 'store', 'type': 'store',
'os': 'iOS', 'os': Mobile_OS.IOS.value,
'store_name': 'apple_store', 'store_name': Store.APP_STORE.value,
'url': 'https://itunes.apple.com/in/app/jitsi-meet/id1165103905' 'url': 'https://itunes.apple.com/in/app/jitsi-meet/id1165103905'
}, { }, {
'type': 'download', 'type': 'download',

View File

@ -16,6 +16,7 @@
# #
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store
metadata = { metadata = {

View File

@ -16,6 +16,7 @@
# #
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store
version = '7.0.6' version = '7.0.6'

View File

@ -16,6 +16,7 @@
# #
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from plinth.templatetags.plinth_extras import Mobile_OS, Store from plinth.templatetags.plinth_extras import Mobile_OS, Store
clients = [{ clients = [{

View File

@ -85,7 +85,7 @@
<td> <td>
<div class="row"> <div class="row">
{% for platform in client.platforms %} {% for platform in client.platforms %}
{% if platform.type == 'store' and platform.os == 'android' %} {% if platform.type == 'store' and platform.os == 'android' or platform.os == 'ios' %}
<div class="col-md-2 col-xs-4"> <div class="col-md-2 col-xs-4">
<a href="{{ platform.url }}"> <a href="{{ platform.url }}">
{% with 'theme/icons/'|add:platform.store_name|add:'.png' as icon %} {% with 'theme/icons/'|add:platform.store_name|add:'.png' as icon %}

View File

@ -16,16 +16,17 @@
# #
import os import os
from django import template
from enum import Enum from enum import Enum
from django import template
register = template.Library() register = template.Library()
class Desktop_OS(Enum): class Desktop_OS(Enum):
WINDOWS = 'windows'
MAC_OS = 'mac-os'
GNU_LINUX = 'gnu-linux' GNU_LINUX = 'gnu-linux'
MAC_OS = 'mac-os'
WINDOWS = 'windows'
class Mobile_OS(Enum): class Mobile_OS(Enum):
@ -34,8 +35,13 @@ class Mobile_OS(Enum):
class Store(Enum): class Store(Enum):
GOOGLE_PLAY = 'google-play' APP_STORE = 'app-store'
F_DROID = 'f-droid' F_DROID = 'f-droid'
GOOGLE_PLAY = 'google-play'
def string_values(enum):
return [x.value for x in list(enum)]
def mark_active_menuitem(menu, path): def mark_active_menuitem(menu, path):
@ -84,22 +90,21 @@ def __check(clients, cond):
if cond(pf)) if cond(pf))
@register.filter(name='has_web_clients') @register.filter(name='has_desktop_clients')
def has_web_clients(clients): def has_desktop_clients(clients):
"""Filter to find out whether an application has web clients""" """Filter to find out whether an application has desktop clients"""
return __check(clients, lambda x: x['type'] == 'web') return __check(clients,
lambda x: x.get('os', '') in string_values(Desktop_OS))
@register.filter(name='has_mobile_clients') @register.filter(name='has_mobile_clients')
def has_mobile_clients(clients): def has_mobile_clients(clients):
"""Filter to find out whether an application has mobile clients""" """Filter to find out whether an application has mobile clients"""
return __check(clients, return __check(clients,
lambda x: x.get('os', '') == Mobile_OS.ANDROID.value) lambda x: x.get('os', '') in string_values(Mobile_OS))
@register.filter(name='has_desktop_clients') @register.filter(name='has_web_clients')
def has_desktop_clients(clients): def has_web_clients(clients):
"""Filter to find out whether an application has desktop clients""" """Filter to find out whether an application has web clients"""
return __check( return __check(clients, lambda x: x['type'] == 'web')
clients,
lambda x: x.get('os', '') in [x.value for x in list(Desktop_OS)])