Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion mobile/lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import 'shared/auth/auth.dart';
import 'shared/deeplink/pending_deep_link_provider.dart';
import 'shared/relay/relay.dart';
import 'shared/theme/theme.dart';
import 'shared/widgets/buzz_loading_indicator.dart';

class App extends HookConsumerWidget {
const App({super.key});
Expand Down Expand Up @@ -113,6 +114,10 @@ class _SplashScreen extends StatelessWidget {

@override
Widget build(BuildContext context) {
return const Scaffold(body: Center(child: CircularProgressIndicator()));
return const Scaffold(
body: Center(
child: BuzzLoadingIndicator(size: 56, semanticLabel: 'Starting Buzz'),
),
);
}
}
1 change: 1 addition & 0 deletions mobile/lib/features/activity/activity_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import '../../shared/relay/relay.dart';
import '../../shared/theme/theme.dart';
import '../../shared/utils/string_utils.dart';
import '../../shared/widgets/avatar_image.dart';
import '../../shared/widgets/buzz_loading_indicator.dart';
import '../../shared/widgets/frosted_app_bar.dart';
import '../../shared/widgets/frosted_scaffold.dart';
import '../../shared/widgets/message_author_meta.dart';
Expand Down
7 changes: 6 additions & 1 deletion mobile/lib/features/activity/activity_page/lists.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ class _RemindersList extends ConsumerWidget {
];

if (remindersAsync.isLoading && reminders.isEmpty) {
return const Center(child: CircularProgressIndicator());
return const Center(
child: BuzzLoadingIndicator(
size: 44,
semanticLabel: 'Loading reminders',
),
);
}
if (reminders.isEmpty) {
return const _EmptySurface(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';

import '../../../shared/theme/theme.dart';
import '../../../shared/widgets/buzz_loading_indicator.dart';
import '../../profile/user_cache_provider.dart';
import '../date_formatters.dart';
import 'observer_models.dart';
Expand Down Expand Up @@ -189,13 +190,10 @@ class _EmptyState extends StatelessWidget {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(
strokeWidth: 2,
color: context.colors.onSurfaceVariant,
),
BuzzLoadingIndicator(
size: 28,
color: context.colors.onSurfaceVariant,
semanticLabel: 'Waiting for agent activity',
),
const SizedBox(height: Grid.xxs),
Text(
Expand Down
1 change: 1 addition & 0 deletions mobile/lib/features/channels/channel_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import '../../shared/relay/relay.dart';
import '../../shared/theme/theme.dart';
import '../../shared/widgets/avatar_image.dart';
import '../../shared/widgets/buzz_loading_indicator.dart';
import '../../shared/widgets/frosted_app_bar.dart';
import '../../shared/widgets/frosted_scaffold.dart';
import '../../shared/widgets/message_author_meta.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,9 @@ class _MessageList extends HookConsumerWidget {
return const Padding(
padding: EdgeInsets.symmetric(vertical: Grid.xs),
child: Center(
child: SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(strokeWidth: 2),
child: BuzzLoadingIndicator(
size: 24,
semanticLabel: 'Loading older messages',
),
),
);
Expand Down
1 change: 1 addition & 0 deletions mobile/lib/features/channels/channels_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import '../../shared/community/community_icon_provider.dart';
import '../../shared/relay/relay.dart';
import '../../shared/theme/theme.dart';
import '../../shared/widgets/avatar_image.dart';
import '../../shared/widgets/buzz_loading_indicator.dart';
import '../../shared/widgets/frosted_app_bar.dart';
import '../../shared/widgets/frosted_scaffold.dart';
import '../../shared/widgets/skeleton.dart';
Expand Down
7 changes: 6 additions & 1 deletion mobile/lib/features/channels/channels_page/community.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ class _CommunitySwitcherSheet extends HookConsumerWidget {
child: communitiesAsync.when(
loading: () => const SizedBox(
height: 120,
child: Center(child: CircularProgressIndicator()),
child: Center(
child: BuzzLoadingIndicator(
size: 40,
semanticLabel: 'Loading communities',
),
),
),
error: (e, _) => Padding(
padding: const EdgeInsets.all(Grid.xs),
Expand Down
16 changes: 11 additions & 5 deletions mobile/lib/features/channels/channels_page/sheets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,11 @@ class _NewDirectMessageSheet extends HookConsumerWidget {
),
child: SizedBox.square(
dimension: 16,
child:
CircularProgressIndicator(
strokeWidth: 2,
),
child: BuzzLoadingIndicator(
size: 16,
semanticLabel:
'Creating conversation',
),
),
)
: null,
Expand Down Expand Up @@ -686,7 +687,12 @@ class _NewDirectMessageSheet extends HookConsumerWidget {
isSearchTransitionPending) {
return const SizedBox(
height: 280,
child: Center(child: CircularProgressIndicator()),
child: Center(
child: BuzzLoadingIndicator(
size: 44,
semanticLabel: 'Loading people',
),
),
);
}
if (directoryAsync.hasError) {
Expand Down
1 change: 1 addition & 0 deletions mobile/lib/features/channels/compose_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:nostr/nostr.dart' as nostr;
import '../../shared/relay/relay.dart';
import '../../shared/theme/theme.dart';
import '../../shared/widgets/avatar_image.dart';
import '../../shared/widgets/buzz_loading_indicator.dart';
import '../profile/user_cache_provider.dart';
import '../profile/user_profile.dart';
import '../../shared/custom_emoji/custom_emoji.dart';
Expand Down
10 changes: 4 additions & 6 deletions mobile/lib/features/channels/compose_bar/attachments.dart
Original file line number Diff line number Diff line change
Expand Up @@ -430,12 +430,10 @@ class _AttachmentStrip extends StatelessWidget {
child: Stack(
alignment: Alignment.center,
children: [
SizedBox.square(
dimension: 34,
child: CircularProgressIndicator(
strokeWidth: 3,
color: context.colors.primary,
),
BuzzLoadingIndicator(
size: 34,
color: context.colors.primary,
semanticLabel: label,
),
if (uploadingCount > 1)
PositionedDirectional(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,10 @@ class _CameraPlaceholder extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.all(Grid.sm),
child: isInitializing
? const CircularProgressIndicator(
? const BuzzLoadingIndicator(
size: 44,
color: Colors.white,
strokeWidth: 3,
semanticLabel: 'Starting camera',
)
: Column(
mainAxisSize: MainAxisSize.min,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ class _IOSAttachmentPopoverCallbacks {
}

class _IOSAttachmentPopoverCoordinator {
static final Object _cancelledSupportCheck = Object();

final MethodChannel _channel;

Object? _activeOwner;
_IOSAttachmentPopoverCallbacks? _callbacks;
Completer<void>? _pendingSupportCancellation;
bool _didPresent = false;
bool _handlerInstalled = false;

Expand All @@ -44,9 +47,15 @@ class _IOSAttachmentPopoverCoordinator {
required VoidCallback onFiles,
}) async {
if (defaultTargetPlatform != TargetPlatform.iOS) return false;
if (_activeOwner != null) return true;
if (_activeOwner case final activeOwner?) {
if (identical(activeOwner, owner)) return true;
if (!_didPresent) _clearOwner(activeOwner);
return _didPresent;
Comment thread
klopez4212 marked this conversation as resolved.
Resolved
}

final supportCancellation = Completer<void>();
_activeOwner = owner;
_pendingSupportCancellation = supportCancellation;
_callbacks = _IOSAttachmentPopoverCallbacks(
onCapture: onCapture,
onChoosePhotos: onChoosePhotos,
Expand All @@ -57,9 +66,16 @@ class _IOSAttachmentPopoverCoordinator {
_ensureHandler();

try {
final supported =
await _channel.invokeMethod<bool>('isSupported') ?? false;
final supportResult = await Future.any<Object?>([
_channel.invokeMethod<bool>('isSupported'),
supportCancellation.future.then<Object?>((_) => _cancelledSupportCheck),
]);
if (identical(supportResult, _cancelledSupportCheck)) return true;
if (identical(_pendingSupportCancellation, supportCancellation)) {
_pendingSupportCancellation = null;
}
if (!identical(_activeOwner, owner)) return false;
final supported = supportResult == true;
if (!supported || !sourceContext.mounted) {
_clearOwner(owner);
return false;
Expand Down Expand Up @@ -102,6 +118,10 @@ class _IOSAttachmentPopoverCoordinator {
try {
await _channel.invokeMethod<void>('dismiss');
} on PlatformException {
// The native bridge is unavailable, so there is nothing left to dismiss.
} on MissingPluginException {
// The native bridge is unavailable, so there is nothing left to dismiss.
} finally {
_clearOwner(owner);
}
}
Expand Down Expand Up @@ -146,6 +166,11 @@ class _IOSAttachmentPopoverCoordinator {

void _clearOwner(Object owner) {
if (!identical(_activeOwner, owner)) return;
final supportCancellation = _pendingSupportCancellation;
_pendingSupportCancellation = null;
if (supportCancellation != null && !supportCancellation.isCompleted) {
supportCancellation.complete();
}
_activeOwner = null;
_callbacks = null;
_didPresent = false;
Expand Down
14 changes: 9 additions & 5 deletions mobile/lib/features/channels/compose_bar/ios_photo_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,10 @@ class _IOSInlinePhotoPicker extends HookWidget {
child: isPreparingSelection.value
? const SizedBox.square(
dimension: 20,
child: CircularProgressIndicator(
strokeWidth: 2,
child: BuzzLoadingIndicator(
size: 20,
color: Colors.white,
semanticLabel: 'Preparing selected photos',
),
)
: Text(
Expand All @@ -201,9 +202,10 @@ class _IOSInlinePhotoPicker extends HookWidget {
const ColoredBox(
color: Color.fromRGBO(0, 0, 0, 0.28),
child: Center(
child: CircularProgressIndicator(
strokeWidth: 3,
child: BuzzLoadingIndicator(
size: 44,
color: Colors.white,
semanticLabel: 'Preparing selected photos',
),
),
),
Expand All @@ -222,7 +224,9 @@ class _NativePhotoPickerLoading extends StatelessWidget {
key: const ValueKey('ios-inline-photo-picker-loading'),
height: _attachmentExpandedHeight,
width: double.infinity,
child: const Center(child: CircularProgressIndicator(strokeWidth: 3)),
child: const Center(
child: BuzzLoadingIndicator(size: 44, semanticLabel: 'Opening Photos'),
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ class _RecentPhotoGalleryPicker extends HookConsumerWidget {

Widget buildGalleryBody() {
if (recentSnapshot.connectionState != ConnectionState.done) {
return const Center(child: CircularProgressIndicator(strokeWidth: 3));
return const Center(
child: BuzzLoadingIndicator(
size: 44,
semanticLabel: 'Loading recent photos',
),
);
}
if (recentSnapshot.hasError) {
return const _PhotoGalleryMessage(
Expand Down Expand Up @@ -209,12 +214,10 @@ class _RecentPhotoGalleryPicker extends HookConsumerWidget {
key: const ValueKey('photo-gallery-action'),
onPressed: isResolving.value ? null : choosePhotos,
icon: isResolving.value
? SizedBox.square(
dimension: 22,
child: CircularProgressIndicator(
strokeWidth: 2,
color: context.colors.primary,
),
? BuzzLoadingIndicator(
size: 22,
color: context.colors.primary,
semanticLabel: 'Opening all photos',
)
: const Icon(LucideIcons.images, size: 18),
label: Text(actionLabel),
Expand All @@ -223,12 +226,10 @@ class _RecentPhotoGalleryPicker extends HookConsumerWidget {
key: const ValueKey('photo-gallery-action'),
onPressed: isResolving.value ? null : choosePhotos,
icon: isResolving.value
? const SizedBox.square(
dimension: 22,
child: CircularProgressIndicator(
strokeWidth: 2,
color: Colors.white,
),
? const BuzzLoadingIndicator(
size: 22,
color: Colors.white,
semanticLabel: 'Preparing selected photos',
)
: const Icon(LucideIcons.plus, size: 18),
label: Text(actionLabel),
Expand Down
11 changes: 4 additions & 7 deletions mobile/lib/features/channels/compose_bar/send_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@ class _SendButton extends StatelessWidget {
),
padding: EdgeInsets.zero,
icon: isSending
? SizedBox(
width: 16,
height: 16,
child: CircularProgressIndicator(
strokeWidth: 2,
color: context.colors.onPrimary,
),
? BuzzLoadingIndicator(
size: 18,
color: context.colors.onPrimary,
semanticLabel: 'Sending message',
)
: Icon(
LucideIcons.arrowUp,
Expand Down
8 changes: 7 additions & 1 deletion mobile/lib/features/channels/manage_channel_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';

import '../../shared/theme/theme.dart';
import '../../shared/widgets/buzz_loading_indicator.dart';
import 'channel.dart';
import 'channel_management_provider.dart';
import 'channel_mutes/channel_mutes_provider.dart';
Expand Down Expand Up @@ -272,7 +273,12 @@ class ManageChannelSheet extends HookConsumerWidget {
],
);
},
loading: () => const Center(child: CircularProgressIndicator()),
loading: () => const Center(
child: BuzzLoadingIndicator(
size: 40,
semanticLabel: 'Loading channel details',
),
),
error: (error, _) => Text(
error.toString(),
style: context.textTheme.bodySmall?.copyWith(
Expand Down
6 changes: 4 additions & 2 deletions mobile/lib/features/channels/media_viewer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:video_player/video_player.dart';

import '../../shared/relay/relay.dart';
import '../../shared/theme/theme.dart';
import '../../shared/widgets/buzz_loading_indicator.dart';
import 'media_viewer_hero.dart';

export 'media_viewer_hero.dart';
Expand Down Expand Up @@ -790,9 +791,10 @@ class _VideoLoadingPoster extends StatelessWidget {
_videoPlaceholder(context),
const ColoredBox(color: Color.fromRGBO(0, 0, 0, 0.24)),
const Center(
child: CircularProgressIndicator(
strokeWidth: 3,
child: BuzzLoadingIndicator(
size: 44,
color: Colors.white,
semanticLabel: 'Loading video',
),
),
],
Expand Down
Loading
Loading