Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug where vnrt user was not getting poll on rejoin #1709

Merged
merged 2 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions packages/hms_room_kit/lib/src/meeting/meeting_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2574,6 +2574,7 @@ class MeetingStore extends ChangeNotifier

@override
void onCue({required HMSHLSCue hlsCue}) {
log("onCue -> payload:${hlsCue.startDate}");
/**
* Here we use a list of alignments and select an alignment at random and use it
* to position the toast for timed metadata
Expand Down Expand Up @@ -2672,7 +2673,7 @@ class MeetingStore extends ChangeNotifier
@override
void onPollUpdate(
{required HMSPoll poll, required HMSPollUpdateType pollUpdateType}) {
log("onPollUpdate -> poll $poll updateType: $pollUpdateType");
log("onPollUpdate -> poll $poll updateType: $pollUpdateType startedAt: ${poll.startedAt}");
switch (pollUpdateType) {
///If the poll is started we add the poll in questions list
case HMSPollUpdateType.started:
Expand All @@ -2695,7 +2696,23 @@ class MeetingStore extends ChangeNotifier
hmsToastType: HMSToastsType.pollStartedToast));
notifyListeners();
} else {
hlsViewerPolls.add(store);
/*
* Here we check whether the poll start time is
* more than 20 secs older from now or not. We have kept 20 secs
* since the stream playback rolling window time is
* set to 20 by default i.e. if the time difference is less than 20 secs
* we will get the [onCue] callback again. If its greater than 20
* we show the toast immediately for the user to vote.
*/
if (poll.startedAt != null &&
(DateTime.now().difference(poll.startedAt!) >
const Duration(seconds: 20))) {
pollQuestions.add(store);
toasts.add(HMSToastModel(store,
hmsToastType: HMSToastsType.pollStartedToast));
} else {
hlsViewerPolls.add(store);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class PollResultCard extends StatelessWidget {
),
);
}),
if (question.voted)
if (question.myResponses.isNotEmpty)
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ class HMSPollExtension {
}
map["roles_that_can_vote"] = rolesThatCanVote

map["started_at"] = poll.startedAt
map["started_at"] = poll.startedAt * 1000
map["started_by"] = HMSPeerExtension.toDictionary(poll.startedBy)
map["state"] = getPollState(poll.state)
map["stopped_at"] = poll.stoppedAt
map["stopped_at"] = poll.stoppedAt?.let {
it * 1000
}?:run {
null
}
map["title"] = poll.title

return map
Expand Down
4 changes: 2 additions & 2 deletions packages/hmssdk_flutter/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ SPEC CHECKSUMS:
FirebaseRemoteConfig: b873a427a48159082361343a85649eed3f5377ea
FirebaseSessions: 2f348975f6d1c139231c180e12194161da2e0cd6
FirebaseSharedSwift: 2fbf73618288b7a36b2014b957745dcdd781389e
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_foreground_task: 21ef182ab0a29a3005cc72cd70e5f45cb7f7f817
GoogleDataTransport: 57c22343ab29bc686febbf7cbb13bad167c2d8fe
GoogleUtilities: 0759d1a57ebb953965c2dfe0ba4c82e95ccc2e34
Expand All @@ -253,4 +253,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 9fb9f6e431a2c6c79942252e94b241ac7972ac90

COCOAPODS: 1.15.0
COCOAPODS: 1.14.3
Loading