diff --git a/packages/hms_room_kit/lib/src/meeting/meeting_store.dart b/packages/hms_room_kit/lib/src/meeting/meeting_store.dart index 8b5a78bd7..ccd9c7ddc 100644 --- a/packages/hms_room_kit/lib/src/meeting/meeting_store.dart +++ b/packages/hms_room_kit/lib/src/meeting/meeting_store.dart @@ -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 @@ -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: @@ -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); + } } } } diff --git a/packages/hms_room_kit/lib/src/widgets/poll_widgets/voting_flow_widgets/poll_result_card.dart b/packages/hms_room_kit/lib/src/widgets/poll_widgets/voting_flow_widgets/poll_result_card.dart index 575d4a5bd..6e37b95d2 100644 --- a/packages/hms_room_kit/lib/src/widgets/poll_widgets/voting_flow_widgets/poll_result_card.dart +++ b/packages/hms_room_kit/lib/src/widgets/poll_widgets/voting_flow_widgets/poll_result_card.dart @@ -155,7 +155,7 @@ class PollResultCard extends StatelessWidget { ), ); }), - if (question.voted) + if (question.myResponses.isNotEmpty) Row( mainAxisAlignment: MainAxisAlignment.end, children: [ diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollExtension.kt index 9eace1dda..e70358047 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollExtension.kt @@ -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 diff --git a/packages/hmssdk_flutter/example/ios/Podfile.lock b/packages/hmssdk_flutter/example/ios/Podfile.lock index 8f1935aa2..875258308 100644 --- a/packages/hmssdk_flutter/example/ios/Podfile.lock +++ b/packages/hmssdk_flutter/example/ios/Podfile.lock @@ -228,7 +228,7 @@ SPEC CHECKSUMS: FirebaseRemoteConfig: b873a427a48159082361343a85649eed3f5377ea FirebaseSessions: 2f348975f6d1c139231c180e12194161da2e0cd6 FirebaseSharedSwift: 2fbf73618288b7a36b2014b957745dcdd781389e - Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 flutter_foreground_task: 21ef182ab0a29a3005cc72cd70e5f45cb7f7f817 GoogleDataTransport: 57c22343ab29bc686febbf7cbb13bad167c2d8fe GoogleUtilities: 0759d1a57ebb953965c2dfe0ba4c82e95ccc2e34 @@ -253,4 +253,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 9fb9f6e431a2c6c79942252e94b241ac7972ac90 -COCOAPODS: 1.15.0 +COCOAPODS: 1.14.3