Skip to content

Commit

Permalink
Remove poll, prediction and hype train 20 seconds after end
Browse files Browse the repository at this point in the history
  • Loading branch information
LezdCS committed Aug 21, 2023
1 parent d4fb3cc commit 84b9709
Showing 1 changed file with 30 additions and 21 deletions.
51 changes: 30 additions & 21 deletions lib/src/core/utils/twitch_event_sub.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class TwitchEventSub {
subscribeToEvent('channel.hype_train.end', '1', sessionId,
{"broadcaster_user_id": _broadcasterId ?? ''});

fakeData();
// fakeData();
}

if (msgMapped['subscription'] != null) {
Expand All @@ -97,6 +97,9 @@ class TwitchEventSub {
break;
case 'channel.poll.end':
currentPoll.value = TwitchPollDTO.fromJson(msgMapped['event']);
Future.delayed(const Duration(seconds: 20)).then((value) =>
currentPoll.value = null
);
break;

//PREDICTIONS
Expand All @@ -111,6 +114,9 @@ class TwitchEventSub {
break;
case 'channel.prediction.end':
currentPrediction.value = TwitchPredictionDTO.fromJson(msgMapped['event']);
Future.delayed(const Duration(seconds: 20)).then((value) =>
currentPrediction.value = null
);
break;

//HYPE TRAIN
Expand All @@ -122,6 +128,9 @@ class TwitchEventSub {
break;
case 'channel.hype_train.end':
currentHypeTrain.value = TwitchHypeTrainDTO.fromJson(msgMapped['event']);
Future.delayed(const Duration(seconds: 20)).then((value) =>
currentHypeTrain.value = null
);
break;
default:
}
Expand Down Expand Up @@ -163,28 +172,28 @@ class TwitchEventSub {
}

void fakeData() async {
// // PREDICTIONS
// _eventListener(predictionBeginJson);
// await Future.delayed(const Duration(seconds: 10));
// _eventListener(predictionProgressJson);
// await Future.delayed(const Duration(seconds: 10));
// _eventListener(predictionLockJson);
// await Future.delayed(const Duration(seconds: 10));
// _eventListener(predictionEndJson);

// // POLLS
// _eventListener(pollBeginJson);
// await Future.delayed(const Duration(seconds: 10));
// _eventListener(pollProgressJson);
// await Future.delayed(const Duration(seconds: 10));
// _eventListener(pollEndJson);
// PREDICTIONS
_eventListener(predictionBeginJson);
await Future.delayed(const Duration(seconds: 10));
_eventListener(predictionProgressJson);
await Future.delayed(const Duration(seconds: 10));
_eventListener(predictionLockJson);
await Future.delayed(const Duration(seconds: 10));
_eventListener(predictionEndJson);

// POLLS
_eventListener(pollBeginJson);
await Future.delayed(const Duration(seconds: 10));
_eventListener(pollProgressJson);
await Future.delayed(const Duration(seconds: 10));
_eventListener(pollEndJson);

// HYPE TRAIN
// _eventListener(hypeBeginJson);
// await Future.delayed(const Duration(seconds: 4));
// _eventListener(hypeProgressJson);
// await Future.delayed(const Duration(seconds: 4));
// _eventListener(hypeEndJson);
_eventListener(hypeBeginJson);
await Future.delayed(const Duration(seconds: 4));
_eventListener(hypeProgressJson);
await Future.delayed(const Duration(seconds: 4));
_eventListener(hypeEndJson);
}
}

Expand Down

0 comments on commit 84b9709

Please sign in to comment.