mutex debugging

This commit is contained in:
Christien Rioux 2024-08-06 08:51:19 -07:00
parent 120a7105c8
commit 103975bb56
24 changed files with 88 additions and 65 deletions

View file

@ -56,6 +56,7 @@ class AccountRecordCubit extends DefaultDHTRecordCubit<AccountRecordState> {
Future<void> _updateAccountAsync(
AccountSpec accountSpec, Future<void> Function() onSuccess) async {
var changed = false;
await record?.eventualUpdateProtobuf(proto.Account.fromBuffer, (old) async {
changed = false;
if (old == null) {

View file

@ -97,7 +97,7 @@ class _EditAccountPageState extends WindowSetupState<EditAccountPage> {
},
child: Row(mainAxisSize: MainAxisSize.min, children: [
const Icon(Icons.cancel, size: 16).paddingLTRB(0, 0, 4, 0),
Text(translate('button.no_cancel')).paddingLTRB(0, 0, 4, 0)
Text(translate('button.no')).paddingLTRB(0, 0, 4, 0)
])),
ElevatedButton(
onPressed: () {
@ -105,7 +105,7 @@ class _EditAccountPageState extends WindowSetupState<EditAccountPage> {
},
child: Row(mainAxisSize: MainAxisSize.min, children: [
const Icon(Icons.check, size: 16).paddingLTRB(0, 0, 4, 0),
Text(translate('button.yes_proceed')).paddingLTRB(0, 0, 4, 0)
Text(translate('button.yes')).paddingLTRB(0, 0, 4, 0)
]))
]).paddingAll(24)
]));
@ -165,7 +165,7 @@ class _EditAccountPageState extends WindowSetupState<EditAccountPage> {
},
child: Row(mainAxisSize: MainAxisSize.min, children: [
const Icon(Icons.cancel, size: 16).paddingLTRB(0, 0, 4, 0),
Text(translate('button.no_cancel')).paddingLTRB(0, 0, 4, 0)
Text(translate('button.no')).paddingLTRB(0, 0, 4, 0)
])),
ElevatedButton(
onPressed: () {
@ -173,7 +173,7 @@ class _EditAccountPageState extends WindowSetupState<EditAccountPage> {
},
child: Row(mainAxisSize: MainAxisSize.min, children: [
const Icon(Icons.check, size: 16).paddingLTRB(0, 0, 4, 0),
Text(translate('button.yes_proceed')).paddingLTRB(0, 0, 4, 0)
Text(translate('button.yes')).paddingLTRB(0, 0, 4, 0)
]))
]).paddingAll(24)
]));

View file

@ -2,6 +2,7 @@ import 'package:async_tools/async_tools.dart';
import 'package:awesome_extensions/awesome_extensions.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:flutter_translate/flutter_translate.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
@ -9,6 +10,7 @@ import 'package:form_builder_validators/form_builder_validators.dart';
import '../../contacts/contacts.dart';
import '../../proto/proto.dart' as proto;
import '../../theme/theme.dart';
import '../../veilid_processor/veilid_processor.dart';
import '../models/models.dart';
const _kDoUpdateSubmit = 'doUpdateSubmit';
@ -291,16 +293,26 @@ class _EditProfileFormState extends State<EditProfileForm> {
const Spacer(),
]).paddingSymmetric(vertical: 4),
if (widget.onSubmit != null)
ElevatedButton(
onPressed: widget.onSubmit == null ? null : _doSubmit,
child: Row(mainAxisSize: MainAxisSize.min, children: [
const Icon(Icons.check, size: 16).paddingLTRB(0, 0, 4, 0),
Text((widget.onSubmit == null)
? widget.submitDisabledText
: widget.submitText)
.paddingLTRB(0, 0, 4, 0)
]),
)
Builder(builder: (context) {
final networkReady = context
.watch<ConnectionStateCubit>()
.state
.asData
?.value
.isPublicInternetReady ??
false;
return ElevatedButton(
onPressed: networkReady ? _doSubmit : null,
child: Row(mainAxisSize: MainAxisSize.min, children: [
const Icon(Icons.check, size: 16).paddingLTRB(0, 0, 4, 0),
Text(networkReady
? widget.submitText
: widget.submitDisabledText)
.paddingLTRB(0, 0, 4, 0)
]),
);
}),
],
),
);

View file

@ -249,7 +249,7 @@ class SingleContactMessagesCubit extends Cubit<SingleContactMessagesState> {
void runCommand(String command) {
final (cmd, rest) = command.splitOnce(' ');
if (kDebugMode) {
if (kIsDebugMode) {
if (cmd == '/repeat' && rest != null) {
final (countStr, text) = rest.splitOnce(' ');
final count = int.tryParse(countStr);

View file

@ -1,3 +1,4 @@
import 'package:awesome_extensions/awesome_extensions.dart';
import 'package:flutter/material.dart';
import 'package:flutter_translate/flutter_translate.dart';
@ -15,7 +16,8 @@ class EmptyContactListWidget extends StatelessWidget {
final textTheme = theme.textTheme;
final scale = theme.extension<ScaleScheme>()!;
return Column(
return Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center,
@ -33,6 +35,6 @@ class EmptyContactListWidget extends StatelessWidget {
),
),
],
);
));
}
}

View file

@ -18,7 +18,7 @@ class VeilidChatGlobalInit {
await getDefaultVeilidPlatformConfig(kIsWeb, VeilidChatApp.name));
// Veilid logging
initVeilidLog(kDebugMode);
initVeilidLog(kIsDebugMode);
// Startup Veilid
await ProcessorRepository.instance.startup();

View file

@ -134,7 +134,7 @@ class RouterCubit extends Cubit<RouterState> {
return _router = GoRouter(
navigatorKey: _rootNavKey,
refreshListenable: StreamListenable(stream.startWith(state).distinct()),
debugLogDiagnostics: kDebugMode,
debugLogDiagnostics: kIsDebugMode,
initialLocation: '/',
routes: routes,
redirect: redirect,

View file

@ -246,7 +246,7 @@ Future<bool> showConfirmModal(
Navigator.pop(context);
},
child: Text(
translate('button.no_cancel'),
translate('button.no'),
style: _buttonTextStyle(context),
),
),
@ -261,7 +261,7 @@ Future<bool> showConfirmModal(
Navigator.pop(context);
},
child: Text(
translate('button.yes_proceed'),
translate('button.yes'),
style: _buttonTextStyle(context),
),
)

View file

@ -152,7 +152,7 @@ void initLoggy() {
if (isTrace) {
logLevel = traceLevel;
} else {
logLevel = kDebugMode ? LogLevel.debug : LogLevel.info;
logLevel = kIsDebugMode ? LogLevel.debug : LogLevel.info;
}
Loggy('').level = getLogOptions(logLevel);