android-notify 1.60.10.dev0__tar.gz → 1.61.0.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/PKG-INFO +5 -5
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/README.md +4 -4
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/base.py +0 -15
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/config.py +1 -1
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/android.py +21 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/helper.py +4 -1
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/permissions.py +2 -2
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/sword.py +74 -64
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify.egg-info/PKG-INFO +5 -5
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify.egg-info/SOURCES.txt +1 -2
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/pyproject.toml +1 -1
- android_notify-1.60.10.dev0/docs/website/src/pages/data/laner_Sent.py +0 -24
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/__init__.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/__main__.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/core.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/fallback-icons/flet-appicon.png +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/fallback-icons/pydroid3-appicon.png +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/an_types.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/channels.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/facade.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/intents.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/java_classes.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/logger.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/styles.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/__init__.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/android_notify_test.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/base_test.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/flet/adv/main.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/flet/adv/tests/__init__.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/flet/adv/tests/test_android_notify_full.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/flet/basic/src/core.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/flet/basic/src/main.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/flet/flet-working/src/core.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/flet/flet-working/src/main.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/main.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/p4a/hook.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/serivces/wallpaper.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/test_basic_notifications.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/test_notification_actions.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/test_notification_appearance.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/test_notification_behavior.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/test_notification_channels.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/test_notification_clear.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/test_notification_permission.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/test_notification_progress.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/test_notification_sound.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/test_notification_styles.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/widgets/images.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/widgets/texts.py +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify.egg-info/dependency_links.txt +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify.egg-info/entry_points.txt +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify.egg-info/requires.txt +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify.egg-info/top_level.txt +0 -0
- {android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: android-notify
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.61.0.dev0
|
|
4
4
|
Summary: A Python package that simplifies creating Android notifications in Kivy and Flet apps.
|
|
5
5
|
Author-email: Fabian <fector101@yahoo.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -81,7 +81,7 @@ In your **`buildozer.spec`** file, ensure you include the following:
|
|
|
81
81
|
|
|
82
82
|
```ini
|
|
83
83
|
# Add pyjnius so ensure it's packaged with the build
|
|
84
|
-
requirements = python3, kivy, pyjnius, android-notify==1.
|
|
84
|
+
requirements = python3, kivy, pyjnius, android-notify==1.61.0.dev0
|
|
85
85
|
# Add permission for notifications
|
|
86
86
|
android.permissions = POST_NOTIFICATIONS
|
|
87
87
|
```
|
|
@@ -99,7 +99,7 @@ In your `pyproject.toml` file, ensure you include the following:
|
|
|
99
99
|
```toml
|
|
100
100
|
[tool.flet.android]
|
|
101
101
|
dependencies = [
|
|
102
|
-
"pyjnius","android-notify==1.
|
|
102
|
+
"pyjnius","android-notify==1.61.0.dev0"
|
|
103
103
|
]
|
|
104
104
|
|
|
105
105
|
[tool.flet.android.permission]
|
|
@@ -117,10 +117,10 @@ dependencies = [
|
|
|
117
117
|
<br/>
|
|
118
118
|
|
|
119
119
|
On the [pydroid 3](https://play.google.com/store/apps/details?id=ru.iiec.pydroid3) mobile app for running python code you can test some features.
|
|
120
|
-
- In pip section where you're asked to insert `Libary name` paste `android-notify==1.
|
|
120
|
+
- In pip section where you're asked to insert `Libary name` paste `android-notify==1.61.0.dev0`
|
|
121
121
|
- Minimal working example
|
|
122
122
|
```py
|
|
123
|
-
# Testing with `android-notify==1.
|
|
123
|
+
# Testing with `android-notify==1.61.0.dev0` on pydroid
|
|
124
124
|
from kivy.app import App
|
|
125
125
|
from kivy.uix.boxlayout import BoxLayout
|
|
126
126
|
from kivy.uix.button import Button
|
|
@@ -58,7 +58,7 @@ In your **`buildozer.spec`** file, ensure you include the following:
|
|
|
58
58
|
|
|
59
59
|
```ini
|
|
60
60
|
# Add pyjnius so ensure it's packaged with the build
|
|
61
|
-
requirements = python3, kivy, pyjnius, android-notify==1.
|
|
61
|
+
requirements = python3, kivy, pyjnius, android-notify==1.61.0.dev0
|
|
62
62
|
# Add permission for notifications
|
|
63
63
|
android.permissions = POST_NOTIFICATIONS
|
|
64
64
|
```
|
|
@@ -76,7 +76,7 @@ In your `pyproject.toml` file, ensure you include the following:
|
|
|
76
76
|
```toml
|
|
77
77
|
[tool.flet.android]
|
|
78
78
|
dependencies = [
|
|
79
|
-
"pyjnius","android-notify==1.
|
|
79
|
+
"pyjnius","android-notify==1.61.0.dev0"
|
|
80
80
|
]
|
|
81
81
|
|
|
82
82
|
[tool.flet.android.permission]
|
|
@@ -94,10 +94,10 @@ dependencies = [
|
|
|
94
94
|
<br/>
|
|
95
95
|
|
|
96
96
|
On the [pydroid 3](https://play.google.com/store/apps/details?id=ru.iiec.pydroid3) mobile app for running python code you can test some features.
|
|
97
|
-
- In pip section where you're asked to insert `Libary name` paste `android-notify==1.
|
|
97
|
+
- In pip section where you're asked to insert `Libary name` paste `android-notify==1.61.0.dev0`
|
|
98
98
|
- Minimal working example
|
|
99
99
|
```py
|
|
100
|
-
# Testing with `android-notify==1.
|
|
100
|
+
# Testing with `android-notify==1.61.0.dev0` on pydroid
|
|
101
101
|
from kivy.app import App
|
|
102
102
|
from kivy.uix.boxlayout import BoxLayout
|
|
103
103
|
from kivy.uix.button import Button
|
|
@@ -11,15 +11,10 @@ class BaseNotification:
|
|
|
11
11
|
# Basic options
|
|
12
12
|
title: str = ''
|
|
13
13
|
message: str = ''
|
|
14
|
-
style: str = 'simple'
|
|
15
14
|
|
|
16
15
|
# Style-specific attributes
|
|
17
|
-
big_picture_path: str = ''
|
|
18
|
-
large_icon_path: str = ''
|
|
19
16
|
progress_max_value: int = 0
|
|
20
17
|
progress_current_value: float = 0.0 # Also Takes in Ints
|
|
21
|
-
body: str = ''
|
|
22
|
-
lines_txt: str = ''
|
|
23
18
|
|
|
24
19
|
# Notification Functions
|
|
25
20
|
name: str = ''
|
|
@@ -28,7 +23,6 @@ class BaseNotification:
|
|
|
28
23
|
# Advanced Options
|
|
29
24
|
id: int = 0
|
|
30
25
|
app_icon: str = 'Defaults to package app icon'
|
|
31
|
-
sub_text: str=''
|
|
32
26
|
|
|
33
27
|
# Channel related
|
|
34
28
|
channel_name: str = 'Default Channel'
|
|
@@ -86,12 +80,3 @@ class BaseNotification:
|
|
|
86
80
|
if not isinstance(actual_value, expected_type):
|
|
87
81
|
raise TypeError(f"Expected '{each_arg}' to be {expected_type}, got {type(actual_value)} instead.")
|
|
88
82
|
|
|
89
|
-
# Validate `style` values
|
|
90
|
-
style_values = [value for key, value in vars(NotificationStyles).items() if not key.startswith("__")]
|
|
91
|
-
if 'style' in inputted_kwargs and inputted_kwargs['style'] not in ['',*style_values]:
|
|
92
|
-
inputted_style=inputted_kwargs['style']
|
|
93
|
-
allowed_styles=', '.join(style_values)
|
|
94
|
-
raise ValueError(
|
|
95
|
-
f"Invalid style '{inputted_style}'. Allowed styles: {allowed_styles}"
|
|
96
|
-
)
|
|
97
|
-
|
{android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/android.py
RENAMED
|
@@ -180,3 +180,24 @@ def force_vibrate(repeat=False):
|
|
|
180
180
|
else:
|
|
181
181
|
vibrator.vibrate(pattern, -1 if not repeat else 0)
|
|
182
182
|
return None
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def get_active_notification_ids(notification_manager=None) -> list:
|
|
186
|
+
"""
|
|
187
|
+
Returns the IDS of all currently active notifications for your app.
|
|
188
|
+
Android 6+
|
|
189
|
+
"""
|
|
190
|
+
active_notification_ids = []
|
|
191
|
+
if not on_android_platform():
|
|
192
|
+
return active_notification_ids
|
|
193
|
+
|
|
194
|
+
if BuildVersion.SDK_INT < 23:
|
|
195
|
+
return active_notification_ids
|
|
196
|
+
|
|
197
|
+
notification_manager = notification_manager or get_notification_manager()
|
|
198
|
+
activeNotifications = notification_manager.getActiveNotifications()
|
|
199
|
+
|
|
200
|
+
for status_bar_notification in activeNotifications:
|
|
201
|
+
active_notification_ids.append(status_bar_notification.getId())
|
|
202
|
+
|
|
203
|
+
return active_notification_ids
|
{android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/helper.py
RENAMED
|
@@ -54,4 +54,7 @@ def execute_callback(callback,arg, from_who="user"):
|
|
|
54
54
|
else:
|
|
55
55
|
callback()
|
|
56
56
|
except Exception as on_permissions_result_callback_error:
|
|
57
|
-
logger.exception(on_permissions_result_callback_error)
|
|
57
|
+
logger.exception(on_permissions_result_callback_error)
|
|
58
|
+
|
|
59
|
+
def on_pydroid_app():
|
|
60
|
+
return "ru.iiec.pydroid3" in os.path.dirname(os.path.abspath(__file__))
|
{android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/permissions.py
RENAMED
|
@@ -6,7 +6,7 @@ import os.path
|
|
|
6
6
|
from .logger import logger
|
|
7
7
|
from android_notify.config import on_android_platform, on_flet_app, get_python_activity_context
|
|
8
8
|
from android_notify.internal.java_classes import autoclass, BuildVersion, Manifest, Intent, String, Settings, Uri, PackageManager, NotificationManagerCompat
|
|
9
|
-
from android_notify.internal.helper import execute_callback
|
|
9
|
+
from android_notify.internal.helper import execute_callback, on_pydroid_app
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def has_notification_permission():
|
|
@@ -80,7 +80,7 @@ def ask_notification_permission(callback=None, set_requesting_state=None, legacy
|
|
|
80
80
|
execute_callback(callback, grants[0])
|
|
81
81
|
execute_callback(set_requesting_state, False,from_who="package")
|
|
82
82
|
|
|
83
|
-
if legacy or on_flet_app():
|
|
83
|
+
if legacy or on_flet_app() or on_pydroid_app():
|
|
84
84
|
# TODO Handle activity with request code
|
|
85
85
|
permission = Manifest.POST_NOTIFICATIONS
|
|
86
86
|
context.requestPermissions([permission], 101)
|
|
@@ -8,7 +8,8 @@ from .internal.helper import generate_channel_id
|
|
|
8
8
|
from .config import from_service_file, get_notification_manager, on_flet_app, get_package_name, run_on_ui_thread, \
|
|
9
9
|
get_python_activity_context, on_android_platform
|
|
10
10
|
from .internal.android import cancel_all_notifications, cancel_notifications, dispatch_notification, \
|
|
11
|
-
set_when, show_infinite_progressbar, remove_buttons, set_sound, get_android_importance, force_vibrate
|
|
11
|
+
set_when, show_infinite_progressbar, remove_buttons, set_sound, get_android_importance, force_vibrate, \
|
|
12
|
+
get_active_notification_ids
|
|
12
13
|
|
|
13
14
|
# Types
|
|
14
15
|
from .internal.an_types import Importance
|
|
@@ -40,23 +41,16 @@ class Notification(BaseNotification):
|
|
|
40
41
|
:param message: Message body.
|
|
41
42
|
---
|
|
42
43
|
(Style Options)
|
|
43
|
-
:param style: Style of the notification ('simple', 'progress', 'big_text', 'inbox', 'big_picture', 'large_icon', 'both_imgs'). both_imgs == using lager icon and big picture
|
|
44
|
-
:param big_picture_path: Relative Path to the image resource.
|
|
45
|
-
:param large_icon_path: Relative Path to the image resource.
|
|
46
44
|
:param progress_current_value: Integer To set progress bar current value.
|
|
47
45
|
:param progress_max_value: Integer To set Max range for progress bar.
|
|
48
|
-
:param body: Large text For `big_Text` style, while `message` acts as subtitle.
|
|
49
|
-
:param lines_txt: text separated by newLine symbol For `inbox` style `use addLine method instead`
|
|
50
46
|
---
|
|
51
47
|
(Advance Options)
|
|
52
|
-
:param sub_text: str for additional information next to title
|
|
53
48
|
:param id: Pass in Old 'id' to use old instance
|
|
54
49
|
:param callback: Function for notification Click.
|
|
55
50
|
:param channel_name: - str Defaults to "Default Channel"
|
|
56
51
|
:param channel_id: - str Defaults to "default_channel"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
:param logs: - Bool Defaults to True
|
|
52
|
+
:param silent: - boolean to make notification silent
|
|
53
|
+
:param app_icon: - change default app icon
|
|
60
54
|
---
|
|
61
55
|
(Custom Style Options)
|
|
62
56
|
:param title_color: title color str (to be safe use hex code)
|
|
@@ -77,6 +71,7 @@ class Notification(BaseNotification):
|
|
|
77
71
|
|
|
78
72
|
self.__called_set_data = None
|
|
79
73
|
self.data_object = None
|
|
74
|
+
self.obey_user_clear = False # if to allow content after Users clear it form Tray, So it doesn't pop up again which becomes annoying
|
|
80
75
|
self.__id = self.id or self.__get_unique_id() # Different use from self.name all notifications require `integers` id's not `strings`
|
|
81
76
|
self.id = self.__id # To use same Notification in different instances
|
|
82
77
|
|
|
@@ -88,6 +83,13 @@ class Notification(BaseNotification):
|
|
|
88
83
|
|
|
89
84
|
self.__generic_parameters_filled = False
|
|
90
85
|
self.__using_set_priority_method = False
|
|
86
|
+
self.__only_alert_once_state = True # controls heads up use .setOnlyAlertOnce()
|
|
87
|
+
|
|
88
|
+
# These Attributes are for reference, For Changes Use setBigText, setSubText,setLargeIcon, setBigPicture
|
|
89
|
+
self.sub_text=""
|
|
90
|
+
self.body=""
|
|
91
|
+
self.large_icon_path=""
|
|
92
|
+
self.big_picture_path=""
|
|
91
93
|
|
|
92
94
|
# For components
|
|
93
95
|
self.__lines = []
|
|
@@ -122,7 +124,6 @@ class Notification(BaseNotification):
|
|
|
122
124
|
add_intent_to_open_app(builder=self.builder, action_name=action_name, notification_title=str(self.title),
|
|
123
125
|
notification_id=self.__id, data_object=self.data_object)
|
|
124
126
|
|
|
125
|
-
|
|
126
127
|
def addLine(self, text: str):
|
|
127
128
|
self.__lines.append(text)
|
|
128
129
|
|
|
@@ -182,7 +183,12 @@ class Notification(BaseNotification):
|
|
|
182
183
|
|
|
183
184
|
def refresh(self):
|
|
184
185
|
"""TO apply new components on notification"""
|
|
185
|
-
if
|
|
186
|
+
if not on_android_platform():
|
|
187
|
+
return
|
|
188
|
+
|
|
189
|
+
in_tray = self.isInTray() if self.obey_user_clear else True
|
|
190
|
+
|
|
191
|
+
if in_tray and self.__generic_parameters_filled:
|
|
186
192
|
# Don't dispatch before filling required values `self.__create_basic_notification`, Shouldn't dispatch till .send() is called
|
|
187
193
|
self.__applyNewLinesIfAny()
|
|
188
194
|
dispatch_notification(notification_id=self.__id, builder=self.builder, passed_check=self.passed_check)
|
|
@@ -193,6 +199,7 @@ class Notification(BaseNotification):
|
|
|
193
199
|
:param path: can be `Relative Path` or `URL`
|
|
194
200
|
:return:
|
|
195
201
|
"""
|
|
202
|
+
self.big_picture_path=path
|
|
196
203
|
if on_android_platform():
|
|
197
204
|
self.__build_img(path, NotificationStyles.BIG_PICTURE)
|
|
198
205
|
logger.info('Done setting big picture.')
|
|
@@ -214,6 +221,7 @@ class Notification(BaseNotification):
|
|
|
214
221
|
:param path: can be `Relative Path` or `URL`
|
|
215
222
|
:return:
|
|
216
223
|
"""
|
|
224
|
+
self.large_icon_path = path
|
|
217
225
|
if on_android_platform():
|
|
218
226
|
self.__build_img(path, NotificationStyles.LARGE_ICON)
|
|
219
227
|
logger.info('Done setting large icon.')
|
|
@@ -225,6 +233,7 @@ class Notification(BaseNotification):
|
|
|
225
233
|
:param title: The big text title
|
|
226
234
|
:param summary: The big text summary
|
|
227
235
|
"""
|
|
236
|
+
self.body = str(body)
|
|
228
237
|
set_big_text(builder=self.builder, body=str(body), title=str(title), summary=str(summary))
|
|
229
238
|
|
|
230
239
|
def setSubText(self, text):
|
|
@@ -359,7 +368,7 @@ class Notification(BaseNotification):
|
|
|
359
368
|
In-Built Delay of 0.5 sec According to Android Docs Don't Update Progressbar too Frequently
|
|
360
369
|
"""
|
|
361
370
|
|
|
362
|
-
# To Cancel any queued timer from `updateProgressBar` method and to avoid race effect
|
|
371
|
+
# To Cancel any queued timer from `updateProgressBar` method and to avoid race effect in case it somehow gets called while in this method
|
|
363
372
|
# Avoiding Running `updateProgressBar.delayed_update` at all
|
|
364
373
|
# so didn't just set `self.__progress_bar_title` and `self.progress_current_value` to 0
|
|
365
374
|
if self.__update_timer:
|
|
@@ -453,10 +462,10 @@ class Notification(BaseNotification):
|
|
|
453
462
|
>>> self.setVibrate()
|
|
454
463
|
>>> self.setVibrate([0, 500, 200, 500])
|
|
455
464
|
"""
|
|
456
|
-
if on_android_platform() and BuildVersion < 26:
|
|
465
|
+
if on_android_platform() and BuildVersion.SDK_INT < 26:
|
|
457
466
|
pattern = pattern or [0, 500]
|
|
458
467
|
self.builder.setVibrate(pattern)
|
|
459
|
-
if not on_android_platform() or BuildVersion < 26:
|
|
468
|
+
if not on_android_platform() or BuildVersion.SDK_INT < 26:
|
|
460
469
|
logger.info(f"Vibration pattern set to {pattern}")
|
|
461
470
|
|
|
462
471
|
@staticmethod
|
|
@@ -474,7 +483,7 @@ class Notification(BaseNotification):
|
|
|
474
483
|
print("\n Sent Notification!!!")
|
|
475
484
|
displayed_args = [
|
|
476
485
|
"title", "message",
|
|
477
|
-
"
|
|
486
|
+
"sub_text", "body", "large_icon_path", "big_picture_path",
|
|
478
487
|
"progress_max_value",
|
|
479
488
|
'name', "channel_name",
|
|
480
489
|
]
|
|
@@ -545,43 +554,6 @@ class Notification(BaseNotification):
|
|
|
545
554
|
remove_buttons(self.builder)
|
|
546
555
|
self.refresh()
|
|
547
556
|
|
|
548
|
-
@run_on_ui_thread
|
|
549
|
-
def addNotificationStyle(self, style: str, already_sent=False):
|
|
550
|
-
"""Adds Style to Notification
|
|
551
|
-
|
|
552
|
-
NOTE: This method has Deprecated Use - (setLargeIcon, setBigPicture, setBigText and setLines) Instead
|
|
553
|
-
|
|
554
|
-
--------
|
|
555
|
-
Args:
|
|
556
|
-
style (str): required style
|
|
557
|
-
already_sent (bool,False): If notification was already sent
|
|
558
|
-
"""
|
|
559
|
-
|
|
560
|
-
if not on_android_platform():
|
|
561
|
-
# TODO for logs when not on android and style related to imgs extract app path from buildozer.spec and log
|
|
562
|
-
return False
|
|
563
|
-
|
|
564
|
-
if self.body:
|
|
565
|
-
self.setBigText(self.body)
|
|
566
|
-
|
|
567
|
-
elif self.lines_txt:
|
|
568
|
-
lines = self.lines_txt.split("\n")
|
|
569
|
-
self.setLines(lines)
|
|
570
|
-
|
|
571
|
-
elif self.big_picture_path or self.large_icon_path:
|
|
572
|
-
if self.big_picture_path:
|
|
573
|
-
self.setBigPicture(self.big_picture_path)
|
|
574
|
-
if self.large_icon_path:
|
|
575
|
-
self.setLargeIcon(self.large_icon_path)
|
|
576
|
-
|
|
577
|
-
elif self.progress_max_value or self.progress_current_value:
|
|
578
|
-
self.builder.setProgress(self.progress_max_value, self.progress_current_value or 0.1, False)
|
|
579
|
-
|
|
580
|
-
if already_sent:
|
|
581
|
-
self.refresh()
|
|
582
|
-
|
|
583
|
-
return True
|
|
584
|
-
|
|
585
557
|
def setLines(self, lines: list):
|
|
586
558
|
"""Pass in a list of strings to be used for lines"""
|
|
587
559
|
set_lines(builder=self.builder, lines=lines)
|
|
@@ -595,21 +567,28 @@ class Notification(BaseNotification):
|
|
|
595
567
|
return set_sound(self.builder, res_sound_name)
|
|
596
568
|
|
|
597
569
|
def fill_args(self, silent: bool = False, persistent=False, close_on_click=True):
|
|
598
|
-
"""Name Makes More sense than start_building
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
def start_building(self, silent: bool = False, persistent=False, close_on_click=True):
|
|
602
|
-
# Main use is for foreground service, bypassing .notify in .send method to let service.startForeground(...) send it
|
|
570
|
+
"""Name Makes More sense than start_building
|
|
571
|
+
Main use is for foreground service, bypassing .notify in .send method to let service.startForeground(...) send it
|
|
572
|
+
"""
|
|
603
573
|
self.silent = silent or self.silent
|
|
604
574
|
if not on_android_platform():
|
|
605
575
|
return NotificationCompatBuilder # this is just a facade
|
|
606
576
|
self.__create_basic_notification(persistent, close_on_click)
|
|
607
|
-
if self.style not in ['simple', '']:
|
|
608
|
-
self.addNotificationStyle(self.style)
|
|
609
577
|
self.__applyNewLinesIfAny()
|
|
610
578
|
|
|
611
579
|
return self.builder
|
|
612
580
|
|
|
581
|
+
def start_building(self, silent: bool = False, persistent=False, close_on_click=True):
|
|
582
|
+
logger.warning("Please Use `fill_args` instead of `start_building`, `start_building` method will be removed in next major release")
|
|
583
|
+
return self.fill_args(silent, persistent , close_on_click)
|
|
584
|
+
|
|
585
|
+
def setOnlyAlertOnce(self, state: bool):
|
|
586
|
+
self.__only_alert_once_state = state
|
|
587
|
+
if not on_android_platform():
|
|
588
|
+
return
|
|
589
|
+
if self.builder:
|
|
590
|
+
self.builder.setOnlyAlertOnce(self.__only_alert_once_state)
|
|
591
|
+
|
|
613
592
|
def __applyNewLinesIfAny(self):
|
|
614
593
|
if self.__lines:
|
|
615
594
|
set_lines(builder=self.builder, lines=self.__lines)
|
|
@@ -629,7 +608,7 @@ class Notification(BaseNotification):
|
|
|
629
608
|
self.builder.setContentText(str(self.message))
|
|
630
609
|
self.__insert_app_icon()
|
|
631
610
|
self.builder.setDefaults(NotificationCompat.DEFAULT_ALL)
|
|
632
|
-
self.builder.setOnlyAlertOnce(
|
|
611
|
+
self.builder.setOnlyAlertOnce(self.__only_alert_once_state)
|
|
633
612
|
self.builder.setOngoing(persistent)
|
|
634
613
|
self.builder.setAutoCancel(close_on_click)
|
|
635
614
|
|
|
@@ -737,6 +716,16 @@ class Notification(BaseNotification):
|
|
|
737
716
|
return int(time.time() * 1000) % 2_147_483_647
|
|
738
717
|
|
|
739
718
|
notification_id = self.notification_ids[-1] + 1
|
|
719
|
+
try:
|
|
720
|
+
ids_in_tray = get_active_notification_ids(notification_manager = get_notification_manager())
|
|
721
|
+
if notification_id in ids_in_tray:
|
|
722
|
+
for _ in ids_in_tray: # I am avoiding while loops
|
|
723
|
+
notification_id = notification_id + 1
|
|
724
|
+
if notification_id not in ids_in_tray:
|
|
725
|
+
break
|
|
726
|
+
except Exception as error_getting_id_that_is_not_in_tray:
|
|
727
|
+
logger.exception(error_getting_id_that_is_not_in_tray)
|
|
728
|
+
traceback.print_exc()
|
|
740
729
|
self.notification_ids.append(notification_id)
|
|
741
730
|
return notification_id
|
|
742
731
|
|
|
@@ -758,6 +747,27 @@ class Notification(BaseNotification):
|
|
|
758
747
|
def isUsingCustom(self):
|
|
759
748
|
self.__using_custom = self.title_color or self.message_color
|
|
760
749
|
return bool(self.__using_custom)
|
|
750
|
+
|
|
751
|
+
def setObeyUserClear(self, state: bool):
|
|
752
|
+
"""
|
|
753
|
+
Control whether the notification reappears when updated by the app
|
|
754
|
+
after the user clears it.
|
|
755
|
+
|
|
756
|
+
Android 6+.
|
|
757
|
+
"""
|
|
758
|
+
self.obey_user_clear = state
|
|
759
|
+
|
|
760
|
+
def isInTray(self) -> bool:
|
|
761
|
+
"""
|
|
762
|
+
Check whether this notification is currently present in the system tray.
|
|
763
|
+
|
|
764
|
+
Android 6+.
|
|
765
|
+
:return: True if the notification is active in the tray, otherwise False.
|
|
766
|
+
"""
|
|
767
|
+
if not on_android_platform():
|
|
768
|
+
return False
|
|
769
|
+
return self.id in get_active_notification_ids(notification_manager = self.notification_manager)
|
|
770
|
+
|
|
761
771
|
# TODO method to create channel groups
|
|
762
772
|
|
|
763
773
|
|
|
@@ -782,7 +792,7 @@ class NotificationHandler:
|
|
|
782
792
|
|
|
783
793
|
saved_intent = cls.__name
|
|
784
794
|
cls.__name = None # so value won't be set when opening app not from notification
|
|
785
|
-
#
|
|
795
|
+
# rint('saved_intent ',saved_intent)
|
|
786
796
|
# if not saved_intent or (isinstance(saved_intent, str) and saved_intent.startswith("android.intent")):
|
|
787
797
|
# Below action is always None
|
|
788
798
|
# __PythonActivity = autoclass(ACTIVITY_CLASS_NAME)
|
|
@@ -791,8 +801,8 @@ class NotificationHandler:
|
|
|
791
801
|
# __Intent = autoclass('android.content.Intent')
|
|
792
802
|
# __intent = __Intent(__context, __PythonActivity)
|
|
793
803
|
# action = __intent.getAction()
|
|
794
|
-
#
|
|
795
|
-
#
|
|
804
|
+
# rint('Start up Intent ----', action)
|
|
805
|
+
# rint('start Up Title --->',__intent.getStringExtra("title"))
|
|
796
806
|
|
|
797
807
|
if on_start: # Using `on_start` arg because no way to know if opening from `Recents` only `Home Screen`
|
|
798
808
|
# if not saved_intent and cls.opened_from_notification:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: android-notify
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.61.0.dev0
|
|
4
4
|
Summary: A Python package that simplifies creating Android notifications in Kivy and Flet apps.
|
|
5
5
|
Author-email: Fabian <fector101@yahoo.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -81,7 +81,7 @@ In your **`buildozer.spec`** file, ensure you include the following:
|
|
|
81
81
|
|
|
82
82
|
```ini
|
|
83
83
|
# Add pyjnius so ensure it's packaged with the build
|
|
84
|
-
requirements = python3, kivy, pyjnius, android-notify==1.
|
|
84
|
+
requirements = python3, kivy, pyjnius, android-notify==1.61.0.dev0
|
|
85
85
|
# Add permission for notifications
|
|
86
86
|
android.permissions = POST_NOTIFICATIONS
|
|
87
87
|
```
|
|
@@ -99,7 +99,7 @@ In your `pyproject.toml` file, ensure you include the following:
|
|
|
99
99
|
```toml
|
|
100
100
|
[tool.flet.android]
|
|
101
101
|
dependencies = [
|
|
102
|
-
"pyjnius","android-notify==1.
|
|
102
|
+
"pyjnius","android-notify==1.61.0.dev0"
|
|
103
103
|
]
|
|
104
104
|
|
|
105
105
|
[tool.flet.android.permission]
|
|
@@ -117,10 +117,10 @@ dependencies = [
|
|
|
117
117
|
<br/>
|
|
118
118
|
|
|
119
119
|
On the [pydroid 3](https://play.google.com/store/apps/details?id=ru.iiec.pydroid3) mobile app for running python code you can test some features.
|
|
120
|
-
- In pip section where you're asked to insert `Libary name` paste `android-notify==1.
|
|
120
|
+
- In pip section where you're asked to insert `Libary name` paste `android-notify==1.61.0.dev0`
|
|
121
121
|
- Minimal working example
|
|
122
122
|
```py
|
|
123
|
-
# Testing with `android-notify==1.
|
|
123
|
+
# Testing with `android-notify==1.61.0.dev0` on pydroid
|
|
124
124
|
from kivy.app import App
|
|
125
125
|
from kivy.uix.boxlayout import BoxLayout
|
|
126
126
|
from kivy.uix.button import Button
|
{android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify.egg-info/SOURCES.txt
RENAMED
|
@@ -48,5 +48,4 @@ android_notify/tests/flet/flet-working/src/main.py
|
|
|
48
48
|
android_notify/tests/p4a/hook.py
|
|
49
49
|
android_notify/tests/serivces/wallpaper.py
|
|
50
50
|
android_notify/widgets/images.py
|
|
51
|
-
android_notify/widgets/texts.py
|
|
52
|
-
docs/website/src/pages/data/laner_Sent.py
|
|
51
|
+
android_notify/widgets/texts.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "android-notify"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.61.0.dev0"
|
|
8
8
|
description = "A Python package that simplifies creating Android notifications in Kivy and Flet apps."
|
|
9
9
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
10
10
|
authors = [
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
const ResponsiveText: React.FC = () => {
|
|
4
|
-
const [fontSize, setFontSize] = useState<string>(getFontSize());
|
|
5
|
-
|
|
6
|
-
function getFontSize(): string {
|
|
7
|
-
return window.innerWidth < 600 ? '12px' : '16px';
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
const handleResize = () => setFontSize(getFontSize());
|
|
12
|
-
|
|
13
|
-
window.addEventListener('resize', handleResize);
|
|
14
|
-
return () => window.removeEventListener('resize', handleResize);
|
|
15
|
-
}, []);
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<p style={{ fontSize }}>
|
|
19
|
-
This text adjusts size based on screen width!
|
|
20
|
-
</p>
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default ResponsiveText;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/an_types.py
RENAMED
|
File without changes
|
{android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/channels.py
RENAMED
|
File without changes
|
{android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/facade.py
RENAMED
|
File without changes
|
{android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/intents.py
RENAMED
|
File without changes
|
{android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/java_classes.py
RENAMED
|
File without changes
|
{android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/internal/logger.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/base_test.py
RENAMED
|
File without changes
|
{android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify/tests/flet/adv/main.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify.egg-info/requires.txt
RENAMED
|
File without changes
|
{android_notify-1.60.10.dev0 → android_notify-1.61.0.dev0}/android_notify.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|