This repository has been archived by the owner on Sep 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Notifies user when roll processed, fixes #57
Adds a background service for pulling rolls and notify user when roll was processed. There's currently a bug where the service may die for a unknown reason. Also the notification is not clickable and doesn't bring back to the app. This commit also brings a bunch of other things such as: - fixes missing `libffi-dev` - adds missing `libgmp3-dev` required by coincurve - upgrades Docker base image to latest Ubuntu Bionic LTS - refactors some file locations (shared with service/)
- Loading branch information
1 parent
8b8d9ab
commit 21130ce
Showing
13 changed files
with
283 additions
and
85 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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
venv/ | ||
.git/ | ||
.buildozer/ | ||
.pytest_cache/ | ||
**/.pytest_cache/ | ||
.tox/ | ||
bin/ | ||
*.pyc | ||
**/__pycache__ |
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
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
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
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
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
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,52 @@ | ||
import ctypes.util | ||
import os | ||
import typing | ||
from ctypes.util import find_library as original_find_library | ||
|
||
from kivy.utils import platform | ||
|
||
|
||
def find_library(name): | ||
""" | ||
Looks in the right places on Android, see: | ||
https://github.com/kivy/python-for-android/blob/0.6.0/ | ||
pythonforandroid/recipes/python2/patches/ctypes-find-library-updated.patch | ||
""" | ||
# Check the user app lib dir | ||
app_root = os.path.abspath('../../').split(os.path.sep) | ||
lib_search = os.path.sep.join(app_root) + os.path.sep + 'lib' | ||
for filename in os.listdir(lib_search): | ||
if filename.endswith('.so') and name in filename: | ||
return lib_search + os.path.sep + filename | ||
# Check the normal Android system libraries | ||
for filename in os.listdir('/system/lib'): | ||
if filename.endswith('.so') and name in filename: | ||
return lib_search + os.path.sep + filename | ||
# fallback on the original find_library() | ||
return original_find_library(name) | ||
|
||
|
||
def patch_find_library_android(): | ||
""" | ||
Monkey patches find_library() to first try to find libraries on Android. | ||
https://github.com/AndreMiras/EtherollApp/issues/30 | ||
""" | ||
if platform == 'android': | ||
ctypes.util.find_library = find_library | ||
|
||
|
||
CT_co = typing.TypeVar('CT_co', covariant=True, bound=type) | ||
|
||
|
||
class Type(typing.Generic[CT_co], extra=type): | ||
__slots__ = () | ||
|
||
|
||
def patch_typing_python351(): | ||
""" | ||
Python 3.5.1 doesn't have typing.Type, refs: | ||
https://github.com/crystax/android-vendor-python-3-5/issues/1 | ||
""" | ||
# TODO: check Python version and only patch if == 3.5.1 | ||
if not hasattr(typing, 'Type'): | ||
typing.Type = Type |
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
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,25 @@ | ||
import os | ||
|
||
from kivy.app import App | ||
from kivy.storage.jsonstore import JsonStore | ||
|
||
|
||
class Store: | ||
|
||
@staticmethod | ||
def get_store_path(): | ||
""" | ||
Returns the full user store path. | ||
""" | ||
user_data_dir = App.get_running_app().user_data_dir | ||
store_path = os.path.join(user_data_dir, 'store.json') | ||
return store_path | ||
|
||
@classmethod | ||
def get_store(cls): | ||
""" | ||
Returns user Store object. | ||
""" | ||
store_path = cls.get_store_path() | ||
store = JsonStore(store_path) | ||
return store |
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
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
Oops, something went wrong.