Skip to content

Commit

Permalink
chore: ♻️ Remove getit usage for OracleService
Browse files Browse the repository at this point in the history
  • Loading branch information
redDwarf03 committed Oct 21, 2024
1 parent a9c7f60 commit cefc891
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 3.1.0

* Remove GetIt usage for `OracleService`

# 3.0.3

*`AppBackground` widget : Add boxfit in param
Expand Down
14 changes: 6 additions & 8 deletions lib/src/application/oracle/provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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');

Expand All @@ -36,21 +37,18 @@ class _ArchethicOracleUCONotifier extends _$ArchethicOracleUCONotifier {
Future<void> stopSubscription() async {
_logger.info('Stop listening to Oracle');
if (archethicOracleSubscription == null) return;
sl
.get<OracleService>()
.closeOracleUpdatesSubscription(archethicOracleSubscription!);
_oracleService.closeOracleUpdatesSubscription(archethicOracleSubscription!);
archethicOracleSubscription = null;
}

Future<void> _getValue() async {
final oracleUcoPrice = await sl.get<OracleService>().getOracleData();
final oracleUcoPrice = await _oracleService.getOracleData();
_fillInfo(oracleUcoPrice);
}

Future<void> _subscribe() async {
archethicOracleSubscription = await sl
.get<OracleService>()
.subscribeToOracleUpdates((oracleUcoPrice) {
archethicOracleSubscription =
await _oracleService.subscribeToOracleUpdates((oracleUcoPrice) {
_fillInfo(oracleUcoPrice!);
});
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit cefc891

Please sign in to comment.