Skip to content

Commit 14ab265

Browse files
Merge pull request #740 from 100mslive/dev
1.2.15 release
2 parents 9163e00 + 48fd861 commit 14ab265

File tree

18 files changed

+178
-80
lines changed

18 files changed

+178
-80
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ dependencies {
6262
implementation "live.100ms:room-kit:$HMS_ROOM_KIT_VERSION"
6363

6464
//100ms noise cancellation dep
65-
def hmsVersion = "2.9.61"
65+
def hmsVersion = "2.9.62"
6666
implementation "live.100ms:hms-noise-cancellation-android:$hmsVersion"
6767

6868
// Navigation

app/src/main/java/live/hms/app2/ui/home/HomeFragment.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ class HomeFragment : Fragment() {
192192
validate()
193193
}
194194

195+
binding.troubleshoot.setOnClickListener {
196+
contextSafe { context, activity ->
197+
HMSRoomKit.launchPreCallDiagnostic(activity)
198+
}
199+
}
200+
195201
binding.edtMeetingUrl.doOnTextChanged { text, _, _, _ ->
196202
if (text.isNullOrEmpty()) {
197203
binding.tvMeetingUrlInputLayout.hint =
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="20dp"
3+
android:height="21dp"
4+
android:viewportWidth="20"
5+
android:viewportHeight="21">
6+
<path
7+
android:pathData="M9.999,2.386C10.426,2.369 10.847,2.49 11.2,2.73C11.431,2.887 11.625,3.09 11.771,3.325H11.875C12.165,3.325 12.443,3.44 12.648,3.645C12.816,3.813 12.924,4.03 12.958,4.262H14.219C14.633,4.262 15.031,4.427 15.324,4.72C15.617,5.013 15.781,5.41 15.781,5.825V10.512C15.781,10.857 15.501,11.137 15.156,11.137C14.811,11.137 14.531,10.857 14.531,10.512V5.825C14.531,5.742 14.498,5.662 14.44,5.604C14.381,5.545 14.302,5.512 14.219,5.512H12.969V6.293C12.969,6.583 12.854,6.862 12.648,7.067C12.443,7.272 12.165,7.387 11.875,7.387H8.125C7.835,7.387 7.557,7.272 7.352,7.067C7.146,6.862 7.031,6.583 7.031,6.293V5.512H5.781C5.698,5.512 5.619,5.545 5.56,5.604C5.502,5.662 5.469,5.742 5.469,5.825V10.512C5.469,10.857 5.189,11.137 4.844,11.137C4.499,11.137 4.219,10.857 4.219,10.512V5.825C4.219,5.41 4.383,5.013 4.676,4.72C4.969,4.427 5.367,4.262 5.781,4.262H7.042C7.076,4.03 7.184,3.813 7.352,3.645C7.557,3.44 7.835,3.325 8.125,3.325H8.232C8.378,3.091 8.571,2.888 8.802,2.731C9.154,2.491 9.574,2.37 9.999,2.386ZM8.281,6.137H11.719V4.575H11.378C11.108,4.575 10.869,4.402 10.785,4.145C10.733,3.99 10.632,3.856 10.497,3.764C10.361,3.671 10.199,3.627 10.036,3.636C10.012,3.637 9.989,3.637 9.966,3.636C9.802,3.627 9.641,3.672 9.506,3.764C9.371,3.856 9.27,3.99 9.218,4.146C9.134,4.402 8.895,4.575 8.625,4.575H8.281V6.137ZM8.034,11.154L9.213,14.395C9.27,14.557 9.374,14.698 9.512,14.8C9.652,14.903 9.82,14.962 9.993,14.968C10.167,14.974 10.339,14.927 10.485,14.833C10.63,14.741 10.743,14.608 10.811,14.45L11.911,11.977L12.191,12.537L12.192,12.539C12.263,12.681 12.373,12.801 12.509,12.884C12.644,12.968 12.801,13.012 12.96,13.012C12.96,13.012 12.96,13.012 12.96,13.012H17.031C17.376,13.012 17.656,12.732 17.656,12.387C17.656,12.042 17.376,11.762 17.031,11.762H13.201L12.659,10.677C12.586,10.531 12.474,10.409 12.334,10.325C12.195,10.241 12.034,10.198 11.871,10.202C11.708,10.206 11.55,10.255 11.414,10.346C11.279,10.436 11.172,10.563 11.105,10.711L10.059,13.065L8.899,9.873C8.841,9.715 8.739,9.577 8.604,9.477C8.469,9.377 8.307,9.318 8.14,9.309C7.972,9.299 7.805,9.339 7.66,9.423C7.514,9.508 7.397,9.633 7.322,9.783C7.322,9.783 7.322,9.783 7.322,9.783L6.333,11.762H2.969C2.624,11.762 2.344,12.042 2.344,12.387C2.344,12.732 2.624,13.012 2.969,13.012H6.574C6.573,13.012 6.574,13.012 6.574,13.012C6.733,13.012 6.889,12.968 7.025,12.884C7.161,12.801 7.27,12.681 7.342,12.539L7.343,12.537L8.034,11.154ZM4.844,13.637C5.189,13.637 5.469,13.917 5.469,14.262V16.137C5.469,16.22 5.502,16.299 5.56,16.358C5.619,16.417 5.698,16.449 5.781,16.449H14.219C14.302,16.449 14.381,16.417 14.44,16.358C14.498,16.299 14.531,16.22 14.531,16.137V14.262C14.531,13.917 14.811,13.637 15.156,13.637C15.501,13.637 15.781,13.917 15.781,14.262V16.137C15.781,16.551 15.617,16.949 15.324,17.242C15.031,17.535 14.633,17.699 14.219,17.699H5.781C5.367,17.699 4.969,17.535 4.676,17.242C4.383,16.949 4.219,16.551 4.219,16.137V14.262C4.219,13.917 4.499,13.637 4.844,13.637Z"
8+
android:fillColor="#538DFF"
9+
android:fillType="evenOdd"/>
10+
</vector>

app/src/main/res/layout/fragment_home.xml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,31 @@ android:orientation="vertical">
4343
android:layout_gravity="center"
4444
android:layout_marginHorizontal="20dp"
4545
android:layout_marginTop="15dp"
46-
android:layout_marginBottom="8dp"
4746
android:gravity="center"
4847
android:text="@string/meeting_link_header_description"
4948
android:textColor="#E0ECFF"
5049
android:textSize="16sp" />
5150

51+
<com.google.android.material.textview.MaterialTextView
52+
android:layout_width="wrap_content"
53+
android:layout_height="wrap_content"
54+
android:layout_gravity="center"
55+
android:layout_marginHorizontal="20dp"
56+
android:layout_marginTop="15dp"
57+
android:maxLines="1"
58+
android:id="@+id/troubleshoot"
59+
android:drawableLeft="@drawable/ic_diagnostic_blue"
60+
android:textColorLink="#538DFF"
61+
android:text="@string/troubles_joining_str"
62+
android:textColor="#538DFF"
63+
android:textSize="16sp" />
64+
5265
<EditText
5366
android:id="@+id/edit_text_name"
5467
android:layout_width="match_parent"
5568
android:layout_height="wrap_content"
5669
android:layout_marginHorizontal="24dp"
57-
android:layout_marginTop="40dp"
70+
android:layout_marginTop="24dp"
5871
android:autofillHints=""
5972
android:background="@drawable/gray_round_btn"
6073
android:fontFamily="@font/inter_regular"

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@
187187
<string name="paste_the_link_here_str">Paste the link here</string>
188188
<string name="joining_link_header">Joining Link</string>
189189
<string name="meeting_link_header_description">Jump right in by pasting a room link or scanning a QR code</string>
190+
<string name="troubles_joining_str">Troubleshoot before you join</string>
190191
<string name="meeting_link_header">Experience the power of 100ms</string>
191192
<string name="join_with_link_instead_str">Join with Link Instead</string>
192193
<string name="scan_qr_code_str">Scan QR Code</string>

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ android.useAndroidX=true
1919
android.enableJetifier=true
2020
# Kotlin code style for this project: "official" or "obsolete":
2121
kotlin.code.style=official
22-
100MS_APP_VERSION_CODE=375
23-
100MS_APP_VERSION_NAME=5.0.9
22+
100MS_APP_VERSION_CODE=376
23+
100MS_APP_VERSION_NAME=5.0.10
2424
hmsRoomKitGroup=live.100ms
25-
HMS_ROOM_KIT_VERSION=1.2.14
25+
HMS_ROOM_KIT_VERSION=1.2.15
2626
android.suppressUnsupportedCompileSdk=33

room-kit/src/main/java/live/hms/roomkit/ViewExt.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ fun View.setOnSingleClickListener(l: (View) -> Unit) {
4444
setOnClickListener(OnSingleClickListener(l))
4545
}
4646

47+
fun Number?.orZeroIfNullOrNaN(): Number {
48+
return if (this == null || (this is Double && this.isNaN()) || (this is Float && this.isNaN())) {
49+
0
50+
} else {
51+
this
52+
}
53+
}
54+
4755
fun View.gone() {
4856
if (this.visibility != View.GONE)
4957
this.visibility = View.GONE

room-kit/src/main/java/live/hms/roomkit/ui/diagnostic/DiagnosticActivity.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import androidx.navigation.fragment.findNavController
99
import live.hms.roomkit.R
1010
import live.hms.roomkit.ui.meeting.MeetingViewModel
1111
import live.hms.roomkit.ui.meeting.MeetingViewModelFactory
12+
import live.hms.roomkit.ui.theme.HMSPrebuiltTheme
1213

1314
class DiagnosticActivity : AppCompatActivity() {
1415

@@ -21,6 +22,9 @@ class DiagnosticActivity : AppCompatActivity() {
2122
override fun onCreate(savedInstanceState: Bundle?) {
2223
super.onCreate(savedInstanceState)
2324
setContentView(R.layout.activity_diagnostic)
25+
if (HMSPrebuiltTheme.getColours() == null) {
26+
HMSPrebuiltTheme.setTheme(HMSPrebuiltTheme.getDefaultHmsColorPalette())
27+
}
2428
viewModel.initSDK()
2529
setupNavGraph()
2630

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package live.hms.roomkit.ui.diagnostic
2+
3+
import android.app.Application
4+
import android.content.Context
5+
import androidx.core.content.edit
6+
import live.hms.video.diagnostics.HMSDiagnostic
7+
import live.hms.video.sdk.HMSSDK
8+
import java.util.UUID
9+
10+
class DiagnosticProvider(private val application: Application) {
11+
private var hms : Pair<HMSSDK,HMSDiagnostic>? = null
12+
private val consistentUserId = getConsistentUserIdOverSessions()
13+
fun disposeOfDiagnostic() {
14+
hms?.second?.stopConnectivityCheck()
15+
hms = null
16+
}
17+
fun getSdk() = hms?.first ?: createInstance(application).first
18+
fun getDiagnosticSdk() : HMSDiagnostic = hms?.second ?: createInstance(application).second
19+
private fun createInstance(application: Application) : Pair<HMSSDK, HMSDiagnostic> {
20+
val hmsSDK = HMSSDK.Builder(application).build()
21+
val diag = hmsSDK.getDiagnosticSDK(consistentUserId)
22+
return Pair(hmsSDK, diag).apply { hms = this }
23+
}
24+
25+
private fun getConsistentUserIdOverSessions(): String {
26+
val sharedPreferences = application.getSharedPreferences(
27+
"your-activity-preference", Context.MODE_PRIVATE
28+
)
29+
if (sharedPreferences.getString("saved_user_id_blocklist", null) == null) {
30+
sharedPreferences.edit {
31+
putString(
32+
"saved_user_id_blocklist", UUID.randomUUID().toString()
33+
)
34+
}
35+
}
36+
return sharedPreferences.getString("saved_user_id_blocklist", null).orEmpty()
37+
}
38+
39+
}

room-kit/src/main/java/live/hms/roomkit/ui/diagnostic/DiagnosticViewModel.kt

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import androidx.lifecycle.MutableLiveData
88
import live.hms.video.audio.HMSAudioManager
99
import live.hms.video.diagnostics.HMSAudioDeviceCheckListener
1010
import live.hms.video.diagnostics.HMSCameraCheckListener
11+
import live.hms.video.diagnostics.HMSDiagnostic
1112
import live.hms.video.diagnostics.models.ConnectivityCheckResult
1213
import live.hms.video.diagnostics.models.ConnectivityState
1314
import live.hms.video.error.HMSException
@@ -20,10 +21,12 @@ import java.util.UUID
2021

2122
class DiagnosticViewModel(application: Application) : AndroidViewModel(application) {
2223
// First create a new sdk instance
23-
val hmsSDK by lazy { HMSSDK.Builder(application).build() }
24-
var regionCode = "in"
25-
val diagnosticSDK by lazy { hmsSDK.getDiagnosticSDK(getConsistentUserIdOverSessions()) }
26-
24+
private var regionCode = "in"
25+
private val diagnosticProvider = DiagnosticProvider(application)
26+
private val diagnosticSDK : HMSDiagnostic
27+
get() {return diagnosticProvider.getDiagnosticSdk()}
28+
private val hmsSDK : HMSSDK
29+
get() { return diagnosticProvider.getSdk()}
2730
val cameraTrackLiveData = MutableLiveData<HMSVideoTrack?>()
2831
fun cameraPermssionGranted() {
2932
diagnosticSDK.startCameraCheck(
@@ -49,21 +52,6 @@ class DiagnosticViewModel(application: Application) : AndroidViewModel(applicati
4952
}
5053
}
5154

52-
53-
private fun getConsistentUserIdOverSessions(): String {
54-
val sharedPreferences = getApplication<Application>().getSharedPreferences(
55-
"your-activity-preference", Context.MODE_PRIVATE
56-
)
57-
if (sharedPreferences.getString("saved_user_id_blocklist", null) == null) {
58-
sharedPreferences.edit {
59-
putString(
60-
"saved_user_id_blocklist", UUID.randomUUID().toString()
61-
)
62-
}
63-
}
64-
return sharedPreferences.getString("saved_user_id_blocklist", null).orEmpty()
65-
}
66-
6755
fun stopCameraCheck() {
6856
diagnosticSDK.stopCameraCheck()
6957
cameraTrackLiveData.postValue(null)
@@ -126,9 +114,11 @@ class DiagnosticViewModel(application: Application) : AndroidViewModel(applicati
126114
var isMediaCaptured : Boolean = false
127115
var isMediaPublished : Boolean = false
128116
fun startConnectivityTest() {
117+
diagnosticProvider.disposeOfDiagnostic()
129118
isMediaPublished= false
130119
isMediaCaptured = false
131120
connectivityLiveData.postValue(null)
121+
connectivityStateLiveData.postValue(null)
132122
diagnosticSDK.startConnectivityCheck(regionCode,
133123
object : live.hms.video.diagnostics.ConnectivityCheckListener {
134124
override fun onCompleted(result: ConnectivityCheckResult) {
@@ -156,5 +146,6 @@ class DiagnosticViewModel(application: Application) : AndroidViewModel(applicati
156146
kotlin.runCatching { diagnosticSDK.startSpeakerCheck() }
157147
}
158148

149+
159150

160151
}

0 commit comments

Comments
 (0)