Skip to content

Commit

Permalink
Merge pull request #1588 from atsign-foundation/fix-activate-teapot
Browse files Browse the repository at this point in the history
fix: activate without teapot
  • Loading branch information
CurtlyCritchlow authored Dec 5, 2024
2 parents 281f7de + 078686b commit 2472148
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:npt_flutter/features/onboarding/cubit/onboarding_cubit.dart';
import 'package:npt_flutter/features/onboarding/util/atsign_manager.dart';
import 'package:npt_flutter/util/form_validator.dart';

class AtsignSelector extends StatefulWidget {
const AtsignSelector({
Expand All @@ -24,11 +25,16 @@ class _AtsignSelectorState extends State<AtsignSelector> {
return TextFormField(
controller: controller,
onChanged: (atsign) {
if (!atsign.startsWith('@')) {
atsign = '@$atsign';
}
context.read<OnboardingCubit>().setState(
atSign: atsign,
rootDomain: widget.options[atsign]?.rootDomain,
);
},
validator: FormValidator.validateRequiredAtsignField,
autovalidateMode: AutovalidateMode.onUserInteraction,
decoration: InputDecoration(
/// This menuAnchor is a dropdown button that allows you to quickly select
/// existing values from [options]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:npt_flutter/features/onboarding/onboarding.dart';
import 'package:npt_flutter/features/onboarding/util/atsign_manager.dart';
import 'package:npt_flutter/features/onboarding/widgets/at_directory_selector.dart';
import 'package:npt_flutter/features/onboarding/widgets/atsign_selector.dart';
import 'package:npt_flutter/styles/sizes.dart';
import 'package:npt_flutter/util/form_validator.dart';
import 'package:npt_flutter/widgets/custom_container.dart';

class OnboardingDialog extends StatelessWidget {
Expand All @@ -22,7 +25,7 @@ class OnboardingDialog extends StatelessWidget {
children: [
CustomContainer.background(
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(strings.selectorTitleAtsign),
Expand All @@ -39,24 +42,28 @@ class OnboardingDialog extends StatelessWidget {
),
),
gapH10,
CustomContainer.background(
child: Row(
children: [
TextButton(
onPressed: () {
Navigator.of(context).pop(false);
},
child: Text(strings.cancel),
),
const Spacer(),
ElevatedButton(
onPressed: () {
Navigator.of(context).pop(true);
},
child: Text(strings.next),
),
],
))
BlocBuilder<OnboardingCubit, OnboardingState>(builder: (context, state) {
return CustomContainer.background(
child: Row(
children: [
TextButton(
onPressed: () {
Navigator.of(context).pop(false);
},
child: Text(strings.cancel),
),
const Spacer(),
ElevatedButton(
onPressed: FormValidator.validateRequiredAtsignField(state.atSign) == null
? () {
Navigator.of(context).pop(true);
}
: null,
child: Text(strings.next),
),
],
));
})
],
),
),
Expand Down
4 changes: 3 additions & 1 deletion packages/dart/npt_flutter/lib/util/form_validator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class FormValidator {

static String? validateRequiredAtsignField(String? value) {
final strings = AppLocalizations.of(App.navState.currentContext!)!;
if (!value!.startsWith('@') || value.length < 2) {
if (value?.isEmpty ?? true) {
return strings.validationErrorEmptyField;
} else if (!value!.startsWith('@') || value.length < 2) {
return strings.validationErrorAtsignField;
}
validateRequiredField(value);
Expand Down
2 changes: 1 addition & 1 deletion packages/dart/npt_flutter/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367

COCOAPODS: 1.15.2
COCOAPODS: 1.14.3
4 changes: 2 additions & 2 deletions packages/dart/npt_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.1.1+1
version: 1.1.2+2

environment:
sdk: ^3.5.0
Expand Down Expand Up @@ -137,7 +137,7 @@ msix_config:
publisher_display_name: Atsign
identity_name: TheCompany.NoPortsDesktop
publisher: CN=BBFE1D0B-F713-4C7F-B375-5EA851CBB1FF
msix_version: 1.1.1.0
msix_version: 1.1.2.0
logo_path: "assets/logo.png"
capabilities: internetClient
store: true
Expand Down

0 comments on commit 2472148

Please sign in to comment.