Skip to content

Commit

Permalink
Updated date type changes in iOS and android
Browse files Browse the repository at this point in the history
  • Loading branch information
Decoder07 committed Dec 13, 2023
1 parent a61638a commit 1486251
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 20 deletions.
8 changes: 3 additions & 5 deletions packages/hms_room_kit/lib/src/preview/preview_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class PreviewStore extends ChangeNotifier
@override
void onRoomUpdate({required HMSRoom room, required HMSRoomUpdate update}) {
this.room = room;
log("onRoomUpdate-> room: ${room.toString()} update: ${update.name}");
log("onRoomUpdate-> room: ${room.toString()} update: ${update.name} streamingState: ${room.hmshlsStreamingState?.state.name}");
switch (update) {
case HMSRoomUpdate.browserRecordingStateUpdated:
isRecordingStarted =
Expand All @@ -194,10 +194,8 @@ class PreviewStore extends ChangeNotifier
case HMSRoomUpdate.hlsStreamingStateUpdated:
isHLSStreamingStarted =
room.hmshlsStreamingState?.state == HMSStreamingState.started;
if (!isMeetingJoined && isRoomJoined) {
isRoomJoinedAndHLSStarted =
(room.hmshlsStreamingState?.state == HMSStreamingState.started) &&
isRoomJoined;
if (!isMeetingJoined && isRoomJoined && isHLSStreamingStarted) {
isRoomJoinedAndHLSStarted = true;
isMeetingJoined = true;
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class HMSHLSVariantExtension {
args["meeting_url"] = hmshlsVariant.meetingUrl ?: ""
args["metadata"] = hmshlsVariant.metadata ?: ""
hmshlsVariant.startedAt?.let {
args["started_at"] = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(it).toString()
args["started_at"] = it
}
return args
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class HMSStreamingState {
map["error"] = HMSExceptionExtension.toDictionary(rtmpStreamingState.error)

rtmpStreamingState.startedAt?.let {
map["started_at"] = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(rtmpStreamingState.startedAt).toString()
map["started_at"] = it
}

map["state"] = rtmpStreamingState.state.name
Expand All @@ -32,7 +32,7 @@ class HMSStreamingState {
map["error"] = HMSExceptionExtension.toDictionary(serverRecordingState.error)

serverRecordingState.startedAt?.let {
map["started_at"] = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(serverRecordingState.startedAt).toString()
map["started_at"] = it
}

map["state"] = serverRecordingState.state.name
Expand All @@ -49,7 +49,7 @@ class HMSStreamingState {
map["error"] = HMSExceptionExtension.toDictionary(browserRecordingState.error)

browserRecordingState.startedAt?.let {
map["started_at"] = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(browserRecordingState.startedAt).toString()
map["started_at"] = it
}

map["initialising"] = browserRecordingState.initialising
Expand Down Expand Up @@ -84,7 +84,7 @@ class HMSStreamingState {
map["running"] = hlsRecordingState.running

hlsRecordingState.startedAt?.let {
map["started_at"] = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(hlsRecordingState.startedAt).toString()
map["started_at"] = it
}

map["state"] = hlsRecordingState.state.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class HMSHLSVariantExtension {
}

if let startedAt = hmshlsVariant.startedAt {
dict["started_at"] = "\(startedAt)"
dict["started_at"] = Int(startedAt.timeIntervalSince1970 * 1000)
}

return dict
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class HMSStreamingStateExtension {

dict["running"] = rtmp.running
if let startedAt = rtmp.startedAt {
dict["started_at"] = "\(startedAt)"
dict["started_at"] = Int(startedAt.timeIntervalSince1970 * 1000)
}
if let error = rtmp.error {
dict.merge(HMSErrorExtension.toDictionary(error)) { (_, new) in new }
Expand All @@ -31,7 +31,7 @@ class HMSStreamingStateExtension {

dict["running"] = server.running
if let startedAt = server.startedAt {
dict["started_at"] = "\(startedAt)"
dict["started_at"] = Int(startedAt.timeIntervalSince1970 * 1000)
}
if let error = server.error {
dict.merge(HMSErrorExtension.toDictionary(error)) { (_, new) in new }
Expand All @@ -49,7 +49,7 @@ class HMSStreamingStateExtension {

dict["running"] = browser.running
if let startedAt = browser.startedAt {
dict["started_at"] = "\(startedAt)"
dict["started_at"] = Int(startedAt.timeIntervalSince1970 * 1000)
}
if let error = browser.error {
dict.merge(HMSErrorExtension.toDictionary(error)) { (_, new) in new }
Expand Down Expand Up @@ -78,7 +78,7 @@ class HMSStreamingStateExtension {

dict["running"] = hlsRecording.running
if let startedAt = hlsRecording.startedAt {
dict["started_at"] = "\(startedAt)"
dict["started_at"] = Int(startedAt.timeIntervalSince1970 * 1000)
}
if let error = hlsRecording.error {
dict.merge(HMSErrorExtension.toDictionary(error)) { (_, new) in new }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class HMSBrowserRecordingState {
error: map["error"] != null ? HMSException.fromMap(map) : null,
running: map['running'],
startedAt: map['started_at'] != null
? HMSDateExtension.convertDateFromString(map['started_at'])
? HMSDateExtension.convertDateFromEpoch(map['started_at'])
: null,
initialising: map['initialising'],
state: HMSRecordingStateValues.getRecordingStateFromName(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class HMSHLSRecordingState {
: null,
running: map['running'],
startedAt: map['started_at'] != null
? HMSDateExtension.convertDateFromString(map['started_at'])
? HMSDateExtension.convertDateFromEpoch(map['started_at'])
: null,
state: HMSRecordingStateValues.getRecordingStateFromName(
map['state'] ?? 'NONE'));
Expand Down
2 changes: 1 addition & 1 deletion packages/hmssdk_flutter/lib/src/model/hms_hls_variant.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class HMSHLSVariant {
meetingUrl: map['meeting_url'] as String?,
metadata: map['metadata'] as String?,
startedAt: map['started_at'] != null
? HMSDateExtension.convertDateFromString(map['started_at'])
? HMSDateExtension.convertDateFromEpoch(map['started_at'])
: null,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class HMSRtmpStreamingState {
error: map["error"] != null ? HMSException.fromMap(map) : null,
running: map['running'],
startedAt: map['started_at'] != null
? HMSDateExtension.convertDateFromString(map['started_at'])
? HMSDateExtension.convertDateFromEpoch(map['started_at'])
: null,
state: HMSStreamingStateValues.getStreamingStateFromName(
map['state'] ?? 'NONE'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class HMSServerRecordingState {
error: map["error"] != null ? HMSException.fromMap(map) : null,
running: map['running'],
startedAt: map['started_at'] != null
? HMSDateExtension.convertDateFromString(map['started_at'])
? HMSDateExtension.convertDateFromEpoch(map['started_at'])
: null,
state: HMSRecordingStateValues.getRecordingStateFromName(
map['state'] ?? 'NONE'));
Expand Down

0 comments on commit 1486251

Please sign in to comment.