162 lines
4.6 KiB
Dart
162 lines
4.6 KiB
Dart
part of 'prediction_bloc.dart';
|
|
|
|
abstract class PredictionEvent extends Equatable {
|
|
const PredictionEvent();
|
|
@override
|
|
List<Object?> get props => [];
|
|
}
|
|
|
|
class PredictionLoadRequested extends PredictionEvent {
|
|
const PredictionLoadRequested();
|
|
}
|
|
|
|
class PredictionIntervalChanged extends PredictionEvent {
|
|
const PredictionIntervalChanged(this.minutes);
|
|
final int minutes;
|
|
@override
|
|
List<Object?> get props => [minutes];
|
|
}
|
|
|
|
class PredictionStakeSelected extends PredictionEvent {
|
|
const PredictionStakeSelected(this.stake);
|
|
final double stake;
|
|
@override
|
|
List<Object?> get props => [stake];
|
|
}
|
|
|
|
class PredictionDirectionSelected extends PredictionEvent {
|
|
const PredictionDirectionSelected(this.direction);
|
|
final String direction;
|
|
@override
|
|
List<Object?> get props => [direction];
|
|
}
|
|
|
|
class PredictionStakeAccountChanged extends PredictionEvent {
|
|
const PredictionStakeAccountChanged(this.kind);
|
|
final StakeAccountKind kind;
|
|
@override
|
|
List<Object?> get props => [kind];
|
|
}
|
|
|
|
class PredictionPlayModeChanged extends PredictionEvent {
|
|
const PredictionPlayModeChanged(this.mode);
|
|
final PredictionPlayMode mode;
|
|
@override
|
|
List<Object?> get props => [mode];
|
|
}
|
|
|
|
class PredictionMultiLevelSelected extends PredictionEvent {
|
|
const PredictionMultiLevelSelected(this.level);
|
|
final MultiLevelModel level;
|
|
@override
|
|
List<Object?> get props => [level];
|
|
}
|
|
|
|
class PredictionMultiDirectionToggled extends PredictionEvent {
|
|
const PredictionMultiDirectionToggled(this.index);
|
|
final int index;
|
|
@override
|
|
List<Object?> get props => [index];
|
|
}
|
|
|
|
class PredictionPlaceBetRequested extends PredictionEvent {
|
|
const PredictionPlaceBetRequested();
|
|
}
|
|
|
|
class PredictionPlaceMultiBetRequested extends PredictionEvent {
|
|
const PredictionPlaceMultiBetRequested();
|
|
}
|
|
|
|
class PredictionAutoSaveRequested extends PredictionEvent {
|
|
const PredictionAutoSaveRequested(this.body);
|
|
final Map<String, dynamic> body;
|
|
@override
|
|
List<Object?> get props => [body];
|
|
}
|
|
|
|
class PredictionRefreshTick extends PredictionEvent {
|
|
const PredictionRefreshTick({this.forceGameState = false});
|
|
|
|
/// When true, always re-fetch `/state` even if WebSocket is healthy.
|
|
/// Used when a new betting window opens so `userBet` unlocks promptly.
|
|
final bool forceGameState;
|
|
|
|
@override
|
|
List<Object?> get props => [forceGameState];
|
|
}
|
|
|
|
class PredictionWsMessageReceived extends PredictionEvent {
|
|
const PredictionWsMessageReceived(this.message);
|
|
final Map<String, dynamic> message;
|
|
@override
|
|
List<Object?> get props => [message];
|
|
}
|
|
|
|
class PredictionSocketStatusChanged extends PredictionEvent {
|
|
const PredictionSocketStatusChanged(this.status);
|
|
final GameSocketConnectionState status;
|
|
@override
|
|
List<Object?> get props => [status];
|
|
}
|
|
|
|
class PredictionHistoryPageRequested extends PredictionEvent {
|
|
const PredictionHistoryPageRequested(
|
|
this.page, {
|
|
this.append = false,
|
|
});
|
|
final int page;
|
|
final bool append;
|
|
@override
|
|
List<Object?> get props => [page, append];
|
|
}
|
|
|
|
class PredictionHistoryFilterChanged extends PredictionEvent {
|
|
const PredictionHistoryFilterChanged({
|
|
this.walletFilter,
|
|
this.statusFilter,
|
|
});
|
|
|
|
/// Full filter snapshot. `null` means no filter for that dimension.
|
|
final String? walletFilter;
|
|
final String? statusFilter;
|
|
|
|
@override
|
|
List<Object?> get props => [walletFilter, statusFilter];
|
|
}
|
|
|
|
class PredictionCandlesOlderRequested extends PredictionEvent {
|
|
const PredictionCandlesOlderRequested();
|
|
}
|
|
|
|
/// Pause HTTP polling when leaving the prediction screen (bloc is app-scoped).
|
|
class PredictionPaused extends PredictionEvent {
|
|
const PredictionPaused();
|
|
}
|
|
|
|
/// Resume polling / reload when entering the prediction screen.
|
|
class PredictionResumed extends PredictionEvent {
|
|
const PredictionResumed();
|
|
}
|
|
|
|
/// Fired when the OS brings the app back to the foreground (screen unlock,
|
|
/// app switcher return, etc.) while already on the prediction screen.
|
|
///
|
|
/// Unlike [PredictionResumed] (screen navigation), this does NOT trust that
|
|
/// the existing WebSocket connection / poll timer chain are still healthy:
|
|
/// mobile OSes routinely suspend timers and silently drop sockets while
|
|
/// backgrounded without ever firing `onDone`/`onError`, so `isConnected` can
|
|
/// stay (wrongly) true. This forces a verified-fresh reconnect + full resync.
|
|
class PredictionAppResumed extends PredictionEvent {
|
|
const PredictionAppResumed();
|
|
}
|
|
|
|
/// Reload main / bonus / test wallet labels for the stake selector.
|
|
class PredictionBalancesRefreshRequested extends PredictionEvent {
|
|
const PredictionBalancesRefreshRequested();
|
|
}
|
|
|
|
/// Clear one-shot UI feedback (error snackbar / bet-placed toast).
|
|
class PredictionFeedbackConsumed extends PredictionEvent {
|
|
const PredictionFeedbackConsumed();
|
|
}
|