Skip to content

Commit

Permalink
Merge branch 'dev' into disable-trading-bot-setting
Browse files Browse the repository at this point in the history
  • Loading branch information
naezith authored and CharlVS committed Jan 10, 2025
1 parent 4e7f329 commit 6de0759
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
unit_tests_:
runs-on: ubuntu-latest
runs-on: [self-hosted, Linux]
timeout-minutes: 15

steps:
Expand Down
3 changes: 2 additions & 1 deletion app_build/build_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
}
},
"coins": {
"fetch_at_build_enabled": true,
"update_commit_on_build": true,
"bundled_coins_repo_commit": "b27db8e6e1c6a9264219fef8292811122538088a",
"coins_repo_api_url": "https://api.github.com/repos/KomodoPlatform/coins",
"coins_repo_content_url": "https://raw.githubusercontent.com/KomodoPlatform/coins",
"coins_repo_content_url": "https://komodoplatform.github.io/coins",
"coins_repo_branch": "master",
"runtime_updates_enabled": true,
"mapped_files": {
Expand Down
31 changes: 18 additions & 13 deletions lib/router/parsers/root_route_parser.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:web_dex/app_config/app_config.dart';
import 'package:web_dex/bloc/coins_bloc/coins_bloc.dart';
import 'package:web_dex/model/first_uri_segment.dart';
import 'package:web_dex/router/parsers/base_route_parser.dart';
import 'package:web_dex/router/parsers/bridge_route_parser.dart';
Expand All @@ -11,22 +12,26 @@ import 'package:web_dex/router/parsers/wallet_route_parser.dart';
import 'package:web_dex/router/routes.dart';

class RootRouteInformationParser extends RouteInformationParser<AppRoutePath> {
final Map<String, BaseRouteParser> _parsers = {
firstUriSegment.wallet: walletRouteParser,
firstUriSegment.fiat: fiatRouteParser,
firstUriSegment.dex: dexRouteParser,
firstUriSegment.bridge: bridgeRouteParser,
firstUriSegment.nfts: nftRouteParser,
firstUriSegment.settings: settingsRouteParser,
};
RootRouteInformationParser(this.coinsBloc);

final CoinsBloc coinsBloc;

Map<String, BaseRouteParser> get _parsers => {
firstUriSegment.wallet: WalletRouteParser(coinsBloc),
firstUriSegment.fiat: fiatRouteParser,
firstUriSegment.dex: dexRouteParser,
firstUriSegment.bridge: bridgeRouteParser,
firstUriSegment.nfts: nftRouteParser,
firstUriSegment.settings: settingsRouteParser,
};

@override
Future<AppRoutePath> parseRouteInformation(
RouteInformation routeInformation) async {
final uri = Uri.parse(routeInformation.uri.path);
final BaseRouteParser parser = _getRoutParser(uri);
final BaseRouteParser parser =
_getRoutParser(Uri.parse(routeInformation.uri.path));

return parser.getRoutePath(uri);
return parser.getRoutePath(routeInformation.uri);
}

@override
Expand All @@ -35,8 +40,8 @@ class RootRouteInformationParser extends RouteInformationParser<AppRoutePath> {
}

BaseRouteParser _getRoutParser(Uri uri) {
const defaultRouteParser =
kIsWalletOnly ? walletRouteParser : dexRouteParser;
final defaultRouteParser =
kIsWalletOnly ? _parsers[firstUriSegment.wallet]! : dexRouteParser;

if (uri.pathSegments.isEmpty) return defaultRouteParser;
return _parsers[uri.pathSegments.first] ?? defaultRouteParser;
Expand Down
102 changes: 55 additions & 47 deletions lib/shared/widgets/logout_popup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:web_dex/app_config/app_config.dart';
import 'package:komodo_ui_kit/komodo_ui_kit.dart';
import 'package:web_dex/bloc/auth_bloc/auth_bloc.dart';
import 'package:web_dex/bloc/auth_bloc/auth_bloc_event.dart';
import 'package:web_dex/blocs/blocs.dart';
import 'package:web_dex/bloc/coins_bloc/coins_bloc.dart';
import 'package:web_dex/generated/codegen_loader.g.dart';
import 'package:web_dex/model/wallet.dart';
import 'package:komodo_ui_kit/komodo_ui_kit.dart';

class LogOutPopup extends StatelessWidget {
const LogOutPopup({
Expand All @@ -20,56 +19,65 @@ class LogOutPopup extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Container(
constraints: const BoxConstraints(maxWidth: 300),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
SelectableText(
LocaleKeys.logoutPopupTitle.tr(),
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w700,
),
),
const SizedBox(height: 12),
if (currentWalletBloc.wallet?.config.type == WalletType.iguana)
SelectableText(
kIsWalletOnly
? LocaleKeys.logoutPopupDescriptionWalletOnly.tr()
: LocaleKeys.logoutPopupDescription.tr(),
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 25),
Row(
return BlocBuilder<AuthBloc, AuthBlocState>(
builder: (context, state) {
final currentWallet = state.currentUser?.wallet;
return Container(
constraints: const BoxConstraints(maxWidth: 300),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
UiUnderlineTextButton(
key: const Key('popup-cancel-logout-button'),
width: 120,
height: 36,
text: LocaleKeys.cancel.tr(),
onPressed: onCancel,
SelectableText(
LocaleKeys.logoutPopupTitle.tr(),
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w700,
),
),
const SizedBox(width: 12),
UiPrimaryButton(
key: const Key('popup-confirm-logout-button'),
width: 120,
height: 36,
text: LocaleKeys.logOut.tr(),
onPressed: () {
context.read<AuthBloc>().add(const AuthLogOutEvent());
onConfirm();
},
const SizedBox(height: 12),
if (currentWallet?.config.type == WalletType.iguana)
SelectableText(
kIsWalletOnly
? LocaleKeys.logoutPopupDescriptionWalletOnly.tr()
: LocaleKeys.logoutPopupDescription.tr(),
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 25),
Row(
mainAxisSize: MainAxisSize.min,
children: [
UiUnderlineTextButton(
key: const Key('popup-cancel-logout-button'),
width: 120,
height: 36,
text: LocaleKeys.cancel.tr(),
onPressed: onCancel,
),
const SizedBox(width: 12),
UiPrimaryButton(
key: const Key('popup-confirm-logout-button'),
width: 120,
height: 36,
text: LocaleKeys.logOut.tr(),
onPressed: () => _onConfirmLogout(context),
),
],
),
],
),
],
),
);
},
);
}

void _onConfirmLogout(BuildContext context) {
// stop listening to balance updates before logging out
context.read<CoinsBloc>().add(CoinsSessionEnded());
context.read<AuthBloc>().add(const AuthSignOutRequested());
onConfirm();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:web_dex/shared/widgets/hidden_without_wallet.dart';
import 'package:web_dex/views/settings/widgets/general_settings/import_swaps.dart';
import 'package:web_dex/views/settings/widgets/general_settings/settings_download_logs.dart';
import 'package:web_dex/views/settings/widgets/general_settings/settings_manage_analytics.dart';
import 'package:web_dex/views/settings/widgets/general_settings/settings_manage_test_coins.dart';
import 'package:web_dex/views/settings/widgets/general_settings/settings_manage_trading_bot.dart';
import 'package:web_dex/views/settings/widgets/general_settings/settings_reset_activated_coins.dart';
import 'package:web_dex/views/settings/widgets/general_settings/settings_theme_switcher.dart';
Expand All @@ -25,6 +26,8 @@ class GeneralSettings extends StatelessWidget {
const SizedBox(height: 25),
const SettingsManageAnalytics(),
const SizedBox(height: 25),
const SettingsManageTestCoins(),
const SizedBox(height: 25),
if (!kIsWalletOnly)
const HiddenWithoutWallet(
child: SettingsManageTradingBot(),
Expand Down
3 changes: 2 additions & 1 deletion packages/komodo_ui_kit/lib/src/images/coin_icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

const coinImagesFolder = 'coin_icons/png/';
const coinImagesFolder = 'packages/komodo_defi_framework/assets/coin_icons/png/';
// NB: ENSURE IT STAYS IN SYNC WITH MAIN PROJECT in `lib/src/utils/utils.dart`.
const mediaCdnUrl = 'https://komodoplatform.github.io/coins/icons/';

final Map<String, bool> _assetExistenceCache = {};
Expand Down

0 comments on commit 6de0759

Please sign in to comment.