-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
640 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[run] | ||
omit = ve/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
*.py[cod] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Packages | ||
*.egg | ||
*.egg-info | ||
dist | ||
build | ||
eggs | ||
parts | ||
bin | ||
lib | ||
var | ||
sdist | ||
develop-eggs | ||
.installed.cfg | ||
lib64 | ||
|
||
# Installer logs | ||
pip-log.txt | ||
|
||
# Unit test / coverage reports | ||
.coverage | ||
.tox | ||
nosetests.xml | ||
htmlcov | ||
|
||
# Translations | ||
*.mo | ||
|
||
# Mr Developer | ||
.mr.developer.cfg | ||
.project | ||
.pydevproject | ||
|
||
# Complexity | ||
output/*.html | ||
output/*/index.html | ||
|
||
# Sphinx | ||
docs/_build | ||
.cache/ | ||
/_trial_temp/ | ||
|
||
.DS_Store | ||
|
||
# Virtualenv | ||
ve/ | ||
|
||
# PyCharm / IntelliJ | ||
.idea/ | ||
|
||
# testapp | ||
testapp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
sudo: false | ||
language: python | ||
python: | ||
- "2.7" | ||
cache: | ||
directories: | ||
- $HOME/.pip-cache/ | ||
|
||
env: | ||
- TZ=UTC | ||
|
||
install: | ||
- pip install twine | ||
- pip install --upgrade pip --cache-dir $HOME/.pip-cache/ | ||
- pip install coveralls coverage --cache-dir $HOME/.pip-cache/ | ||
- pip install flake8 --cache-dir $HOME/.pip-cache/ | ||
- pip install -r requirements-dev.txt --cache-dir $HOME/.pip-cache/ | ||
- pip install -e . --cache-dir $HOME/.pip-cache/ | ||
script: | ||
- flake8 molo | ||
- molo scaffold testapp --require molo.pwa --include molo.pwa ^pwa/ | ||
- flake8 testapp | ||
- cp test_settings.py testapp/testapp/settings/local.py | ||
- pip install -e testapp | ||
- py.test --cov=molo.pwa --cov-report=term | ||
|
||
after_success: | ||
- coveralls | ||
|
||
deploy: | ||
provider: pypi | ||
distributions: sdist bdist_wheel | ||
user: praekelt.org | ||
password: | ||
secure: RiysryXsxh41tamHCB5BqJidEAYCoxxZnaJNAsV9XtYrq6q90iWnmFKz2pwW6S5RcdNYeVceKTh/kp8RhrYgp9HpDAze9PTTEIBgeVbothJcHTCvV+4eXgVO529WxJksKfC+4JheZQLQczIdIVDYxuztiRq2wPQKKEYyeK7ymwMl80gB5pUiDsUFpsGZhTM9GSlWxCcoXUQIX3biP/95f/KEwEkwqWFTeXDqNlFoCdHrPntHlf4cR3YyzedW2SkhSKcEYylAISoTmze3rmTQBA11JzurlH+cK9ZCu7cuA2OdFe59MtensgO4M2btanPGiS2FrCcvRc33B5rzidSiCHMha77Npf9D1qjs1rKZZjSLU/vjv3Q3usYmplSOohuy7WHGJDfFf4KcTdm+heIbZKRIoH9knICtShJ4BIV8tgbFUG6vKuIn+yy4Ao4SzlQrb22z6Ndk/0+2hSp+EfaI9UJx6tYbLzfmFpGcN7LiWu7/C9cq+pFdIz3aXWhKpEzvuhF/RO4inXL9UP5MQJgOc8QF9necBQfHv4Ec6HdD5BtZLF+lsvLOfVbUXwQGTxJQwDvcpDdjhjNfsV47BL3EnEhYVw9ubPW+gmIMKKaLdq5ZQyafgPbQ+BAtEpZeAXFbW77uWQY5Lzbm3FBwDMjwwD8CutBTUUwiGb+n8qIdSEA= | ||
on: | ||
tags: true | ||
all_branches: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CHANGE LOG | ||
========== | ||
|
||
1.0.0 | ||
----- | ||
- PWA Foundation | ||
- Push Notification Functionality | ||
|
||
0.0.1 | ||
----- | ||
- Initial commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Running local HTML Tests | ||
|
||
To Get Started | ||
|
||
- $ virtualenv ve | ||
- $ source ve/bin/activate | ||
- $ pip install -e . | ||
|
||
- molo scaffold testapp --require molo.pwa | ||
- cp molo/surveys/test_templates/*.html testapp/testapp/templates/core/ | ||
|
||
- pip install -e testapp | ||
- py.test --cov=molo.pwa --cov-report=term | ||
- pip install -r requirements-dev.txt | ||
- py.test | ||
|
||
To Run A Specific Test | ||
- py.test -k test_pwa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Copyright (c) Praekelt Foundation and individual contributors. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the Praekelt Foundation nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
include LICENSE | ||
include README.rst | ||
include VERSION | ||
include requirements.txt | ||
include requirements-dev.txt | ||
|
||
recursive-include tests * | ||
|
||
recursive-include docs *.rst conf.py | ||
|
||
recursive-include molo/surveys * | ||
|
||
recursive-exclude * __pycache__ | ||
recursive-exclude * *.py[co] | ||
|
||
recursive-include molo/pwa/templates * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
molo.surveys | ||
============================= | ||
|
||
.. image:: https://img.shields.io/travis/praekelt/molo.pwa.svg | ||
:target: https://travis-ci.org/praekelt/molo.pwa | ||
|
||
.. image:: https://img.shields.io/pypi/v/molo.pwa.svg | ||
:target: https://pypi.python.org/pypi/molo.pwa | ||
|
||
.. image:: https://coveralls.io/repos/praekelt/molo.pwa/badge.png?branch=develop | ||
:target: https://coveralls.io/r/praekelt/molo.pwa?branch=develop | ||
:alt: Code Coverage | ||
|
||
An implementation of pwa as a Molo plugin | ||
|
||
Installation:: | ||
|
||
pip install molo.pwa | ||
|
||
|
||
Django setup:: | ||
|
||
INSTALLED_APPS = [ | ||
... | ||
'molo.pwa', | ||
'fcm_django', | ||
... | ||
] | ||
|
||
Configure serviceworker path, app name, description, icons, and FCM:: | ||
|
||
PWA_SERVICE_WORKER_PATH = join( | ||
PROJECT_ROOT, 'your_app', 'templates', SITE_LAYOUT_BASE, 'serviceworker.js') | ||
PWA_NAME = 'App Name' | ||
PWA_DESCRIPTION = 'App Description' | ||
PWA_THEME_COLOR = '#fff' | ||
PWA_DISPLAY = 'standalone' | ||
PWA_START_URL = '/' | ||
PWA_ICONS = [ | ||
{ | ||
'src': '/static/img/appicons/app_icon.png', | ||
'sizes': '160x160', | ||
"type": "image/png" | ||
} | ||
] | ||
PWA_FCM_API_KEY = 'FCM API KEY' | ||
PWA_FCM_MSGSENDER_ID = 'FCM MESSAGE SENDER ID' | ||
FCM_DJANGO_SETTINGS = { | ||
"FCM_SERVER_KEY": 'FCM SERVER KEY', | ||
"ONE_DEVICE_PER_USER": True, | ||
"DELETE_INACTIVE_DEVICES": False, | ||
} | ||
|
||
|
||
In your urls.py:: | ||
|
||
urlpatterns = [ | ||
url(r'', include('molo.pwa.urls')), | ||
... | ||
... | ||
] | ||
|
||
In your base.html:: | ||
|
||
{% load molo_pwa %} | ||
|
||
<head> | ||
... | ||
{% molo_pwa_meta %} | ||
... | ||
</head> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__import__('pkg_resources').declare_namespace(__name__) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from django.conf import settings | ||
import os | ||
|
||
# Path to the service worker implementation. | ||
PWA_SERVICE_WORKER_PATH = getattr(settings, 'PWA_SERVICE_WORKER_PATH', | ||
os.path.join(os.path.abspath( | ||
os.path.dirname(__file__)), | ||
'templates', | ||
'serviceworker.js')) | ||
|
||
# App parameters to include in manifest.json and appropriate meta tags | ||
PWA_NAME = getattr(settings, 'PWA_NAME', 'Molo') | ||
PWA_DESCRIPTION = getattr(settings, 'PWA_DESCRIPTION', | ||
'Molo Progressive Web App') | ||
PWA_ROOT_URL = getattr(settings, 'PWA_ROOT_URL', '/') | ||
PWA_THEME_COLOR = getattr(settings, 'PWA_THEME_COLOR', '#000') | ||
PWA_DISPLAY = getattr(settings, 'PWA_DISPLAY', 'standalone') | ||
PWA_START_URL = getattr(settings, 'PWA_START_URL', '/') | ||
PWA_ICONS = getattr(settings, 'PWA_ICONS', [ | ||
{ | ||
'src': '/', | ||
'sizes': '160x160' | ||
} | ||
]) | ||
PWA_FCM_API_KEY = getattr(settings, 'PWA_FCM_API_KEY', '') | ||
PWA_FCM_MSGSENDER_ID = getattr(settings, 'PWA_FCM_MSGSENDER_ID', '') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class PwaConfig(AppConfig): | ||
name = 'molo_pwa' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% load molo_pwa %} | ||
{ | ||
"name": {{ PWA_NAME|js }}, | ||
"short_name": {{ PWA_NAME|js }}, | ||
"description": {{ PWA_DESCRIPTION|js }}, | ||
"start_url": {{ PWA_START_URL|js }}, | ||
"display": {{ PWA_DISPLAY|js }}, | ||
"background_color": "#fff", | ||
"theme_color": {{ PWA_THEME_COLOR|js }}, | ||
"icons": {{ PWA_ICONS|js }}, | ||
"gcm_sender_id": "103953800507" | ||
} |
Oops, something went wrong.