- Changed window size to mobile phone format (400x800) - Removed width condition for ActiveProxyFooter - now always visible - Added run-umbrix.sh launch script with icon copying - Stats cards now display on all screen sizes
34 lines
1.0 KiB
Dart
34 lines
1.0 KiB
Dart
import 'package:fpdart/fpdart.dart';
|
|
import 'package:umbrix/core/utils/exception_handler.dart';
|
|
import 'package:umbrix/features/stats/model/stats_entity.dart';
|
|
import 'package:umbrix/features/stats/model/stats_failure.dart';
|
|
import 'package:umbrix/singbox/service/singbox_service.dart';
|
|
import 'package:umbrix/utils/custom_loggers.dart';
|
|
|
|
abstract interface class StatsRepository {
|
|
Stream<Either<StatsFailure, StatsEntity>> watchStats();
|
|
}
|
|
|
|
class StatsRepositoryImpl
|
|
with ExceptionHandler, InfraLogger
|
|
implements StatsRepository {
|
|
StatsRepositoryImpl({required this.singbox});
|
|
|
|
final SingboxService singbox;
|
|
|
|
@override
|
|
Stream<Either<StatsFailure, StatsEntity>> watchStats() {
|
|
return singbox
|
|
.watchStats()
|
|
.map(
|
|
(event) => StatsEntity(
|
|
uplink: event.uplink,
|
|
downlink: event.downlink,
|
|
uplinkTotal: event.uplinkTotal,
|
|
downlinkTotal: event.downlinkTotal,
|
|
),
|
|
)
|
|
.handleExceptions(StatsUnexpectedFailure.new);
|
|
}
|
|
}
|