From cefc891d7e352ae2c4057a99f5807c4f82cd03dd Mon Sep 17 00:00:00 2001 From: redDwarf03 Date: Mon, 21 Oct 2024 16:17:55 +0200 Subject: [PATCH] chore: :recycle: Remove getit usage for OracleService --- CHANGELOG.md | 4 ++++ lib/src/application/oracle/provider.dart | 14 ++++++-------- pubspec.yaml | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aecbff5..97ec623 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 3.1.0 + +* Remove GetIt usage for `OracleService` + # 3.0.3 * ✨ `AppBackground` widget : Add boxfit in param diff --git a/lib/src/application/oracle/provider.dart b/lib/src/application/oracle/provider.dart index d8db4aa..b377f25 100644 --- a/lib/src/application/oracle/provider.dart +++ b/lib/src/application/oracle/provider.dart @@ -3,7 +3,6 @@ import 'dart:async'; import 'package:archethic_dapp_framework_flutter/src/application/oracle/state.dart'; -import 'package:archethic_dapp_framework_flutter/src/util/generic/get_it_instance.dart'; import 'package:archethic_lib_dart/archethic_lib_dart.dart'; import 'package:logging/logging.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; @@ -13,6 +12,8 @@ part 'provider.g.dart'; @Riverpod(keepAlive: true) class _ArchethicOracleUCONotifier extends _$ArchethicOracleUCONotifier { ArchethicOracle? archethicOracleSubscription; + final OracleService _oracleService = + OracleService('https://mainnet.archethic.net'); static final _logger = Logger('ArchethicOracleUCONotifier'); @@ -36,21 +37,18 @@ class _ArchethicOracleUCONotifier extends _$ArchethicOracleUCONotifier { Future stopSubscription() async { _logger.info('Stop listening to Oracle'); if (archethicOracleSubscription == null) return; - sl - .get() - .closeOracleUpdatesSubscription(archethicOracleSubscription!); + _oracleService.closeOracleUpdatesSubscription(archethicOracleSubscription!); archethicOracleSubscription = null; } Future _getValue() async { - final oracleUcoPrice = await sl.get().getOracleData(); + final oracleUcoPrice = await _oracleService.getOracleData(); _fillInfo(oracleUcoPrice); } Future _subscribe() async { - archethicOracleSubscription = await sl - .get() - .subscribeToOracleUpdates((oracleUcoPrice) { + archethicOracleSubscription = + await _oracleService.subscribeToOracleUpdates((oracleUcoPrice) { _fillInfo(oracleUcoPrice!); }); } diff --git a/pubspec.yaml b/pubspec.yaml index 6adc46a..2082808 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: archethic_dapp_framework_flutter description: An internal framework for archethic flutter development homepage: https://github.com/archethic-foundation/archethic-dapp-framework-flutter -version: 3.0.3 +version: 3.1.0 environment: sdk: ">=3.3.0 <4.0.0"