-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af0c815
commit 0eb8f92
Showing
63 changed files
with
3,408 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,4 @@ migrate_working_dir/ | |
**/doc/api/ | ||
.dart_tool/ | ||
build/ | ||
lib/utils/api_keys.dart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// ignore_for_file: non_constant_identifier_names | ||
|
||
import 'package:cloud_firestore/cloud_firestore.dart'; | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
|
||
import '../../converter/timestamp_json_converter.dart'; | ||
|
||
part 'live_stream_model.freezed.dart'; | ||
|
||
part 'live_stream_model.g.dart'; | ||
|
||
@freezed | ||
class LiveStreamModel with _$LiveStreamModel { | ||
const factory LiveStreamModel({ | ||
required String id, | ||
required String match_id, | ||
required String rtmp_url, | ||
required String stream_id, | ||
required String server_url, | ||
required String stream_name, | ||
required String broadcast_id, | ||
required String title, | ||
@TimeStampJsonConverter() DateTime? start_time, | ||
@Default(LiveStreamStatus.pending) LiveStreamStatus status, | ||
}) = _LiveStreamModel; | ||
|
||
factory LiveStreamModel.fromJson(Map<String, dynamic> json) => | ||
_$LiveStreamModelFromJson(json); | ||
|
||
factory LiveStreamModel.fromFireStore( | ||
DocumentSnapshot<Map<String, dynamic>> snapshot, | ||
SnapshotOptions? options, | ||
) => | ||
LiveStreamModel.fromJson(snapshot.data()!); | ||
} | ||
|
||
enum LiveStreamStatus { | ||
pending, | ||
live, | ||
paused, | ||
completed; | ||
} | ||
|
||
enum MediumOption { | ||
kheloYTChannel, | ||
userYTChannel; | ||
|
||
bool get isLoginRequired => this == MediumOption.userYTChannel; | ||
} | ||
|
||
@freezed | ||
class YTChannel with _$YTChannel { | ||
const factory YTChannel({ | ||
required String id, | ||
required String title, | ||
required String description, | ||
required bool madeForKids, | ||
required bool selfDeclaredMadeForKids, | ||
required String? thumbnailUrl, | ||
required PrivacyStatus privacyStatus, | ||
}) = _YTChannel; | ||
|
||
factory YTChannel.fromJson(Map<String, dynamic> json) { | ||
return YTChannel( | ||
id: json['id'], | ||
title: json['snippet']['title'], | ||
description: json['snippet']['description'], | ||
madeForKids: json['status']['madeForKids'] ?? false, | ||
selfDeclaredMadeForKids: json['status']['selfDeclaredMadeForKids'] ?? false, | ||
thumbnailUrl: json['snippet']['thumbnails']['default']['url'], | ||
privacyStatus: json['status']['privacyStatus'] == 'public' | ||
? PrivacyStatus.public | ||
: json['status']['privacyStatus'] == 'private' | ||
? PrivacyStatus.private | ||
: PrivacyStatus.unlisted, | ||
); | ||
} | ||
} | ||
|
||
enum PrivacyStatus { | ||
public, | ||
private, | ||
unlisted, | ||
} |
Oops, something went wrong.