diff --git a/lib/account_manager/cubits/account_record_cubit.dart b/lib/account_manager/cubits/account_record_cubit.dart index 2a3d9e2..ee8ec89 100644 --- a/lib/account_manager/cubits/account_record_cubit.dart +++ b/lib/account_manager/cubits/account_record_cubit.dart @@ -56,7 +56,7 @@ class AccountRecordCubit extends DefaultDHTRecordCubit { Future _updateAccountAsync( AccountSpec accountSpec, Future Function() onSuccess) async { var changed = false; - await record.eventualUpdateProtobuf(proto.Account.fromBuffer, (old) async { + await record?.eventualUpdateProtobuf(proto.Account.fromBuffer, (old) async { changed = false; if (old == null) { return null; diff --git a/lib/contact_invitation/cubits/waiting_invitations_bloc_map_cubit.dart b/lib/contact_invitation/cubits/waiting_invitations_bloc_map_cubit.dart index 97e1c76..3787205 100644 --- a/lib/contact_invitation/cubits/waiting_invitations_bloc_map_cubit.dart +++ b/lib/contact_invitation/cubits/waiting_invitations_bloc_map_cubit.dart @@ -41,7 +41,7 @@ class WaitingInvitationsBlocMapCubit extends BlocMapCubit close() async { - await _singleInvitationStatusProcessor.unfollow(); + await _singleInvitationStatusProcessor.close(); await super.close(); } diff --git a/lib/conversation/cubits/conversation_cubit.dart b/lib/conversation/cubits/conversation_cubit.dart index 11ba12f..b42d3a6 100644 --- a/lib/conversation/cubits/conversation_cubit.dart +++ b/lib/conversation/cubits/conversation_cubit.dart @@ -209,7 +209,7 @@ class ConversationCubit extends Cubit> { return; } serialFuture((this, _sfUpdateAccountChange), () async { - await cubit.record.eventualUpdateProtobuf(proto.Conversation.fromBuffer, + await cubit.record?.eventualUpdateProtobuf(proto.Conversation.fromBuffer, (old) async { if (old == null || old.profile == account.profile) { return null; diff --git a/lib/layout/home/drawer_menu/menu_item_widget.dart b/lib/layout/home/drawer_menu/menu_item_widget.dart index e538b15..8529411 100644 --- a/lib/layout/home/drawer_menu/menu_item_widget.dart +++ b/lib/layout/home/drawer_menu/menu_item_widget.dart @@ -80,7 +80,7 @@ class MenuItemWidget extends StatelessWidget { ), onPressed: footerCallback), ], - ), + ).paddingAll(2), ); @override diff --git a/lib/theme/views/avatar_widget.dart b/lib/theme/views/avatar_widget.dart index 43d351b..7a1f610 100644 --- a/lib/theme/views/avatar_widget.dart +++ b/lib/theme/views/avatar_widget.dart @@ -39,7 +39,7 @@ class AvatarWidget extends StatelessWidget { width: _size, decoration: BoxDecoration( shape: BoxShape.circle, - border: _scaleConfig.preferBorders + border: _scaleConfig.useVisualIndicators ? Border.all( color: _borderColor, width: 1 * (_size ~/ 32 + 1), diff --git a/lib/theme/views/widget_helpers.dart b/lib/theme/views/widget_helpers.dart index 51cb7b6..131ec8c 100644 --- a/lib/theme/views/widget_helpers.dart +++ b/lib/theme/views/widget_helpers.dart @@ -116,7 +116,7 @@ Widget buildProgressIndicator() => Builder(builder: (context) { return FittedBox( fit: BoxFit.scaleDown, child: SpinKitFoldingCube( - color: scale.tertiaryScale.primary, + color: scale.tertiaryScale.border, size: 80, )); }); diff --git a/packages/veilid_support/lib/dht_support/src/dht_record/default_dht_record_cubit.dart b/packages/veilid_support/lib/dht_support/src/dht_record/default_dht_record_cubit.dart index 5ea6761..e5fb513 100644 --- a/packages/veilid_support/lib/dht_support/src/dht_record/default_dht_record_cubit.dart +++ b/packages/veilid_support/lib/dht_support/src/dht_record/default_dht_record_cubit.dart @@ -52,8 +52,11 @@ class DefaultDHTRecordCubit extends DHTRecordCubit { Future refreshDefault() async { await initWait(); - - final defaultSubkey = record.subkeyOrDefault(-1); - await refresh([ValueSubkeyRange(low: defaultSubkey, high: defaultSubkey)]); + final rec = record; + if (rec != null) { + final defaultSubkey = rec.subkeyOrDefault(-1); + await refresh( + [ValueSubkeyRange(low: defaultSubkey, high: defaultSubkey)]); + } } } diff --git a/packages/veilid_support/lib/dht_support/src/dht_record/dht_record_cubit.dart b/packages/veilid_support/lib/dht_support/src/dht_record/dht_record_cubit.dart index ac33716..6d42753 100644 --- a/packages/veilid_support/lib/dht_support/src/dht_record/dht_record_cubit.dart +++ b/packages/veilid_support/lib/dht_support/src/dht_record/dht_record_cubit.dart @@ -26,7 +26,7 @@ abstract class DHTRecordCubit extends Cubit> { // Do record open/create while (!cancel.isCompleted) { try { - _record = await open(); + record = await open(); _wantsCloseRecord = true; break; } on DHTExceptionNotAvailable { @@ -49,7 +49,7 @@ abstract class DHTRecordCubit extends Cubit> { ) async { // Make initial state update try { - final initialState = await initialStateFunction(_record); + final initialState = await initialStateFunction(record!); if (initialState != null) { emit(AsyncValue.data(initialState)); } @@ -57,7 +57,7 @@ abstract class DHTRecordCubit extends Cubit> { emit(AsyncValue.error(e)); } - _subscription = await _record.listen((record, data, subkeys) async { + _subscription = await record!.listen((record, data, subkeys) async { try { final newState = await stateFunction(record, subkeys, data); if (newState != null) { @@ -68,17 +68,17 @@ abstract class DHTRecordCubit extends Cubit> { } }); - await watchFunction(_record); + await watchFunction(record!); } @override Future close() async { await initWait(cancelValue: true); - await _record.cancelWatch(); + await record?.cancelWatch(); await _subscription?.cancel(); _subscription = null; if (_wantsCloseRecord) { - await _record.close(); + await record?.close(); _wantsCloseRecord = false; } await super.close(); @@ -91,10 +91,10 @@ abstract class DHTRecordCubit extends Cubit> { for (final skr in subkeys) { for (var sk = skr.low; sk <= skr.high; sk++) { - final data = await _record.get( - subkey: sk, refreshMode: DHTRecordRefreshMode.update); + final data = await record! + .get(subkey: sk, refreshMode: DHTRecordRefreshMode.update); if (data != null) { - final newState = await _stateFunction(_record, updateSubkeys, data); + final newState = await _stateFunction(record!, updateSubkeys, data); if (newState != null) { // Emit the new state emit(AsyncValue.data(newState)); @@ -108,13 +108,13 @@ abstract class DHTRecordCubit extends Cubit> { } } - DHTRecord get record => _record; + // DHTRecord get record => _record; @protected final WaitSet initWait = WaitSet(); StreamSubscription? _subscription; - late DHTRecord _record; + DHTRecord? record; bool _wantsCloseRecord; final StateFunction _stateFunction; } diff --git a/packages/veilid_support/lib/dht_support/src/dht_record/dht_record_pool.dart b/packages/veilid_support/lib/dht_support/src/dht_record/dht_record_pool.dart index 68ea53d..3cfa784 100644 --- a/packages/veilid_support/lib/dht_support/src/dht_record/dht_record_pool.dart +++ b/packages/veilid_support/lib/dht_support/src/dht_record/dht_record_pool.dart @@ -849,7 +849,7 @@ class DHTRecordPool with TableDBBackedJson { openedRecordInfo.shared.needsWatchStateUpdate = false; } } on VeilidAPIException catch (e) { - // Failed to cancel DHT watch, try again next tick + // Failed to update DHT watch, try again next tick log('Exception in watch update: $e'); } }