Skip to content

Commit 75a73b0

Browse files
committed
Full update to 2.0-beta
1 parent a4e0fe3 commit 75a73b0

21 files changed

Lines changed: 1479 additions & 632 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
__pycache__
2+
/bin
3+
/.buildozer

assets/presplash.png

-61.3 KB
Loading

buildozer.spec

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
[app]
22

3+
title = NoDPI
4+
package.name = nodpi
5+
package.domain = com.gvcoder
6+
version = 2.0
7+
38
source.dir = ./src
49
source.include_exts = py,png,jpg,kv,txt
5-
version = 1.0
10+
611
requirements = kivy,https://github.com/kivymd/kivymd/archive/master.zip,android,pyjnius,materialyoucolor,pillow,asynckivy,asyncgui
712

813
presplash.filename = ./assets/presplash.png
914
icon.filename = ./assets/ico.png
1015
orientation = portrait
1116
fullscreen = 0
1217

13-
[android]
18+
p4a.branch = master
1419

15-
title = NoDPI
16-
package.name = nodpi
17-
package.domain = com.gvcoder
20+
[android]
1821

19-
services = Proxy:%(source.dir)s/service.py:foreground:sticky
20-
android.permissions = INTERNET,FOREGROUND_SERVICE,POST_NOTIFICATIONS
22+
services = proxy:%(source.dir)s/service.py:foreground:sticky
23+
android.permissions = INTERNET,FOREGROUND_SERVICE,POST_NOTIFICATIONS,REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
2124
android.accept_sdk_license = True
2225

2326
[buildozer]

src/constants.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""
2+
Constants module
3+
"""
4+
5+
APP_VERSION = "2.0-beta"
6+
7+
BLACKLIST_FILENAME = "blacklist.txt"
8+
PROXY_CONFIG_FILENAME = "proxy_config.json"
9+
APP_SETTINGS_FILENAME = "app_settings.json"
10+
11+
DEFAULT_PROXY_CONFIG = {"host": "127.0.0.1", "port": "8881"}
12+
13+
DEFAULT_APP_SETTINGS = {
14+
"first_run": True,
15+
"fragment_method": "sni",
16+
"blacklist": "standard",
17+
"matching": "strict",
18+
}
19+
20+
DEFAULT_BLACKLIST = [
21+
"youtube.com",
22+
"youtu.be",
23+
"yt.be",
24+
"googlevideo.com",
25+
"ytimg.com",
26+
"yting.com",
27+
"ggpht.com",
28+
"gvt1.com",
29+
"youtube-nocookie.com",
30+
"youtube-ui.l.google.com",
31+
"youtubeembeddedplayer.googleapis.com",
32+
"youtube.googleapis.com",
33+
"youtubei.googleapis.com",
34+
"jnn-pa.googleapis.com",
35+
"yt-video-upload.l.google.com",
36+
"wide-youtube.l.google.com",
37+
"yt3.googleusercontent.com",
38+
"youtubekids.com"
39+
]

src/lib/android/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
"""
2+
Android module
3+
"""
4+
15
from kivy import platform
26

37
if platform != 'android':

src/lib/android/notification.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
from jnius import autoclass, cast #pylint: disable=no-name-in-module
1+
"""
2+
Android notifications
3+
"""
4+
5+
from jnius import autoclass, cast # pylint: disable=no-name-in-module
26

37
String = autoclass("java.lang.String")
48

@@ -8,8 +12,9 @@
812

913

1014
def create_notify_channel(
11-
channel_id: str, channel_name: str, channel_description: str) -> None:
12-
""" Creates notification channel """
15+
channel_id: str, channel_name: str, channel_description: str
16+
) -> None:
17+
"""Creates notification channel"""
1318

1419
NotificationManager = autoclass("android.app.NotificationManager")
1520
NotificationChannel = autoclass("android.app.NotificationChannel")
@@ -28,7 +33,7 @@ def create_notify_channel(
2833

2934

3035
def notify(id: int, channel_id: str, title: str, text: str, ticker: str = "") -> None:
31-
""" Send notification """
36+
"""Send notification"""
3237

3338
Builder = autoclass("android.app.Notification$Builder")
3439
Notification = autoclass("android.app.Notification")

src/lib/android/service.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
from android import mActivity #pylint: disable=no-name-in-module
2-
from jnius import autoclass, cast #pylint: disable=no-name-in-module
1+
"""
2+
Android service
3+
"""
4+
35
import logging
46

7+
from android import mActivity # pylint: disable=no-name-in-module
8+
from jnius import autoclass, cast # pylint: disable=no-name-in-module
9+
510

611
def is_service_running(name_service: str) -> bool:
7-
""" Check if service is running """
12+
"""Check if service is running"""
813

914
PythonActivity = autoclass("org.kivy.android.PythonActivity")
1015
context = PythonActivity.mActivity
1116

12-
ActivityManager = autoclass("android.app.ActivityManager")
1317
activity_manager = cast(
1418
"android.app.ActivityManager",
1519
context.getSystemService(context.ACTIVITY_SERVICE),
@@ -25,14 +29,18 @@ def is_service_running(name_service: str) -> bool:
2529

2630

2731
def start_service(name_service: str) -> None:
32+
"""Start service"""
2833

2934
context = mActivity.getApplicationContext()
30-
service = autoclass(str(context.getPackageName()) + ".Service" + name_service)
35+
service = autoclass(str(context.getPackageName()) +
36+
".Service" + name_service)
3137
service.start(mActivity, "")
3238

3339

3440
def stop_service(name_service: str) -> None:
41+
"""Stop service"""
3542

3643
context = mActivity.getApplicationContext()
37-
service = autoclass(str(context.getPackageName()) + ".Service" + name_service)
44+
service = autoclass(str(context.getPackageName()) +
45+
".Service" + name_service)
3846
service.stop(mActivity)

src/lib/android/storage.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
"""
2+
Android storage
3+
"""
4+
15
from android.storage import app_storage_path
26

37

48
def get_app_path() -> str:
5-
""" Get app path """
9+
"""Get app path"""
610

711
return str(app_storage_path())

0 commit comments

Comments
 (0)