Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
trims extra white spaces for passwords and seed phrase
published windows version
  • Loading branch information
oliverbytes committed Oct 22, 2022
1 parent 83e3450 commit 8bd67db
Show file tree
Hide file tree
Showing 11 changed files with 127 additions and 76 deletions.
1 change: 1 addition & 0 deletions lib/core/translations/en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ final en = {
"not_subscribed": "You are not subscribed to @w1 Pro",
"month_billed_annually": "month billed annually",
"try_free": "Try Free",
"try": "Try",
"subscribe": "Subscribe",
"trial_remind": "We'll remind you before your trial ends",
"easy_cancel": "2 taps to start, super easy to cancel",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class CreatePasswordScreenController extends GetxController
await SupabaseAuthService.to.signOut(); // just to make sure

// TODO: improve password validation
if (passwordController.text != passwordConfirmController.text) {
if (passwordController.text.trim() !=
passwordConfirmController.text.trim()) {
change(null, status: RxStatus.success());

// TODO: localize
Expand All @@ -80,7 +81,7 @@ class CreatePasswordScreenController extends GetxController

await WalletService.to.create(
Get.parameters['seed']!,
passwordController.text,
passwordController.text.trim(),
isNewVault,
);

Expand Down
118 changes: 79 additions & 39 deletions lib/features/drawer/drawer.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:liso/features/files/storage.service.dart';
import 'package:liso/features/general/pro.widget.dart';

import '../../../core/utils/utils.dart';
import '../../resources/resources.dart';
import '../../core/persistence/persistence_builder.widget.dart';
import '../pro/pro.controller.dart';
import 'drawer_widget.controller.dart';
Expand Down Expand Up @@ -251,49 +252,88 @@ class DrawerMenu extends StatelessWidget with ConsoleMixin {
),
),
const Divider(),
PersistenceBuilder(
builder: (p, context) => Obx(
() => Column(
children: [
ListTile(
title: Row(
children: [
if (!ProController.to.isPro) ...[
const Text(
'Try ',
style: TextStyle(fontWeight: FontWeight.normal),
),
],
const ProText(size: 16)
],
),
subtitle: Text(
ProController.to.isPro
? 'Active'
: 'Unlock All Access',
style: const TextStyle(
color: Colors.grey,
fontWeight: FontWeight.w500,
Obx(
() => Visibility(
visible: ProController.to.isPro,
replacement: ListTile(
// onTap: controller.showContestDialog,
onTap: () => Utils.adaptiveRouteOpen(name: Routes.upgrade),
title: Row(
children: [
if (!ProController.to.isPro) ...[
Text(
'${'try'.tr} ',
style: TextStyle(color: Get.theme.primaryColor),
),
),
leading: Icon(LineIcons.rocket, color: proColor),
onTap: () => ProController.to.isPro
? Utils.openUrl(
ProController.to.info.value.managementURL!,
)
: Utils.adaptiveRouteOpen(
name: Routes.upgrade,
method: 'offAndToNamed',
),
)
.animate(onPlay: (c) => c.repeat())
.shimmer(duration: 2000.ms)
.shakeX(duration: 1000.ms, hz: 2, amount: 1)
.then(delay: 3000.ms),
],
],
const ProText(size: 16),
],
),
leading: Image.asset(Images.logo, height: 20),
)
.animate(onPlay: (c) => c.repeat())
.shimmer(duration: 2000.ms)
.shakeX(duration: 1000.ms, hz: 2, amount: 1)
.then(delay: 3000.ms),
child: ListTile(
title: const ProText(size: 16),
leading: Icon(
LineIcons.rocket,
color: Get.theme.primaryColor,
),
onTap: () {
if (ProController.to.info.value.managementURL != null) {
Utils.openUrl(
ProController.to.info.value.managementURL!,
);
}
},
),
),
),
// PersistenceBuilder(
// builder: (p, context) => Obx(
// () => Column(
// children: [
// ListTile(
// title: Row(
// children: [
// if (!ProController.to.isPro) ...[
// const Text(
// 'Try ',
// style: TextStyle(fontWeight: FontWeight.normal),
// ),
// ],
// const ProText(size: 16)
// ],
// ),
// subtitle: Text(
// ProController.to.isPro
// ? 'Active'
// : 'Unlock All Access',
// style: const TextStyle(
// color: Colors.grey,
// fontWeight: FontWeight.w500,
// ),
// ),
// leading: Icon(LineIcons.rocket, color: proColor),
// onTap: () {
// if (ProController.to.info.value.managementURL !=
// null) {
// Utils.openUrl(
// ProController.to.info.value.managementURL!,
// );
// }
// },
// )
// .animate(onPlay: (c) => c.repeat())
// .shimmer(duration: 2000.ms)
// .shakeX(duration: 1000.ms, hz: 2, amount: 1)
// .then(delay: 3000.ms),
// ],
// ),
// ),
// ),
ListTile(
title: const Text('Need Help?'),
subtitle: const Text("Don't hesitate to contact us"),
Expand Down
6 changes: 3 additions & 3 deletions lib/features/general/version.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ class VersionText extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SizedBox(
height: 20,
height: 30,
child: Align(
alignment: Alignment.bottomRight,
child: Padding(
padding: const EdgeInsets.only(bottom: 25, right: 15),
padding: const EdgeInsets.only(bottom: 15, right: 15),
child: Text(
Globals.metadata?.app.formattedVersion ?? '',
Globals.metadata?.app.formattedVersion ?? 'Unknown Version',
style: const TextStyle(color: Colors.grey, fontSize: 10),
),
),
Expand Down
2 changes: 2 additions & 0 deletions lib/features/import/import.screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class ImportScreen extends StatelessWidget with ConsoleMixin {
);
},
),
const SizedBox(height: 10),
Obx(
() => DropdownButtonFormField<ExportedSourceFormat>(
value: controller.sourceFormat.value,
Expand All @@ -107,6 +108,7 @@ class ImportScreen extends StatelessWidget with ConsoleMixin {
.toList(),
),
),
const SizedBox(height: 10),
Row(
children: [
Expanded(
Expand Down
2 changes: 1 addition & 1 deletion lib/features/restore/restore_screen.controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class RestoreScreenController extends GetxController
if (!formKey.currentState!.validate()) return;
change(null, status: RxStatus.loading());

final seed = seedController.text;
final seed = seedController.text.trim();
final credentials = WalletService.to.mnemonicToPrivateKey(seed);
final address = credentials.address.hexEip55;

Expand Down
3 changes: 2 additions & 1 deletion lib/features/seed/seed.screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:iconsax/iconsax.dart';
import 'package:line_icons/line_icons.dart';
import 'package:liso/core/persistence/persistence.dart';
import 'package:liso/features/seed/seed_chips.widget.dart';
import 'package:liso/features/wallet/wallet.service.dart';

import '../../core/utils/globals.dart';
import '../../core/utils/utils.dart';
Expand Down Expand Up @@ -74,7 +75,7 @@ class SeedScreen extends StatelessWidget with ConsoleMixin {
const SizedBox(height: 20),
seedPhrase,
const SizedBox(height: 20),
if (!Persistence.to.backedUpSeed.val) ...[
if (!Persistence.to.backedUpSeed.val || !WalletService.to.isSaved) ...[
ObxValue(
(RxBool data) => CheckboxListTile(
checkboxShape: const CircleBorder(),
Expand Down
2 changes: 1 addition & 1 deletion lib/features/seed/seed_field.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class SeedField extends StatelessWidget with ConsoleMixin {
String? _validateSeed(String seed) {
if (required && seed.isEmpty) {
return 'Required';
} else if (seed.isNotEmpty && !bip39.validateMnemonic(seed)) {
} else if (seed.isNotEmpty && !bip39.validateMnemonic(seed.trim())) {
return 'Invalid seed phrase';
} else {
return null;
Expand Down
51 changes: 28 additions & 23 deletions lib/features/settings/settings.screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,27 @@ class SettingsScreen extends StatelessWidget with ConsoleMixin {
subtitle: const Text("Keep multiple devices in sync"),
onChanged: (value) => p.sync.val = value,
),
if (p.sync.val) ...[
// if (!GetPlatform.isWindows) ...[
// ListTile(
// leading: Icon(Iconsax.cpu, color: themeColor),
// trailing: const Icon(Iconsax.arrow_right_3),
// title: const Text('Devices'),
// subtitle: const Text('Manage your synced devices'),
// onTap: () => Utils.adaptiveRouteOpen(name: Routes.devices),
// ),
// ],
// ListTile(
// leading: Icon(Iconsax.setting, color: themeColor),
// trailing: const Icon(Iconsax.arrow_right_3),
// title: const Text('Configuration'),
// subtitle: const Text('Change your sync configuration'),
// onTap: () => Utils.adaptiveRouteOpen(
// name: Routes.syncProvider,
// ),
// ),
],
// TODO: temporary
// if (p.sync.val) ...[
// if (!GetPlatform.isWindows) ...[
// ListTile(
// leading: Icon(Iconsax.cpu, color: themeColor),
// trailing: const Icon(Iconsax.arrow_right_3),
// title: const Text('Devices'),
// subtitle: const Text('Manage your synced devices'),
// onTap: () => Utils.adaptiveRouteOpen(name: Routes.devices),
// ),
// ],
// ListTile(
// leading: Icon(Iconsax.setting, color: themeColor),
// trailing: const Icon(Iconsax.arrow_right_3),
// title: const Text('Configuration'),
// subtitle: const Text('Change your sync configuration'),
// onTap: () => Utils.adaptiveRouteOpen(
// name: Routes.syncProvider,
// ),
// ),
// ],
],
);
}),
Expand Down Expand Up @@ -298,9 +299,13 @@ class SettingsScreen extends StatelessWidget with ConsoleMixin {
: Text(
'${ProController.to.proPrefixString} ${ProController.to.proDateString}',
),
onTap: () => Utils.openUrl(
ProController.to.info.value.managementURL!,
),
onTap: () {
if (ProController.to.info.value.managementURL != null) {
Utils.openUrl(
ProController.to.info.value.managementURL!,
);
}
},
),
] else if (!isApple || kDebugMode) ...[
ListTile(
Expand Down
8 changes: 3 additions & 5 deletions lib/features/unlock/unlock_screen.controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,15 @@ class UnlockScreenController extends GetxController
if (status == RxStatus.loading()) return console.error('still busy');
await Get.closeCurrentSnackbar();
change(null, status: RxStatus.loading());
final password = passwordController.text.trim();

if (passwordController.text != SecretPersistence.to.walletPassword.val) {
if (password != SecretPersistence.to.walletPassword.val) {
return _wrongPassword();
}

if (!WalletService.to.isReady) {
WalletService.to
.initJson(
SecretPersistence.to.wallet.val,
password: passwordController.text,
)
.initJson(SecretPersistence.to.wallet.val, password: password)
.then((wallet) {
if (wallet == null) {
return UIUtils.showSimpleDialog(
Expand Down
5 changes: 4 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies:
cloud_functions: 4.0.2
# FIREBASE DESKTOP
firebase_core_desktop: 1.0.2
# firebase_functions_desktop: 0.2.0+3
firebase_functions_desktop: 0.2.0+3
firebase_core_platform_interface: 4.5.1
# FIREBASE DESKTOP WORKAROUND
firebase_dart: ^1.0.11
Expand Down Expand Up @@ -113,6 +113,9 @@ dependencies:

dependency_overrides:
package_info_plus: ^3.0.1
# for firebase_functions_desktop on windows
firebase_core: ^2.1.0
cloud_functions: ^4.0.2

dev_dependencies:
# flutter_test:
Expand Down

0 comments on commit 8bd67db

Please sign in to comment.