-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #183 from nnsnodnb/support-liveactivity
Support LiveActivity
- Loading branch information
Showing
29 changed files
with
671 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,34 @@ | ||
from .clients.apns import ApnsClient | ||
from .clients.live_activity import LiveActivityClient | ||
from .clients.voip import VoIPClient | ||
from .models.apns_config import ApnsConfig | ||
from .models.apns_priority import ApnsPriority | ||
from .models.apns_push_type import ApnsPushType | ||
from .models.critical_sound import CriticalSound | ||
from .models.interruption_level import InterruptionLevel | ||
from .models.payload import Payload | ||
from .models.payload_alert import PayloadAlert | ||
from .models import ( | ||
ApnsConfig, | ||
ApnsPriority, | ||
ApnsPushType, | ||
CriticalSound, | ||
InterruptionLevel, | ||
LiveActivityApnsConfig, | ||
LiveActivityEvent, | ||
LiveActivityPayload, | ||
Payload, | ||
PayloadAlert, | ||
VoIPApnsConfig, | ||
) | ||
|
||
__all__ = [ | ||
"ApnsClient", | ||
"VoIPClient", | ||
"ApnsConfig", | ||
"ApnsPriority", | ||
"ApnsPushType", | ||
"CriticalSound", | ||
"InterruptionLevel", | ||
"LiveActivityApnsConfig", | ||
"LiveActivityClient", | ||
"LiveActivityEvent", | ||
"LiveActivityPayload", | ||
"Payload", | ||
"PayloadAlert", | ||
"VoIPClient", | ||
"VoIPApnsConfig", | ||
"exceptions", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from dataclasses import dataclass | ||
from typing import Any, Dict, Union | ||
|
||
from httpx import AsyncClient | ||
|
||
from ..models import LiveActivityApnsConfig, LiveActivityPayload | ||
from .apns import ApnsClient | ||
|
||
|
||
@dataclass | ||
class LiveActivityClient(ApnsClient): | ||
async def send_message( | ||
self, | ||
device_token: str, | ||
payload: Union[LiveActivityPayload, Dict[str, Any]], | ||
apns_config: LiveActivityApnsConfig, | ||
) -> str: | ||
return await super().send_message( | ||
device_token=device_token, | ||
payload=payload, | ||
apns_config=apns_config, | ||
) | ||
|
||
def _init_client(self, apns_config: LiveActivityApnsConfig) -> AsyncClient: | ||
return super()._init_client(apns_config=apns_config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
from .apns_config import ApnsConfig | ||
from .apns_config import ApnsConfig, LiveActivityApnsConfig, VoIPApnsConfig | ||
from .apns_priority import ApnsPriority | ||
from .apns_push_type import ApnsPushType | ||
from .critical_sound import CriticalSound | ||
from .interruption_level import InterruptionLevel | ||
from .payload import Payload | ||
from .live_activity_event import LiveActivityEvent | ||
from .payload import LiveActivityPayload, Payload | ||
from .payload_alert import PayloadAlert | ||
|
||
__all__ = [ | ||
"ApnsConfig", | ||
"LiveActivityApnsConfig", | ||
"VoIPApnsConfig", | ||
"ApnsPriority", | ||
"ApnsPushType", | ||
"CriticalSound", | ||
"InterruptionLevel", | ||
"LiveActivityEvent", | ||
"Payload", | ||
"LiveActivityPayload", | ||
"PayloadAlert", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from enum import Enum | ||
|
||
|
||
class LiveActivityEvent(Enum): | ||
START: str = "start" | ||
UPDATE: str = "update" | ||
END: str = "end" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.