Skip to content

Commit 7eee728

Browse files
committed
fix(mobile): keep the channel list's offline message on iOS
URLSession failures don't implement SocketException, so an offline channel-list load on iOS fell through to the generic message. Check the URLSession failure too, as pairing and invites do. Also correct the snapshot cap comment, which no longer holds where gzip inflates natively. Signed-off-by: Tom Brow <[email protected]>
1 parent 15bc9ff commit 7eee728

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

‎mobile/lib/features/channels/channels_page.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:buzz/shared/widgets/adaptive_conversation_pane.dart';
44
import 'channel_unread.dart';
55
import '../../shared/widgets/collapsible_section_body.dart';
66
import '../../shared/widgets/collapsible_sliver_body.dart';
7+
import '../../shared/http/app_http_client.dart';
78
import '../../shared/me/me_sync.dart';
89
import '../../shared/hosted/hosted_relay_auth.dart';
910
import '../../shared/hosted/organization_environment.dart';

‎mobile/lib/features/channels/channels_page/badges.dart‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class _ErrorView extends HookConsumerWidget {
4646
}
4747
return 'Server error (${error.statusCode}). Try again later.';
4848
}
49-
if (error is SocketException) {
49+
if (error is SocketException ||
50+
urlSessionFailure(error) == TransportFailure.unreachable) {
5051
return 'Could not reach the relay server.';
5152
}
5253
return 'Something went wrong. Check your connection.';

‎mobile/lib/shared/relay/relay_session_snapshot.dart‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ extension on RelaySessionNotifier {
5353
final origin = Uri.parse(config.baseUrl);
5454
final discovery = http.Request('GET', origin.resolve('/'))
5555
..headers['Accept'] = 'application/nostr+json';
56-
// The query transport leaves gzip bodies compressed (see
57-
// RelayHttpQueryClient), and the relay's CDN gzips both responses. The
58-
// inflated size is capped too: the transport cap only sees the
59-
// compressed bytes.
56+
// The relay's CDN gzips both responses. The inflated size is capped too:
57+
// where the query transport leaves gzip bodies compressed (see
58+
// RelayHttpQueryClient), the transport cap only sees the compressed
59+
// bytes.
6060
final discovered = await send(discovery, 64 * 1024);
6161
final info = jsonDecode(
6262
relayResponseText(

0 commit comments

Comments
 (0)