diff --git a/.trunk/.gitignore b/.trunk/.gitignore index 1e2465290..15966d087 100644 --- a/.trunk/.gitignore +++ b/.trunk/.gitignore @@ -6,3 +6,4 @@ plugins user_trunk.yaml user.yaml +tmp diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 3d660863f..9e26200d5 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -1,28 +1,28 @@ version: 0.1 cli: - version: 1.18.0 + version: 1.21.0 plugins: sources: - id: trunk - ref: v1.3.0 + ref: v1.4.5 uri: https://github.com/trunk-io/plugins lint: enabled: - - actionlint@1.6.26 - - checkov@3.1.9 - - osv-scanner@1.5.0 - - trivy@0.48.0 - - trufflehog@3.63.2 + - actionlint@1.6.27 + - checkov@3.2.55 + - osv-scanner@1.7.0 + - trivy@0.50.1 + - trufflehog@3.71.0 - oxipng@9.0.0 - - yamllint@1.33.0 - - markdownlint@0.37.0 - - prettier@3.1.0 + - yamllint@1.35.1 + - markdownlint@0.39.0 + - prettier@3.2.5 - git-diff-check - shfmt@3.6.0 - - shellcheck@0.9.0 - - gitleaks@8.18.1 - - svgo@3.0.5 - - ktlint@1.0.1 + - shellcheck@0.10.0 + - gitleaks@8.18.2 + - svgo@3.2.0 + - ktlint@1.2.1 runtimes: enabled: - python@3.10.8 diff --git a/packages/hms_room_kit/example/pubspec.lock b/packages/hms_room_kit/example/pubspec.lock index 079ffbea2..640206749 100644 --- a/packages/hms_room_kit/example/pubspec.lock +++ b/packages/hms_room_kit/example/pubspec.lock @@ -442,10 +442,10 @@ packages: dependency: transitive description: name: pointycastle - sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29" + sha256: "70fe966348fe08c34bf929582f1d8247d9d9408130723206472b4687227e4333" url: "https://pub.dev" source: hosted - version: "3.7.4" + version: "3.8.0" provider: dependency: transitive description: diff --git a/packages/hms_room_kit/lib/src/assets/icons/caption_off.svg b/packages/hms_room_kit/lib/src/assets/icons/caption_off.svg index edf176b43..9532a1d0c 100644 --- a/packages/hms_room_kit/lib/src/assets/icons/caption_off.svg +++ b/packages/hms_room_kit/lib/src/assets/icons/caption_off.svg @@ -1,5 +1 @@ - - - - - + \ No newline at end of file diff --git a/packages/hms_room_kit/lib/src/assets/icons/caption_on.svg b/packages/hms_room_kit/lib/src/assets/icons/caption_on.svg index 29f524240..0716c0d8b 100644 --- a/packages/hms_room_kit/lib/src/assets/icons/caption_on.svg +++ b/packages/hms_room_kit/lib/src/assets/icons/caption_on.svg @@ -1,3 +1 @@ - - - + \ No newline at end of file diff --git a/packages/hms_room_kit/lib/src/assets/icons/hand_off.svg b/packages/hms_room_kit/lib/src/assets/icons/hand_off.svg index 103406c20..88e183ecd 100644 --- a/packages/hms_room_kit/lib/src/assets/icons/hand_off.svg +++ b/packages/hms_room_kit/lib/src/assets/icons/hand_off.svg @@ -1,3 +1 @@ - - - + \ No newline at end of file diff --git a/packages/hms_room_kit/lib/src/assets/icons/music_wave.svg b/packages/hms_room_kit/lib/src/assets/icons/music_wave.svg index 863ee3614..0e56ef9fa 100644 --- a/packages/hms_room_kit/lib/src/assets/icons/music_wave.svg +++ b/packages/hms_room_kit/lib/src/assets/icons/music_wave.svg @@ -1,9 +1 @@ - - - - - - - - - + \ No newline at end of file diff --git a/packages/hms_room_kit/lib/src/assets/icons/sip_call.svg b/packages/hms_room_kit/lib/src/assets/icons/sip_call.svg index 635ee3b49..500fe670f 100644 --- a/packages/hms_room_kit/lib/src/assets/icons/sip_call.svg +++ b/packages/hms_room_kit/lib/src/assets/icons/sip_call.svg @@ -1,7 +1 @@ - - - - - - - + \ No newline at end of file diff --git a/packages/hms_room_kit/pubspec.lock b/packages/hms_room_kit/pubspec.lock index 52ddfb799..c884f6190 100644 --- a/packages/hms_room_kit/pubspec.lock +++ b/packages/hms_room_kit/pubspec.lock @@ -419,10 +419,10 @@ packages: dependency: transitive description: name: pointycastle - sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29" + sha256: "70fe966348fe08c34bf929582f1d8247d9d9408130723206472b4687227e4333" url: "https://pub.dev" source: hosted - version: "3.7.4" + version: "3.8.0" provider: dependency: "direct main" description: diff --git a/packages/hms_room_kit/pubspec.yaml b/packages/hms_room_kit/pubspec.yaml index cc9d7d6f0..e051445d5 100644 --- a/packages/hms_room_kit/pubspec.yaml +++ b/packages/hms_room_kit/pubspec.yaml @@ -15,7 +15,7 @@ dependencies: sdk: flutter hmssdk_flutter: - path: ../hmssdk_flutter + path: ../hmssdk_flutter intl: ^0.18.0 permission_handler: ^11.0.0 provider: ^6.0.5 diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSHLSVariantExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSHLSVariantExtension.kt index bebd5530e..7b8ff793d 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSHLSVariantExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSHLSVariantExtension.kt @@ -1,7 +1,6 @@ package live.hms.hmssdk_flutter import live.hms.video.sdk.models.HMSHLSVariant -import java.text.SimpleDateFormat class HMSHLSVariantExtension { companion object { diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSPeerExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSPeerExtension.kt index 8f57848fb..31222fbfb 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSPeerExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSPeerExtension.kt @@ -49,7 +49,7 @@ class HMSPeerExtension { } private fun getValueFromPeerType(peerType: HMSPeerType): String { - return when(peerType){ + return when (peerType) { HMSPeerType.SIP -> "sip" HMSPeerType.REGULAR -> "regular" else -> "regular" diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSRtmpStreamingState.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSRtmpStreamingState.kt index 04e62b4b2..6cd49555c 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSRtmpStreamingState.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSRtmpStreamingState.kt @@ -2,7 +2,6 @@ import live.hms.hmssdk_flutter.HMSExceptionExtension import live.hms.hmssdk_flutter.HMSHLSVariantExtension import live.hms.video.sdk.models.* -import java.text.SimpleDateFormat class HMSStreamingState { companion object { diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSTrackSettingsExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSTrackSettingsExtension.kt index c810d7893..2a742e6a0 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSTrackSettingsExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSTrackSettingsExtension.kt @@ -54,7 +54,7 @@ class HMSTrackSettingsExtension { val enableNoiseCancellation = audioHashMap["enable_noise_cancellation"] as? Boolean enableNoiseCancellation?.let { - if(it){ + if (it) { hmsAudioTrackSettings.enableNoiseCancellation(true) } } diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HmssdkFlutterPlugin.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HmssdkFlutterPlugin.kt index a177ab114..e938b36fe 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HmssdkFlutterPlugin.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HmssdkFlutterPlugin.kt @@ -38,7 +38,6 @@ import live.hms.video.error.HMSException import live.hms.video.events.AgentType import live.hms.video.interactivity.HmsPollUpdateListener import live.hms.video.media.tracks.* -import live.hms.video.polls.HMSPollBuilder import live.hms.video.polls.models.HMSPollUpdateType import live.hms.video.polls.models.HmsPoll import live.hms.video.sdk.* @@ -65,7 +64,7 @@ class HmssdkFlutterPlugin : private var rtcStatsChannel: EventChannel? = null private var sessionStoreChannel: EventChannel? = null var hlsPlayerChannel: EventChannel? = null - private var pollsEventChannel : EventChannel? = null + private var pollsEventChannel: EventChannel? = null private var eventSink: EventChannel.EventSink? = null private var previewSink: EventChannel.EventSink? = null private var logsSink: EventChannel.EventSink? = null @@ -122,7 +121,7 @@ class HmssdkFlutterPlugin : this.rtcStatsChannel?.setStreamHandler(this) ?: Log.e("Channel Error", "RTC Stats channel not found") this.sessionStoreChannel?.setStreamHandler(this) ?: Log.e("Channel Error", "Session Store channel not found") this.hlsPlayerChannel?.setStreamHandler(this) ?: Log.e("Channel Error", "HLS Player channel not found") - this.pollsEventChannel?.setStreamHandler(this) ?: Log.e("Channel Error","polls events channel not found") + this.pollsEventChannel?.setStreamHandler(this) ?: Log.e("Channel Error", "polls events channel not found") this.hmsVideoFactory = HMSVideoViewFactory(this) this.hmsHLSPlayerFactory = HMSHLSPlayerFactory(this) @@ -286,8 +285,8 @@ class HmssdkFlutterPlugin : HMSPeerListIteratorAction.peerListIteratorAction(call, result, hmssdk!!) } - "add_poll_update_listener", "remove_poll_update_listener", "quick_start_poll", "add_single_choice_poll_response", "add_multi_choice_poll_response", "stop_poll", "fetch_leaderboard","fetch_poll_list", "fetch_poll_questions", "get_poll_results" -> { - pollActions(call,result) + "add_poll_update_listener", "remove_poll_update_listener", "quick_start_poll", "add_single_choice_poll_response", "add_multi_choice_poll_response", "stop_poll", "fetch_leaderboard", "fetch_poll_list", "fetch_poll_questions", "get_poll_results" -> { + pollActions(call, result) } "enable_noise_cancellation", "disable_noise_cancellation", "is_noise_cancellation_enabled", "is_noise_cancellation_available" -> { @@ -472,17 +471,22 @@ class HmssdkFlutterPlugin : } private var currentPolls = ArrayList() - private fun pollActions(call: MethodCall, result: Result){ - when(call.method){ + + private fun pollActions( + call: MethodCall, + result: Result, + ) { + when (call.method) { "add_poll_update_listener" -> { hmssdk?.getHmsInteractivityCenter()?.pollUpdateListener = hmsPollListener } "remove_poll_update_listener" -> { hmssdk?.getHmsInteractivityCenter()?.pollUpdateListener = null } - else -> hmssdk?.let { - HMSPollAction.pollActions(call,result, it,currentPolls) - } + else -> + hmssdk?.let { + HMSPollAction.pollActions(call, result, it, currentPolls) + } } } @@ -497,7 +501,7 @@ class HmssdkFlutterPlugin : rtcStatsChannel?.setStreamHandler(null) ?: Log.e("Channel Error", "RTC Stats channel not found") sessionStoreChannel?.setStreamHandler(null) ?: Log.e("Channel Error", "Session Store channel not found") hlsPlayerChannel?.setStreamHandler(null) ?: Log.e("Channel Error", "HLS Player channel not found") - pollsEventChannel?.setStreamHandler(null)?: Log.e("Channel Error", "polls event channel not found") + pollsEventChannel?.setStreamHandler(null) ?: Log.e("Channel Error", "polls event channel not found") eventSink = null previewSink = null rtcSink = null @@ -635,7 +639,7 @@ class HmssdkFlutterPlugin : this.sessionStoreSink = events } else if (nameOfEventSink == "hls_player") { this.hlsPlayerSink = events - } else if(nameOfEventSink == "polls") { + } else if (nameOfEventSink == "polls") { this.pollsSink = events } } @@ -673,7 +677,12 @@ class HmssdkFlutterPlugin : Log.i("HMSTextureView", "Init Add Track called for track: ${track.trackId}") renderer.addTrack(videoTrack, disableAutoSimulcastLayerSelect) } ?: run { - HMSErrorLogger.returnHMSException("createTextureView", "No track with $trackId found", "Track not found error", result) + HMSErrorLogger.returnHMSException( + "createTextureView", + "No track with $trackId found", + "Track not found error", + result, + ) return } } ?: run { @@ -876,7 +885,8 @@ class HmssdkFlutterPlugin : authToken?.let { hmssdk!!.getRoomLayout( - authToken, layoutRequestOptions, + authToken, + layoutRequestOptions, object : HMSLayoutListener { override fun onError(error: HMSException) { result.success(HMSResultExtension.toDictionary(false, HMSExceptionExtension.toDictionary(error))) @@ -1582,8 +1592,12 @@ class HmssdkFlutterPlugin : private fun startScreenShare(result: Result) { androidScreenshareResult = result if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - activity.applicationContext?.registerReceiver(activityBroadcastReceiver, IntentFilter("ACTIVITY_RECEIVER"), Context.RECEIVER_EXPORTED) - }else { + activity.applicationContext?.registerReceiver( + activityBroadcastReceiver, + IntentFilter("ACTIVITY_RECEIVER"), + Context.RECEIVER_EXPORTED, + ) + } else { activity.applicationContext?.registerReceiver(activityBroadcastReceiver, IntentFilter("ACTIVITY_RECEIVER")) } val mediaProjectionManager: MediaProjectionManager = @@ -1651,9 +1665,13 @@ class HmssdkFlutterPlugin : androidAudioShareResult = result mode = call.argument("audio_mixing_mode") if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - activity.applicationContext?.registerReceiver(activityBroadcastReceiver, IntentFilter("ACTIVITY_RECEIVER"), Context.RECEIVER_EXPORTED) - }else { - activity.applicationContext?.registerReceiver(activityBroadcastReceiver, IntentFilter("ACTIVITY_RECEIVER"),) + activity.applicationContext?.registerReceiver( + activityBroadcastReceiver, + IntentFilter("ACTIVITY_RECEIVER"), + Context.RECEIVER_EXPORTED, + ) + } else { + activity.applicationContext?.registerReceiver(activityBroadcastReceiver, IntentFilter("ACTIVITY_RECEIVER")) } val mediaProjectionManager: MediaProjectionManager? = activity.getSystemService( @@ -2042,7 +2060,6 @@ class HmssdkFlutterPlugin : private val audioPreviewDeviceChangeListener = object : AudioManagerDeviceChangeListener { - override fun onAudioDeviceChanged( selectedAudioDevice: AudioDevice, availableAudioDevices: Set, @@ -2075,7 +2092,6 @@ class HmssdkFlutterPlugin : } } } - } private val audioDeviceChangeListener = @@ -2087,12 +2103,12 @@ class HmssdkFlutterPlugin : val args = HashMap() args["event_name"] = "on_audio_device_changed" val dict = HashMap() - dict["current_audio_device"] = selectedAudioDevice.name - val audioDevicesList = ArrayList() - availableAudioDevices.forEach { device -> - audioDevicesList.add(device.name) - } - dict["available_audio_device"] = audioDevicesList + dict["current_audio_device"] = selectedAudioDevice.name + val audioDevicesList = ArrayList() + availableAudioDevices.forEach { device -> + audioDevicesList.add(device.name) + } + dict["available_audio_device"] = audioDevicesList args["data"] = dict if (args["data"] != null) { CoroutineScope(Dispatchers.Main).launch { @@ -2114,36 +2130,37 @@ class HmssdkFlutterPlugin : } } - private val hmsPollListener = object : HmsPollUpdateListener{ - override fun onPollUpdate(hmsPoll: HmsPoll, hmsPollUpdateType: HMSPollUpdateType) { - - if(hmsPollUpdateType == HMSPollUpdateType.started){ - currentPolls.add(hmsPoll) - } else if(hmsPollUpdateType == HMSPollUpdateType.resultsupdated){ - val index = currentPolls.indexOfFirst { it.pollId == hmsPoll.pollId } - if(index != -1){ - currentPolls[index] = hmsPoll - } - } else if(hmsPollUpdateType == HMSPollUpdateType.stopped){ - val index = currentPolls.indexOfFirst { it.pollId == hmsPoll.pollId } - if(index != -1){ - currentPolls.removeAt(index) + private val hmsPollListener = + object : HmsPollUpdateListener { + override fun onPollUpdate( + hmsPoll: HmsPoll, + hmsPollUpdateType: HMSPollUpdateType, + ) { + if (hmsPollUpdateType == HMSPollUpdateType.started) { + currentPolls.add(hmsPoll) + } else if (hmsPollUpdateType == HMSPollUpdateType.resultsupdated) { + val index = currentPolls.indexOfFirst { it.pollId == hmsPoll.pollId } + if (index != -1) { + currentPolls[index] = hmsPoll + } + } else if (hmsPollUpdateType == HMSPollUpdateType.stopped) { + val index = currentPolls.indexOfFirst { it.pollId == hmsPoll.pollId } + if (index != -1) { + currentPolls.removeAt(index) + } } - } - val args = HashMap() - args["event_name"] = "on_poll_update" + val args = HashMap() + args["event_name"] = "on_poll_update" - val pollHashMap = HashMap() - pollHashMap["poll"] = HMSPollExtension.toDictionary(hmsPoll) - pollHashMap["poll_update_type"] = HMSPollExtension.getPollUpdateType(hmsPollUpdateType) - args["data"] = pollHashMap + val pollHashMap = HashMap() + pollHashMap["poll"] = HMSPollExtension.toDictionary(hmsPoll) + pollHashMap["poll_update_type"] = HMSPollExtension.getPollUpdateType(hmsPollUpdateType) + args["data"] = pollHashMap - CoroutineScope(Dispatchers.Main).launch { - pollsSink?.success(args) + CoroutineScope(Dispatchers.Main).launch { + pollsSink?.success(args) + } } } - } - - } diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/hls_player/HLSStatsHandler.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/hls_player/HLSStatsHandler.kt index 208a7630c..e0e11fada 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/hls_player/HLSStatsHandler.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/hls_player/HLSStatsHandler.kt @@ -66,7 +66,11 @@ class HLSStatsHandler { } }, ) ?: run { - HMSErrorLogger.logError("addHLSStatsListener", "hlsPlayer is null, Consider calling this method after attaching the HMSHLSPlayer or sending isHLSStatsRequired as true to get the stats", "NULL_ERROR") + HMSErrorLogger.logError( + "addHLSStatsListener", + "hlsPlayer is null, Consider calling this method after attaching the HMSHLSPlayer or sending isHLSStatsRequired as true to get the stats", + "NULL_ERROR", + ) } } diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSCameraControlsAction.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSCameraControlsAction.kt index e39727c85..7a1040118 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSCameraControlsAction.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSCameraControlsAction.kt @@ -98,7 +98,11 @@ class HMSCameraControlsAction { if (cameraControl.isFlashSupported()) { cameraControl.setFlash(true) } else { - HMSErrorLogger.logError("captureImageAtMaxSupportedResolution", "Flash is not supported for current facing camera", "Compatibility error") + HMSErrorLogger.logError( + "captureImageAtMaxSupportedResolution", + "Flash is not supported for current facing camera", + "Compatibility error", + ) } } cameraControl.captureImageAtMaxSupportedResolution(imageFile) { isSuccess -> @@ -107,7 +111,9 @@ class HMSCameraControlsAction { if (isSuccess) { result.success(HMSResultExtension.toDictionary(true, filePath)) } else { - result.success(HMSResultExtension.toDictionary(false, HMSExceptionExtension.getError("Error in capturing image"))) + result.success( + HMSResultExtension.toDictionary(false, HMSExceptionExtension.getError("Error in capturing image")), + ) } if (withFlash) { cameraControl.setFlash(false) @@ -177,7 +183,14 @@ class HMSCameraControlsAction { result.success(HMSResultExtension.toDictionary(true, null)) return } else { - result.success(HMSResultExtension.toDictionary(false, HMSExceptionExtension.getError("Flash is not supported for current facing camera, Also please ensure camera is turned ON"))) + result.success( + HMSResultExtension.toDictionary( + false, + HMSExceptionExtension.getError( + "Flash is not supported for current facing camera, Also please ensure camera is turned ON", + ), + ), + ) return } } ?: run { diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSNoiseCancellationControllerAction.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSNoiseCancellationControllerAction.kt index 6cea949ba..90a267057 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSNoiseCancellationControllerAction.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSNoiseCancellationControllerAction.kt @@ -8,24 +8,24 @@ import live.hms.video.factories.noisecancellation.AvailabilityStatus import live.hms.video.sdk.HMSSDK class HMSNoiseCancellationControllerAction { - companion object { - - fun noiseCancellationActions(call: MethodCall, - result: MethodChannel.Result, - hmssdk: HMSSDK,){ - when(call.method){ + fun noiseCancellationActions( + call: MethodCall, + result: MethodChannel.Result, + hmssdk: HMSSDK, + ) { + when (call.method) { "enable_noise_cancellation" -> { - enable(result,hmssdk) + enable(result, hmssdk) } "disable_noise_cancellation" -> { - disable(result,hmssdk) + disable(result, hmssdk) } "is_noise_cancellation_enabled" -> { - isEnabled(result,hmssdk) + isEnabled(result, hmssdk) } "is_noise_cancellation_available" -> { - isAvailable(result,hmssdk) + isAvailable(result, hmssdk) } else -> { result.notImplemented() @@ -36,7 +36,10 @@ class HMSNoiseCancellationControllerAction { /** * [enable] method enables noise cancellation for the user */ - private fun enable(result: MethodChannel.Result, hmssdk: HMSSDK){ + private fun enable( + result: MethodChannel.Result, + hmssdk: HMSSDK, + ) { hmssdk.setNoiseCancellationEnabled(true) result.success(null) } @@ -44,7 +47,10 @@ class HMSNoiseCancellationControllerAction { /** * [disable] method disables noise cancellation for the user */ - private fun disable(result: MethodChannel.Result, hmssdk: HMSSDK){ + private fun disable( + result: MethodChannel.Result, + hmssdk: HMSSDK, + ) { hmssdk.setNoiseCancellationEnabled(false) result.success(null) } @@ -52,7 +58,10 @@ class HMSNoiseCancellationControllerAction { /** * [isEnabled] method returns whether noise cancellation is enabled or not */ - private fun isEnabled(result: MethodChannel.Result, hmssdk: HMSSDK){ + private fun isEnabled( + result: MethodChannel.Result, + hmssdk: HMSSDK, + ) { val isEnabled = hmssdk.getNoiseCancellationEnabled() result.success(HMSResultExtension.toDictionary(true, isEnabled)) } @@ -60,17 +69,18 @@ class HMSNoiseCancellationControllerAction { /** * [isAvailable] method returns whether noise cancellation is available in the room */ - private fun isAvailable(result: MethodChannel.Result, hmssdk: HMSSDK){ + private fun isAvailable( + result: MethodChannel.Result, + hmssdk: HMSSDK, + ) { val availabilityStatus = hmssdk.isNoiseCancellationAvailable() - if(availabilityStatus == AvailabilityStatus.Available){ + if (availabilityStatus == AvailabilityStatus.Available) { result.success(HMSResultExtension.toDictionary(true, data = true)) - }else{ + } else { val reason = (availabilityStatus as AvailabilityStatus.NotAvailable).reason - HMSErrorLogger.logError("isAvailable",reason,"NoiseCancellation Error") + HMSErrorLogger.logError("isAvailable", reason, "NoiseCancellation Error") result.success(HMSResultExtension.toDictionary(true, data = false)) } } - } - -} \ No newline at end of file +} diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSPeerListIteratorAction.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSPeerListIteratorAction.kt index 8bc585269..c28a7b9c1 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSPeerListIteratorAction.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSPeerListIteratorAction.kt @@ -60,10 +60,16 @@ class HMSPeerListIteratorAction { peerListIteratorOptions = PeerListIteratorOptions( byRoleName = it["by_role_name"] as String?, - byPeerIds = it["by_peer_ids"] as ArrayList?, limit = limitValue, + byPeerIds = it["by_peer_ids"] as ArrayList?, + limit = limitValue, ) } ?: run { - HMSErrorLogger.returnHMSException("getPeerListIterator", "limit parameter is null while peerListIteratorOptions is non-null", "NULL Error", result) + HMSErrorLogger.returnHMSException( + "getPeerListIterator", + "limit parameter is null while peerListIteratorOptions is non-null", + "NULL Error", + result, + ) } } @@ -100,7 +106,12 @@ class HMSPeerListIteratorAction { peerListIterator?.let { iterator -> result.success(HMSResultExtension.toDictionary(true, iterator.hasNext())) } ?: run { - HMSErrorLogger.returnHMSException("peerListIteratorHasNext", "No peerListIterator with given uid found", "NULL Error", result) + HMSErrorLogger.returnHMSException( + "peerListIteratorHasNext", + "No peerListIterator with given uid found", + "NULL Error", + result, + ) } } ?: run { HMSErrorLogger.returnHMSException("peerListIteratorHasNext", "uid is null", "NULL Error", result) @@ -128,7 +139,9 @@ class HMSPeerListIteratorAction { iterator.next( object : PeerListResultListener { override fun onError(error: HMSException) { - methodChannelResult.success(HMSResultExtension.toDictionary(false, HMSExceptionExtension.toDictionary(error))) + methodChannelResult.success( + HMSResultExtension.toDictionary(false, HMSExceptionExtension.toDictionary(error)), + ) } override fun onSuccess(result: ArrayList) { @@ -144,7 +157,12 @@ class HMSPeerListIteratorAction { }, ) } ?: run { - HMSErrorLogger.returnHMSException("peerListIteratorNext", "No peerListIterator with given uid found", "NULL Error", methodChannelResult) + HMSErrorLogger.returnHMSException( + "peerListIteratorNext", + "No peerListIterator with given uid found", + "NULL Error", + methodChannelResult, + ) } } ?: run { HMSErrorLogger.returnHMSException("peerListIteratorNext", "uid is null", "NULL Error", methodChannelResult) diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSPollAction.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSPollAction.kt index a18054604..712493445 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSPollAction.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSPollAction.kt @@ -6,8 +6,8 @@ import live.hms.hmssdk_flutter.HMSCommonAction import live.hms.hmssdk_flutter.HMSErrorLogger import live.hms.hmssdk_flutter.HMSExceptionExtension import live.hms.hmssdk_flutter.HMSResultExtension -import live.hms.hmssdk_flutter.poll_extension.HMSPollBuilderExtension import live.hms.hmssdk_flutter.poll_extension.HMSPollAnswerResponseExtension +import live.hms.hmssdk_flutter.poll_extension.HMSPollBuilderExtension import live.hms.hmssdk_flutter.poll_extension.HMSPollExtension import live.hms.hmssdk_flutter.poll_extension.HMSPollLeaderboardResponseExtension import live.hms.hmssdk_flutter.poll_extension.HMSPollQuestionExtension @@ -23,53 +23,64 @@ import live.hms.video.sdk.HMSSDK import live.hms.video.sdk.HmsTypedActionResultListener class HMSPollAction { - - companion object{ - fun pollActions(call: MethodCall, result: MethodChannel.Result, hmssdk: HMSSDK, polls: ArrayList?){ - when(call.method){ - "quick_start_poll" -> quickStartPoll(call,result,hmssdk) - "add_single_choice_poll_response" -> addSingleChoicePollResponse(call,result,hmssdk,polls) - "add_multi_choice_poll_response" -> addMultiChoicePollResponse(call,result,hmssdk,polls) - "stop_poll" -> stopPoll(call,result,hmssdk,polls) - "fetch_leaderboard" -> fetchLeaderboard(call,result,hmssdk) - "fetch_poll_list" -> fetchPollList(call,result,hmssdk) - "fetch_poll_questions" -> fetchPollQuestions(call,result,hmssdk) - "get_poll_results" -> getPollResults(call,result,hmssdk) + companion object { + fun pollActions( + call: MethodCall, + result: MethodChannel.Result, + hmssdk: HMSSDK, + polls: ArrayList?, + ) { + when (call.method) { + "quick_start_poll" -> quickStartPoll(call, result, hmssdk) + "add_single_choice_poll_response" -> addSingleChoicePollResponse(call, result, hmssdk, polls) + "add_multi_choice_poll_response" -> addMultiChoicePollResponse(call, result, hmssdk, polls) + "stop_poll" -> stopPoll(call, result, hmssdk, polls) + "fetch_leaderboard" -> fetchLeaderboard(call, result, hmssdk) + "fetch_poll_list" -> fetchPollList(call, result, hmssdk) + "fetch_poll_questions" -> fetchPollQuestions(call, result, hmssdk) + "get_poll_results" -> getPollResults(call, result, hmssdk) } } - private fun quickStartPoll(call: MethodCall, result: MethodChannel.Result, hmssdk: HMSSDK){ + private fun quickStartPoll( + call: MethodCall, + result: MethodChannel.Result, + hmssdk: HMSSDK, + ) { + val pollBuilderMap = call.argument?>("poll_builder") - val pollBuilderMap = call.argument?>("poll_builder") - - val pollBuilder = HMSPollBuilderExtension.toHMSPollBuilder(pollBuilderMap,hmssdk) + val pollBuilder = HMSPollBuilderExtension.toHMSPollBuilder(pollBuilderMap, hmssdk) pollBuilder?.let { - hmssdk.getHmsInteractivityCenter().quickStartPoll( pollBuilder, HMSCommonAction.getActionListener(result)) - }?:run{ + hmssdk.getHmsInteractivityCenter().quickStartPoll(pollBuilder, HMSCommonAction.getActionListener(result)) + } ?: run { HMSErrorLogger.returnArgumentsError("pollBuilder parsing failed") } - } - private fun addSingleChoicePollResponse(call: MethodCall, methodChannelResult: MethodChannel.Result, hmssdk: HMSSDK, currentPolls: ArrayList?){ - + private fun addSingleChoicePollResponse( + call: MethodCall, + methodChannelResult: MethodChannel.Result, + hmssdk: HMSSDK, + currentPolls: ArrayList?, + ) { val pollId = call.argument("poll_id") val index = call.argument("question_index") val userId = call.argument("user_id") - val answer = call.argument>("answer") + val answer = call.argument>("answer") val timeTakenToAnswer = call.argument("time_taken_to_answer") /* * Here we get index for the option selected by the user * if the option doesn't exist we return the arguments error */ - val optionIndex = answer?.let { - it["index"] as Int - }?:run { - HMSErrorLogger.returnArgumentsError("Invalid option index") - return - } + val optionIndex = + answer?.let { + it["index"] as Int + } ?: run { + HMSErrorLogger.returnArgumentsError("Invalid option index") + return + } /* * We fetch the polls which are currently active and find the poll matching the pollId @@ -82,54 +93,67 @@ class HMSPollAction { * * If anywhere the sdk is unable to find the property we return the error */ - currentPolls?.find { it.pollId == pollId }?.let {poll -> - index?.let {questionIndex -> + currentPolls?.find { it.pollId == pollId }?.let { poll -> + index?.let { questionIndex -> - poll.questions?.get(questionIndex)?.let { currentQuestion -> + poll.questions?.get(questionIndex)?.let { currentQuestion -> /* * Here the index needs to be subtracted by 1 * since the HMSPollQuestionOption object has indexing with 1 */ - val questionOption = currentQuestion.options?.get(optionIndex - 1) - questionOption?.let {selectedOption -> - val response = - timeTakenToAnswer?.let {_timeTakenToAnswer -> - HMSPollResponseBuilder(poll, userId).addResponse(currentQuestion,selectedOption, - _timeTakenToAnswer.toLong() - ) - }?: run { - HMSPollResponseBuilder(poll, userId).addResponse(currentQuestion,selectedOption) - } - hmssdk.getHmsInteractivityCenter().add(response, object : HmsTypedActionResultListener{ + val questionOption = currentQuestion.options?.get(optionIndex - 1) + questionOption?.let { selectedOption -> + val response = + timeTakenToAnswer?.let { _timeTakenToAnswer -> + HMSPollResponseBuilder(poll, userId).addResponse( + currentQuestion, + selectedOption, + _timeTakenToAnswer.toLong(), + ) + } ?: run { + HMSPollResponseBuilder(poll, userId).addResponse(currentQuestion, selectedOption) + } + hmssdk.getHmsInteractivityCenter().add( + response, + object : HmsTypedActionResultListener { override fun onSuccess(result: PollAnswerResponse) { - methodChannelResult.success(HMSResultExtension.toDictionary(true,HMSPollAnswerResponseExtension.toDictionary(result))) + methodChannelResult.success( + HMSResultExtension.toDictionary(true, HMSPollAnswerResponseExtension.toDictionary(result)), + ) } + override fun onError(error: HMSException) { - methodChannelResult.success(HMSResultExtension.toDictionary(false,HMSExceptionExtension.toDictionary(error))) + methodChannelResult.success( + HMSResultExtension.toDictionary(false, HMSExceptionExtension.toDictionary(error)), + ) } - }) - } - - }?:run { - HMSErrorLogger.returnArgumentsError("Question not found") - return + }, + ) } - }?: run { - HMSErrorLogger.returnArgumentsError("Incorrect question index") + } ?: run { + HMSErrorLogger.returnArgumentsError("Question not found") return } - }?:run { + } ?: run { + HMSErrorLogger.returnArgumentsError("Incorrect question index") + return + } + } ?: run { HMSErrorLogger.returnArgumentsError("No poll with given pollId found") return } } - private fun addMultiChoicePollResponse(call: MethodCall, methodChannelResult: MethodChannel.Result, hmssdk: HMSSDK, currentPolls: ArrayList?){ - + private fun addMultiChoicePollResponse( + call: MethodCall, + methodChannelResult: MethodChannel.Result, + hmssdk: HMSSDK, + currentPolls: ArrayList?, + ) { val pollId = call.argument("poll_id") val index = call.argument("question_index") val userId = call.argument("user_id") - val answer = call.argument?>>("answer") + val answer = call.argument?>>("answer") val timeTakenToAnswer = call.argument("time_taken_to_answer") /* @@ -144,121 +168,154 @@ class HMSPollAction { * If anywhere the sdk is unable to find the property we return the error */ currentPolls?.find { it.pollId == pollId }?.let { poll -> - index?.let {questionIndex -> + index?.let { questionIndex -> poll.questions?.get(questionIndex)?.let { currentQuestion -> val questionOptions = ArrayList() answer?.forEach { selectedOptions -> - selectedOptions as HashMap + selectedOptions as HashMap /* * Here the index needs to be subtracted by 1 * since the HMSPollQuestionOption object has indexing with 1 */ selectedOptions["index"]?.let { - index -> index as Int + index -> + index as Int val questionOption = currentQuestion.options?.get(index - 1) - questionOption?.let {option -> + questionOption?.let { option -> questionOptions.add(option) } } } val response = - timeTakenToAnswer?.let {_timeTakenToAnswer -> - HMSPollResponseBuilder(poll, userId).addResponse(currentQuestion,questionOptions, - _timeTakenToAnswer.toLong() + timeTakenToAnswer?.let { _timeTakenToAnswer -> + HMSPollResponseBuilder(poll, userId).addResponse( + currentQuestion, + questionOptions, + _timeTakenToAnswer.toLong(), ) - }?: run { - HMSPollResponseBuilder(poll, userId).addResponse(currentQuestion,questionOptions) - } - hmssdk.getHmsInteractivityCenter().add(response, object : HmsTypedActionResultListener{ - override fun onSuccess(result: PollAnswerResponse) { - methodChannelResult.success(HMSResultExtension.toDictionary(true,HMSPollAnswerResponseExtension.toDictionary(result))) - } - override fun onError(error: HMSException) { - methodChannelResult.success(HMSResultExtension.toDictionary(false,HMSExceptionExtension.toDictionary(error))) + } ?: run { + HMSPollResponseBuilder(poll, userId).addResponse(currentQuestion, questionOptions) } - }) + hmssdk.getHmsInteractivityCenter().add( + response, + object : HmsTypedActionResultListener { + override fun onSuccess(result: PollAnswerResponse) { + methodChannelResult.success( + HMSResultExtension.toDictionary(true, HMSPollAnswerResponseExtension.toDictionary(result)), + ) + } - }?: run { + override fun onError(error: HMSException) { + methodChannelResult.success( + HMSResultExtension.toDictionary(false, HMSExceptionExtension.toDictionary(error)), + ) + } + }, + ) + } ?: run { HMSErrorLogger.returnArgumentsError("Question not found") return } - }?:run{ + } ?: run { HMSErrorLogger.returnArgumentsError("Incorrect question index") return } - - }?:run { - HMSErrorLogger.returnArgumentsError("No poll with given pollId found") - return + } ?: run { + HMSErrorLogger.returnArgumentsError("No poll with given pollId found") + return } } - private fun stopPoll(call: MethodCall, result: MethodChannel.Result, hmssdk: HMSSDK, currentPolls: ArrayList?){ + private fun stopPoll( + call: MethodCall, + result: MethodChannel.Result, + hmssdk: HMSSDK, + currentPolls: ArrayList?, + ) { val pollId = call.argument("poll_id") - val poll = currentPolls?.first{ - it.pollId == pollId - }?:run { - HMSErrorLogger.returnArgumentsError("No Poll with given pollId found") - return - } - hmssdk.getHmsInteractivityCenter().stop(poll,HMSCommonAction.getActionListener(result)) - + val poll = + currentPolls?.first { + it.pollId == pollId + } ?: run { + HMSErrorLogger.returnArgumentsError("No Poll with given pollId found") + return + } + hmssdk.getHmsInteractivityCenter().stop(poll, HMSCommonAction.getActionListener(result)) } - private fun fetchLeaderboard(call: MethodCall, methodChannelResult: MethodChannel.Result, hmssdk: HMSSDK){ + private fun fetchLeaderboard( + call: MethodCall, + methodChannelResult: MethodChannel.Result, + hmssdk: HMSSDK, + ) { val pollId = call.argument("poll_id") val count = call.argument("count") val startIndex = call.argument("start_index") val includeCurrentPeer = call.argument("include_current_peer") - if(pollId == null || count == null || startIndex == null || includeCurrentPeer == null){ + if (pollId == null || count == null || startIndex == null || includeCurrentPeer == null) { HMSErrorLogger.returnArgumentsError("Either pollId, count, startIndex or includeCurrentPeer is null") return } - hmssdk.getHmsInteractivityCenter().fetchLeaderboard(pollId,count.toLong(),startIndex.toLong(),includeCurrentPeer, object : HmsTypedActionResultListener { - override fun onSuccess(result: PollLeaderboardResponse) { - methodChannelResult.success(HMSResultExtension.toDictionary(true,HMSPollLeaderboardResponseExtension.toDictionary(result))) - } + hmssdk.getHmsInteractivityCenter().fetchLeaderboard( + pollId, + count.toLong(), + startIndex.toLong(), + includeCurrentPeer, + object : HmsTypedActionResultListener { + override fun onSuccess(result: PollLeaderboardResponse) { + methodChannelResult.success( + HMSResultExtension.toDictionary(true, HMSPollLeaderboardResponseExtension.toDictionary(result)), + ) + } - override fun onError(error: HMSException) { - methodChannelResult.success(HMSResultExtension.toDictionary(false,HMSExceptionExtension.toDictionary(error))) - } - }) + override fun onError(error: HMSException) { + methodChannelResult.success(HMSResultExtension.toDictionary(false, HMSExceptionExtension.toDictionary(error))) + } + }, + ) } - private fun fetchPollList(call: MethodCall, methodChannelResult: MethodChannel.Result, hmssdk: HMSSDK){ + private fun fetchPollList( + call: MethodCall, + methodChannelResult: MethodChannel.Result, + hmssdk: HMSSDK, + ) { val state = call.argument("poll_state") val pollState = getPollState(state) pollState?.let { - hmssdk.getHmsInteractivityCenter().fetchPollList(it,object : HmsTypedActionResultListener>{ - override fun onSuccess(result: List) { - - val map = ArrayList>() + hmssdk.getHmsInteractivityCenter().fetchPollList( + it, + object : HmsTypedActionResultListener> { + override fun onSuccess(result: List) { + val map = ArrayList>() - result.forEach { poll -> - map.add(HMSPollExtension.toDictionary(poll)) + result.forEach { poll -> + map.add(HMSPollExtension.toDictionary(poll)) + } + methodChannelResult.success(HMSResultExtension.toDictionary(true, map)) } - methodChannelResult.success(HMSResultExtension.toDictionary(true, map)) - } - - override fun onError(error: HMSException) { - methodChannelResult.success(HMSResultExtension.toDictionary(false,HMSExceptionExtension.toDictionary(error))) - } - }) - - }?: run { - HMSErrorLogger.returnHMSException("fetchPollList","No poll state matched", "ARGUMENTS_ERROR",methodChannelResult) + override fun onError(error: HMSException) { + methodChannelResult.success(HMSResultExtension.toDictionary(false, HMSExceptionExtension.toDictionary(error))) + } + }, + ) + } ?: run { + HMSErrorLogger.returnHMSException("fetchPollList", "No poll state matched", "ARGUMENTS_ERROR", methodChannelResult) } - } - private fun fetchPollQuestions(call: MethodCall, methodChannelResult: MethodChannel.Result, hmssdk: HMSSDK){ + private fun fetchPollQuestions( + call: MethodCall, + methodChannelResult: MethodChannel.Result, + hmssdk: HMSSDK, + ) { val pollId = call.argument("poll_id") val state = call.argument("poll_state") @@ -266,51 +323,63 @@ class HMSPollAction { val pollState = getPollState(state) pollState?.let { - hmssdk.getHmsInteractivityCenter().fetchPollList(it,object : HmsTypedActionResultListener>{ - override fun onSuccess(result: List) { - - val poll = result.find { - _poll -> - _poll.pollId == pollId - } - poll?.let { _poll -> - hmssdk.getHmsInteractivityCenter().fetchPollQuestions(_poll, object : HmsTypedActionResultListener>{ - override fun onSuccess(result: List) { - val map = ArrayList>() - - result.forEach { pollQuestion -> - val pollQuestionMap = HMSPollQuestionExtension.toDictionary(pollQuestion) - pollQuestionMap?.let { _pollQuestionMap -> - map.add(_pollQuestionMap) - } - } - methodChannelResult.success(HMSResultExtension.toDictionary(true, map)) - } - - override fun onError(error: HMSException) { - methodChannelResult.success(HMSResultExtension.toDictionary(false,HMSExceptionExtension.toDictionary(error))) + hmssdk.getHmsInteractivityCenter().fetchPollList( + it, + object : HmsTypedActionResultListener> { + override fun onSuccess(result: List) { + val poll = + result.find { + _poll -> + _poll.pollId == pollId } + poll?.let { _poll -> + hmssdk.getHmsInteractivityCenter().fetchPollQuestions( + _poll, + object : HmsTypedActionResultListener> { + override fun onSuccess(result: List) { + val map = ArrayList>() + + result.forEach { pollQuestion -> + val pollQuestionMap = HMSPollQuestionExtension.toDictionary(pollQuestion) + pollQuestionMap?.let { _pollQuestionMap -> + map.add(_pollQuestionMap) + } + } + methodChannelResult.success(HMSResultExtension.toDictionary(true, map)) + } - }) - }?:run{ - HMSErrorLogger.logError("fetchPollQuestions","No poll with given pollId found","NULL_ERROR") + override fun onError(error: HMSException) { + methodChannelResult.success( + HMSResultExtension.toDictionary(false, HMSExceptionExtension.toDictionary(error)), + ) + } + }, + ) + } ?: run { + HMSErrorLogger.logError("fetchPollQuestions", "No poll with given pollId found", "NULL_ERROR") + } } - } - override fun onError(error: HMSException) { - methodChannelResult.success(HMSResultExtension.toDictionary(false,HMSExceptionExtension.toDictionary(error))) - } - }) - }?:run{ + override fun onError(error: HMSException) { + methodChannelResult.success( + HMSResultExtension.toDictionary(false, HMSExceptionExtension.toDictionary(error)), + ) + } + }, + ) + } ?: run { HMSErrorLogger.returnArgumentsError("No state matched with given state") } - }?:run{ + } ?: run { HMSErrorLogger.returnArgumentsError("pollId is null") } } - private fun getPollResults(call: MethodCall, methodChannelResult: MethodChannel.Result, hmssdk: HMSSDK){ - + private fun getPollResults( + call: MethodCall, + methodChannelResult: MethodChannel.Result, + hmssdk: HMSSDK, + ) { val pollId = call.argument("poll_id") val state = call.argument("poll_state") @@ -318,48 +387,61 @@ class HMSPollAction { val pollState = getPollState(state) pollState?.let { - hmssdk.getHmsInteractivityCenter().fetchPollList(it,object : HmsTypedActionResultListener>{ - override fun onSuccess(result: List) { - - val poll = result.find { - _poll -> - _poll.pollId == pollId - } - poll?.let { _poll -> - hmssdk.getHmsInteractivityCenter().getPollResults(_poll, object : HmsTypedActionResultListener{ - override fun onSuccess(result: HmsPoll) { - methodChannelResult.success(HMSResultExtension.toDictionary(true, HMSPollExtension.toDictionary(result))) - } - - override fun onError(error: HMSException) { - methodChannelResult.success(HMSResultExtension.toDictionary(false,HMSExceptionExtension.toDictionary(error))) + hmssdk.getHmsInteractivityCenter().fetchPollList( + it, + object : HmsTypedActionResultListener> { + override fun onSuccess(result: List) { + val poll = + result.find { + _poll -> + _poll.pollId == pollId } + poll?.let { _poll -> + hmssdk.getHmsInteractivityCenter().getPollResults( + _poll, + object : HmsTypedActionResultListener { + override fun onSuccess(result: HmsPoll) { + methodChannelResult.success( + HMSResultExtension.toDictionary(true, HMSPollExtension.toDictionary(result)), + ) + } - }) - }?:run{ - HMSErrorLogger.logError("getPollResults","No poll with given pollId found","NULL_ERROR") + override fun onError(error: HMSException) { + methodChannelResult.success( + HMSResultExtension.toDictionary(false, HMSExceptionExtension.toDictionary(error)), + ) + } + }, + ) + } ?: run { + HMSErrorLogger.logError("getPollResults", "No poll with given pollId found", "NULL_ERROR") + } } - } - override fun onError(error: HMSException) { - methodChannelResult.success(HMSResultExtension.toDictionary(false,HMSExceptionExtension.toDictionary(error))) - } - }) - }?:run{ + override fun onError(error: HMSException) { + methodChannelResult.success( + HMSResultExtension.toDictionary(false, HMSExceptionExtension.toDictionary(error)), + ) + } + }, + ) + } ?: run { HMSErrorLogger.returnArgumentsError("No state matched with given state") } - }?:run{ + } ?: run { HMSErrorLogger.returnArgumentsError("pollId is null") } } - private fun getPollState(pollState: String?):HmsPollState?{ - return when(pollState){ - "created"-> HmsPollState.CREATED - "started" -> HmsPollState.STARTED + private fun getPollState(pollState: String?): HmsPollState? { + return when (pollState) { + "created" -> HmsPollState.CREATED + "started" -> HmsPollState.STARTED "stopped" -> HmsPollState.STOPPED - else -> {null} + else -> { + null + } } } } -} \ No newline at end of file +} diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSSessionStoreAction.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSSessionStoreAction.kt index a6bec486b..6eecc5f13 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSSessionStoreAction.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/methods/HMSSessionStoreAction.kt @@ -1,9 +1,6 @@ package live.hms.hmssdk_flutter.methods -import com.google.gson.JsonArray import com.google.gson.JsonElement -import com.google.gson.JsonObject -import com.google.gson.JsonParser import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodChannel.Result import live.hms.hmssdk_flutter.HMSCommonAction diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollAnswerExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollAnswerExtension.kt index d623f20ad..b02ac910c 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollAnswerExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollAnswerExtension.kt @@ -3,12 +3,9 @@ package live.hms.hmssdk_flutter.poll_extension import live.hms.hmssdk_flutter.HMSErrorLogger import live.hms.hmssdk_flutter.poll_extension.HMSPollQuestionExtension.Companion.getStringFromPollQuestionType import live.hms.video.polls.models.answer.HmsPollAnswer -import live.hms.video.polls.models.network.HMSPollQuestionResponse class HMSPollAnswerExtension { - companion object { - fun toDictionary(answer: HmsPollAnswer?): HashMap? { answer?.let { val map = HashMap() @@ -26,72 +23,76 @@ class HMSPollAnswerExtension { } } - fun toHMSPollAnswer(answerMap: HashMap?): HmsPollAnswer?{ - + fun toHMSPollAnswer(answerMap: HashMap?): HmsPollAnswer? { answerMap?.let { - - val answer = answerMap["answer"]?.let { - it as String - }?:run { - HMSErrorLogger.returnArgumentsError("answer should not be null") - return null - } - - val duration = answerMap["duration"]?.let { - (it as Int).toLong() - }?:run { - HMSErrorLogger.returnArgumentsError("duration should not be null") - return null - } - - val questionId = answerMap["question_id"]?.let { - it as Int - }?:run { - HMSErrorLogger.returnArgumentsError("questionId should not be null") - return null - } - - val questionType = answerMap["question_type"]?.let { - HMSPollQuestionExtension.getPollQuestionTypeFromString(it as String) - }?:run { - HMSErrorLogger.returnArgumentsError("questionType should not be null") - return null - } - - val selectedOption = answerMap["selected_option"]?.let { - it as Int - }?:run { - HMSErrorLogger.returnArgumentsError("selectedOption should not be null") - return null - } - - val selectedOptions = answerMap["selected_options"]?.let { - it as ArrayList - }?:run { - HMSErrorLogger.returnArgumentsError("selectedOptions should not be null") - return null - } - - val skipped = answerMap["skipped"]?.let { - it as Boolean - }?:run { - HMSErrorLogger.returnArgumentsError("skipped should not be null") - return null - } - - val update = answerMap["update"]?.let { - it as Boolean - }?:run { - HMSErrorLogger.returnArgumentsError("update should not be null") - return null - } - - return HmsPollAnswer(questionId,questionType,skipped,selectedOption,selectedOptions,answer,update,duration) - - - }?:run { + val answer = + answerMap["answer"]?.let { + it as String + } ?: run { + HMSErrorLogger.returnArgumentsError("answer should not be null") + return null + } + + val duration = + answerMap["duration"]?.let { + (it as Int).toLong() + } ?: run { + HMSErrorLogger.returnArgumentsError("duration should not be null") + return null + } + + val questionId = + answerMap["question_id"]?.let { + it as Int + } ?: run { + HMSErrorLogger.returnArgumentsError("questionId should not be null") + return null + } + + val questionType = + answerMap["question_type"]?.let { + HMSPollQuestionExtension.getPollQuestionTypeFromString(it as String) + } ?: run { + HMSErrorLogger.returnArgumentsError("questionType should not be null") + return null + } + + val selectedOption = + answerMap["selected_option"]?.let { + it as Int + } ?: run { + HMSErrorLogger.returnArgumentsError("selectedOption should not be null") + return null + } + + val selectedOptions = + answerMap["selected_options"]?.let { + it as ArrayList + } ?: run { + HMSErrorLogger.returnArgumentsError("selectedOptions should not be null") + return null + } + + val skipped = + answerMap["skipped"]?.let { + it as Boolean + } ?: run { + HMSErrorLogger.returnArgumentsError("skipped should not be null") + return null + } + + val update = + answerMap["update"]?.let { + it as Boolean + } ?: run { + HMSErrorLogger.returnArgumentsError("update should not be null") + return null + } + + return HmsPollAnswer(questionId, questionType, skipped, selectedOption, selectedOptions, answer, update, duration) + } ?: run { return null } } } -} \ No newline at end of file +} diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollAnswerResponseExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollAnswerResponseExtension.kt index cf0c2e38e..852d72f3b 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollAnswerResponseExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollAnswerResponseExtension.kt @@ -4,14 +4,12 @@ import live.hms.hmssdk_flutter.HMSExceptionExtension import live.hms.video.polls.models.answer.PollAnswerResponse class HMSPollAnswerResponseExtension { - - companion object{ - fun toDictionary(pollAnswerResponse: PollAnswerResponse):HashMap?{ - - val map = HashMap() - val resultMapList = ArrayList>() - pollAnswerResponse.result.forEach{ - val resultMap = HashMap() + companion object { + fun toDictionary(pollAnswerResponse: PollAnswerResponse): HashMap? { + val map = HashMap() + val resultMapList = ArrayList>() + pollAnswerResponse.result.forEach { + val resultMap = HashMap() resultMap["correct"] = it.correct resultMap["error"] = HMSExceptionExtension.toDictionary(it.error) resultMap["question_index"] = it.questionIndex @@ -24,4 +22,4 @@ class HMSPollAnswerResponseExtension { return map } } -} \ No newline at end of file +} diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollBuilderExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollBuilderExtension.kt index e53f9765a..d62a8fe98 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollBuilderExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollBuilderExtension.kt @@ -1,26 +1,23 @@ package live.hms.hmssdk_flutter.poll_extension import live.hms.hmssdk_flutter.HMSErrorLogger -import live.hms.hmssdk_flutter.HMSRoleExtension import live.hms.video.polls.HMSPollBuilder import live.hms.video.polls.HMSPollQuestionBuilder import live.hms.video.polls.models.HmsPollCategory import live.hms.video.polls.models.HmsPollUserTrackingMode -import live.hms.video.polls.models.question.HMSPollQuestion import live.hms.video.polls.models.question.HMSPollQuestionType import live.hms.video.sdk.HMSSDK import live.hms.video.sdk.models.role.HMSRole -import okhttp3.internal.notify class HMSPollBuilderExtension { - - companion object{ - - fun toHMSPollBuilder(pollBuilderMap: HashMap?,hmssdk: HMSSDK):HMSPollBuilder?{ - + companion object { + fun toHMSPollBuilder( + pollBuilderMap: HashMap?, + hmssdk: HMSSDK, + ): HMSPollBuilder? { pollBuilderMap?.let { val pollBuilder = HMSPollBuilder.Builder() - pollBuilderMap["anonymous"]?.let{ + pollBuilderMap["anonymous"]?.let { pollBuilder.withAnonymous(it as Boolean) } pollBuilderMap["duration"]?.let { @@ -41,13 +38,12 @@ class HMSPollBuilderExtension { val questions = it as ArrayList<*> val pollQuestions = ArrayList() questions.forEach { pollQuestion -> - pollQuestion as HashMap? + pollQuestion as HashMap? val pollQuestionBuilder = getPollQuestionBuilder(pollQuestion) - pollQuestionBuilder?.let {questionBuilder -> + pollQuestionBuilder?.let { questionBuilder -> pollBuilder.addQuestion(questionBuilder) } } - } val availableRoles = hmssdk.getRoles() @@ -66,9 +62,9 @@ class HMSPollBuilderExtension { pollBuilderMap["roles_that_can_vote"]?.let { val roles = it as ArrayList<*> val rolesThatCanVote = ArrayList() - roles.forEach{ forEveryRole -> + roles.forEach { forEveryRole -> val role = availableRoles.find { role -> role.name == forEveryRole } - role?.let {currentRole -> + role?.let { currentRole -> rolesThatCanVote.add(currentRole) } } @@ -80,122 +76,123 @@ class HMSPollBuilderExtension { } return pollBuilder.build() - - }?: run { + } ?: run { return null } - - } private fun getPollCategoryFromString(category: String): HmsPollCategory { - return when(category) { + return when (category) { "poll" -> HmsPollCategory.POLL "quiz" -> HmsPollCategory.QUIZ else -> HmsPollCategory.POLL } } - - private fun getPollUserTrackingModeFromString(pollUserTrackingMode: String):HmsPollUserTrackingMode{ - return when(pollUserTrackingMode){ + private fun getPollUserTrackingModeFromString(pollUserTrackingMode: String): HmsPollUserTrackingMode { + return when (pollUserTrackingMode) { "user_id" -> HmsPollUserTrackingMode.USER_ID "peer_id" -> HmsPollUserTrackingMode.PEER_ID - "username"-> HmsPollUserTrackingMode.USERNAME + "username" -> HmsPollUserTrackingMode.USERNAME else -> HmsPollUserTrackingMode.USER_ID - } } - private fun getPollQuestionTypeFromString(pollQuestionType: String): HMSPollQuestionType{ - return when(pollQuestionType){ + private fun getPollQuestionTypeFromString(pollQuestionType: String): HMSPollQuestionType { + return when (pollQuestionType) { "multi_choice" -> HMSPollQuestionType.multiChoice "short_answer" -> HMSPollQuestionType.shortAnswer - "long_answer" -> HMSPollQuestionType.longAnswer + "long_answer" -> HMSPollQuestionType.longAnswer "single_choice" -> HMSPollQuestionType.singleChoice else -> HMSPollQuestionType.singleChoice } } - private fun getPollQuestionBuilder(pollQuestion: HashMap?):HMSPollQuestionBuilder?{ - - val pollQuestionBuilder : HMSPollQuestionBuilder.Builder + private fun getPollQuestionBuilder(pollQuestion: HashMap?): HMSPollQuestionBuilder? { + val pollQuestionBuilder: HMSPollQuestionBuilder.Builder pollQuestion?.let { + val type = + pollQuestion["type"]?.let { type -> + getPollQuestionTypeFromString(type as String) + } ?: run { + HMSErrorLogger.returnArgumentsError("type should not be null") + return null + } - val type = pollQuestion["type"]?.let {type -> - getPollQuestionTypeFromString(type as String) - }?:run{ - HMSErrorLogger.returnArgumentsError("type should not be null") - return null - } - - type.let {questionType -> + type.let { questionType -> pollQuestionBuilder = HMSPollQuestionBuilder.Builder(questionType) } - val canSkip = pollQuestion["can_skip"]?.let {canSkipQuestion -> - canSkipQuestion as Boolean - } + val canSkip = + pollQuestion["can_skip"]?.let { canSkipQuestion -> + canSkipQuestion as Boolean + } canSkip?.let { canSkipQuestion -> pollQuestionBuilder.withCanBeSkipped(canSkipQuestion) } - val text = pollQuestion["text"]?.let { text -> - text as String - } + val text = + pollQuestion["text"]?.let { text -> + text as String + } text?.let { pollQuestionBuilder.withTitle(text) } - val duration = pollQuestion["duration"]?.let { duration -> - (duration as Int).toLong() - } + val duration = + pollQuestion["duration"]?.let { duration -> + (duration as Int).toLong() + } duration?.let { duration -> pollQuestionBuilder.withDuration(duration) } - val weight = pollQuestion["weight"]?.let {weight -> - weight as Int - } + val weight = + pollQuestion["weight"]?.let { weight -> + weight as Int + } weight?.let { pollQuestionBuilder.withWeight(weight) } - val answerHidden = pollQuestion["answer_hidden"]?.let {answerHidden -> - answerHidden as Boolean - } + val answerHidden = + pollQuestion["answer_hidden"]?.let { answerHidden -> + answerHidden as Boolean + } answerHidden?.let { pollQuestionBuilder.withAnswerHidden(answerHidden) } - val maxLength = pollQuestion["max_length"]?.let { maxLength -> - (maxLength as Int).toLong() - } + val maxLength = + pollQuestion["max_length"]?.let { maxLength -> + (maxLength as Int).toLong() + } maxLength?.let { pollQuestionBuilder.withMaxLength(maxLength) } - - val minLength = pollQuestion["min_length"]?.let { minLength -> - (minLength as Int).toLong() - } + val minLength = + pollQuestion["min_length"]?.let { minLength -> + (minLength as Int).toLong() + } minLength?.let { pollQuestionBuilder.withMinLength(minLength) } - val pollOptions = pollQuestion["poll_options"]?.let { options -> - options as ArrayList - }?:run { - HMSErrorLogger.returnArgumentsError("pollOptions should not be null") - null - } + val pollOptions = + pollQuestion["poll_options"]?.let { options -> + options as ArrayList + } ?: run { + HMSErrorLogger.returnArgumentsError("pollOptions should not be null") + null + } pollOptions?.let { pollOptions.forEach { @@ -203,45 +200,46 @@ class HMSPollBuilderExtension { } } - val option = pollQuestion["options"]?.let { options -> + val option = + pollQuestion["options"]?.let { options -> - options as ArrayList> - val optionMap = ArrayList>() + options as ArrayList> + val optionMap = ArrayList>() - options.forEach { - val text = it["text"] as String? - text?.let { optionText -> - val isCorrect = it["is_correct"] - isCorrect?.let { isCorrectOption -> - optionMap.add(Pair(optionText,isCorrectOption)) + options.forEach { + val text = it["text"] as String? + text?.let { optionText -> + val isCorrect = it["is_correct"] + isCorrect?.let { isCorrectOption -> + optionMap.add(Pair(optionText, isCorrectOption)) + } } } + optionMap + } ?: run { + HMSErrorLogger.returnArgumentsError("options should not be null") + null } - optionMap - }?:run { - HMSErrorLogger.returnArgumentsError("options should not be null") - null - } option?.let { option.forEach { - pollQuestionBuilder.addQuizOption(it.first,it.second) + pollQuestionBuilder.addQuizOption(it.first, it.second) } } - val canChangeResponse = pollQuestion["can_change_response"]?.let { canChangeResponse -> - canChangeResponse as Boolean - } + val canChangeResponse = + pollQuestion["can_change_response"]?.let { canChangeResponse -> + canChangeResponse as Boolean + } canChangeResponse?.let { pollQuestionBuilder.withCanChangeResponse(it) } return pollQuestionBuilder.build() - - }?:run{ + } ?: run { return null } } } -} \ No newline at end of file +} 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 e70358047..7852b20fb 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 @@ -5,11 +5,9 @@ import live.hms.hmssdk_flutter.HMSRoleExtension import live.hms.video.polls.models.* class HMSPollExtension { - companion object { fun toDictionary(poll: HmsPoll): HashMap { - - val map = HashMap() + val map = HashMap() map["anonymous"] = poll.anonymous map["category"] = getPollCategory(poll.category) @@ -19,22 +17,22 @@ class HMSPollExtension { map["poll_id"] = poll.pollId map["question_count"] = poll.questionCount - val questions = ArrayList?>() - poll.questions?.forEach{ + val questions = ArrayList?>() + poll.questions?.forEach { questions.add(HMSPollQuestionExtension.toDictionary(it)) } map["questions"] = questions map["result"] = HMSPollResultDisplayExtension.toDictionary(poll.result) - val rolesThatCanViewResponses = ArrayList?>() - poll.rolesThatCanViewResponses.forEach{ + val rolesThatCanViewResponses = ArrayList?>() + poll.rolesThatCanViewResponses.forEach { rolesThatCanViewResponses.add(HMSRoleExtension.toDictionary(it)) } map["roles_that_can_view_responses"] = rolesThatCanViewResponses - val rolesThatCanVote = ArrayList?>() - poll.rolesThatCanVote.forEach{ + val rolesThatCanVote = ArrayList?>() + poll.rolesThatCanVote.forEach { rolesThatCanVote.add(HMSRoleExtension.toDictionary(it)) } map["roles_that_can_vote"] = rolesThatCanVote @@ -44,7 +42,7 @@ class HMSPollExtension { map["state"] = getPollState(poll.state) map["stopped_at"] = poll.stoppedAt?.let { it * 1000 - }?:run { + } ?: run { null } map["title"] = poll.title @@ -52,16 +50,16 @@ class HMSPollExtension { return map } - private fun getPollCategory(pollCategory: HmsPollCategory):String?{ - return when(pollCategory){ + private fun getPollCategory(pollCategory: HmsPollCategory): String? { + return when (pollCategory) { HmsPollCategory.POLL -> "poll" HmsPollCategory.QUIZ -> "quiz" else -> null } } - private fun getPollUserTrackingMode(pollUserTrackingMode: HmsPollUserTrackingMode?):String?{ - return when(pollUserTrackingMode){ + private fun getPollUserTrackingMode(pollUserTrackingMode: HmsPollUserTrackingMode?): String? { + return when (pollUserTrackingMode) { HmsPollUserTrackingMode.USER_ID -> "user_id" HmsPollUserTrackingMode.PEER_ID -> "peer_id" HmsPollUserTrackingMode.USERNAME -> "username" @@ -69,8 +67,8 @@ class HMSPollExtension { } } - private fun getPollState(pollState: HmsPollState):String?{ - return when(pollState){ + private fun getPollState(pollState: HmsPollState): String? { + return when (pollState) { HmsPollState.CREATED -> "created" HmsPollState.STARTED -> "started" HmsPollState.STOPPED -> "stopped" @@ -78,8 +76,8 @@ class HMSPollExtension { } } - fun getPollUpdateType(hmsPollUpdateType: HMSPollUpdateType):String?{ - return when(hmsPollUpdateType){ + fun getPollUpdateType(hmsPollUpdateType: HMSPollUpdateType): String? { + return when (hmsPollUpdateType) { HMSPollUpdateType.started -> "started" HMSPollUpdateType.stopped -> "stopped" HMSPollUpdateType.resultsupdated -> "results_updated" @@ -88,4 +86,3 @@ class HMSPollExtension { } } } - diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollLeaderboardEntryExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollLeaderboardEntryExtension.kt index 335542faa..39d73eae0 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollLeaderboardEntryExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollLeaderboardEntryExtension.kt @@ -3,12 +3,9 @@ package live.hms.hmssdk_flutter.poll_extension import live.hms.video.polls.network.HMSPollLeaderboardEntry class HMSPollLeaderboardEntryExtension { - - companion object{ - - fun toDictionary(hmsPollLeaderboardEntry: HMSPollLeaderboardEntry):HashMap{ - - val map = HashMap() + companion object { + fun toDictionary(hmsPollLeaderboardEntry: HMSPollLeaderboardEntry): HashMap { + val map = HashMap() map["correct_responses"] = hmsPollLeaderboardEntry.correctResponses map["duration"] = hmsPollLeaderboardEntry.duration @@ -19,4 +16,4 @@ class HMSPollLeaderboardEntryExtension { return map } } -} \ No newline at end of file +} diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollLeaderboardResponseExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollLeaderboardResponseExtension.kt index a87ca438c..47fafbbf4 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollLeaderboardResponseExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollLeaderboardResponseExtension.kt @@ -3,14 +3,11 @@ package live.hms.hmssdk_flutter.poll_extension import live.hms.video.polls.network.PollLeaderboardResponse class HMSPollLeaderboardResponseExtension { + companion object { + fun toDictionary(pollLeaderboardResponse: PollLeaderboardResponse): HashMap { + val map = HashMap() - companion object{ - - fun toDictionary(pollLeaderboardResponse: PollLeaderboardResponse):HashMap{ - - val map = HashMap() - - val entryMap = ArrayList>() + val entryMap = ArrayList>() pollLeaderboardResponse.entries?.forEach { pollLeaderboardResponse -> entryMap.add(HMSPollLeaderboardEntryExtension.toDictionary(pollLeaderboardResponse)) @@ -22,4 +19,4 @@ class HMSPollLeaderboardResponseExtension { return map } } -} \ No newline at end of file +} diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollLeaderboardSummaryExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollLeaderboardSummaryExtension.kt index b5eee64d7..22b3692a2 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollLeaderboardSummaryExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollLeaderboardSummaryExtension.kt @@ -3,16 +3,13 @@ package live.hms.hmssdk_flutter.poll_extension import live.hms.video.polls.network.HMSPollLeaderboardSummary class HMSPollLeaderboardSummaryExtension { - - companion object{ - - fun toDictionary(pollLeaderboardSummary: HMSPollLeaderboardSummary?):HashMap?{ - - if(pollLeaderboardSummary == null){ + companion object { + fun toDictionary(pollLeaderboardSummary: HMSPollLeaderboardSummary?): HashMap? { + if (pollLeaderboardSummary == null) { return null } - val map = HashMap() + val map = HashMap() map["average_score"] = pollLeaderboardSummary.averageScore map["average_time"] = pollLeaderboardSummary.averageTime @@ -23,4 +20,4 @@ class HMSPollLeaderboardSummaryExtension { return map } } -} \ No newline at end of file +} diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollQuestionAnswerExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollQuestionAnswerExtension.kt index e46e44a35..bcff675d3 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollQuestionAnswerExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollQuestionAnswerExtension.kt @@ -4,47 +4,47 @@ import live.hms.hmssdk_flutter.HMSErrorLogger import live.hms.video.polls.models.answer.HMSPollQuestionAnswer class HMSPollQuestionAnswerExtension { - companion object { - fun toDictionary(answer: HMSPollQuestionAnswer?):HashMap?{ + fun toDictionary(answer: HMSPollQuestionAnswer?): HashMap? { answer?.let { - val map = HashMap() + val map = HashMap() map["hidden"] = it.hidden map["option"] = it.option map["options"] = it.options return map - }?:run{ + } ?: run { return null } } - fun toPollQuestionAnswer(pollQuestionAnswer: HashMap?): HMSPollQuestionAnswer?{ - + fun toPollQuestionAnswer(pollQuestionAnswer: HashMap?): HMSPollQuestionAnswer? { pollQuestionAnswer?.let { + val hidden = + pollQuestionAnswer["hidden"]?.let { + it as Boolean + } ?: run { + HMSErrorLogger.returnArgumentsError("hidden should not be null") + return null + } + val option = + pollQuestionAnswer["option"]?.let { + it as Int + } ?: run { + HMSErrorLogger.returnArgumentsError("option should not be null") + return null + } + val options = + pollQuestionAnswer["options"]?.let { + it as ArrayList + } ?: run { + HMSErrorLogger.returnArgumentsError("options should not be null") + return null + } - val hidden = pollQuestionAnswer["hidden"]?.let { - it as Boolean - }?:run { - HMSErrorLogger.returnArgumentsError("hidden should not be null") - return null - } - val option = pollQuestionAnswer["option"]?.let { - it as Int - }?:run { - HMSErrorLogger.returnArgumentsError("option should not be null") - return null - } - val options = pollQuestionAnswer["options"]?.let { - it as ArrayList - }?:run { - HMSErrorLogger.returnArgumentsError("options should not be null") - return null - } - - return HMSPollQuestionAnswer(hidden,option,options) - }?:run { + return HMSPollQuestionAnswer(hidden, option, options) + } ?: run { return null } } } -} \ No newline at end of file +} diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollQuestionExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollQuestionExtension.kt index 765e12443..acef20211 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollQuestionExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollQuestionExtension.kt @@ -7,130 +7,150 @@ import live.hms.video.polls.models.question.HMSPollQuestionOption import live.hms.video.polls.models.question.HMSPollQuestionType class HMSPollQuestionExtension { - companion object{ - fun toDictionary(question:HMSPollQuestion?):HashMap?{ - - question?.let { - val map = HashMap() - map["question_id"] = it.questionID - map["can_skip"] = it.canSkip - map["correct_answer"] = HMSPollQuestionAnswerExtension.toDictionary(it.correctAnswer) - map["duration"] = it.duration - - val responses = ArrayList?>() - it.myResponses.forEach { - response -> responses.add(HMSPollAnswerExtension.toDictionary(response)) - } - map["my_responses"] = responses - - val options = ArrayList?>() - it.options?.forEach{ - option -> options.add(HMSPollQuestionOptionExtension.toDictionary(option)) - } - map["options"] = options + companion object { + fun toDictionary(question: HMSPollQuestion?): HashMap? { + question?.let { + val map = HashMap() + map["question_id"] = it.questionID + map["can_skip"] = it.canSkip + map["correct_answer"] = HMSPollQuestionAnswerExtension.toDictionary(it.correctAnswer) + map["duration"] = it.duration + + val responses = ArrayList?>() + it.myResponses.forEach { + response -> + responses.add(HMSPollAnswerExtension.toDictionary(response)) + } + map["my_responses"] = responses - map["text"] = it.text - map["type"] = getStringFromPollQuestionType(it.type) - map["voted"] = it.voted - map["weight"] = it.weight - map["can_change_response"] = it.canChangeResponse - return map - }?:run { - return null + val options = ArrayList?>() + it.options?.forEach { + option -> + options.add(HMSPollQuestionOptionExtension.toDictionary(option)) } + map["options"] = options + + map["text"] = it.text + map["type"] = getStringFromPollQuestionType(it.type) + map["voted"] = it.voted + map["weight"] = it.weight + map["can_change_response"] = it.canChangeResponse + return map + } ?: run { + return null } + } - fun toHMSPollQuestion(pollQuestion: HashMap?):HMSPollQuestion?{ - + fun toHMSPollQuestion(pollQuestion: HashMap?): HMSPollQuestion? { pollQuestion?.let { + val questionID = + pollQuestion["question_id"]?.let { + it as Int + } ?: run { + HMSErrorLogger.returnArgumentsError("questionID should not be null") + return null + } - val questionID = pollQuestion["question_id"]?.let { - it as Int - }?:run { - HMSErrorLogger.returnArgumentsError("questionID should not be null") - return null - } - - val canSkip = pollQuestion["can_skip"]?.let { - it as Boolean - }?:run { - HMSErrorLogger.returnArgumentsError("canSkip should not be null") - return null - } - val correctAnswer = pollQuestion["correct_answer"]?.let { - HMSPollQuestionAnswerExtension.toPollQuestionAnswer(it as HashMap?) - }?:run { - HMSErrorLogger.returnArgumentsError("correctAnswer should not be null") - return null - } - val duration = pollQuestion["duration"]?.let { - (it as Int).toLong() - }?:run { - HMSErrorLogger.returnArgumentsError("duration should not be null") - return null - } + val canSkip = + pollQuestion["can_skip"]?.let { + it as Boolean + } ?: run { + HMSErrorLogger.returnArgumentsError("canSkip should not be null") + return null + } + val correctAnswer = + pollQuestion["correct_answer"]?.let { + HMSPollQuestionAnswerExtension.toPollQuestionAnswer(it as HashMap?) + } ?: run { + HMSErrorLogger.returnArgumentsError("correctAnswer should not be null") + return null + } + val duration = + pollQuestion["duration"]?.let { + (it as Int).toLong() + } ?: run { + HMSErrorLogger.returnArgumentsError("duration should not be null") + return null + } - val myResponses = pollQuestion["my_responses"]?.let { - val responses = it as ArrayList<*> - val myResponses = ArrayList() - responses.forEach { response -> - val answer = HMSPollAnswerExtension.toHMSPollAnswer(response as HashMap?) - answer?.let { value -> - myResponses.add(value) + val myResponses = + pollQuestion["my_responses"]?.let { + val responses = it as ArrayList<*> + val myResponses = ArrayList() + responses.forEach { response -> + val answer = HMSPollAnswerExtension.toHMSPollAnswer(response as HashMap?) + answer?.let { value -> + myResponses.add(value) + } } + myResponses + } ?: run { + HMSErrorLogger.returnArgumentsError("myResponses should not be null") + return null } - myResponses - }?:run { - HMSErrorLogger.returnArgumentsError("myResponses should not be null") - return null - } - val options = pollQuestion["options"]?.let { - val options = it as ArrayList<*> - val pollOptions = ArrayList() - options.forEach { option -> - val pollOption = HMSPollQuestionOptionExtension.toHMSPollQuestionOption(option as HashMap?) - pollOption?.let { value -> - pollOptions.add(value) + val options = + pollQuestion["options"]?.let { + val options = it as ArrayList<*> + val pollOptions = ArrayList() + options.forEach { option -> + val pollOption = HMSPollQuestionOptionExtension.toHMSPollQuestionOption(option as HashMap?) + pollOption?.let { value -> + pollOptions.add(value) + } } + pollOptions + } ?: run { + HMSErrorLogger.returnArgumentsError("options should not be null") + return null } - pollOptions - }?:run { - HMSErrorLogger.returnArgumentsError("options should not be null") - return null - } - - val text = pollQuestion["text"]?.let { - it as String - }?:run { - HMSErrorLogger.returnArgumentsError("text should not be null") - return null - } - - val type = pollQuestion["type"]?.let { - getPollQuestionTypeFromString(it as String) - }?:run { - HMSErrorLogger.returnArgumentsError("type should not be null") - return null - } - val weight = pollQuestion["weight"]?.let { - it as Int - }?:run { - HMSErrorLogger.returnArgumentsError("weight should not be null") - return null - } + val text = + pollQuestion["text"]?.let { + it as String + } ?: run { + HMSErrorLogger.returnArgumentsError("text should not be null") + return null + } - return HMSPollQuestion(questionID,type,text,canSkip,false,duration,weight,null,null,options,correctAnswer,false,myResponses) + val type = + pollQuestion["type"]?.let { + getPollQuestionTypeFromString(it as String) + } ?: run { + HMSErrorLogger.returnArgumentsError("type should not be null") + return null + } + val weight = + pollQuestion["weight"]?.let { + it as Int + } ?: run { + HMSErrorLogger.returnArgumentsError("weight should not be null") + return null + } - }?:run { + return HMSPollQuestion( + questionID, + type, + text, + canSkip, + false, + duration, + weight, + null, + null, + options, + correctAnswer, + false, + myResponses, + ) + } ?: run { return null } } - fun getStringFromPollQuestionType(pollQuestionType: HMSPollQuestionType):String?{ - return when(pollQuestionType){ + fun getStringFromPollQuestionType(pollQuestionType: HMSPollQuestionType): String? { + return when (pollQuestionType) { HMSPollQuestionType.multiChoice -> "multi_choice" HMSPollQuestionType.shortAnswer -> "short_answer" HMSPollQuestionType.longAnswer -> "long_answer" @@ -139,8 +159,8 @@ class HMSPollQuestionExtension { } } - fun getPollQuestionTypeFromString(pollQuestionType: String):HMSPollQuestionType?{ - return when(pollQuestionType){ + fun getPollQuestionTypeFromString(pollQuestionType: String): HMSPollQuestionType? { + return when (pollQuestionType) { "multi_choice" -> HMSPollQuestionType.multiChoice "short_answer" -> HMSPollQuestionType.shortAnswer "long_answer" -> HMSPollQuestionType.longAnswer @@ -149,4 +169,4 @@ class HMSPollQuestionExtension { } } } -} \ No newline at end of file +} diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollQuestionOptionExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollQuestionOptionExtension.kt index 81df38fd6..b5665a7a6 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollQuestionOptionExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollQuestionOptionExtension.kt @@ -4,64 +4,65 @@ import live.hms.hmssdk_flutter.HMSErrorLogger import live.hms.video.polls.models.question.HMSPollQuestionOption class HMSPollQuestionOptionExtension { - - companion object{ - - fun toDictionary(pollOptions: HMSPollQuestionOption?): HashMap?{ - + companion object { + fun toDictionary(pollOptions: HMSPollQuestionOption?): HashMap? { pollOptions?.let { - val map = HashMap() + val map = HashMap() map["index"] = it.index map["text"] = it.text map["vote_count"] = it.voteCount map["weight"] = it.weight return map - }?:run { + } ?: run { return null } } - fun toHMSPollQuestionOption(pollQuestionOptionMap: HashMap?):HMSPollQuestionOption?{ - + fun toHMSPollQuestionOption(pollQuestionOptionMap: HashMap?): HMSPollQuestionOption? { pollQuestionOptionMap?.let { + val index = + pollQuestionOptionMap["index"]?.let { + it as Int + } ?: run { + HMSErrorLogger.returnArgumentsError("index should not be null") + return null + } - val index = pollQuestionOptionMap["index"]?.let { - it as Int - }?:run { - HMSErrorLogger.returnArgumentsError("index should not be null") - return null - } - - val text = pollQuestionOptionMap["text"]?.let { - it as String - }?:run { - HMSErrorLogger.returnArgumentsError("text should not be null") - return null - } + val text = + pollQuestionOptionMap["text"]?.let { + it as String + } ?: run { + HMSErrorLogger.returnArgumentsError("text should not be null") + return null + } - val voteCount = pollQuestionOptionMap["vote_count"]?.let { - (it as Int).toLong() - }?:run { - HMSErrorLogger.returnArgumentsError("voteCount should not be null") - return null - } + val voteCount = + pollQuestionOptionMap["vote_count"]?.let { + (it as Int).toLong() + } ?: run { + HMSErrorLogger.returnArgumentsError("voteCount should not be null") + return null + } - val weight = pollQuestionOptionMap["weight"]?.let { - it as Int - }?:run { - HMSErrorLogger.returnArgumentsError("weight should not be null") - return null - } + val weight = + pollQuestionOptionMap["weight"]?.let { + it as Int + } ?: run { + HMSErrorLogger.returnArgumentsError("weight should not be null") + return null + } - return HMSPollQuestionOption(index,text,weight, + return HMSPollQuestionOption( + index, + text, + weight, case = false, trim = false, - voteCount = voteCount + voteCount = voteCount, ) - - }?: run { + } ?: run { return null } } } -} \ No newline at end of file +} diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollResponsePeerInfoExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollResponsePeerInfoExtension.kt index 630f6437c..f39535695 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollResponsePeerInfoExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollResponsePeerInfoExtension.kt @@ -3,16 +3,13 @@ package live.hms.hmssdk_flutter.poll_extension import live.hms.video.polls.models.network.HMSPollResponsePeerInfo class HMSPollResponsePeerInfoExtension { - - companion object{ - - fun toDictionary(hmsPollResponsePeerInfo: HMSPollResponsePeerInfo?):HashMap?{ - - if(hmsPollResponsePeerInfo == null){ + companion object { + fun toDictionary(hmsPollResponsePeerInfo: HMSPollResponsePeerInfo?): HashMap? { + if (hmsPollResponsePeerInfo == null) { return null } - val map = HashMap() + val map = HashMap() map["hash"] = hmsPollResponsePeerInfo.hash map["peer_id"] = hmsPollResponsePeerInfo.peerid @@ -22,4 +19,4 @@ class HMSPollResponsePeerInfoExtension { return map } } -} \ No newline at end of file +} diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollResultDisplayExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollResultDisplayExtension.kt index 18aeef3b9..0de0ed709 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollResultDisplayExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollResultDisplayExtension.kt @@ -3,16 +3,13 @@ package live.hms.hmssdk_flutter.poll_extension import live.hms.video.polls.network.PollResultsDisplay class HMSPollResultDisplayExtension { - - companion object{ - - fun toDictionary(pollResultsDisplay: PollResultsDisplay?):HashMap?{ - + companion object { + fun toDictionary(pollResultsDisplay: PollResultsDisplay?): HashMap? { pollResultsDisplay?.let { - val map = HashMap() + val map = HashMap() - val questions = ArrayList?>() - it.questions.forEach{ question -> questions.add(HMSPollStatsQuestionsExtension.toDictionary(question))} + val questions = ArrayList?>() + it.questions.forEach { question -> questions.add(HMSPollStatsQuestionsExtension.toDictionary(question)) } map["questions"] = questions map["total_distinct_users"] = it.totalDistinctUsers @@ -20,9 +17,9 @@ class HMSPollResultDisplayExtension { map["voting_users"] = it.votingUsers return map - }?:run { + } ?: run { return null } } } -} \ No newline at end of file +} diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollStatsQuestionsExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollStatsQuestionsExtension.kt index 104976624..f3b5aa218 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollStatsQuestionsExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/poll_extension/HMSPollStatsQuestionsExtension.kt @@ -3,22 +3,19 @@ package live.hms.hmssdk_flutter.poll_extension import live.hms.video.polls.models.PollStatsQuestions class HMSPollStatsQuestionsExtension { - - companion object{ - - fun toDictionary(pollStatsQuestions: PollStatsQuestions?):HashMap?{ - + companion object { + fun toDictionary(pollStatsQuestions: PollStatsQuestions?): HashMap? { pollStatsQuestions?.let { - val map = HashMap() + val map = HashMap() map["attempted_times"] = pollStatsQuestions.attemptedTimes map["correct"] = pollStatsQuestions.correct map["options"] = pollStatsQuestions.options map["question_type"] = HMSPollQuestionExtension.getStringFromPollQuestionType(pollStatsQuestions.questionType) map["skipped"] = pollStatsQuestions.skipped return map - }?:run { + } ?: run { return null } } } -} \ No newline at end of file +} diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/views/HMSHLSPlayer.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/views/HMSHLSPlayer.kt index 063391769..f6cecf8f1 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/views/HMSHLSPlayer.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/views/HMSHLSPlayer.kt @@ -52,7 +52,12 @@ class HMSHLSPlayer( */ init { // Inflate the HLS player view using the layout inflater service. - hlsPlayerView = (context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater).inflate(R.layout.hms_hls_player, this)?.findViewById(R.id.hlsView) + hlsPlayerView = + ( + context.getSystemService( + Context.LAYOUT_INFLATER_SERVICE, + ) as LayoutInflater + ).inflate(R.layout.hms_hls_player, this)?.findViewById(R.id.hlsView) hlsPlayerView?.let { // Set the HLS player controller visibility based on the showHLSControls flag. @@ -120,7 +125,7 @@ class HMSHLSPlayer( player.play(streamUrl) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { context.registerReceiver(broadcastReceiver, IntentFilter(HLS_PLAYER_INTENT), RECEIVER_NOT_EXPORTED) - }else { + } else { context.registerReceiver(broadcastReceiver, IntentFilter(HLS_PLAYER_INTENT)) } diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/views/HMSTextureView.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/views/HMSTextureView.kt index 82186a16e..c328c689f 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/views/HMSTextureView.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/views/HMSTextureView.kt @@ -8,70 +8,81 @@ import io.flutter.view.TextureRegistry import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch -import live.hms.hmssdk_flutter.HMSTrackUpdateExtension import live.hms.video.media.tracks.HMSVideoTrack import live.hms.videoview.VideoViewStateChangeListener import live.hms.videoview.textureview.HMSTextureRenderer class HMSTextureView( texture: SurfaceTexture, - private var entry: TextureRegistry.SurfaceTextureEntry? -):EventChannel.StreamHandler{ - + private var entry: TextureRegistry.SurfaceTextureEntry?, +) : EventChannel.StreamHandler { private var eventChannel: EventChannel? = null private var eventSink: EventSink? = null private var hmsTextureRenderer: HMSTextureRenderer? = null private var uid: Long? = null + init { hmsTextureRenderer = HMSTextureRenderer(texture) uid = entry?.id() } - private val videoViewStateChangeListener = object : VideoViewStateChangeListener{ - override fun onResolutionChange(newWidth: kotlin.Int, newHeight: kotlin.Int) { - val args = HashMap() - args["event_name"] = "on_resolution_changed" - val data = HashMap() - data["height"] = newHeight - data["width"] = newWidth - args["data"] = data - if (args["data"] != null) { - CoroutineScope(Dispatchers.Main).launch { - eventSink?.success(args) + private val videoViewStateChangeListener = + object : VideoViewStateChangeListener { + override fun onResolutionChange( + newWidth: kotlin.Int, + newHeight: kotlin.Int, + ) { + val args = HashMap() + args["event_name"] = "on_resolution_changed" + val data = HashMap() + data["height"] = newHeight + data["width"] = newWidth + args["data"] = data + if (args["data"] != null) { + CoroutineScope(Dispatchers.Main).launch { + eventSink?.success(args) + } } } - } - override fun onFirstFrameRendered() { - super.onFirstFrameRendered() + override fun onFirstFrameRendered() { + super.onFirstFrameRendered() + } } - } - fun addTrack(track: HMSVideoTrack, disableAutoSimulcastLayerSelect: Boolean, height: Int? = null, width: Int? = null){ - Log.i("HMSTextureView","Add Track called for track: ${track.trackId}") + fun addTrack( + track: HMSVideoTrack, + disableAutoSimulcastLayerSelect: Boolean, + height: Int? = null, + width: Int? = null, + ) { + Log.i("HMSTextureView", "Add Track called for track: ${track.trackId}") hmsTextureRenderer?.addVideoViewStateChangeListener(videoViewStateChangeListener) hmsTextureRenderer?.disableAutoSimulcastLayerSelect(disableAutoSimulcastLayerSelect) - if(!disableAutoSimulcastLayerSelect){ + if (!disableAutoSimulcastLayerSelect) { height?.let { videoViewHeight -> width?.let { videoViewWidth -> - hmsTextureRenderer?.displayResolution(videoViewWidth,videoViewHeight) + hmsTextureRenderer?.displayResolution(videoViewWidth, videoViewHeight) } } } - hmsTextureRenderer?.addTrack(track,true) + hmsTextureRenderer?.addTrack(track, true) } - fun setDisplayResolution(width: Int, height: Int){ - hmsTextureRenderer?.displayResolution(width,height) + fun setDisplayResolution( + width: Int, + height: Int, + ) { + hmsTextureRenderer?.displayResolution(width, height) } - fun removeTrack(){ - Log.i("HMSTextureView","Remove Track called") + fun removeTrack() { + Log.i("HMSTextureView", "Remove Track called") hmsTextureRenderer?.removeTrack() } - fun disposeTextureView(){ - Log.i("HMSTextureView","disposeTextureView called") + fun disposeTextureView() { + Log.i("HMSTextureView", "disposeTextureView called") removeTrack() entry?.release() entry = null @@ -80,15 +91,18 @@ class HMSTextureView( eventSink = null } - fun setTextureViewEventChannel(eventChannel:EventChannel){ - this.eventChannel = eventChannel + fun setTextureViewEventChannel(eventChannel: EventChannel) { + this.eventChannel = eventChannel } - override fun onListen(arguments: Any?, events: EventSink?) { + override fun onListen( + arguments: Any?, + events: EventSink?, + ) { eventSink = events } override fun onCancel(arguments: Any?) { eventSink = null } -} \ No newline at end of file +} diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/views/HMSVideoView.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/views/HMSVideoView.kt index a015e7822..50ecf4119 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/views/HMSVideoView.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/views/HMSVideoView.kt @@ -2,7 +2,6 @@ package live.hms.hmssdk_flutter.views import android.content.BroadcastReceiver import android.content.Context -import android.content.Context.RECEIVER_EXPORTED import android.content.Context.RECEIVER_NOT_EXPORTED import android.content.Intent import android.content.IntentFilter @@ -111,7 +110,7 @@ class HMSVideoView( hmsVideoView?.addTrack(track) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { context.registerReceiver(broadcastReceiver, IntentFilter(track.trackId), RECEIVER_NOT_EXPORTED) - }else { + } else { context.registerReceiver(broadcastReceiver, IntentFilter(track.trackId)) } } else { diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/views/HMSVideoViewFactory.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/views/HMSVideoViewFactory.kt index cf903c056..21cd984ee 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/views/HMSVideoViewFactory.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/views/HMSVideoViewFactory.kt @@ -81,7 +81,14 @@ class HMSVideoViewFactory(private val plugin: HmssdkFlutterPlugin) : requireNotNull( context, ), - viewId, creationParams, track, setMirror!!, scaleType, matchParent, disableAutoSimulcastLayerSelect, plugin, + viewId, + creationParams, + track, + setMirror!!, + scaleType, + matchParent, + disableAutoSimulcastLayerSelect, + plugin, ) } } diff --git a/packages/hmssdk_flutter/example/ExampleAppChangelog.txt b/packages/hmssdk_flutter/example/ExampleAppChangelog.txt index 35ad1f0ba..593ea824a 100644 --- a/packages/hmssdk_flutter/example/ExampleAppChangelog.txt +++ b/packages/hmssdk_flutter/example/ExampleAppChangelog.txt @@ -12,7 +12,23 @@ https://100ms.atlassian.net/browse/FLUT-279 - Removed `flutter_foreground_task` from `hms_room_kit` https://100ms.atlassian.net/browse/FLUT-280 +- Main Player UI with Chat below +https://100ms.atlassian.net/browse/FLUT-262 + +- Description Pane +https://100ms.atlassian.net/browse/FLUT-263 + +- Remove webrtc header and footer + Bottom toolbar from HLS screen +https://100ms.atlassian.net/browse/FLUT-264 + +- New Player Controls (Auto hide/overlay) +https://100ms.atlassian.net/browse/FLUT-266 + +- Header + Description from Layout API in Description Pane +https://100ms.atlassian.net/browse/FLUT-271 + + Room Kit: 1.1.0 Core SDK: 1.10.0 -Android SDK: 2.9.52 +Android SDK: 2.9.53 iOS SDK: 1.8.0 \ No newline at end of file diff --git a/packages/hmssdk_flutter/example/android/Gemfile b/packages/hmssdk_flutter/example/android/Gemfile index bf7ea486e..bbe6e4229 100644 --- a/packages/hmssdk_flutter/example/android/Gemfile +++ b/packages/hmssdk_flutter/example/android/Gemfile @@ -1,6 +1,6 @@ source "https://rubygems.org" -gem "fastlane" +gem "fastlane", "~> 2.220.0" gem "activesupport", "= 7.0.8" diff --git a/packages/hmssdk_flutter/example/android/Gemfile.lock b/packages/hmssdk_flutter/example/android/Gemfile.lock index 9097321f9..cd5100325 100644 --- a/packages/hmssdk_flutter/example/android/Gemfile.lock +++ b/packages/hmssdk_flutter/example/android/Gemfile.lock @@ -15,8 +15,8 @@ GEM artifactory (3.0.17) atomos (0.1.3) aws-eventstream (1.3.0) - aws-partitions (1.904.0) - aws-sdk-core (3.191.5) + aws-partitions (1.910.0) + aws-sdk-core (3.191.6) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.8) @@ -73,15 +73,15 @@ GEM faraday-retry (1.0.3) faraday_middleware (1.2.0) faraday (~> 1.0) - fastimage (2.3.0) - fastlane (2.218.0) + fastimage (2.3.1) + fastlane (2.220.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) aws-sdk-s3 (~> 1.0) babosa (>= 1.0.3, < 2.0.0) bundler (>= 1.12.0, < 3.0.0) - colored + colored (~> 1.2) commander (~> 4.6) dotenv (>= 2.1.1, < 3.0.0) emoji_regex (>= 0.1, < 4.0) @@ -93,6 +93,7 @@ GEM gh_inspector (>= 1.1.2, < 2.0.0) google-apis-androidpublisher_v3 (~> 0.3) google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-env (>= 1.6.0, < 2.0.0) google-cloud-storage (~> 1.31) highline (~> 2.0) http-cookie (~> 1.0.5) @@ -101,10 +102,10 @@ GEM mini_magick (>= 4.9.4, < 5.0.0) multipart-post (>= 2.0.0, < 3.0.0) naturally (~> 2.2) - optparse (>= 0.1.1) + optparse (>= 0.1.1, < 1.0.0) plist (>= 3.1.0, < 4.0.0) rubyzip (>= 2.0.0, < 3.0.0) - security (= 0.1.3) + security (= 0.1.5) simctl (~> 1.6.3) terminal-notifier (>= 2.0.0, < 3.0.0) terminal-table (~> 3) @@ -113,16 +114,16 @@ GEM word_wrap (~> 1.0.0) xcodeproj (>= 1.13.0, < 2.0.0) xcpretty (~> 0.3.0) - xcpretty-travis-formatter (>= 0.0.3) + xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) fastlane-plugin-firebase_app_distribution (0.9.0) google-apis-firebaseappdistribution_v1 (~> 0.3.0) google-apis-firebaseappdistribution_v1alpha (~> 0.2.0) gh_inspector (1.1.3) - google-apis-androidpublisher_v3 (0.60.0) - google-apis-core (>= 0.14.0, < 2.a) - google-apis-core (0.14.1) + google-apis-androidpublisher_v3 (0.54.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-core (0.11.3) addressable (~> 2.5, >= 2.5.1) - googleauth (~> 1.9) + googleauth (>= 0.16.2, < 2.a) httpclient (>= 2.8.1, < 3.a) mini_mime (~> 1.0) representable (~> 3.0) @@ -132,30 +133,28 @@ GEM google-apis-core (>= 0.11.0, < 2.a) google-apis-firebaseappdistribution_v1alpha (0.2.0) google-apis-core (>= 0.11.0, < 2.a) - google-apis-iamcredentials_v1 (0.20.0) - google-apis-core (>= 0.14.0, < 2.a) - google-apis-playcustomapp_v1 (0.15.0) - google-apis-core (>= 0.14.0, < 2.a) - google-apis-storage_v1 (0.37.0) - google-apis-core (>= 0.14.0, < 2.a) + google-apis-iamcredentials_v1 (0.17.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-playcustomapp_v1 (0.13.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-storage_v1 (0.31.0) + google-apis-core (>= 0.11.0, < 2.a) google-cloud-core (1.7.0) google-cloud-env (>= 1.0, < 3.a) google-cloud-errors (~> 1.0) - google-cloud-env (2.1.1) - faraday (>= 1.0, < 3.a) + google-cloud-env (1.6.0) + faraday (>= 0.17.3, < 3.0) google-cloud-errors (1.4.0) - google-cloud-storage (1.49.0) + google-cloud-storage (1.47.0) addressable (~> 2.8) digest-crc (~> 0.4) - google-apis-core (~> 0.13) - google-apis-iamcredentials_v1 (~> 0.18) - google-apis-storage_v1 (~> 0.33) + google-apis-iamcredentials_v1 (~> 0.1) + google-apis-storage_v1 (~> 0.31.0) google-cloud-core (~> 1.6) - googleauth (~> 1.9) + googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) - googleauth (1.11.0) - faraday (>= 1.0, < 3.a) - google-cloud-env (~> 2.1) + googleauth (1.8.1) + faraday (>= 0.17.3, < 3.a) jwt (>= 1.4, < 3.0) multi_json (~> 1.11) os (>= 0.9, < 2.0) @@ -167,7 +166,7 @@ GEM i18n (1.14.4) concurrent-ruby (~> 1.0) jmespath (1.6.2) - json (2.7.1) + json (2.7.2) jwt (2.8.1) base64 mini_magick (4.12.0) @@ -181,8 +180,8 @@ GEM optparse (0.4.0) os (1.1.4) plist (3.7.1) - public_suffix (5.0.4) - rake (13.1.0) + public_suffix (5.0.5) + rake (13.2.1) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) @@ -192,7 +191,7 @@ GEM rouge (2.0.7) ruby2_keywords (0.0.5) rubyzip (2.3.2) - security (0.1.3) + security (0.1.5) signet (0.19.0) addressable (~> 2.8) faraday (>= 0.17.5, < 3.a) @@ -231,7 +230,7 @@ PLATFORMS DEPENDENCIES activesupport (= 7.0.8) - fastlane + fastlane (~> 2.220.0) fastlane-plugin-firebase_app_distribution BUNDLED WITH diff --git a/packages/hmssdk_flutter/example/ios/Gemfile b/packages/hmssdk_flutter/example/ios/Gemfile index b288471e6..a24614677 100644 --- a/packages/hmssdk_flutter/example/ios/Gemfile +++ b/packages/hmssdk_flutter/example/ios/Gemfile @@ -1,6 +1,6 @@ source "https://rubygems.org" -gem "fastlane" +gem "fastlane", "~> 2.220.0" gem "activesupport", "= 7.0.8" plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') diff --git a/packages/hmssdk_flutter/example/ios/Gemfile.lock b/packages/hmssdk_flutter/example/ios/Gemfile.lock index c311b5449..a09506e5e 100644 --- a/packages/hmssdk_flutter/example/ios/Gemfile.lock +++ b/packages/hmssdk_flutter/example/ios/Gemfile.lock @@ -15,8 +15,8 @@ GEM artifactory (3.0.17) atomos (0.1.3) aws-eventstream (1.3.0) - aws-partitions (1.904.0) - aws-sdk-core (3.191.5) + aws-partitions (1.910.0) + aws-sdk-core (3.191.6) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.8) @@ -73,15 +73,15 @@ GEM faraday-retry (1.0.3) faraday_middleware (1.2.0) faraday (~> 1.0) - fastimage (2.3.0) - fastlane (2.218.0) + fastimage (2.3.1) + fastlane (2.220.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) aws-sdk-s3 (~> 1.0) babosa (>= 1.0.3, < 2.0.0) bundler (>= 1.12.0, < 3.0.0) - colored + colored (~> 1.2) commander (~> 4.6) dotenv (>= 2.1.1, < 3.0.0) emoji_regex (>= 0.1, < 4.0) @@ -93,6 +93,7 @@ GEM gh_inspector (>= 1.1.2, < 2.0.0) google-apis-androidpublisher_v3 (~> 0.3) google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-env (>= 1.6.0, < 2.0.0) google-cloud-storage (~> 1.31) highline (~> 2.0) http-cookie (~> 1.0.5) @@ -101,10 +102,10 @@ GEM mini_magick (>= 4.9.4, < 5.0.0) multipart-post (>= 2.0.0, < 3.0.0) naturally (~> 2.2) - optparse (>= 0.1.1) + optparse (>= 0.1.1, < 1.0.0) plist (>= 3.1.0, < 4.0.0) rubyzip (>= 2.0.0, < 3.0.0) - security (= 0.1.3) + security (= 0.1.5) simctl (~> 1.6.3) terminal-notifier (>= 2.0.0, < 3.0.0) terminal-table (~> 3) @@ -113,17 +114,17 @@ GEM word_wrap (~> 1.0.0) xcodeproj (>= 1.13.0, < 2.0.0) xcpretty (~> 0.3.0) - xcpretty-travis-formatter (>= 0.0.3) + xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) fastlane-plugin-firebase_app_distribution (0.9.0) google-apis-firebaseappdistribution_v1 (~> 0.3.0) google-apis-firebaseappdistribution_v1alpha (~> 0.2.0) fastlane-plugin-versioning (0.5.2) gh_inspector (1.1.3) - google-apis-androidpublisher_v3 (0.60.0) - google-apis-core (>= 0.14.0, < 2.a) - google-apis-core (0.14.1) + google-apis-androidpublisher_v3 (0.54.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-core (0.11.3) addressable (~> 2.5, >= 2.5.1) - googleauth (~> 1.9) + googleauth (>= 0.16.2, < 2.a) httpclient (>= 2.8.1, < 3.a) mini_mime (~> 1.0) representable (~> 3.0) @@ -133,30 +134,28 @@ GEM google-apis-core (>= 0.11.0, < 2.a) google-apis-firebaseappdistribution_v1alpha (0.2.0) google-apis-core (>= 0.11.0, < 2.a) - google-apis-iamcredentials_v1 (0.20.0) - google-apis-core (>= 0.14.0, < 2.a) - google-apis-playcustomapp_v1 (0.15.0) - google-apis-core (>= 0.14.0, < 2.a) - google-apis-storage_v1 (0.37.0) - google-apis-core (>= 0.14.0, < 2.a) + google-apis-iamcredentials_v1 (0.17.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-playcustomapp_v1 (0.13.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-storage_v1 (0.31.0) + google-apis-core (>= 0.11.0, < 2.a) google-cloud-core (1.7.0) google-cloud-env (>= 1.0, < 3.a) google-cloud-errors (~> 1.0) - google-cloud-env (2.1.1) - faraday (>= 1.0, < 3.a) + google-cloud-env (1.6.0) + faraday (>= 0.17.3, < 3.0) google-cloud-errors (1.4.0) - google-cloud-storage (1.49.0) + google-cloud-storage (1.47.0) addressable (~> 2.8) digest-crc (~> 0.4) - google-apis-core (~> 0.13) - google-apis-iamcredentials_v1 (~> 0.18) - google-apis-storage_v1 (~> 0.33) + google-apis-iamcredentials_v1 (~> 0.1) + google-apis-storage_v1 (~> 0.31.0) google-cloud-core (~> 1.6) - googleauth (~> 1.9) + googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) - googleauth (1.11.0) - faraday (>= 1.0, < 3.a) - google-cloud-env (~> 2.1) + googleauth (1.8.1) + faraday (>= 0.17.3, < 3.a) jwt (>= 1.4, < 3.0) multi_json (~> 1.11) os (>= 0.9, < 2.0) @@ -168,7 +167,7 @@ GEM i18n (1.14.4) concurrent-ruby (~> 1.0) jmespath (1.6.2) - json (2.7.1) + json (2.7.2) jwt (2.8.1) base64 mini_magick (4.12.0) @@ -182,8 +181,8 @@ GEM optparse (0.4.0) os (1.1.4) plist (3.7.1) - public_suffix (5.0.4) - rake (13.1.0) + public_suffix (5.0.5) + rake (13.2.1) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) @@ -193,7 +192,7 @@ GEM rouge (2.0.7) ruby2_keywords (0.0.5) rubyzip (2.3.2) - security (0.1.3) + security (0.1.5) signet (0.19.0) addressable (~> 2.8) faraday (>= 0.17.5, < 3.a) @@ -232,7 +231,7 @@ PLATFORMS DEPENDENCIES activesupport (= 7.0.8) - fastlane + fastlane (~> 2.220.0) fastlane-plugin-firebase_app_distribution fastlane-plugin-versioning diff --git a/packages/hmssdk_flutter/example/ios/Runner/AppDelegate.swift b/packages/hmssdk_flutter/example/ios/Runner/AppDelegate.swift index 0e33de35f..3196f6df3 100644 --- a/packages/hmssdk_flutter/example/ios/Runner/AppDelegate.swift +++ b/packages/hmssdk_flutter/example/ios/Runner/AppDelegate.swift @@ -8,12 +8,12 @@ import Flutter didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { GeneratedPluginRegistrant.register(with: self) - + SwiftFlutterForegroundTaskPlugin.setPluginRegistrantCallback(registerPlugins) if #available(iOS 10.0, *) { UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate } - + return super.application(application, didFinishLaunchingWithOptions: launchOptions) } } diff --git a/packages/hmssdk_flutter/example/lib/qr_code_screen.dart b/packages/hmssdk_flutter/example/lib/qr_code_screen.dart index 9b15738e9..d01d5f469 100644 --- a/packages/hmssdk_flutter/example/lib/qr_code_screen.dart +++ b/packages/hmssdk_flutter/example/lib/qr_code_screen.dart @@ -78,21 +78,21 @@ class _QRCodeScreenState extends State { initForegroundTask(); Navigator.of(context).pushReplacement(MaterialPageRoute( builder: (_) => WithForegroundTask( - child: HMSPrebuilt( - roomCode: Constant.roomCode, - onLeave: stopForegroundTask, - options: HMSPrebuiltOptions( - userName: AppDebugConfig.nameChangeOnPreview - ? null - : "Flutter User", - userId: widget.uuidString, - endPoints: endPoints, - iOSScreenshareConfig: HMSIOSScreenshareConfig( - appGroup: "group.flutterhms", - preferredExtension: - "live.100ms.flutter.FlutterBroadcastUploadExtension"), - enableNoiseCancellation: true)), - ))); + child: HMSPrebuilt( + roomCode: Constant.roomCode, + onLeave: stopForegroundTask, + options: HMSPrebuiltOptions( + userName: AppDebugConfig.nameChangeOnPreview + ? null + : "Flutter User", + userId: widget.uuidString, + endPoints: endPoints, + iOSScreenshareConfig: HMSIOSScreenshareConfig( + appGroup: "group.flutterhms", + preferredExtension: + "live.100ms.flutter.FlutterBroadcastUploadExtension"), + enableNoiseCancellation: true)), + ))); } } } catch (e) { diff --git a/packages/hmssdk_flutter/example/pubspec.lock b/packages/hmssdk_flutter/example/pubspec.lock index 6cd30ef53..6e2e99ab1 100644 --- a/packages/hmssdk_flutter/example/pubspec.lock +++ b/packages/hmssdk_flutter/example/pubspec.lock @@ -554,10 +554,10 @@ packages: dependency: transitive description: name: pointycastle - sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29" + sha256: "70fe966348fe08c34bf929582f1d8247d9d9408130723206472b4687227e4333" url: "https://pub.dev" source: hosted - version: "3.7.4" + version: "3.8.0" provider: dependency: transitive description: diff --git a/packages/hmssdk_flutter/ios/Classes/Actions/HMSNoiseCancellationControllerAction.swift b/packages/hmssdk_flutter/ios/Classes/Actions/HMSNoiseCancellationControllerAction.swift index cbe5fab33..c7e708265 100644 --- a/packages/hmssdk_flutter/ios/Classes/Actions/HMSNoiseCancellationControllerAction.swift +++ b/packages/hmssdk_flutter/ios/Classes/Actions/HMSNoiseCancellationControllerAction.swift @@ -9,12 +9,11 @@ import Foundation import HMSSDK import HMSNoiseCancellationModels -class HMSNoiseCancellationController{ +class HMSNoiseCancellationController { static var noiseCancellationController: HMSNoiseCancellationPlugin? - - - static func noiseCancellationActions(_ call: FlutterMethodCall, _ result: @escaping FlutterResult){ - switch call.method{ + + static func noiseCancellationActions(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) { + switch call.method { case "enable_noise_cancellation": enable(result) case "disable_noise_cancellation": @@ -27,77 +26,75 @@ class HMSNoiseCancellationController{ result(FlutterMethodNotImplemented) } } - + /** * [createPlugin] creates the noiseCancellationPlugin based on the parameter in audio track settings */ - static func createPlugin(){ + static func createPlugin() { noiseCancellationController = { if let pathForNCModel = HMSNoiseCancellationModels.path(for: .smallFullBand) { return HMSNoiseCancellationPlugin(modelPath: pathForNCModel, initialState: .enabled) - } - else { + } else { assertionFailure("Noise cancellation model was not found") } return nil }() } - + /** * [enable] method enables noise cancellation for the user */ - private static func enable(_ result: @escaping FlutterResult){ - if let controller = noiseCancellationController{ + private static func enable(_ result: @escaping FlutterResult) { + if let controller = noiseCancellationController { do { try controller.enable() result(nil) } catch { print("An error occurred: \(error)") } - }else{ + } else { HMSErrorLogger.logError(#function, "Noise cancellation controller is not initialised. Please enable noise cancellation in audio track settings while initialising HMSSDK", "NULL_ERROR") } } - + /** * [disable] method disables noise cancellation for the user */ - private static func disable(_ result: @escaping FlutterResult){ - if let controller = noiseCancellationController{ + private static func disable(_ result: @escaping FlutterResult) { + if let controller = noiseCancellationController { do { try controller.disable() result(nil) } catch { print("An error occurred: \(error)") } - }else{ + } else { HMSErrorLogger.logError(#function, "Noise cancellation controller is not initialised. Please enable noise cancellation in audio track settings while initialising HMSSDK", "NULL_ERROR") } } - + /** * [isEnabled] method returns whether noise cancellation is enabled or not */ - private static func isEnabled(_ result: @escaping FlutterResult){ - if let controller = noiseCancellationController{ + private static func isEnabled(_ result: @escaping FlutterResult) { + if let controller = noiseCancellationController { let isNoiseCancellationEnabled = controller.isEnabled() - result(HMSResultExtension.toDictionary(true,isNoiseCancellationEnabled)) - }else{ + result(HMSResultExtension.toDictionary(true, isNoiseCancellationEnabled)) + } else { HMSErrorLogger.logError(#function, "Noise cancellation controller is not initialised. Please enable noise cancellation in audio track settings while initialising HMSSDK", "NULL_ERROR") } } - + /** * [isAvailable] method returns whether noise cancellation is available in the room */ - private static func isAvailable(_ result: @escaping FlutterResult){ - if let controller = noiseCancellationController{ + private static func isAvailable(_ result: @escaping FlutterResult) { + if let controller = noiseCancellationController { let isNoiseCancellationAvailable = controller.isNoiseCancellationAvailable - result(HMSResultExtension.toDictionary(true,isNoiseCancellationAvailable)) - }else{ + result(HMSResultExtension.toDictionary(true, isNoiseCancellationAvailable)) + } else { HMSErrorLogger.logError(#function, "Noise cancellation controller is not initialised. Please enable noise cancellation in audio track settings while initialising HMSSDK", "NULL_ERROR") } } - - + } diff --git a/packages/hmssdk_flutter/ios/Classes/Actions/HMSPollAction.swift b/packages/hmssdk_flutter/ios/Classes/Actions/HMSPollAction.swift index 18e9201bb..63b28d493 100644 --- a/packages/hmssdk_flutter/ios/Classes/Actions/HMSPollAction.swift +++ b/packages/hmssdk_flutter/ios/Classes/Actions/HMSPollAction.swift @@ -8,10 +8,10 @@ import Foundation import HMSSDK -class HMSPollAction{ - - static func pollActions(_ call: FlutterMethodCall, _ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?, _ polls: [HMSPoll]?){ - switch call.method{ +class HMSPollAction { + + static func pollActions(_ call: FlutterMethodCall, _ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?, _ polls: [HMSPoll]?) { + switch call.method { case "quick_start_poll": quickStartPoll(call, result, hmsSDK) break @@ -28,91 +28,90 @@ class HMSPollAction{ case "fetch_poll_list": fetchPollList(call, result, hmsSDK) case "fetch_poll_questions": - fetchPollQuestions(call,result,hmsSDK) + fetchPollQuestions(call, result, hmsSDK) case "get_poll_results": getPollResults(call, result, hmsSDK) default: result(FlutterMethodNotImplemented) } } - - static private func quickStartPoll(_ call: FlutterMethodCall,_ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?){ - + + static private func quickStartPoll(_ call: FlutterMethodCall, _ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?) { + let arguments = call.arguments as? [AnyHashable: Any] - - guard let pollBuilderMap = arguments?["poll_builder"] as? [String:Any?] else{ + + guard let pollBuilderMap = arguments?["poll_builder"] as? [String: Any?] else { result(HMSErrorExtension.getError("No pollBuilder found in \(#function)")) return } - - if let hmsSDK{ + + if let hmsSDK { guard let pollBuilder = HMSPollBuilderExtension.toHMSPollBuilder(pollBuilderMap, hmsSDK) - else{ + else { HMSErrorLogger.returnArgumentsError("pollBuilder parsing failed") return } - - hmsSDK.interactivityCenter.quickStartPoll(with: (pollBuilder), completion: {_ , error in + + hmsSDK.interactivityCenter.quickStartPoll(with: (pollBuilder), completion: {_, error in if let error = error { result(HMSErrorExtension.toDictionary(error)) } else { result(nil) }}) - } else{ + } else { result(HMSErrorExtension.getError("hmsSDK is nil in \(#function)")) return } - + } - - - static private func addSingleChoicePollResponse(_ call: FlutterMethodCall,_ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?,_ currentPolls: [HMSPoll]?){ - + + static private func addSingleChoicePollResponse(_ call: FlutterMethodCall, _ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?, _ currentPolls: [HMSPoll]?) { + let arguments = call.arguments as? [AnyHashable: Any] - + guard let pollId = arguments?["poll_id"] as? String, let index = arguments?["question_index"] as? Int, - let answer = arguments?["answer"] as? [String:Any?] + let answer = arguments?["answer"] as? [String: Any?] else { HMSErrorLogger.returnArgumentsError("Invalid arguments") return } - + let timeTakenToAnswer = arguments?["time_taken_to_answer"] as? Int - + if let optionIndex = answer["index"] as? Int { - - if let poll = currentPolls?.first(where: {$0.pollID == pollId}){ - - if let question = poll.questions?[index]{ - - if let optionSelected = question.options?[optionIndex - 1]{ + + if let poll = currentPolls?.first(where: {$0.pollID == pollId}) { + + if let question = poll.questions?[index] { + + if let optionSelected = question.options?[optionIndex - 1] { let response = HMSPollResponseBuilder(poll: poll) - response.addResponse(for: question, options: [optionSelected],duration: timeTakenToAnswer) - hmsSDK?.interactivityCenter.add(response: response){ pollResult, error in - - if let error = error{ + response.addResponse(for: question, options: [optionSelected], duration: timeTakenToAnswer) + hmsSDK?.interactivityCenter.add(response: response) { pollResult, error in + + if let error = error { result(HMSResultExtension.toDictionary(false, HMSErrorExtension.toDictionary(error))) - }else{ + } else { var pollResults = [[String: Any?]]() - - pollResult?.forEach{ + + pollResult?.forEach { pollResults.append(HMSPollAnswerResponseExtension.toDictionary(pollAnswerResponse: $0)) } - var map = [String:Any?]() + var map = [String: Any?]() map["result"] = pollResults result(HMSResultExtension.toDictionary(true, map)) } } - }else{ + } else { HMSErrorLogger.returnArgumentsError("No option found at given index") } - - }else{ + + } else { HMSErrorLogger.returnArgumentsError("No question found at given index") } - - }else{ + + } else { HMSErrorLogger.returnArgumentsError("No poll with given pollId found") return } @@ -121,251 +120,250 @@ class HMSPollAction{ return } } - - - static private func addMultiChoicePollResponse(_ call: FlutterMethodCall,_ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?,_ currentPolls: [HMSPoll]?){ - + + static private func addMultiChoicePollResponse(_ call: FlutterMethodCall, _ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?, _ currentPolls: [HMSPoll]?) { + let arguments = call.arguments as? [AnyHashable: Any] - + guard let pollId = arguments?["poll_id"] as? String, let index = arguments?["question_index"] as? Int, - let answer = arguments?["answer"] as? [[String:Any?]] + let answer = arguments?["answer"] as? [[String: Any?]] else { HMSErrorLogger.returnArgumentsError("Invalid arguments") return } - + let timeTakenToAnswer = arguments?["time_taken_to_answer"] as? Int - - if let poll = currentPolls?.first(where: {$0.pollID == pollId}){ - - if let question = poll.questions?[index]{ + + if let poll = currentPolls?.first(where: {$0.pollID == pollId}) { + + if let question = poll.questions?[index] { var selectedOptions = [HMSPollQuestionOption]() - answer.forEach{ - if let optionIndex = $0["index"] as? Int{ - if let option = question.options?[optionIndex - 1] as? HMSPollQuestionOption{ + answer.forEach { + if let optionIndex = $0["index"] as? Int { + if let option = question.options?[optionIndex - 1] as? HMSPollQuestionOption { selectedOptions.append(option) - }else{ + } else { HMSErrorLogger.returnArgumentsError("Invalid option index") return } - }else{ + } else { HMSErrorLogger.returnArgumentsError("Invalid index") return } } let response = HMSPollResponseBuilder(poll: poll) - response.addResponse(for: question, options: selectedOptions,duration: timeTakenToAnswer) - hmsSDK?.interactivityCenter.add(response: response){ pollResult, error in - - if let error = error{ + response.addResponse(for: question, options: selectedOptions, duration: timeTakenToAnswer) + hmsSDK?.interactivityCenter.add(response: response) { pollResult, error in + + if let error = error { result(HMSResultExtension.toDictionary(false, HMSErrorExtension.toDictionary(error))) - }else{ + } else { var pollResults = [[String: Any?]]() - - pollResult?.forEach{ + + pollResult?.forEach { pollResults.append(HMSPollAnswerResponseExtension.toDictionary(pollAnswerResponse: $0)) } - var map = [String:Any?]() + var map = [String: Any?]() map["result"] = pollResults result(HMSResultExtension.toDictionary(true, map)) } } - }else{ + } else { HMSErrorLogger.returnArgumentsError("No question found at given index") return } - }else{ + } else { HMSErrorLogger.returnArgumentsError("No poll with given pollId found") return } } - - static private func stopPoll(_ call: FlutterMethodCall,_ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?,_ currentPolls: [HMSPoll]?){ - + + static private func stopPoll(_ call: FlutterMethodCall, _ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?, _ currentPolls: [HMSPoll]?) { + let arguments = call.arguments as? [AnyHashable: Any] - + guard let pollId = arguments?["poll_id"] as? String - else{ + else { HMSErrorLogger.returnArgumentsError("pollId can't be null") return } - + if let poll = currentPolls?.first(where: { $0.pollID == pollId - }){ - hmsSDK?.interactivityCenter.stop(poll: poll){ + }) { + hmsSDK?.interactivityCenter.stop(poll: poll) { _, error in - if let error = error{ + if let error = error { result(HMSErrorExtension.toDictionary(error)) - }else{ + } else { result(nil) } } } } - - static private func fetchLeaderboard(_ call: FlutterMethodCall,_ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?,_ currentPolls: [HMSPoll]?){ - + + static private func fetchLeaderboard(_ call: FlutterMethodCall, _ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?, _ currentPolls: [HMSPoll]?) { + let arguments = call.arguments as? [AnyHashable: Any] - + guard let pollId = arguments?["poll_id"] as? String, let count = arguments?["count"] as? Int, let startIndex = arguments?["start_index"] as? Int, let includeCurrentPeer = arguments?["include_current_peer"] as? Bool - else{ + else { HMSErrorLogger.returnArgumentsError("Either pollId, count, startIndex or includeCurrentPeer is null") return } - - if let poll = hmsSDK?.interactivityCenter.polls.first(where: {$0.pollID == pollId}){ - hmsSDK?.interactivityCenter.fetchLeaderboard(for: poll, offset: startIndex, count: count,includeCurrentPeer: includeCurrentPeer){ + + if let poll = hmsSDK?.interactivityCenter.polls.first(where: {$0.pollID == pollId}) { + hmsSDK?.interactivityCenter.fetchLeaderboard(for: poll, offset: startIndex, count: count, includeCurrentPeer: includeCurrentPeer) { pollLeaderboardResponse, error in - - if let error = error{ + + if let error = error { result(HMSResultExtension.toDictionary(false, HMSErrorExtension.toDictionary(error))) - }else{ + } else { result(HMSResultExtension.toDictionary(true, HMSPollLeaderboardResponseExtension.toDictionary(pollLeaderboardResponse: pollLeaderboardResponse))) } } - }else{ + } else { HMSErrorLogger.returnArgumentsError("No poll with given pollId found") return } } - - static private func fetchPollList(_ call: FlutterMethodCall,_ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?){ - + + static private func fetchPollList(_ call: FlutterMethodCall, _ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?) { + let arguments = call.arguments as? [AnyHashable: Any] - + guard let state = arguments?["poll_state"] as? String - else{ + else { HMSErrorLogger.returnArgumentsError("state is null") return } - - if let state = getPollState(pollState: state){ - hmsSDK?.interactivityCenter.fetchPollList(state: state){ + + if let state = getPollState(pollState: state) { + hmsSDK?.interactivityCenter.fetchPollList(state: state) { pollList, error in - - if let error = error{ + + if let error = error { result(HMSResultExtension.toDictionary(false, HMSErrorExtension.toDictionary(error))) - }else{ + } else { var map = [[String: Any?]]() - - pollList?.forEach{ + + pollList?.forEach { map.append(HMSPollExtension.toDictionary(poll: $0)) } result(HMSResultExtension.toDictionary(true, map)) } } - }else{ - HMSErrorLogger.logError(#function, "No poll state matched","ARGUMENTS_ERROR") + } else { + HMSErrorLogger.logError(#function, "No poll state matched", "ARGUMENTS_ERROR") result(nil) } } - - private static func fetchPollQuestions(_ call: FlutterMethodCall,_ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?){ + + private static func fetchPollQuestions(_ call: FlutterMethodCall, _ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?) { let arguments = call.arguments as? [AnyHashable: Any] - + guard let state = arguments?["poll_state"] as? String, let pollId = arguments?["poll_id"] as? String - else{ + else { HMSErrorLogger.returnArgumentsError("pollId or state is null") return } - - if let state = getPollState(pollState: state){ - hmsSDK?.interactivityCenter.fetchPollList(state: state){ + + if let state = getPollState(pollState: state) { + hmsSDK?.interactivityCenter.fetchPollList(state: state) { pollList, error in - - if let error = error{ + + if let error = error { result(HMSResultExtension.toDictionary(false, HMSErrorExtension.toDictionary(error))) - }else{ - + } else { + if let poll = pollList?.first(where: { $0.pollID == pollId - }){ - hmsSDK?.interactivityCenter.fetchPollQuestions(poll: poll){ + }) { + hmsSDK?.interactivityCenter.fetchPollQuestions(poll: poll) { updatedPoll, error in - - if let error = error{ + + if let error = error { result(HMSResultExtension.toDictionary(false, HMSErrorExtension.toDictionary(error))) - }else{ + } else { var map = [[String: Any?]]() - updatedPoll?.questions?.forEach{ + updatedPoll?.questions?.forEach { map.append(HMSPollQuestionExtension.toDictionary(question: $0)) } result(HMSResultExtension.toDictionary(true, map)) - + } } - }else{ - HMSErrorLogger.logError(#function,"No poll with given pollId found","NULL_ERROR") + } else { + HMSErrorLogger.logError(#function, "No poll with given pollId found", "NULL_ERROR") } - + } } - }else{ - HMSErrorLogger.logError(#function, "No poll state matched","ARGUMENTS_ERROR") + } else { + HMSErrorLogger.logError(#function, "No poll state matched", "ARGUMENTS_ERROR") result(nil) } } - - private static func getPollResults(_ call: FlutterMethodCall,_ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?){ + + private static func getPollResults(_ call: FlutterMethodCall, _ result: @escaping FlutterResult, _ hmsSDK: HMSSDK?) { let arguments = call.arguments as? [AnyHashable: Any] - + guard let state = arguments?["poll_state"] as? String, let pollId = arguments?["poll_id"] as? String - else{ + else { HMSErrorLogger.returnArgumentsError("pollId or state is null") return } - - if let state = getPollState(pollState: state){ - hmsSDK?.interactivityCenter.fetchPollList(state: state){ + + if let state = getPollState(pollState: state) { + hmsSDK?.interactivityCenter.fetchPollList(state: state) { pollList, error in - - if let error = error{ + + if let error = error { result(HMSResultExtension.toDictionary(false, HMSErrorExtension.toDictionary(error))) - }else{ - + } else { + if let poll = pollList?.first(where: { $0.pollID == pollId - }){ - hmsSDK?.interactivityCenter.fetchPollResult(for: poll){ + }) { + hmsSDK?.interactivityCenter.fetchPollResult(for: poll) { updatedPoll, error in - - if let error = error{ + + if let error = error { result(HMSResultExtension.toDictionary(false, HMSErrorExtension.toDictionary(error))) - }else{ - if let updatedPoll{ + } else { + if let updatedPoll { result(HMSResultExtension.toDictionary(true, HMSPollExtension.toDictionary(poll: updatedPoll))) - }else{ - HMSErrorLogger.logError(#function,"poll is NULL","NULL_ERROR") + } else { + HMSErrorLogger.logError(#function, "poll is NULL", "NULL_ERROR") result(nil) return } - + } } - }else{ - HMSErrorLogger.logError(#function,"No poll with given pollId found","NULL_ERROR") + } else { + HMSErrorLogger.logError(#function, "No poll with given pollId found", "NULL_ERROR") } - + } } - }else{ - HMSErrorLogger.logError(#function, "No poll state matched","ARGUMENTS_ERROR") + } else { + HMSErrorLogger.logError(#function, "No poll state matched", "ARGUMENTS_ERROR") result(nil) } } - + private static func getPollState(pollState: String?) -> HMSPollState? { guard let state = pollState else { return nil } - + switch state { case "created": return .created @@ -377,5 +375,5 @@ class HMSPollAction{ return nil } } - + } diff --git a/packages/hmssdk_flutter/ios/Classes/Actions/HMSSessionStoreAction.swift b/packages/hmssdk_flutter/ios/Classes/Actions/HMSSessionStoreAction.swift index f400ede98..60a3c08a3 100644 --- a/packages/hmssdk_flutter/ios/Classes/Actions/HMSSessionStoreAction.swift +++ b/packages/hmssdk_flutter/ios/Classes/Actions/HMSSessionStoreAction.swift @@ -47,40 +47,37 @@ class HMSSessionStoreAction { return } - do{ + do { let isValid = try JSONSerialization.isValidJSONObject(value) - - if(isValid){ + + if isValid { let jsonData = try JSONSerialization.data(withJSONObject: value, options: []) - if let jsonString = String(data: jsonData, encoding: .utf8){ + if let jsonString = String(data: jsonData, encoding: .utf8) { result(HMSResultExtension.toDictionary(true, jsonString)) - }else{ + } else { HMSErrorLogger.logError(#function, "Session metadata type is not compatible, Please use String? type while setting metadata", "Type Incompatibility Error") result(HMSResultExtension.toDictionary(true, nil)) } - } - else{ - if let intValue = value as? Int{ + } else { + if let intValue = value as? Int { let stringValue = String(intValue) result(HMSResultExtension.toDictionary(true, stringValue)) - } else if let doubleValue = value as? Double{ + } else if let doubleValue = value as? Double { let stringValue = String(doubleValue) result(HMSResultExtension.toDictionary(true, stringValue)) - } else if let stringValue = value as? String{ + } else if let stringValue = value as? String { result(HMSResultExtension.toDictionary(true, stringValue)) - } else if let boolValue = value as? Bool{ + } else if let boolValue = value as? Bool { let stringValue = String(boolValue) result(HMSResultExtension.toDictionary(true, stringValue)) - } else if (value == nil || value is NSNull){ + } else if value == nil || value is NSNull { result(HMSResultExtension.toDictionary(true, nil)) - } - else{ + } else { HMSErrorLogger.logError(#function, "Session metadata type is not compatible, Please use compatible type while setting metadata", "Type Incompatibility Error") result(HMSResultExtension.toDictionary(true, nil)) } } - } - catch{ + } catch { HMSErrorLogger.logError(#function, "Session metadata type is not compatible, JSON parsing failed", "Type Incompatibility Error") result(HMSResultExtension.toDictionary(true, nil)) } diff --git a/packages/hmssdk_flutter/ios/Classes/Models/HMSPeerExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/HMSPeerExtension.swift index 4f308ce58..c4cc17ef9 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/HMSPeerExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/HMSPeerExtension.swift @@ -73,7 +73,7 @@ class HMSPeerExtension { return "defaultUpdate" } } - + private static func getPeerType(_ peerType: HMSPeerType) -> String { switch peerType { case .sip: diff --git a/packages/hmssdk_flutter/ios/Classes/Models/HMSPermissionExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/HMSPermissionExtension.swift index bd4a755db..a70e374b3 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/HMSPermissionExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/HMSPermissionExtension.swift @@ -22,7 +22,7 @@ class HMSPermissionExtension { "un_mute": permission.unmute ?? false, "poll_read": permission.pollRead ?? false, "poll_write": permission.pollWrite ?? false - + ] } } diff --git a/packages/hmssdk_flutter/ios/Classes/Models/HMSRoomExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/HMSRoomExtension.swift index cad828eb2..c99622137 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/HMSRoomExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/HMSRoomExtension.swift @@ -17,7 +17,7 @@ class HMSRoomExtension { if let roomID = room.roomID { dict["id"] = roomID } - + if let name = room.name { dict["name"] = name } diff --git a/packages/hmssdk_flutter/ios/Classes/Models/HMSStreamingStateExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/HMSStreamingStateExtension.swift index e1c1895a1..20b5e9ab4 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/HMSStreamingStateExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/HMSStreamingStateExtension.swift @@ -20,7 +20,7 @@ class HMSStreamingStateExtension { if let error = rtmp.error { dict.merge(HMSErrorExtension.toDictionary(error)) { (_, new) in new } } - + dict["state"] = rtmp.state.displayString().uppercased() return dict } @@ -36,7 +36,7 @@ class HMSStreamingStateExtension { if let error = server.error { dict.merge(HMSErrorExtension.toDictionary(error)) { (_, new) in new } } - + dict["state"] = server.state.displayString().uppercased() return dict } diff --git a/packages/hmssdk_flutter/ios/Classes/Models/HMSTrackSettingsExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/HMSTrackSettingsExtension.swift index 1e64c273f..4063cc75a 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/HMSTrackSettingsExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/HMSTrackSettingsExtension.swift @@ -67,7 +67,7 @@ class HMSTrackSettingsExtension { if let muteState = audioSettingsDict["track_initial_state"] as? String { initialMuteState = getinitialMuteState(from: muteState) } - + if #available(iOS 13.0, *), !audioMixerSourceMap.isEmpty { do { let audioMixerSource = try HMSAudioMixerSource(nodes: audioMixerSourceMap.values.map {$0}) @@ -99,15 +99,15 @@ class HMSTrackSettingsExtension { if let mode = getAudioMode(from: audioSettingsDict["audio_mode"] as? String) { builder.audioMode = mode } - + /* Here we set the noise cancellation controller based on the parameter passed in audio track settings */ - if let enableNoiseCancellation = audioSettingsDict["enable_noise_cancellation"] as? Bool{ - if(enableNoiseCancellation){ - - ///We create the noise cancellation plugin + if let enableNoiseCancellation = audioSettingsDict["enable_noise_cancellation"] as? Bool { + if enableNoiseCancellation { + + /// We create the noise cancellation plugin HMSNoiseCancellationController.createPlugin() builder.noiseCancellationPlugin = HMSNoiseCancellationController.noiseCancellationController } diff --git a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollAnswerExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollAnswerExtension.swift index d326e3d45..14a79932b 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollAnswerExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollAnswerExtension.swift @@ -8,11 +8,11 @@ import Foundation import HMSSDK -class HMSPollAnswerExtension{ - - static func toDictionary(answer: HMSPollQuestionResponse) -> [String:Any]{ - - var map = [String:Any]() +class HMSPollAnswerExtension { + + static func toDictionary(answer: HMSPollQuestionResponse) -> [String: Any] { + + var map = [String: Any]() map["answer"] = answer.text map["duration"] = answer.duration @@ -22,7 +22,7 @@ class HMSPollAnswerExtension{ map["selected_options"] = answer.options map["skipped"] = answer.skipped map["update"] = answer.update - + return map } } diff --git a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollAnswerResponseExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollAnswerResponseExtension.swift index 7c90a6fb8..0e9305ffe 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollAnswerResponseExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollAnswerResponseExtension.swift @@ -8,21 +8,20 @@ import Foundation import HMSSDK -class HMSPollAnswerResponseExtension{ - - static func toDictionary(pollAnswerResponse: HMSPollQuestionResponseResult) -> [String: Any?]{ - - var map = [String:Any?]() - +class HMSPollAnswerResponseExtension { + + static func toDictionary(pollAnswerResponse: HMSPollQuestionResponseResult) -> [String: Any?] { + + var map = [String: Any?]() + map["question_index"] = pollAnswerResponse.question - if let error = pollAnswerResponse.error{ + if let error = pollAnswerResponse.error { map["error"] = HMSErrorExtension.toDictionary(error) } map["correct"] = pollAnswerResponse.correct - + return map - + } - - + } diff --git a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollBuilderExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollBuilderExtension.swift index a74e4e2b8..2030a6e42 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollBuilderExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollBuilderExtension.swift @@ -8,20 +8,20 @@ import Foundation import HMSSDK -class HMSPollBuilderExtension{ - - static func toHMSPollBuilder(_ pollBuilderMap:[String:Any?]?, _ hmssdk:HMSSDK) -> HMSPollBuilder?{ - - guard let pollBuilderMap = pollBuilderMap else{ +class HMSPollBuilderExtension { + + static func toHMSPollBuilder(_ pollBuilderMap: [String: Any?]?, _ hmssdk: HMSSDK) -> HMSPollBuilder? { + + guard let pollBuilderMap = pollBuilderMap else { return nil } - + let pollBuilder = HMSPollBuilder() - - if let anonymous = pollBuilderMap["anonymous"] as? Bool{ + + if let anonymous = pollBuilderMap["anonymous"] as? Bool { pollBuilder.withAnonymous(anonymous) } - + if let duration = pollBuilderMap["duration"] as? Int { pollBuilder.withDuration(duration) } @@ -29,7 +29,7 @@ class HMSPollBuilderExtension{ if let mode = pollBuilderMap["mode"] as? String { pollBuilder.withUserTrackingMode(getPollUserTrackingModeFromString(mode)) } - + if let pollCategory = pollBuilderMap["poll_category"] as? String { pollBuilder.withCategory(getPollCategoryFromString(pollCategory)) } @@ -37,7 +37,7 @@ class HMSPollBuilderExtension{ if let pollId = pollBuilderMap["poll_id"] as? String { pollBuilder.withPollID(pollId) } - + let availableRoles = hmssdk.roles if let rolesThatCanViewResponses = pollBuilderMap["roles_that_can_view_responses"] as? [String] { let roles = rolesThatCanViewResponses.compactMap { roleName in @@ -56,22 +56,22 @@ class HMSPollBuilderExtension{ if let title = pollBuilderMap["title"] as? String { pollBuilder.withTitle(title) } - - if let questions = pollBuilderMap["questions"] as? [[String: Any?]]{ - - questions.forEach{ - if let questionBuilder = getPollQuestionBuilder($0){ + + if let questions = pollBuilderMap["questions"] as? [[String: Any?]] { + + questions.forEach { + if let questionBuilder = getPollQuestionBuilder($0) { pollBuilder.addQuestion(with: questionBuilder) } } - + } return pollBuilder } - - private static func getPollCategoryFromString(_ pollCategory:String) -> HMSPollCategory{ - - switch pollCategory{ + + private static func getPollCategoryFromString(_ pollCategory: String) -> HMSPollCategory { + + switch pollCategory { case "poll": return .poll case "quiz": @@ -80,7 +80,7 @@ class HMSPollBuilderExtension{ return .poll } } - + private static func getPollUserTrackingModeFromString(_ pollUserTrackingMode: String) -> HMSPollUserTrackingMode { switch pollUserTrackingMode { case "user_id": @@ -108,7 +108,7 @@ class HMSPollBuilderExtension{ return .singleChoice } } - + private static func getPollQuestionBuilder(_ pollQuestion: [String: Any?]?) -> HMSPollQuestionBuilder? { guard let pollQuestion = pollQuestion else { return nil @@ -116,7 +116,7 @@ class HMSPollBuilderExtension{ let pollQuestionBuilder = HMSPollQuestionBuilder() - if let typeString = pollQuestion["type"] as? String{ + if let typeString = pollQuestion["type"] as? String { let type = getPollQuestionTypeFromString(typeString) pollQuestionBuilder.withType(type) } else { @@ -124,7 +124,6 @@ class HMSPollBuilderExtension{ return nil } - if let canSkip = pollQuestion["can_skip"] as? Bool { pollQuestionBuilder.withCanBeSkipped(canSkip) } @@ -161,18 +160,17 @@ class HMSPollBuilderExtension{ if let options = pollQuestion["options"] as? [[String: Any?]] { options.forEach { option in - if let key = option["text"] as? String, let value = option["is_correct"] as? Bool{ + if let key = option["text"] as? String, let value = option["is_correct"] as? Bool { pollQuestionBuilder.addQuizOption(with: key, isCorrect: value) } } } - if let canChangeResponse = pollQuestion["can_change_response"] as? Bool{ + if let canChangeResponse = pollQuestion["can_change_response"] as? Bool { pollQuestionBuilder.withCanChangeResponse(canChangeResponse: canChangeResponse) } return pollQuestionBuilder } - } diff --git a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollExtension.swift index fd52f54c7..44fe94738 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollExtension.swift @@ -15,24 +15,24 @@ class HMSPollExtension { map["anonymous"] = poll.anonymous map["category"] = getPollCategory(pollCategory: poll.category) - - if let createdBy = poll.createdBy{ + + if let createdBy = poll.createdBy { map["created_by"] = HMSPeerExtension.toDictionary(createdBy) } - + map["duration"] = poll.duration - - if let mode = poll.mode{ + + if let mode = poll.mode { map["mode"] = getPollUserTrackingMode(mode: mode) } - + map["poll_id"] = poll.pollID map["question_count"] = poll.questionCount let questions = poll.questions?.map { HMSPollQuestionExtension.toDictionary(question: $0) } map["questions"] = questions - if let result = poll.result{ + if let result = poll.result { map["result"] = HMSPollResultExtension.toDictionary(pollResult: result) } @@ -42,20 +42,20 @@ class HMSPollExtension { let rolesThatCanVote = poll.rolesThatCanVote.map { HMSRoleExtension.toDictionary($0) } map["roles_that_can_vote"] = rolesThatCanVote - if let startedAt = poll.startedAt{ + if let startedAt = poll.startedAt { map["started_at"] = Int(startedAt.timeIntervalSince1970 * 1000) } - - if let startedBy = poll.startedBy{ + + if let startedBy = poll.startedBy { map["started_by"] = HMSPeerExtension.toDictionary(startedBy) } - + map["state"] = getPollState(state: poll.state) - - if let stoppedAt = poll.stoppedAt{ + + if let stoppedAt = poll.stoppedAt { map["stopped_at"] = Int(stoppedAt.timeIntervalSince1970 * 1000) } - + map["title"] = poll.title return map @@ -111,4 +111,3 @@ class HMSPollExtension { } } } - diff --git a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollLeaderboardEntryExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollLeaderboardEntryExtension.swift index 7db87b77c..f1f8d628d 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollLeaderboardEntryExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollLeaderboardEntryExtension.swift @@ -8,19 +8,19 @@ import Foundation import HMSSDK -class HMSPollLeaderboardEntryExtension{ - - static func toDictionary(hmsPollLeaderboardEntry: HMSPollLeaderboardEntry) -> [String:Any?] { +class HMSPollLeaderboardEntryExtension { + + static func toDictionary(hmsPollLeaderboardEntry: HMSPollLeaderboardEntry) -> [String: Any?] { + + var map = [String: Any?]() - var map = [String:Any?]() - map["correct_responses"] = hmsPollLeaderboardEntry.correctResponses map["duration"] = hmsPollLeaderboardEntry.duration map["position"] = hmsPollLeaderboardEntry.position map["score"] = hmsPollLeaderboardEntry.score map["total_responses"] = hmsPollLeaderboardEntry.totalResponses map["peer"] = HMSPollResponsePeerInfoExtension.toDictionary(hmsPollResponsePeerInfo: hmsPollLeaderboardEntry.peer) - + return map } } diff --git a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollLeaderboardResponseExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollLeaderboardResponseExtension.swift index 54b03a23c..80b07ac1f 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollLeaderboardResponseExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollLeaderboardResponseExtension.swift @@ -8,15 +8,15 @@ import Foundation import HMSSDK -class HMSPollLeaderboardResponseExtension{ - - static func toDictionary(pollLeaderboardResponse: HMSPollLeaderboardResponse?) -> [String:Any?]?{ - - if let pollLeaderboardResponse{ - +class HMSPollLeaderboardResponseExtension { + + static func toDictionary(pollLeaderboardResponse: HMSPollLeaderboardResponse?) -> [String: Any?]? { + + if let pollLeaderboardResponse { + var map = [String: Any?]() var entryMap = [[String: Any?]]() - + for entry in pollLeaderboardResponse.entries { entryMap.append(HMSPollLeaderboardEntryExtension.toDictionary(hmsPollLeaderboardEntry: entry)) } @@ -24,11 +24,11 @@ class HMSPollLeaderboardResponseExtension{ map["entries"] = entryMap map["has_next"] = pollLeaderboardResponse.hasNext map["summary"] = HMSPollLeaderboardSummaryExtension.toDictionary(hmsPollLeaderboardSummary: pollLeaderboardResponse.summary) - + return map - }else{ + } else { return nil } } - + } diff --git a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollLeaderboardSummaryExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollLeaderboardSummaryExtension.swift index 515acb436..2163ab2c1 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollLeaderboardSummaryExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollLeaderboardSummaryExtension.swift @@ -8,26 +8,26 @@ import Foundation import HMSSDK -class HMSPollLeaderboardSummaryExtension{ - - static func toDictionary(hmsPollLeaderboardSummary: HMSPollLeaderboardSummary?) -> [String:Any?]?{ - - if let hmsPollLeaderboardSummary{ - - var map = [String:Any?]() - +class HMSPollLeaderboardSummaryExtension { + + static func toDictionary(hmsPollLeaderboardSummary: HMSPollLeaderboardSummary?) -> [String: Any?]? { + + if let hmsPollLeaderboardSummary { + + var map = [String: Any?]() + map["average_score"] = hmsPollLeaderboardSummary.averageScore map["average_time"] = hmsPollLeaderboardSummary.averageTime map["responded_peers_count"] = hmsPollLeaderboardSummary.respondedPeersCount map["responded_correctly_peers_count"] = hmsPollLeaderboardSummary.respondedCorrectlyPeersCount map["total_peers_count"] = hmsPollLeaderboardSummary.totalPeersCount - + return map - - }else{ + + } else { return nil } - + } - + } diff --git a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollQuestionAnswerExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollQuestionAnswerExtension.swift index 870c71e0a..578ea6518 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollQuestionAnswerExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollQuestionAnswerExtension.swift @@ -8,16 +8,16 @@ import Foundation import HMSSDK -class HMSPollQuestionAnswerExtension{ - - static func toDictionary(answer: HMSPollQuestionAnswer) -> [String:Any]{ - - var map = [String:Any]() - +class HMSPollQuestionAnswerExtension { + + static func toDictionary(answer: HMSPollQuestionAnswer) -> [String: Any] { + + var map = [String: Any]() + map["hidden"] = answer.hidden map["option"] = answer.option map["options"] = answer.options - + return map } } diff --git a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollQuestionExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollQuestionExtension.swift index 79129307c..508e1f77a 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollQuestionExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollQuestionExtension.swift @@ -8,36 +8,36 @@ import Foundation import HMSSDK -class HMSPollQuestionExtension{ - - static func toDictionary(question: HMSPollQuestion) -> [String:Any?]{ +class HMSPollQuestionExtension { + + static func toDictionary(question: HMSPollQuestion) -> [String: Any?] { var map = [String: Any?]() - + map["question_id"] = question.index map["can_skip"] = question.skippable - - if let answer = question.answer{ + + if let answer = question.answer { map["correct_answer"] = HMSPollQuestionAnswerExtension.toDictionary(answer: answer) } - + map["duration"] = question.duration - - let myResponses = question.myResponses.map{ (HMSPollAnswerExtension.toDictionary(answer:$0)) } + + let myResponses = question.myResponses.map { (HMSPollAnswerExtension.toDictionary(answer: $0)) } map["my_responses"] = myResponses - - let options = question.options?.map{ (HMSPollQuestionOptionExtension.toDictionary(pollOptions: $0)) } + + let options = question.options?.map { (HMSPollQuestionOptionExtension.toDictionary(pollOptions: $0)) } map["options"] = options - + map["text"] = question.text map["type"] = getPollQuestionType(pollQuestionType: question.type) map["voted"] = question.voted map["weight"] = question.weight map["can_change_response"] = question.once return map - + } - - static func getPollQuestionType(pollQuestionType: HMSPollQuestionType) -> String?{ + + static func getPollQuestionType(pollQuestionType: HMSPollQuestionType) -> String? { switch pollQuestionType { case .longAnswer: return "long_answer" diff --git a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollQuestionOptionExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollQuestionOptionExtension.swift index 5bead12e2..0260a4be2 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollQuestionOptionExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollQuestionOptionExtension.swift @@ -8,17 +8,17 @@ import Foundation import HMSSDK -class HMSPollQuestionOptionExtension{ - +class HMSPollQuestionOptionExtension { + static func toDictionary(pollOptions: HMSPollQuestionOption) -> [String: Any] { - + var map = [String: Any]() - + map["index"] = pollOptions.index map["text"] = pollOptions.text map["vote_count"] = pollOptions.voteCount map["weight"] = pollOptions.weight - + return map } } diff --git a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollQuestionResultExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollQuestionResultExtension.swift index 2889979d3..30b2817fe 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollQuestionResultExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollQuestionResultExtension.swift @@ -8,18 +8,18 @@ import Foundation import HMSSDK -class HMSPollQuestionResultExtension{ - - static func toDictionary(pollQuestionResult: HMSPollQuestionResult)-> [String:Any]{ - - var map = [String:Any]() - +class HMSPollQuestionResultExtension { + + static func toDictionary(pollQuestionResult: HMSPollQuestionResult) -> [String: Any] { + + var map = [String: Any]() + map["attempted_times"] = pollQuestionResult.totalVotes map["correct"] = pollQuestionResult.correctVotes map["options"] = pollQuestionResult.optionVoteCounts map["question_type"] = pollQuestionResult.type map["skipped"] = pollQuestionResult.skippedVotes - + return map } } diff --git a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollResponsePeerInfoExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollResponsePeerInfoExtension.swift index 46dce2d01..80327ff7e 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollResponsePeerInfoExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollResponsePeerInfoExtension.swift @@ -8,24 +8,24 @@ import Foundation import HMSSDK -class HMSPollResponsePeerInfoExtension{ - - static func toDictionary(hmsPollResponsePeerInfo: HMSPollResponsePeerInfo?) -> [String:Any?]?{ - - if let hmsPollResponsePeerInfo{ - - var map = [String:Any?]() - +class HMSPollResponsePeerInfoExtension { + + static func toDictionary(hmsPollResponsePeerInfo: HMSPollResponsePeerInfo?) -> [String: Any?]? { + + if let hmsPollResponsePeerInfo { + + var map = [String: Any?]() + map["hash"] = hmsPollResponsePeerInfo.userHash map["peer_id"] = hmsPollResponsePeerInfo.peerID map["user_id"] = hmsPollResponsePeerInfo.customerUserID map["username"] = hmsPollResponsePeerInfo.userName - + return map - }else{ + } else { return nil } - + } - + } diff --git a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollResultExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollResultExtension.swift index 1b0d78136..070711223 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollResultExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/polls/HMSPollResultExtension.swift @@ -8,19 +8,19 @@ import Foundation import HMSSDK -class HMSPollResultExtension{ - - static func toDictionary(pollResult: HMSPollResult) -> [String:Any]{ - - var map = [String:Any]() - - var questions = pollResult.questions.map{( HMSPollQuestionResultExtension.toDictionary(pollQuestionResult: $0))} +class HMSPollResultExtension { + + static func toDictionary(pollResult: HMSPollResult) -> [String: Any] { + + var map = [String: Any]() + + var questions = pollResult.questions.map {( HMSPollQuestionResultExtension.toDictionary(pollQuestionResult: $0))} map["questions"] = questions - + map["total_distinct_users"] = pollResult.maxUserCount map["total_responses"] = pollResult.totalResponse map["voting_users"] = pollResult.userCount - + return map } } diff --git a/packages/hmssdk_flutter/ios/Classes/SwiftHmssdkFlutterPlugin.swift b/packages/hmssdk_flutter/ios/Classes/SwiftHmssdkFlutterPlugin.swift index 76c22e92d..423e5d2ff 100644 --- a/packages/hmssdk_flutter/ios/Classes/SwiftHmssdkFlutterPlugin.swift +++ b/packages/hmssdk_flutter/ios/Classes/SwiftHmssdkFlutterPlugin.swift @@ -17,7 +17,7 @@ public class SwiftHmssdkFlutterPlugin: NSObject, FlutterPlugin, HMSUpdateListene var sessionEventChannel: FlutterEventChannel? var hlsPlayerChannel: FlutterEventChannel? var pollsEventChannel: FlutterEventChannel? - + var eventSink: FlutterEventSink? var previewSink: FlutterEventSink? var logsSink: FlutterEventSink? @@ -56,8 +56,8 @@ public class SwiftHmssdkFlutterPlugin: NSObject, FlutterPlugin, HMSUpdateListene let rtcChannel = FlutterEventChannel(name: "rtc_event_channel", binaryMessenger: registrar.messenger()) let sessionChannel = FlutterEventChannel(name: "session_event_channel", binaryMessenger: registrar.messenger()) let hlsChannel = FlutterEventChannel(name: "hls_player_channel", binaryMessenger: registrar.messenger()) - let pollsChannel = FlutterEventChannel(name: "polls_event_channel",binaryMessenger: registrar.messenger()) - + let pollsChannel = FlutterEventChannel(name: "polls_event_channel", binaryMessenger: registrar.messenger()) + let instance = SwiftHmssdkFlutterPlugin(channel: channel, meetingEventChannel: eventChannel, previewEventChannel: previewChannel, @@ -176,7 +176,7 @@ public class SwiftHmssdkFlutterPlugin: NSObject, FlutterPlugin, HMSUpdateListene if pollsEventChannel != nil { pollsEventChannel!.setStreamHandler(nil) pollsEventSink = nil - } else{ + } else { print(#function, "pollsEventChannel not found") } } @@ -314,14 +314,14 @@ public class SwiftHmssdkFlutterPlugin: NSObject, FlutterPlugin, HMSUpdateListene HMSPeerListIteratorAction.peerListIteratorAction(call, result, hmsSDK) // MARK: - Polls - + case "add_poll_update_listener", "remove_poll_update_listener", "quick_start_poll", "add_single_choice_poll_response", "add_multi_choice_poll_response", "stop_poll", "fetch_leaderboard", "fetch_poll_list", "fetch_poll_questions", "get_poll_results": pollsAction(call, result) - + // MARK: - Noise Cancellation case "enable_noise_cancellation", "disable_noise_cancellation", "is_noise_cancellation_enabled", "is_noise_cancellation_available": HMSNoiseCancellationController.noiseCancellationActions(call, result) - + default: result(FlutterMethodNotImplemented) } @@ -426,30 +426,29 @@ public class SwiftHmssdkFlutterPlugin: NSObject, FlutterPlugin, HMSUpdateListene result(FlutterMethodNotImplemented) } } - + var currentPolls = [HMSPoll]() private func pollsAction(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) { switch call.method { case "add_poll_update_listener": - let listener : HMSInteractivityCenter.HMSPollListener = { [weak self] hmsPoll, hmsPollUpdateType in - + let listener: HMSInteractivityCenter.HMSPollListener = { [weak self] hmsPoll, hmsPollUpdateType in + guard let self = self else { return } - + let map = ["event_name": "on_poll_update", "data": [ "poll": HMSPollExtension.toDictionary(poll: hmsPoll), "poll_update_type": HMSPollExtension.getPollUpdateType(updateType: hmsPollUpdateType) ] - ] as [String : Any] - if(hmsPollUpdateType == .started){ + ] as [String: Any] + if hmsPollUpdateType == .started { currentPolls.append(hmsPoll) - }else if(hmsPollUpdateType == .stopped){ + } else if hmsPollUpdateType == .stopped { currentPolls.removeAll(where: { $0.pollID == hmsPoll.pollID }) - } - else if(hmsPollUpdateType == .resultsUpdated){ - if let index = currentPolls.firstIndex(where: {$0.pollID == hmsPoll.pollID}){ + } else if hmsPollUpdateType == .resultsUpdated { + if let index = currentPolls.firstIndex(where: {$0.pollID == hmsPoll.pollID}) { currentPolls[index] = hmsPoll } } @@ -606,38 +605,35 @@ public class SwiftHmssdkFlutterPlugin: NSObject, FlutterPlugin, HMSUpdateListene var dict: [String: Any] = ["key": key] - do{ + do { let isValid = try JSONSerialization.isValidJSONObject(value) - if(isValid){ + if isValid { let jsonData = try JSONSerialization.data(withJSONObject: value, options: []) - if let jsonString = String(data: jsonData, encoding: .utf8){ + if let jsonString = String(data: jsonData, encoding: .utf8) { dict["value"] = jsonString - }else{ + } else { HMSErrorLogger.logError(#function, "Session metadata type is not compatible, Please use String? type while setting metadata", "Type Incompatibility Error") dict["value"] = nil } - } - else{ - if let intValue = value as? Int{ + } else { + if let intValue = value as? Int { let stringValue = String(intValue) dict["value"] = stringValue - } else if let doubleValue = value as? Double{ + } else if let doubleValue = value as? Double { let doubleValue = String(doubleValue) dict["value"] = doubleValue - } else if let stringValue = value as? String{ + } else if let stringValue = value as? String { dict["value"] = stringValue - } else if let boolValue = value as? Bool{ + } else if let boolValue = value as? Bool { dict["value"] = String(boolValue) - } else if (value == nil || value is NSNull) { + } else if value == nil || value is NSNull { dict["value"] = nil - } - else{ + } else { HMSErrorLogger.logError(#function, "Session metadata type is not compatible, Please use compatible type while setting metadata", "Type Incompatibility Error") dict["value"] = nil } } - } - catch{ + } catch { HMSErrorLogger.logError(#function, "Session metadata type is not compatible, JSON parsing failed", "Type Incompatibility Error") dict["value"] = nil } @@ -800,7 +796,7 @@ public class SwiftHmssdkFlutterPlugin: NSObject, FlutterPlugin, HMSUpdateListene if let settings = trackSettings { sdk.trackSettings = settings } - + if setLogger { sdk.logger = self } @@ -1295,7 +1291,7 @@ public class SwiftHmssdkFlutterPlugin: NSObject, FlutterPlugin, HMSUpdateListene hlsStreamUrl = room.hlsStreamingState.variants.first?.url?.absoluteString } } - + /** `willTerminateNotification` is not fired in all cases. When app is in background & then app is force closed then this notification is not fired resulting in `leave` method not being invoked. */ diff --git a/packages/hmssdk_flutter/lib/assets/sdk-versions.json b/packages/hmssdk_flutter/lib/assets/sdk-versions.json index 2bae0357f..281e35a6f 100644 --- a/packages/hmssdk_flutter/lib/assets/sdk-versions.json +++ b/packages/hmssdk_flutter/lib/assets/sdk-versions.json @@ -4,5 +4,5 @@ "iOSBroadcastExtension": "0.0.9", "iOSHLSPlayerSDK": "0.0.2", "iOSNoiseCancellationModels": "1.0.0", - "android": "2.9.52" + "android": "2.9.53" } diff --git a/sample apps/flutter-meet/README.md b/sample apps/flutter-meet/README.md index 08ab7d3d1..667478c9a 100644 --- a/sample apps/flutter-meet/README.md +++ b/sample apps/flutter-meet/README.md @@ -25,4 +25,3 @@ Google Meet clone made in Flutter using 100ms. ## Demo https://user-images.githubusercontent.com/53579386/153129731-a5123b2a-c782-4c06-8d49-a6a431d8fa6d.mp4 - diff --git a/sample apps/flutter-meet/analysis_options.yaml b/sample apps/flutter-meet/analysis_options.yaml index 61b6c4de1..fd16f9219 100644 --- a/sample apps/flutter-meet/analysis_options.yaml +++ b/sample apps/flutter-meet/analysis_options.yaml @@ -24,6 +24,5 @@ linter: rules: # avoid_print: false # Uncomment to disable the `avoid_print` rule # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule - # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options diff --git a/sample apps/flutter-meet/android/app/src/main/kotlin/com/aditya/google_meet/MainActivity.kt b/sample apps/flutter-meet/android/app/src/main/kotlin/com/aditya/google_meet/MainActivity.kt index 585878b3c..298d6d89e 100644 --- a/sample apps/flutter-meet/android/app/src/main/kotlin/com/aditya/google_meet/MainActivity.kt +++ b/sample apps/flutter-meet/android/app/src/main/kotlin/com/aditya/google_meet/MainActivity.kt @@ -2,5 +2,4 @@ package com.aditya.google_meet import io.flutter.embedding.android.FlutterActivity -class MainActivity: FlutterActivity() { -} +class MainActivity : FlutterActivity() diff --git a/sample apps/flutter-meet/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/sample apps/flutter-meet/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index db77bb4b7..64f764c13 100644 Binary files a/sample apps/flutter-meet/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/sample apps/flutter-meet/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/sample apps/flutter-meet/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/sample apps/flutter-meet/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index 17987b79b..5aa38115a 100644 Binary files a/sample apps/flutter-meet/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/sample apps/flutter-meet/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/sample apps/flutter-meet/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/sample apps/flutter-meet/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 09d439148..c7142758e 100644 Binary files a/sample apps/flutter-meet/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/sample apps/flutter-meet/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/sample apps/flutter-meet/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/sample apps/flutter-meet/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index d5f1c8d34..10a9921c1 100644 Binary files a/sample apps/flutter-meet/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/sample apps/flutter-meet/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/sample apps/flutter-meet/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/sample apps/flutter-meet/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 4d6372eeb..1a33a8122 100644 Binary files a/sample apps/flutter-meet/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/sample apps/flutter-meet/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index d36b1fab2..e882ab988 100644 --- a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,122 +1,122 @@ { - "images" : [ + "images": [ { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" + "size": "20x20", + "idiom": "iphone", + "filename": "Icon-App-20x20@2x.png", + "scale": "2x" }, { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "Icon-App-20x20@3x.png", - "scale" : "3x" + "size": "20x20", + "idiom": "iphone", + "filename": "Icon-App-20x20@3x.png", + "scale": "3x" }, { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" + "size": "29x29", + "idiom": "iphone", + "filename": "Icon-App-29x29@1x.png", + "scale": "1x" }, { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" + "size": "29x29", + "idiom": "iphone", + "filename": "Icon-App-29x29@2x.png", + "scale": "2x" }, { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@3x.png", - "scale" : "3x" + "size": "29x29", + "idiom": "iphone", + "filename": "Icon-App-29x29@3x.png", + "scale": "3x" }, { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" + "size": "40x40", + "idiom": "iphone", + "filename": "Icon-App-40x40@2x.png", + "scale": "2x" }, { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-App-40x40@3x.png", - "scale" : "3x" + "size": "40x40", + "idiom": "iphone", + "filename": "Icon-App-40x40@3x.png", + "scale": "3x" }, { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-App-60x60@2x.png", - "scale" : "2x" + "size": "60x60", + "idiom": "iphone", + "filename": "Icon-App-60x60@2x.png", + "scale": "2x" }, { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-App-60x60@3x.png", - "scale" : "3x" + "size": "60x60", + "idiom": "iphone", + "filename": "Icon-App-60x60@3x.png", + "scale": "3x" }, { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "Icon-App-20x20@1x.png", - "scale" : "1x" + "size": "20x20", + "idiom": "ipad", + "filename": "Icon-App-20x20@1x.png", + "scale": "1x" }, { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" + "size": "20x20", + "idiom": "ipad", + "filename": "Icon-App-20x20@2x.png", + "scale": "2x" }, { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" + "size": "29x29", + "idiom": "ipad", + "filename": "Icon-App-29x29@1x.png", + "scale": "1x" }, { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" + "size": "29x29", + "idiom": "ipad", + "filename": "Icon-App-29x29@2x.png", + "scale": "2x" }, { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "Icon-App-40x40@1x.png", - "scale" : "1x" + "size": "40x40", + "idiom": "ipad", + "filename": "Icon-App-40x40@1x.png", + "scale": "1x" }, { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" + "size": "40x40", + "idiom": "ipad", + "filename": "Icon-App-40x40@2x.png", + "scale": "2x" }, { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-App-76x76@1x.png", - "scale" : "1x" + "size": "76x76", + "idiom": "ipad", + "filename": "Icon-App-76x76@1x.png", + "scale": "1x" }, { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-App-76x76@2x.png", - "scale" : "2x" + "size": "76x76", + "idiom": "ipad", + "filename": "Icon-App-76x76@2x.png", + "scale": "2x" }, { - "size" : "83.5x83.5", - "idiom" : "ipad", - "filename" : "Icon-App-83.5x83.5@2x.png", - "scale" : "2x" + "size": "83.5x83.5", + "idiom": "ipad", + "filename": "Icon-App-83.5x83.5@2x.png", + "scale": "2x" }, { - "size" : "1024x1024", - "idiom" : "ios-marketing", - "filename" : "Icon-App-1024x1024@1x.png", - "scale" : "1x" + "size": "1024x1024", + "idiom": "ios-marketing", + "filename": "Icon-App-1024x1024@1x.png", + "scale": "1x" } ], - "info" : { - "version" : 1, - "author" : "xcode" + "info": { + "version": 1, + "author": "xcode" } } diff --git a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png index dc9ada472..6b3f08fb3 100644 Binary files a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png index 28c6bf030..b8e7dda87 100644 Binary files a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png index 2ccbfd967..90f6959d9 100644 Binary files a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png index f091b6b0b..2f00e1e02 100644 Binary files a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png index 4cde12118..dd514f6de 100644 Binary files a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png index d0ef06e7e..853be3d66 100644 Binary files a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png index dcdc2306c..740b6ac9c 100644 Binary files a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png index 2ccbfd967..90f6959d9 100644 Binary files a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png index c8f9ed8f5..967a62da7 100644 Binary files a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png index a6d6b8609..10d3dd24a 100644 Binary files a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png index a6d6b8609..10d3dd24a 100644 Binary files a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png index c4df70d39..8dc0fecb0 100644 Binary files a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json index 0bedcf2fd..781d7cdca 100644 --- a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +++ b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -1,23 +1,23 @@ { - "images" : [ + "images": [ { - "idiom" : "universal", - "filename" : "LaunchImage.png", - "scale" : "1x" + "idiom": "universal", + "filename": "LaunchImage.png", + "scale": "1x" }, { - "idiom" : "universal", - "filename" : "LaunchImage@2x.png", - "scale" : "2x" + "idiom": "universal", + "filename": "LaunchImage@2x.png", + "scale": "2x" }, { - "idiom" : "universal", - "filename" : "LaunchImage@3x.png", - "scale" : "3x" + "idiom": "universal", + "filename": "LaunchImage@3x.png", + "scale": "3x" } ], - "info" : { - "version" : 1, - "author" : "xcode" + "info": { + "version": 1, + "author": "xcode" } } diff --git a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md index 89c2725b7..b5b843ad3 100644 --- a/sample apps/flutter-meet/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +++ b/sample apps/flutter-meet/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -2,4 +2,4 @@ You can customize the launch screen with your own desired assets by replacing the image files in this directory. -You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. diff --git a/sample apps/flutter-meet/pubspec.yaml b/sample apps/flutter-meet/pubspec.yaml index 41087c0a9..8920bef85 100644 --- a/sample apps/flutter-meet/pubspec.yaml +++ b/sample apps/flutter-meet/pubspec.yaml @@ -3,7 +3,7 @@ description: Google Meet clone made in Flutter using 100ms. # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev +publish_to: "none" # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 @@ -30,7 +30,6 @@ dependencies: flutter: sdk: flutter - # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. hmssdk_flutter: 1.9.14 @@ -38,7 +37,7 @@ dependencies: http: 0.13.4 provider: 6.0.2 draggable_widget: 2.0.0 - + # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: 1.0.2 @@ -59,7 +58,6 @@ dev_dependencies: # The following section is specific to Flutter. flutter: - # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class.