FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonnative/src/pythonnative/native_modules/share.py at main · pythonnative/pythonnative · GitHub
pythonnative
/
pythonnative
Public
Notifications
You must be signed in to change notification settings
Fork
23
Star
131
Code
Issues
11
Pull requests
4
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
pythonnative
/
src
/
pythonnative
/
native_modules
/
share.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
51 lines (39 loc) · 1.44 KB
Breadcrumbs
pythonnative
/
src
/
pythonnative
/
native_modules
/
share.py
Copy path
File metadata and controls
51 lines (39 loc) · 1.44 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""Present the system share sheet.
[`Share.share`][pythonnative.Share] is a coroutine that opens
``UIActivityViewController`` (iOS) or an ``ACTION_SEND`` chooser
(Android) through the native ``Share`` module and resolves to ``True``
once the user completes a share or ``False`` if they dismiss it.
Example:
```python
import pythonnative as pn
async def share_link():
await pn.Share.share(
message="Check out PythonNative!",
url="https://example.com",
)
```
"""
from
__future__
import
annotations
from
typing
import
Optional
from
.
registry
import
native_module
class
Share
:
"""System share-sheet interface."""
@
staticmethod
async
def
share
(
*
,
message
:
Optional
[
str
]
=
None
,
url
:
Optional
[
str
]
=
None
,
title
:
Optional
[
str
]
=
None
,
)
->
bool
:
"""Open the share sheet with ``message`` / ``url``.
Args:
message: Text body to share.
url: A URL to share (combined with ``message`` on Android).
title: Chooser title (Android) / subject (iOS mail).
Returns:
``True`` if the user completed a share, ``False`` if they
dismissed the sheet or the platform has no share UI (tests).
Raises:
NativeModuleError: If the sheet could not be presented.
"""
return
bool
(
await
native_module
(
"Share"
).
call_async
(
"share"
,
message
=
message
,
url
=
url
,
title
=
title
))
Back
|
FazBrowse Home
|
New Git URL