Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a15f83b
feat(nft): tolerate activation failures
takenagain Jul 28, 2025
a1fc9bf
fix(nft): skip missing parents in firstWhere
takenagain Jul 28, 2025
9e3029d
refactor(nft-main-repo): fix parent coin filter and use logging package
takenagain Jul 28, 2025
ecaa82e
fix(nft): don't return an error if there are no NFTs returned
takenagain Jul 28, 2025
21ac328
fix(nft): revert map-based error responses in favor of manual activation
takenagain Jul 28, 2025
e4c530d
fix(skeleton-list-tile): add height constraint to fix renderflex assert
takenagain Jul 28, 2025
fbce539
fix(coin): temporarily skip calling deactivation RPC
takenagain Jul 28, 2025
c962821
Merge remote-tracking branch 'origin/dev' into codex/add-function-to-…
takenagain Jul 28, 2025
a76f100
fix(activation): use more complete coin conversion function
takenagain Jul 29, 2025
7baa8be
feat(nft): add nft image bloc for url resolution, fallbacks and retry
takenagain Jul 29, 2025
6cee8f2
Merge remote-tracking branch 'origin/dev' into codex/add-function-to-…
takenagain Jul 29, 2025
22e07ba
fix(ipfs-gateway-manager): move gateway match above subdomain
takenagain Jul 29, 2025
38ef68f
test: add unit tests for ipfs url normaliser and fix case sensitivity
takenagain Jul 29, 2025
a2c983c
refactor(nft-image): remove dead code & move url testing out of bloc
takenagain Jul 29, 2025
d9bb03c
Merge branch 'codex/add-function-to-activate-parent-coins-for-nfts' i…
takenagain Jul 29, 2025
8ed8de5
Merge branch 'dev' into bugfix/nft-image-loading
takenagain Aug 4, 2025
c1251a9
fix(nft): delegate IpfsGatewayManager disposal to root provider (#3047)
takenagain Aug 4, 2025
b1ca168
fix(nft): reset NFT image on url change (#3046)
takenagain Aug 4, 2025
a0d7cf6
style: apply updated dart formatting to modified files
takenagain Aug 4, 2025
c8a8e3f
fix(coins): filter excluded and testnet coins out of price updates
takenagain Aug 4, 2025
7db078c
fix(nft-image): reduce the number of success events fired
takenagain Aug 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 53 additions & 56 deletions lib/bloc/app_bloc_root.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import 'package:web_dex/router/parsers/root_route_parser.dart';
import 'package:web_dex/router/state/routing_state.dart';
import 'package:web_dex/services/orders_service/my_orders_service.dart';
import 'package:web_dex/shared/utils/debug_utils.dart';
import 'package:web_dex/shared/utils/ipfs_gateway_manager.dart';
import 'package:web_dex/shared/utils/utils.dart';

class AppBlocRoot extends StatelessWidget {
Expand All @@ -86,8 +87,9 @@ class AppBlocRoot extends StatelessWidget {
) async {
final sharedPrefs = await SharedPreferences.getInstance();

final storedLastPerformanceMode =
sharedPrefs.getString('last_performance_mode');
final storedLastPerformanceMode = sharedPrefs.getString(
'last_performance_mode',
);

if (storedLastPerformanceMode != performanceMode?.name) {
profitLossRepo.clearCache().ignore();
Expand Down Expand Up @@ -152,11 +154,14 @@ class AppBlocRoot extends StatelessWidget {

return MultiRepositoryProvider(
providers: [
// Keep ipfs gateway manager near root to keep in-memory cache of failing
// URLS to avoid repeated requests to the same failing URLs.
RepositoryProvider(
create: (_) => NftsRepo(
api: mm2Api.nft,
coinsRepo: coinsRepository,
),
create: (_) => IpfsGatewayManager(),
dispose: (manager) => manager.dispose(),
),
RepositoryProvider(
create: (_) => NftsRepo(api: mm2Api.nft, coinsRepo: coinsRepository),
),
RepositoryProvider(create: (_) => tradingEntitiesBloc),
RepositoryProvider(create: (_) => dexRepository),
Expand All @@ -178,21 +183,17 @@ class AppBlocRoot extends StatelessWidget {
child: MultiBlocProvider(
providers: [
BlocProvider(
create: (context) => CoinsBloc(
komodoDefiSdk,
coinsRepository,
)..add(CoinsStarted()),
create: (context) =>
CoinsBloc(komodoDefiSdk, coinsRepository)..add(CoinsStarted()),
),
BlocProvider<PriceChartBloc>(
create: (context) => PriceChartBloc(
binanceRepository,
komodoDefiSdk,
)..add(
const PriceChartStarted(
symbols: ['BTC'],
period: Duration(days: 30),
create: (context) =>
PriceChartBloc(binanceRepository, komodoDefiSdk)..add(
const PriceChartStarted(
symbols: ['BTC'],
period: Duration(days: 30),
),
),
),
),
BlocProvider<AssetOverviewBloc>(
create: (context) => AssetOverviewBloc(
Expand All @@ -202,10 +203,7 @@ class AppBlocRoot extends StatelessWidget {
),
),
BlocProvider<ProfitLossBloc>(
create: (context) => ProfitLossBloc(
profitLossRepo,
komodoDefiSdk,
),
create: (context) => ProfitLossBloc(profitLossRepo, komodoDefiSdk),
),
BlocProvider<PortfolioGrowthBloc>(
create: (BuildContext ctx) => PortfolioGrowthBloc(
Expand All @@ -214,9 +212,8 @@ class AppBlocRoot extends StatelessWidget {
),
),
BlocProvider<TransactionHistoryBloc>(
create: (BuildContext ctx) => TransactionHistoryBloc(
sdk: komodoDefiSdk,
),
create: (BuildContext ctx) =>
TransactionHistoryBloc(sdk: komodoDefiSdk),
),
BlocProvider<SettingsBloc>(
create: (context) =>
Expand Down Expand Up @@ -252,10 +249,8 @@ class AppBlocRoot extends StatelessWidget {
),
BlocProvider(
lazy: false,
create: (context) => NftMainBloc(
repo: context.read<NftsRepo>(),
sdk: komodoDefiSdk,
),
create: (context) =>
NftMainBloc(repo: context.read<NftsRepo>(), sdk: komodoDefiSdk),
),
if (isBitrefillIntegrationEnabled)
BlocProvider(
Expand All @@ -264,10 +259,7 @@ class AppBlocRoot extends StatelessWidget {
),
BlocProvider<MarketMakerBotBloc>(
create: (context) => MarketMakerBotBloc(
MarketMakerBotRepository(
mm2Api,
SettingsRepository(),
),
MarketMakerBotRepository(mm2Api, SettingsRepository()),
MarketMakerBotOrderListRepository(
myOrdersService,
SettingsRepository(),
Expand All @@ -277,13 +269,14 @@ class AppBlocRoot extends StatelessWidget {
),
BlocProvider<TradingStatusBloc>(
lazy: false,
create: (context) => TradingStatusBloc(
context.read<TradingStatusRepository>(),
)..add(TradingStatusCheckRequested()),
create: (context) =>
TradingStatusBloc(context.read<TradingStatusRepository>())
..add(TradingStatusCheckRequested()),
),
BlocProvider<SystemHealthBloc>(
create: (_) => SystemHealthBloc(SystemClockRepository(), mm2Api)
..add(SystemHealthPeriodicCheckStarted()),
create: (_) =>
SystemHealthBloc(SystemClockRepository(), mm2Api)
..add(SystemHealthPeriodicCheckStarted()),
),
BlocProvider<CoinsManagerBloc>(
create: (context) => CoinsManagerBloc(
Expand Down Expand Up @@ -347,8 +340,9 @@ class _MyAppViewState extends State<_MyAppView> {
Widget build(BuildContext context) {
return MaterialApp.router(
onGenerateTitle: (_) => appTitle,
themeMode: context
.select((SettingsBloc settingsBloc) => settingsBloc.state.themeMode),
themeMode: context.select(
(SettingsBloc settingsBloc) => settingsBloc.state.themeMode,
),
darkTheme: theme.global.dark,
theme: theme.global.light,
routerDelegate: _routerDelegate,
Expand Down Expand Up @@ -388,15 +382,16 @@ class _MyAppViewState extends State<_MyAppView> {
// Remove the loading indicator.
loadingElement.remove();

final delay =
DateTime.now().difference(_pageLoadStartTime).inMilliseconds;
final delay = DateTime.now()
.difference(_pageLoadStartTime)
.inMilliseconds;
context.read<AnalyticsBloc>().logEvent(
PageInteractiveDelayEventData(
pageName: 'app_root',
interactiveDelayMs: delay,
spinnerTimeMs: 200,
),
);
PageInteractiveDelayEventData(
pageName: 'app_root',
interactiveDelayMs: delay,
spinnerTimeMs: 200,
),
);
}
}

Expand Down Expand Up @@ -430,20 +425,22 @@ class _MyAppViewState extends State<_MyAppView> {
// }

// ignore: use_build_context_synchronously
await AssetIcon.precacheAssetIcon(context, assetId).onError(
(_, __) => debugPrint('Error precaching coin icon $assetId'));
await AssetIcon.precacheAssetIcon(
context,
assetId,
).onError((_, __) => debugPrint('Error precaching coin icon $assetId'));
}

_currentPrecacheOperation!.complete();

if (!mounted) return;
context.read<AnalyticsBloc>().logEvent(
CoinsDataUpdatedEventData(
updateSource: 'remote',
updateDurationMs: stopwatch.elapsedMilliseconds,
coinsCount: availableAssetIds.length,
),
);
CoinsDataUpdatedEventData(
updateSource: 'remote',
updateDurationMs: stopwatch.elapsedMilliseconds,
coinsCount: availableAssetIds.length,
),
);
} catch (e) {
log('Error precaching coin icons: $e');
_currentPrecacheOperation!.completeError(e);
Expand Down
Loading
Loading