Billing Stripe, link regia mobile e staff solo trasmissione.

Aggiunge fatturazione club, pagina regia condivisibile senza account, roster squadre e rimuove la modalità controller dall'app (v1.1.0).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-29 07:23:13 +02:00
parent 4083bc5dee
commit f4b7be0f80
156 changed files with 5033 additions and 2033 deletions

View File

@@ -1,6 +1,7 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../core/auth_storage.dart';
import '../core/team_selection_storage.dart';
import '../shared/models/user.dart';
class AuthState {
@@ -82,6 +83,7 @@ class AuthNotifier extends StateNotifier<AuthState> {
void logout() {
state = const AuthState();
AuthStorage.clear();
TeamSelectionStorage.clear();
}
}

View File

@@ -4,53 +4,38 @@ import '../shared/models/device_state.dart';
import '../shared/models/match.dart';
import '../shared/models/stream_session.dart';
enum DeviceRole { camera, controller }
class SessionState {
const SessionState({
this.session,
this.match,
this.connected = false,
this.deviceRole = DeviceRole.controller,
this.cameraDevice,
this.elapsed = Duration.zero,
this.connected = false,
this.cameraDevice,
this.viewerCount = 0,
this.loading = false,
this.error,
});
final StreamSession? session;
final MatchModel? match;
final bool connected;
final DeviceRole deviceRole;
final DeviceStateModel? cameraDevice;
final Duration elapsed;
final bool connected;
final DeviceStateModel? cameraDevice;
final int viewerCount;
final bool loading;
final String? error;
SessionState copyWith({
StreamSession? session,
MatchModel? match,
bool? connected,
DeviceRole? deviceRole,
DeviceStateModel? cameraDevice,
Duration? elapsed,
bool? connected,
DeviceStateModel? cameraDevice,
int? viewerCount,
bool? loading,
String? error,
bool clearError = false,
}) {
return SessionState(
session: session ?? this.session,
match: match ?? this.match,
connected: connected ?? this.connected,
deviceRole: deviceRole ?? this.deviceRole,
cameraDevice: cameraDevice ?? this.cameraDevice,
elapsed: elapsed ?? this.elapsed,
connected: connected ?? this.connected,
cameraDevice: cameraDevice ?? this.cameraDevice,
viewerCount: viewerCount ?? this.viewerCount,
loading: loading ?? this.loading,
error: clearError ? null : (error ?? this.error),
);
}
}
@@ -59,23 +44,27 @@ class SessionNotifier extends StateNotifier<SessionState> {
SessionNotifier() : super(const SessionState());
void setSession(StreamSession session, {MatchModel? match}) {
state = state.copyWith(
session: session,
match: match,
clearError: true,
);
state = state.copyWith(session: session, match: match);
}
void setMatch(MatchModel match) {
state = state.copyWith(match: match);
}
void setElapsed(Duration elapsed) {
state = state.copyWith(elapsed: elapsed);
}
void setConnected(bool connected) {
state = state.copyWith(connected: connected);
}
void setDeviceRole(DeviceRole role) {
state = state.copyWith(deviceRole: role);
void setCameraDevice(DeviceStateModel? device) {
state = state.copyWith(cameraDevice: device);
}
void setViewerCount(int count) {
state = state.copyWith(viewerCount: count);
}
void updateDeviceState(DeviceStateModel device) {
@@ -83,34 +72,29 @@ class SessionNotifier extends StateNotifier<SessionState> {
state = state.copyWith(cameraDevice: device);
}
if (device.status != null && state.session != null) {
final s = state.session!;
state = state.copyWith(
session: StreamSession(
id: state.session!.id,
matchId: state.session!.matchId,
id: s.id,
matchId: s.matchId,
status: device.status!,
platform: state.session!.platform,
rtmpIngestUrl: state.session!.rtmpIngestUrl,
youtubeBroadcastId: state.session!.youtubeBroadcastId,
privacyStatus: state.session!.privacyStatus,
qualityPreset: state.session!.qualityPreset,
targetBitrate: state.session!.targetBitrate,
startedAt: state.session!.startedAt,
disconnectionCount: state.session!.disconnectionCount,
score: state.session!.score,
devices: state.session!.devices,
platform: s.platform,
rtmpIngestUrl: s.rtmpIngestUrl,
hlsPlaybackUrl: s.hlsPlaybackUrl,
watchPageUrl: s.watchPageUrl,
youtubeBroadcastId: s.youtubeBroadcastId,
privacyStatus: s.privacyStatus,
qualityPreset: s.qualityPreset,
targetBitrate: s.targetBitrate,
startedAt: s.startedAt,
disconnectionCount: s.disconnectionCount,
score: s.score,
devices: s.devices,
),
);
}
}
void setElapsed(Duration elapsed) {
state = state.copyWith(elapsed: elapsed);
}
void setViewerCount(int count) {
state = state.copyWith(viewerCount: count);
}
void applyCommand(String action) {
final session = state.session;
if (session == null) return;
@@ -128,38 +112,35 @@ class SessionNotifier extends StateNotifier<SessionState> {
break;
}
state = state.copyWith(
session: StreamSession(
id: session.id,
matchId: session.matchId,
status: newStatus,
platform: session.platform,
rtmpIngestUrl: session.rtmpIngestUrl,
youtubeBroadcastId: session.youtubeBroadcastId,
privacyStatus: session.privacyStatus,
qualityPreset: session.qualityPreset,
targetBitrate: session.targetBitrate,
startedAt: session.startedAt,
disconnectionCount: session.disconnectionCount,
score: session.score,
devices: session.devices,
),
);
if (newStatus != session.status) {
state = state.copyWith(
session: StreamSession(
id: session.id,
matchId: session.matchId,
status: newStatus,
platform: session.platform,
rtmpIngestUrl: session.rtmpIngestUrl,
hlsPlaybackUrl: session.hlsPlaybackUrl,
watchPageUrl: session.watchPageUrl,
youtubeBroadcastId: session.youtubeBroadcastId,
privacyStatus: session.privacyStatus,
qualityPreset: session.qualityPreset,
targetBitrate: session.targetBitrate,
startedAt: session.startedAt,
disconnectionCount: session.disconnectionCount,
score: session.score,
devices: session.devices,
),
);
}
}
void setLoading(bool loading) {
state = state.copyWith(loading: loading);
}
void setError(String message) {
state = state.copyWith(loading: false, error: message);
}
void reset() {
void clear() {
state = const SessionState();
}
}
final sessionProvider = StateNotifierProvider<SessionNotifier, SessionState>(
(ref) => SessionNotifier(),
);
final sessionProvider =
StateNotifierProvider<SessionNotifier, SessionState>((ref) {
return SessionNotifier();
});