android-notify 1.59__py3-none-any.whl → 1.59.2__py3-none-any.whl
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.
Potentially problematic release.
This version of android-notify might be problematic. Click here for more details.
- android_notify/an_utils.py +10 -0
- android_notify/styles.py +7 -1
- android_notify/sword.py +40 -11
- {android_notify-1.59.dist-info → android_notify-1.59.2.dist-info}/METADATA +10 -8
- android_notify-1.59.2.dist-info/RECORD +12 -0
- android_notify-1.59.dist-info/RECORD +0 -11
- {android_notify-1.59.dist-info → android_notify-1.59.2.dist-info}/WHEEL +0 -0
- {android_notify-1.59.dist-info → android_notify-1.59.2.dist-info}/top_level.txt +0 -0
android_notify/styles.py
CHANGED
|
@@ -6,8 +6,14 @@ class NotificationStyles:
|
|
|
6
6
|
|
|
7
7
|
PROGRESS = "progress"
|
|
8
8
|
INBOX = "inbox"
|
|
9
|
+
|
|
10
|
+
# v1.59+
|
|
11
|
+
# Deprecated
|
|
12
|
+
# setBigText == Notification(...,big_picture_path="...",style=NotificationStyles.BIG_TEXT)
|
|
13
|
+
# setLargeIcon == Notification(...,large_icon_path="...",style=NotificationStyles.LARGE_ICON)
|
|
14
|
+
# setBigPicture == Notification(...,body="...",style=NotificationStyles.BIG_PICTURE)
|
|
15
|
+
# Use .refresh to apply any new changes after .send
|
|
9
16
|
BIG_TEXT = "big_text"
|
|
10
|
-
|
|
11
17
|
LARGE_ICON = "large_icon"
|
|
12
18
|
BIG_PICTURE = "big_picture"
|
|
13
19
|
BOTH_IMGS = "both_imgs"
|
android_notify/sword.py
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
import traceback
|
|
3
3
|
import os,re
|
|
4
4
|
import threading
|
|
5
|
+
|
|
6
|
+
|
|
5
7
|
from .an_types import Importance
|
|
8
|
+
from .an_utils import can_accept_arguments
|
|
6
9
|
from .styles import NotificationStyles
|
|
7
10
|
from .base import BaseNotification
|
|
8
11
|
DEV=0
|
|
@@ -31,7 +34,7 @@ try:
|
|
|
31
34
|
IconCompat = autoclass('androidx.core.graphics.drawable.IconCompat')
|
|
32
35
|
ON_ANDROID = True
|
|
33
36
|
except Exception as e:
|
|
34
|
-
if e.name != 'android':
|
|
37
|
+
if hasattr(e,'name') and e.name != 'android':
|
|
35
38
|
print('Exception: ',e)
|
|
36
39
|
print(traceback.format_exc())
|
|
37
40
|
|
|
@@ -218,7 +221,7 @@ class Notification(BaseNotification):
|
|
|
218
221
|
|
|
219
222
|
def setSmallIcon(self,path):
|
|
220
223
|
"""
|
|
221
|
-
sets small icon to the top
|
|
224
|
+
sets small icon to the top left
|
|
222
225
|
:param path: can be `Relative Path` or `URL`
|
|
223
226
|
:return:
|
|
224
227
|
"""
|
|
@@ -241,6 +244,10 @@ class Notification(BaseNotification):
|
|
|
241
244
|
print('Done setting large icon')
|
|
242
245
|
|
|
243
246
|
def setBigText(self,body):
|
|
247
|
+
"""Sets a big text for when drop down button is pressed
|
|
248
|
+
|
|
249
|
+
:param body: The big text that will be displayed
|
|
250
|
+
"""
|
|
244
251
|
if ON_ANDROID:
|
|
245
252
|
big_text_style = NotificationCompatBigTextStyle()
|
|
246
253
|
big_text_style.bigText(str(body))
|
|
@@ -526,7 +533,12 @@ class Notification(BaseNotification):
|
|
|
526
533
|
return True
|
|
527
534
|
|
|
528
535
|
def __dispatch_notification(self):
|
|
529
|
-
|
|
536
|
+
if NotificationHandler.has_permission():
|
|
537
|
+
self.notification_manager.notify(self.__id, self.__builder.build())
|
|
538
|
+
else:
|
|
539
|
+
print('Permission not granted to send notifications')
|
|
540
|
+
# Not asking for permission too frequently, This makes dialog popup to stop showing
|
|
541
|
+
# NotificationHandler.asks_permission()
|
|
530
542
|
|
|
531
543
|
def __start_notification_build(self, persistent, close_on_click):
|
|
532
544
|
self.__create_basic_notification(persistent, close_on_click)
|
|
@@ -552,7 +564,8 @@ class Notification(BaseNotification):
|
|
|
552
564
|
self.__built_parameter_filled = True
|
|
553
565
|
|
|
554
566
|
def __insert_app_icon(self,path=''):
|
|
555
|
-
if path or self.app_icon not in ['','Defaults to package app icon']:
|
|
567
|
+
if BuildVersion.SDK_INT >= 23 and (path or self.app_icon not in ['','Defaults to package app icon']):
|
|
568
|
+
# Bitmap Insert as Icon Not available below Android 6
|
|
556
569
|
if self.logs:
|
|
557
570
|
print('getting custom icon...')
|
|
558
571
|
self.__set_icon_from_bitmap(path or self.app_icon)
|
|
@@ -768,7 +781,7 @@ class NotificationHandler:
|
|
|
768
781
|
"""For Notification Operations """
|
|
769
782
|
__name = None
|
|
770
783
|
__bound = False
|
|
771
|
-
|
|
784
|
+
__requesting_permission=False
|
|
772
785
|
@classmethod
|
|
773
786
|
def get_name(cls):
|
|
774
787
|
"""Returns name or id str for Clicked Notification."""
|
|
@@ -876,22 +889,38 @@ class NotificationHandler:
|
|
|
876
889
|
return check_permission(Permission.POST_NOTIFICATIONS)
|
|
877
890
|
|
|
878
891
|
@classmethod
|
|
892
|
+
@run_on_ui_thread
|
|
879
893
|
def asks_permission(cls,callback=None):
|
|
880
894
|
"""
|
|
881
895
|
Ask for permission to send notifications if needed.
|
|
896
|
+
Passes True to callback if access granted
|
|
882
897
|
"""
|
|
883
|
-
if not ON_ANDROID:
|
|
884
|
-
return
|
|
885
|
-
|
|
886
|
-
|
|
898
|
+
if cls.__requesting_permission or not ON_ANDROID:
|
|
899
|
+
return True
|
|
900
|
+
|
|
901
|
+
def on_permissions_result(permissions, grants):
|
|
887
902
|
try:
|
|
888
903
|
if callback:
|
|
889
|
-
callback
|
|
904
|
+
if can_accept_arguments(callback, True):
|
|
905
|
+
callback(grants[0])
|
|
906
|
+
else:
|
|
907
|
+
callback()
|
|
890
908
|
except Exception as request_permission_error:
|
|
891
909
|
print('Exception: ',request_permission_error)
|
|
892
|
-
print('Permission
|
|
910
|
+
print('Permission response callback error: ',traceback.format_exc())
|
|
911
|
+
finally:
|
|
912
|
+
cls.__requesting_permission = False
|
|
913
|
+
|
|
893
914
|
if not cls.has_permission():
|
|
915
|
+
cls.__requesting_permission = True
|
|
894
916
|
request_permissions([Permission.POST_NOTIFICATIONS],on_permissions_result)
|
|
917
|
+
else:
|
|
918
|
+
cls.__requesting_permission = False
|
|
919
|
+
if callback:
|
|
920
|
+
if can_accept_arguments(callback,True):
|
|
921
|
+
callback(True)
|
|
922
|
+
else:
|
|
923
|
+
callback()
|
|
895
924
|
|
|
896
925
|
|
|
897
926
|
NotificationHandler.bindNotifyListener()
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: android-notify
|
|
3
|
-
Version: 1.59
|
|
3
|
+
Version: 1.59.2
|
|
4
4
|
Summary: A Python package that simplifies creating Android notifications in Kivy apps.
|
|
5
|
-
Home-page: https://
|
|
5
|
+
Home-page: https://android-notify.vercel.app
|
|
6
6
|
Author: Fabian
|
|
7
7
|
Author-email: fector101@yahoo.com
|
|
8
8
|
License: MIT
|
|
9
|
-
Project-URL: Documentation, https://android-notify.vercel.app/
|
|
9
|
+
Project-URL: Documentation, https://android-notify.vercel.app/
|
|
10
10
|
Project-URL: Source, https://github.com/fector101/android-notify
|
|
11
11
|
Project-URL: Tracker, https://github.com/fector101/android-notify/issues
|
|
12
12
|
Project-URL: Funding, https://www.buymeacoffee.com/fector101
|
|
@@ -36,13 +36,13 @@ Dynamic: summary
|
|
|
36
36
|
|
|
37
37
|
<div align="center">
|
|
38
38
|
<br>
|
|
39
|
-
<h1> Android-
|
|
40
|
-
<p><a href='https://android-notify.vercel.app
|
|
39
|
+
<h1> Android-Notify </h1>
|
|
40
|
+
<p><a href='https://android-notify.vercel.app'>Android Notify</a> is a Python library for effortlessly creating and managing Android notifications in Kivy apps.</p>
|
|
41
41
|
<p>Supports various styles and ensures seamless integration, customization and Pythonic APIs.</p>
|
|
42
42
|
<!-- <br> -->
|
|
43
43
|
<!-- <img src="https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/democollage.jpg"> -->
|
|
44
44
|
</div>
|
|
45
|
-
<!--
|
|
45
|
+
<!-- Channel [CRUD]
|
|
46
46
|
The Android Notify package provides a simple yet comprehensive way to create and manage rich notifications on Android devices directly from your Python code. This library bridges the gap between Python and Android's notification system, giving you full control over notifications with a clean, Pythonic API. -->
|
|
47
47
|
|
|
48
48
|
## Features
|
|
@@ -60,10 +60,12 @@ The Android Notify package provides a simple yet comprehensive way to create and
|
|
|
60
60
|
- Add action buttons with custom callbacks
|
|
61
61
|
- Update notification content dynamically
|
|
62
62
|
- Manage progress bars with fine-grained control
|
|
63
|
-
- Custom notification
|
|
63
|
+
- Custom notification Icon
|
|
64
|
+
- Custom notification channels for Android 8.0+ (Creating and Deleting)
|
|
64
65
|
- Silent notifications
|
|
65
66
|
- Persistent notifications
|
|
66
67
|
- Click handlers and callbacks
|
|
68
|
+
- Cancel Notifications
|
|
67
69
|
|
|
68
70
|
## Quick Start
|
|
69
71
|
|
|
@@ -106,7 +108,7 @@ pip install android_notify
|
|
|
106
108
|
## Documentation
|
|
107
109
|
|
|
108
110
|
For full documentation, examples, and advanced usage, API reference visit the
|
|
109
|
-
[documentation](https://android-notify.vercel.app
|
|
111
|
+
[documentation](https://android-notify.vercel.app)
|
|
110
112
|
|
|
111
113
|
## ☕ Support the Project
|
|
112
114
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
android_notify/__init__.py,sha256=lcLjyfegXgU7cyGhfSphAOBipXwemrVkdYy3mcF6X5Y,172
|
|
2
|
+
android_notify/__main__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
android_notify/an_types.py,sha256=LlE0zzPskVG2topZx3mVETGu5MqnpThs58Ph392ocy4,2390
|
|
4
|
+
android_notify/an_utils.py,sha256=Io34r5JTorH3EbeR0bIfQ-8-bF3xO1wiVnvqafA2qyw,245
|
|
5
|
+
android_notify/base.py,sha256=Fgv3hf-vwu-GvivDsKxseOyeOrLmw1moNAv_mZKvA5M,3477
|
|
6
|
+
android_notify/core.py,sha256=Per4HFwYwP-mxHJqnwcLlWXsbZsSeeAYN49MmFU2qVk,6113
|
|
7
|
+
android_notify/styles.py,sha256=jLxeXB41HXe0fn3l07JZsHi-d0u-dESvsV_OqQow_Xc,726
|
|
8
|
+
android_notify/sword.py,sha256=DASgJ5t4HIYCLd_-my_WGi678M2v_7xEJO4oBDL-gOc,38450
|
|
9
|
+
android_notify-1.59.2.dist-info/METADATA,sha256=ogkrhZVaMdpIi8WBCTtqaG9ohj5eSEjhIGrVfEs8k_M,4375
|
|
10
|
+
android_notify-1.59.2.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
|
|
11
|
+
android_notify-1.59.2.dist-info/top_level.txt,sha256=IR1ONMrRSRINZpWn2X0dL5gbWwWINsK7PW8Jy2p4fU8,15
|
|
12
|
+
android_notify-1.59.2.dist-info/RECORD,,
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
android_notify/__init__.py,sha256=lcLjyfegXgU7cyGhfSphAOBipXwemrVkdYy3mcF6X5Y,172
|
|
2
|
-
android_notify/__main__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
android_notify/an_types.py,sha256=LlE0zzPskVG2topZx3mVETGu5MqnpThs58Ph392ocy4,2390
|
|
4
|
-
android_notify/base.py,sha256=Fgv3hf-vwu-GvivDsKxseOyeOrLmw1moNAv_mZKvA5M,3477
|
|
5
|
-
android_notify/core.py,sha256=Per4HFwYwP-mxHJqnwcLlWXsbZsSeeAYN49MmFU2qVk,6113
|
|
6
|
-
android_notify/styles.py,sha256=QBkCY8ZO26FnS-jPtRLf9CKEEnnYylmH9enCa5CNDes,354
|
|
7
|
-
android_notify/sword.py,sha256=hBNIJDDszEozbvkXHuWhmiRz-9q2Kz4WBEnV1LAe8vw,37291
|
|
8
|
-
android_notify-1.59.dist-info/METADATA,sha256=U4RSxaMqEaWBoS82Kp5L66992cka8MixFGwYlqYQiHM,4347
|
|
9
|
-
android_notify-1.59.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
|
|
10
|
-
android_notify-1.59.dist-info/top_level.txt,sha256=IR1ONMrRSRINZpWn2X0dL5gbWwWINsK7PW8Jy2p4fU8,15
|
|
11
|
-
android_notify-1.59.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|