create app correctly
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
7a70f7ccb4
commit
76ac14cb5a
|
@ -127,7 +127,7 @@ class MobileTransaction(ExpiringModel):
|
||||||
|
|
||||||
def send_message(self, request: Optional[HttpRequest], **context):
|
def send_message(self, request: Optional[HttpRequest], **context):
|
||||||
"""Send mobile message"""
|
"""Send mobile message"""
|
||||||
initialize_app(credentials.Certificate(self.device.stage.firebase_config))
|
app = initialize_app(credentials.Certificate(self.device.stage.firebase_config), name=str(self.tx_id))
|
||||||
branding = DEFAULT_TENANT.branding_title
|
branding = DEFAULT_TENANT.branding_title
|
||||||
domain = ""
|
domain = ""
|
||||||
if request:
|
if request:
|
||||||
|
@ -160,12 +160,13 @@ class MobileTransaction(ExpiringModel):
|
||||||
),
|
),
|
||||||
interruption_level="time-sensitive",
|
interruption_level="time-sensitive",
|
||||||
tx_id=str(self.tx_id),
|
tx_id=str(self.tx_id),
|
||||||
|
options=["foo", "bar", "baz"],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
token=self.device.firebase_token,
|
token=self.device.firebase_token,
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
response = send(message)
|
response = send(message, app=app)
|
||||||
LOGGER.debug("Sent notification", id=response)
|
LOGGER.debug("Sent notification", id=response)
|
||||||
except (ValueError, FirebaseError) as exc:
|
except (ValueError, FirebaseError) as exc:
|
||||||
LOGGER.warning("failed to push", exc=exc)
|
LOGGER.warning("failed to push", exc=exc)
|
||||||
|
|
Reference in New Issue