FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonnative/src/pythonnative/sdk/services.py at v0.43.1 · pythonnative/pythonnative · GitHub
pythonnative
pythonnative
Repository navigation
Code
Issues
11
(11)
Pull requests
4
(4)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
pythonnative
/
src
/
pythonnative
/
sdk
/
services.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
144 lines (85 loc) · 4.62 KB
Breadcrumbs
pythonnative
/
src
/
pythonnative
/
sdk
/
services.py
Copy path
File metadata and controls
144 lines (85 loc) · 4.62 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
"""Canonical service interfaces shared by built-ins and extensions."""
# Protocol members are schema declarations. User-facing service docstrings live
# on the public facades in native_modules, rather than duplicating that API here.
# ruff: noqa: D101, D102
from
__future__
import
annotations
from
typing
import
Any
,
Dict
,
List
,
Literal
,
Optional
,
Protocol
from
.
schema
import
ModuleSchema
,
register_schema
class
DeviceService
(
Protocol
):
def
info
(
self
)
->
Dict
[
str
,
Any
]: ...
class
AppStateService
(
Protocol
):
def
current_state
(
self
)
->
str
: ...
class
StorageService
(
Protocol
):
def
get
(
self
,
key
:
str
)
->
Optional
[
str
]: ...
def
set
(
self
,
key
:
str
,
value
:
str
)
->
None
: ...
def
delete
(
self
,
key
:
str
)
->
None
: ...
def
all_keys
(
self
)
->
List
[
str
]: ...
def
clear
(
self
)
->
None
: ...
class
SecureStoreService
(
Protocol
):
def
set_item
(
self
,
key
:
str
,
value
:
str
)
->
bool
: ...
def
get_item
(
self
,
key
:
str
)
->
Optional
[
str
]: ...
def
delete_item
(
self
,
key
:
str
)
->
bool
: ...
def
clear
(
self
)
->
None
: ...
class
ClipboardService
(
Protocol
):
def
set_string
(
self
,
text
:
str
)
->
None
: ...
def
get_string
(
self
)
->
str
: ...
class
AlertService
(
Protocol
):
def
show
(
self
,
title
:
str
,
message
:
Optional
[
str
],
buttons
:
List
[
Dict
[
str
,
Any
]],
style
:
str
)
->
None
: ...
async
def
present
(
self
,
title
:
str
,
message
:
Optional
[
str
],
buttons
:
List
[
Dict
[
str
,
Any
]],
style
:
str
)
->
int
: ...
class
ShareService
(
Protocol
):
async
def
share
(
self
,
message
:
Optional
[
str
]
=
None
,
url
:
Optional
[
str
]
=
None
,
title
:
Optional
[
str
]
=
None
)
->
bool
: ...
class
LinkingService
(
Protocol
):
def
open_url
(
self
,
url
:
str
)
->
bool
: ...
def
can_open_url
(
self
,
url
:
str
)
->
bool
: ...
def
open_settings
(
self
)
->
bool
: ...
class
HapticsService
(
Protocol
):
def
impact
(
self
,
style
:
str
=
"medium"
)
->
None
: ...
def
notification
(
self
,
type
:
str
=
"success"
)
->
None
: ...
def
selection
(
self
)
->
None
: ...
def
vibrate
(
self
,
duration_ms
:
int
=
400
)
->
None
: ...
def
cancel
(
self
)
->
None
: ...
class
BatteryService
(
Protocol
):
def
get_level
(
self
)
->
float
: ...
def
get_state
(
self
)
->
str
: ...
class
NetInfoService
(
Protocol
):
def
fetch
(
self
)
->
Optional
[
Dict
[
str
,
Any
]]: ...
class
PermissionsService
(
Protocol
):
def
check
(
self
,
permission
:
str
)
->
str
: ...
async
def
request
(
self
,
permission
:
str
)
->
str
: ...
class
NotificationsService
(
Protocol
):
async
def
request_permission
(
self
)
->
bool
: ...
async
def
schedule
(
self
,
title
:
str
,
body
:
str
=
""
,
delay_seconds
:
float
=
0
,
identifier
:
str
=
"default"
)
->
bool
: ...
async
def
cancel
(
self
,
identifier
:
str
=
"default"
)
->
None
: ...
async
def
get_device_token
(
self
)
->
Optional
[
str
]: ...
class
CameraService
(
Protocol
):
async
def
take_photo
(
self
,
*
,
quality
:
float
=
0.9
,
allow_editing
:
bool
=
False
)
->
Optional
[
str
]: ...
async
def
pick_from_gallery
(
self
,
*
,
quality
:
float
=
0.9
,
allow_editing
:
bool
=
False
)
->
Optional
[
str
]: ...
class
LocationService
(
Protocol
):
async
def
get_current
(
self
,
*
,
accuracy
:
Literal
[
"balanced"
,
"high"
]
=
"balanced"
,
timeout
:
float
=
10.0
)
->
Optional
[
Dict
[
str
,
float
]]: ...
class
BiometricsService
(
Protocol
):
def
is_available
(
self
)
->
bool
: ...
async
def
authenticate
(
self
,
reason
:
str
=
"Authenticate"
)
->
bool
: ...
def
install_services
()
->
None
:
"""Register the canonical interfaces without constructing service objects."""
register_schema
(
ModuleSchema
.
from_protocol
(
"Device"
,
DeviceService
))
register_schema
(
ModuleSchema
.
from_protocol
(
"AppState"
,
AppStateService
))
register_schema
(
ModuleSchema
.
from_protocol
(
"Storage"
,
StorageService
))
register_schema
(
ModuleSchema
.
from_protocol
(
"SecureStore"
,
SecureStoreService
))
register_schema
(
ModuleSchema
.
from_protocol
(
"Clipboard"
,
ClipboardService
))
register_schema
(
ModuleSchema
.
from_protocol
(
"Alert"
,
AlertService
))
register_schema
(
ModuleSchema
.
from_protocol
(
"Share"
,
ShareService
))
register_schema
(
ModuleSchema
.
from_protocol
(
"Linking"
,
LinkingService
))
register_schema
(
ModuleSchema
.
from_protocol
(
"Haptics"
,
HapticsService
))
register_schema
(
ModuleSchema
.
from_protocol
(
"Battery"
,
BatteryService
))
register_schema
(
ModuleSchema
.
from_protocol
(
"NetInfo"
,
NetInfoService
))
register_schema
(
ModuleSchema
.
from_protocol
(
"Permissions"
,
PermissionsService
))
register_schema
(
ModuleSchema
.
from_protocol
(
"Notifications"
,
NotificationsService
))
register_schema
(
ModuleSchema
.
from_protocol
(
"Camera"
,
CameraService
))
register_schema
(
ModuleSchema
.
from_protocol
(
"Location"
,
LocationService
))
register_schema
(
ModuleSchema
.
from_protocol
(
"Biometrics"
,
BiometricsService
))
Back
|
FazBrowse Home
|
New Git URL