android-notify 1.59.3__py3-none-any.whl → 1.59.4__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/sword.py CHANGED
@@ -105,6 +105,7 @@ class Notification(BaseNotification):
105
105
  button_ids=[0]
106
106
  btns_box={}
107
107
  main_functions={}
108
+ passed_check = False
108
109
 
109
110
  # During Development (When running on PC)
110
111
  BaseNotification.logs=not ON_ANDROID
@@ -125,7 +126,9 @@ class Notification(BaseNotification):
125
126
 
126
127
  # For components
127
128
  self.__lines = []
128
-
129
+ self.__builder = None # want to make builder always available for getter
130
+ self.notification_manager = None
131
+
129
132
  self.__format_channel(self.channel_name, self.channel_id)
130
133
  if not ON_ANDROID:
131
134
  return
@@ -419,29 +422,51 @@ class Notification(BaseNotification):
419
422
  persistent (bool): True To not remove Notification When User hits clears All notifications button
420
423
  close_on_click (bool): True if you want Notification to be removed when clicked
421
424
  """
422
- self.silent= silent or self.silent
425
+ self.silent = silent or self.silent
423
426
  if ON_ANDROID:
424
427
  self.__start_notification_build(persistent, close_on_click)
425
428
  self.__dispatch_notification()
429
+
430
+ self.__send_logs()
431
+
432
+ def send_(self,silent:bool=False,persistent=False,close_on_click=True):
433
+ """Sends notification without checking for additional notification permission
426
434
 
427
- if self.logs:
428
- string_to_display=''
429
- print("\n Sent Notification!!!")
430
- for name,value in vars(self).items():
431
- if value and name in ["title", "message", "style", "body", "large_icon_path", "big_picture_path", "progress_current_value", "progress_max_value", "channel_name",'body','name']:
432
- if name == "progress_max_value":
433
- if self.style == NotificationStyles.PROGRESS:
434
- string_to_display += f'\n {name}: {value}'
435
- elif name == "body":
436
- if self.style == NotificationStyles.BIG_TEXT:
437
- string_to_display += f'\n {name}: {value}'
438
- else:
439
- string_to_display += f'\n {name}: {value}'
435
+ Args:
436
+ silent (bool): True if you don't want to show briefly on screen
437
+ persistent (bool): True To not remove Notification When User hits clears All notifications button
438
+ close_on_click (bool): True if you want Notification to be removed when clicked
439
+ """
440
+ self.passed_check = True
441
+ self.send(silent,persistent,close_on_click)
440
442
 
441
- string_to_display +="\n (Won't Print Logs When Complied,except if selected `Notification.logs=True`)"
442
- print(string_to_display)
443
- if DEV:
444
- print(f'channel_name: {self.channel_name}, Channel ID: {self.channel_id}, __id: {self.__id}')
443
+ def __send_logs(self):
444
+ if not self.logs:
445
+ return
446
+ string_to_display=''
447
+ print("\n Sent Notification!!!")
448
+ displayed_args = [
449
+ "title", "message",
450
+ "style", "body", "large_icon_path", "big_picture_path",
451
+ "progress_max_value",
452
+ 'name', "channel_name",
453
+ ]
454
+ is_progress_not_default = isinstance(self.progress_current_value, int) or (isinstance(self.progress_current_value, float) and self.progress_current_value != 0.0)
455
+ for name,value in vars(self).items():
456
+ if value and name in displayed_args:
457
+ if name == "progress_max_value":
458
+ if is_progress_not_default:
459
+ string_to_display += f'\n progress_current_value: {self.progress_current_value}, {name}: {value}'
460
+ elif name == "channel_name":
461
+ string_to_display += f'\n {name}: {value}, channel_id: {self.channel_id}'
462
+ else:
463
+ string_to_display += f'\n {name}: {value}'
464
+
465
+ string_to_display +="\n (Won't Print Logs When Complied,except if selected `Notification.logs=True`)"
466
+ print(string_to_display)
467
+
468
+ def builder(self):
469
+ return self.__builder
445
470
 
446
471
  def addButton(self, text:str,on_release):
447
472
  """For adding action buttons
