From 8888ce88125af700e317a40732b1e13d44576ec3 Mon Sep 17 00:00:00 2001 From: Dat PHAM HOANG Date: Tue, 11 Mar 2025 12:45:44 +0700 Subject: [PATCH] Configurable push gateway with `PUSH_NOTIFICATIONS_GATEWAY_URL` --- docs/configurations/configure_push_gateway.md | 14 ++++++++++++++ lib/config/app_config.dart | 9 +++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 docs/configurations/configure_push_gateway.md diff --git a/docs/configurations/configure_push_gateway.md b/docs/configurations/configure_push_gateway.md new file mode 100644 index 0000000000..f7d8f29af1 --- /dev/null +++ b/docs/configurations/configure_push_gateway.md @@ -0,0 +1,14 @@ +## Configuration for push gateway + +1. get the push gateway url and add the postfix +``` +{pushGatewayUrl}/_matrix/push/v1/notify +``` +Fx: `https://sygnal.domain.dev/_matrix/push/v1/notify` + +2. build the app with `--dart-define` and the param `PUSH_NOTIFICATIONS_GATEWAY_URL` + +Fx: +``` +flutter build apk --release --dart-define=PUSH_NOTIFICATIONS_GATEWAY_URL=https://sygnal.domain.dev/_matrix/push/v1/notify +``` diff --git a/lib/config/app_config.dart b/lib/config/app_config.dart index fc45d6590d..1bf870c5f7 100644 --- a/lib/config/app_config.dart +++ b/lib/config/app_config.dart @@ -106,8 +106,13 @@ abstract class AppConfig { ? "app.twake.ios.chat" : "app.twake.ios.chat.sandbox" : "app.twake.android.chat"; - static const String pushNotificationsGatewayUrl = - 'https://sygnal.lin-saas.dev/_matrix/push/v1/notify'; + + static const String _pushNotificationsGatewayUrlEnv = String.fromEnvironment( + 'PUSH_NOTIFICATIONS_GATEWAY_URL', + defaultValue: 'https://sygnal.lin-saas.dev/_matrix/push/v1/notify', + ); + + static String pushNotificationsGatewayUrl = _pushNotificationsGatewayUrlEnv; static const String pushNotificationsPusherFormat = 'event_id_only'; static const String emojiFontName = 'Noto Emoji'; static const String emojiFontUrl =