From d631b7308ba825fe315a2205e9bb0e104ad36988 Mon Sep 17 00:00:00 2001 From: Christien Rioux Date: Sat, 30 Sep 2023 12:45:32 -0400 Subject: [PATCH] base64 fix and turn off dht caching until we have background sync --- .../chat_single_contact_item_widget.dart | 2 +- lib/components/paste_invite_dialog.dart | 5 +++- lib/components/signal_strength_meter.dart | 2 +- lib/router/router_notifier.dart | 2 +- lib/veilid_support/src/config.dart | 23 +++++++++---------- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/components/chat_single_contact_item_widget.dart b/lib/components/chat_single_contact_item_widget.dart index d749f8c..6075194 100644 --- a/lib/components/chat_single_contact_item_widget.dart +++ b/lib/components/chat_single_contact_item_widget.dart @@ -20,7 +20,7 @@ class ChatSingleContactItemWidget extends ConsumerWidget { //final textTheme = theme.textTheme; final scale = theme.extension()!; - final activeChat = ref.watch(activeChatStateProvider).asData?.value; + final activeChat = ref.watch(activeChatStateProvider).value; final remoteConversationRecordKey = proto.TypedKeyProto.fromProto(contact.remoteConversationRecordKey); final selected = activeChat == remoteConversationRecordKey; diff --git a/lib/components/paste_invite_dialog.dart b/lib/components/paste_invite_dialog.dart index cf423e1..dc96d6d 100644 --- a/lib/components/paste_invite_dialog.dart +++ b/lib/components/paste_invite_dialog.dart @@ -54,7 +54,10 @@ class PasteInviteDialogState extends ConsumerState { if (lastline <= firstline) { return; } - final inviteDataBase64 = lines.sublist(firstline, lastline).join(); + final inviteDataBase64 = lines + .sublist(firstline, lastline) + .join() + .replaceAll(RegExp(r'[^A-Za-z0-9\-_]'), ''); final inviteData = base64UrlNoPadDecode(inviteDataBase64); await validateInviteData(inviteData: inviteData); diff --git a/lib/components/signal_strength_meter.dart b/lib/components/signal_strength_meter.dart index 04499c6..29f4699 100644 --- a/lib/components/signal_strength_meter.dart +++ b/lib/components/signal_strength_meter.dart @@ -15,7 +15,7 @@ class SignalStrengthMeterWidget extends ConsumerWidget { final scale = theme.extension()!; const iconSize = 16.0; - final connState = ref.watch(globalConnectionStateProvider).asData?.value; + final connState = ref.watch(globalConnectionStateProvider).value; if (connState == null) { return const Icon(Icons.signal_cellular_off, size: iconSize); } diff --git a/lib/router/router_notifier.dart b/lib/router/router_notifier.dart index aa1d583..d9ee694 100644 --- a/lib/router/router_notifier.dart +++ b/lib/router/router_notifier.dart @@ -29,7 +29,7 @@ class RouterNotifier extends _$RouterNotifier implements Listenable { hasAnyAccount = await ref.watch( localAccountsProvider.selectAsync((data) => data.isNotEmpty), ); - hasActiveChat = ref.watch(activeChatStateProvider).asData?.value != null; + hasActiveChat = ref.watch(activeChatStateProvider).value != null; // When this notifier's state changes, inform GoRouter ref.listenSelf((_, __) { diff --git a/lib/veilid_support/src/config.dart b/lib/veilid_support/src/config.dart index bdd9537..3e2fc75 100644 --- a/lib/veilid_support/src/config.dart +++ b/lib/veilid_support/src/config.dart @@ -18,16 +18,15 @@ Future getVeilidChatConfig() async { config.copyWith(blockStore: config.blockStore.copyWith(delete: true)); } - // // xxx hack - // config = config.copyWith( - // network: config.network.copyWith( - // dht: config.network.dht.copyWith( - // getValueCount: 3, - // getValueFanout: 8, - // getValueTimeoutMs: 5000, - // setValueCount: 4, - // setValueFanout: 10, - // setValueTimeoutMs: 5000))); - - return config; + return config.copyWith( + capabilities: const VeilidConfigCapabilities(disable: ['DHTV', 'TUNL']), + // network: config.network.copyWith( + // dht: config.network.dht.copyWith( + // getValueCount: 3, + // getValueFanout: 8, + // getValueTimeoutMs: 5000, + // setValueCount: 4, + // setValueFanout: 10, + // setValueTimeoutMs: 5000)) + ); }