@@ -556,8 +581,14 @@ class Notification(BaseNotification):
556
581
  print('Added Lines: ', lines)
557
582
 
558
583
  def __dispatch_notification(self):
559
- if NotificationHandler.has_permission():
560
- self.notification_manager.notify(self.__id, self.__builder.build())
584
+ # self.passed_check is for self.send_() some devices don't return true when checking for permission when it's actually True in settings
585
+ # And so users can do Notification.passed_check = True at top of their file and use regular .send()
586
+ if self.passed_check or NotificationHandler.has_permission():
587
+ try:
588
+ self.notification_manager.notify(self.__id, self.__builder.build())
589
+ except Exception as notify_error:
590
+ print('Exception:', notify_error)
591
+ print('Failed to send traceback:', traceback.format_exc())
561
592
  else:
562
593
  print('Permission not granted to send notifications')
563
594
  # Not asking for permission too frequently, This makes dialog popup to stop showing
@@ -1,119 +1,119 @@
1
- Metadata-Version: 2.4
2
- Name: android-notify
3
- Version: 1.59.3
4
- Summary: A Python package that simplifies creating Android notifications in Kivy apps.
5
- Home-page: https://android-notify.vercel.app
6
- Author: Fabian
7
- Author-email: fector101@yahoo.com
8
- License: MIT
9
- Project-URL: Documentation, https://android-notify.vercel.app/
10
- Project-URL: Source, https://github.com/fector101/android-notify
11
- Project-URL: Tracker, https://github.com/fector101/android-notify/issues
12
- Project-URL: Funding, https://www.buymeacoffee.com/fector101
13
- Keywords: android,notifications,kivy,mobile,post-notifications,pyjnius,android-notifications,kivy-notifications,python-android,mobile-development,push-notifications,mobile-app,kivy-application
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: License :: OSI Approved :: MIT License
16
- Classifier: Operating System :: Android
17
- Classifier: Development Status :: 5 - Production/Stable
18
- Classifier: Intended Audience :: Developers
19
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
- Requires-Python: >=3.6
21
- Description-Content-Type: text/markdown
22
- Requires-Dist: kivy>=2.0.0
23
- Requires-Dist: pyjnius>=1.4.2
24
- Dynamic: author
25
- Dynamic: author-email
26
- Dynamic: classifier
27
- Dynamic: description
28
- Dynamic: description-content-type
29
- Dynamic: home-page
30
- Dynamic: keywords
31
- Dynamic: license
32
- Dynamic: project-url
33
- Dynamic: requires-dist
34
- Dynamic: requires-python
35
- Dynamic: summary
36
-
37
- <div align="center">
38
- <br>
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
- <p>Supports various styles and ensures seamless integration, customization and Pythonic APIs.</p>
42
- <!-- <br> -->
43
- <!-- <img src="https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/democollage.jpg"> -->
44
- </div>
45
- <!-- Channel [CRUD]
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
-
48
- ## Features
49
-
50
- - **Multiple Notification Styles**: Support for various notification styles including:
51
- - Simple text notifications
52
- - Progress bar notifications (determinate and indeterminate)
53
- - Big text notifications
54
- - Inbox-style notifications
55
- - Large icon notifications
56
- - Big picture notifications
57
- - Combined image styles
58
-
59
- - **Rich Functionality**:
60
- - Add action buttons with custom callbacks
61
- - Update notification content dynamically
62
- - Manage progress bars with fine-grained control
63
- - Custom notification Icon
64
- - Custom notification channels for Android 8.0+ (Creating and Deleting)
65
- - Silent notifications
66
- - Persistent notifications
67
- - Click handlers and callbacks
68
- - Cancel Notifications
69
-
70
- ## Quick Start
71
-
72
- ```python
73
- from android_notify import Notification
74
-
75
- # Simple notification
76
- Notification(
77
- title="Hello",
78
- message="This is a basic notification."
79
- ).send()
80
-
81
- ```
82
-
83
- **Sample Image:**
84
- ![basic notification img sample](https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/basicnoti.jpg)
85
-
86
- ## Installation
87
-
88
- In your **`buildozer.spec`** file, ensure you include the following:
89
-
90
- ```ini
91
- # Add pyjnius so ensure it's packaged with the build
92
- requirements = python3, kivy, pyjnius, android-notify
93
- # Add permission for notifications
94
- android.permissions = POST_NOTIFICATIONS
95
-
96
- # Required dependencies (write exactly as shown, no quotation marks)
97
- android.gradle_dependencies = androidx.core:core:1.6.0, androidx.core:core-ktx:1.15.0
98
- android.enable_androidx = True
99
- android.api = 35
100
- ```
101
-
102
- Can be installed via `pip` For testing purposes:
103
-
104
- ```bash
105
- pip install android_notify
106
- ```
107
-
108
- ## Documentation
109
-
110
- For full documentation, examples, and advanced usage, API reference visit the
111
- [documentation](https://android-notify.vercel.app)
112
-
113
- ## ☕ Support the Project
114
-
115
- If you find this project helpful, consider buying me a coffee! 😊 Or Giving it a star on 🌟 [GitHub](https://github.com/Fector101/android_notify/) Your support helps maintain and improve the project.
116
-
117
- <a href="https://www.buymeacoffee.com/fector101" target="_blank">
118
- <img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="60">
119
- </a>
1
+ Metadata-Version: 2.4
2
+ Name: android-notify
3
+ Version: 1.59.4
4
+ Summary: A Python package that simplifies creating Android notifications in Kivy apps.
5
+ Home-page: https://android-notify.vercel.app
6
+ Author: Fabian
7
+ Author-email: fector101@yahoo.com
8
+ License: MIT
9
+ Project-URL: Documentation, https://android-notify.vercel.app/
10
+ Project-URL: Source, https://github.com/fector101/android-notify
11
+ Project-URL: Tracker, https://github.com/fector101/android-notify/issues
12
+ Project-URL: Funding, https://www.buymeacoffee.com/fector101
13
+ Keywords: android,notifications,kivy,mobile,post-notifications,pyjnius,android-notifications,kivy-notifications,python-android,mobile-development,push-notifications,mobile-app,kivy-application
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: Android
17
+ Classifier: Development Status :: 5 - Production/Stable
18
+ Classifier: Intended Audience :: Developers
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Requires-Python: >=3.6
21
+ Description-Content-Type: text/markdown
22
+ Requires-Dist: kivy>=2.0.0
23
+ Requires-Dist: pyjnius>=1.4.2
24
+ Dynamic: author
25
+ Dynamic: author-email
26
+ Dynamic: classifier
27
+ Dynamic: description
28
+ Dynamic: description-content-type
29
+ Dynamic: home-page
30
+ Dynamic: keywords
31
+ Dynamic: license
32
+ Dynamic: project-url
33
+ Dynamic: requires-dist
34
+ Dynamic: requires-python
35
+ Dynamic: summary
36
+
37
+ <div align="center">
38
+ <br>
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
+ <p>Supports various styles and ensures seamless integration, customization and Pythonic APIs.</p>
42
+ <!-- <br> -->
43
+ <!-- <img src="https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/democollage.jpg"> -->
44
+ </div>
45
+ <!-- Channel [CRUD]
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
+
48
+ ## Features
49
+
50
+ - **Multiple Notification Styles**: Support for various notification styles including:
51
+ - Simple text notifications
52
+ - Progress bar notifications (determinate and indeterminate)
53
+ - Big text notifications
54
+ - Inbox-style notifications
55
+ - Large icon notifications
56
+ - Big picture notifications
57
+ - Combined image styles
58
+
59
+ - **Rich Functionality**:
60
+ - Add action buttons with custom callbacks
61
+ - Update notification content dynamically
62
+ - Manage progress bars with fine-grained control
63
+ - Custom notification Icon
64
+ - Custom notification channels for Android 8.0+ (Creating and Deleting)
65
+ - Silent notifications
66
+ - Persistent notifications
67
+ - Click handlers and callbacks
68
+ - Cancel Notifications
69
+
70
+ ## Quick Start
71
+
72
+ ```python
73
+ from android_notify import Notification
74
+
75
+ # Simple notification
76
+ Notification(
77
+ title="Hello",
78
+ message="This is a basic notification."
79
+ ).send()
80
+
81
+ ```
82
+
83
+ **Sample Image:**
84
+ ![basic notification img sample](https://raw.githubusercontent.com/Fector101/android_notify/main/docs/imgs/basicnoti.jpg)
85
+
86
+ ## Installation
87
+
88
+ In your **`buildozer.spec`** file, ensure you include the following:
89
+
90
+ ```ini
91
+ # Add pyjnius so ensure it's packaged with the build
92
+ requirements = python3, kivy, pyjnius, android-notify
93
+ # Add permission for notifications
94
+ android.permissions = POST_NOTIFICATIONS
95
+
96
+ # Required dependencies (write exactly as shown, no quotation marks)
97
+ android.gradle_dependencies = androidx.core:core:1.6.0, androidx.core:core-ktx:1.15.0
98
+ android.enable_androidx = True
99
+ android.api = 35
100
+ ```
101
+
102
+ Can be installed via `pip` For testing purposes:
103
+
104
+ ```bash
105
+ pip install android_notify
106
+ ```
107
+
108
+ ## Documentation
109
+
110
+ For full documentation, examples, and advanced usage, API reference visit the
111
+ [documentation](https://android-notify.vercel.app)
112
+
113
+ ## ☕ Support the Project
114
+
115
+ If you find this project helpful, consider buying me a coffee! 😊 Or Giving it a star on 🌟 [GitHub](https://github.com/Fector101/android_notify/) Your support helps maintain and improve the project.
116
+
117
+ <a href="https://www.buymeacoffee.com/fector101" target="_blank">
118
+ <img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="60">
119
+ </a>
@@ -5,8 +5,8 @@ android_notify/an_utils.py,sha256=ZEP_67Til9WdX0nyFpVQ9lSJnUG6uyHMWzUn7Q6s1OI,45
5
5
  android_notify/base.py,sha256=PAF8-Jw60395O32ZGJ8xSJXIQbUglpYgngfJycCYCeY,3501
6
6
  android_notify/core.py,sha256=Per4HFwYwP-mxHJqnwcLlWXsbZsSeeAYN49MmFU2qVk,6113
7
7
  android_notify/styles.py,sha256=jLxeXB41HXe0fn3l07JZsHi-d0u-dESvsV_OqQow_Xc,726
8
- android_notify/sword.py,sha256=0bDNXUqZqa7OXP4mISmJjf6W8jUe-26Txfmsk-s3yKI,39810
9
- android_notify-1.59.3.dist-info/METADATA,sha256=NejpmdEysbWtDi2quXTlYZr23NoTbBFf-FKjwTIc3WE,4375
10
- android_notify-1.59.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
- android_notify-1.59.3.dist-info/top_level.txt,sha256=IR1ONMrRSRINZpWn2X0dL5gbWwWINsK7PW8Jy2p4fU8,15
12
- android_notify-1.59.3.dist-info/RECORD,,
8
+ android_notify/sword.py,sha256=PbqbYR2Wjt5d5DL346OLepaKhsAgd-MlnXY9UNAqv1U,41197
9
+ android_notify-1.59.4.dist-info/METADATA,sha256=skTNItz_1JsdBlCwHwnTD97XEzQB5cAcZi4z4w2wnmM,4494
10
+ android_notify-1.59.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
+ android_notify-1.59.4.dist-info/top_level.txt,sha256=IR1ONMrRSRINZpWn2X0dL5gbWwWINsK7PW8Jy2p4fU8,15
12
+ android_notify-1.59.4.dist-info/RECORD,,