mirror of
https://github.com/block/buzz.git
synced 2026-10-29 21:41:33 +00:00
Make the push gateway origin configurable across the relay, gateway, mobile client, and deployment chart. This is a fresh deployment. The gateway has only run on personal development infrastructure, and push has no existing enabled users. Legacy migration, configured-to-unconfigured mobile transitions, and rolling upgrades from pre-launch gateway binaries are not supported. Populated pre-launch databases are rejected with an informative error before migrations run; their data is untouched. Mobile builds may omit the gateway URL, leaving push unavailable. Once push is enabled, subsequent builds must retain that configuration. ### Validation - All applicable CI checks pass at `5f546cfaf403f0386f146d213adfb4392f4ec29c`, including Rust, mobile/Swift, desktop/integration, security, image builds, and Helm checks. An unrelated agent cancellation test passed on retry. - PostgreSQL CI passed 384 tests, including the production-entry-point regression for refusing populated pre-launch databases before migrations, fresh initialization, and subsequent initialized deployments. - Focused local validation passed all 10 gateway PostgreSQL tests under the CI discovery filter and all 3 unconfigured-mobile tests. Repository-wide PostgreSQL discovery validation and the complete pre-push hooks passed. - Physical-device APNs/App Attest behavior and deployment to a live cluster were not verified in this work. --------- Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: Codex <noreply@openai.com>
94 lines
3.3 KiB
Dart
94 lines
3.3 KiB
Dart
part of '../settings_page.dart';
|
|
|
|
class _NotificationsSection extends ConsumerWidget {
|
|
const _NotificationsSection();
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
if (defaultTargetPlatform != TargetPlatform.iOS) {
|
|
return const SizedBox.shrink();
|
|
}
|
|
final community = ref.watch(activeCommunityProvider).value;
|
|
if (community == null) return const SizedBox.shrink();
|
|
if (!Env.pushGatewayConfigured) {
|
|
return AppListCard(
|
|
label: 'Notifications',
|
|
verticalPadding: Grid.twelve,
|
|
children: [
|
|
AppListRow(
|
|
key: const ValueKey('push-notifications-unavailable'),
|
|
icon: LucideIcons.bell,
|
|
title: 'Push notifications',
|
|
subtitle: 'Unavailable in this build',
|
|
),
|
|
],
|
|
);
|
|
}
|
|
final authorization = ref.watch(buzzPushAuthorizationStatusProvider);
|
|
final status = authorization.value;
|
|
final permissionUnavailable = authorization.hasError;
|
|
final permissionDenied = status == BuzzPushAuthorizationStatus.denied;
|
|
final showSettingsRecovery =
|
|
community.pushNotificationsEnabled &&
|
|
(permissionDenied || permissionUnavailable);
|
|
final subtitle = !community.pushNotificationsEnabled
|
|
? 'Off for this community'
|
|
: switch (status) {
|
|
BuzzPushAuthorizationStatus.notDetermined =>
|
|
'Waiting for iOS notification permission',
|
|
BuzzPushAuthorizationStatus.denied =>
|
|
'Enabled in Buzz, but disabled in iOS Settings',
|
|
BuzzPushAuthorizationStatus.authorized ||
|
|
BuzzPushAuthorizationStatus.provisional ||
|
|
BuzzPushAuthorizationStatus.ephemeral =>
|
|
'Receive message notifications from this community',
|
|
null when authorization.isLoading =>
|
|
'Checking iOS notification permission',
|
|
null => 'Enabled in Buzz; iOS permission status unavailable',
|
|
};
|
|
|
|
return AppListCard(
|
|
label: 'Notifications',
|
|
verticalPadding: Grid.twelve,
|
|
children: [
|
|
AppListRow(
|
|
key: const ValueKey('push-notifications-enabled'),
|
|
icon: LucideIcons.bell,
|
|
title: 'Push notifications',
|
|
subtitle: subtitle,
|
|
subtitleStyle: showSettingsRecovery
|
|
? context.textTheme.bodySmall?.copyWith(
|
|
color: context.colors.error,
|
|
)
|
|
: null,
|
|
trailing: Switch.adaptive(
|
|
value: community.pushNotificationsEnabled,
|
|
onChanged: (enabled) => unawaited(
|
|
ref
|
|
.read(communityListProvider.notifier)
|
|
.setPushNotificationsEnabled(community.id, enabled),
|
|
),
|
|
),
|
|
onTap: () => unawaited(
|
|
ref
|
|
.read(communityListProvider.notifier)
|
|
.setPushNotificationsEnabled(
|
|
community.id,
|
|
!community.pushNotificationsEnabled,
|
|
),
|
|
),
|
|
),
|
|
if (showSettingsRecovery)
|
|
AppListRow(
|
|
key: const ValueKey('push-notifications-open-settings'),
|
|
icon: LucideIcons.settings,
|
|
title: 'Open iOS Notification Settings',
|
|
onTap: () => unawaited(
|
|
ref.read(buzzPushNotificationSettingsOpenerProvider)(),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|