Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Universal links for jitsi calls implemented (not fully tested) #720

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ext.versions = [
'okhttp' : '4.10.0',
'sqlDelight' : '1.5.4',
'toplAndroid': '2.1.2',
'targetSdk' : 33
'targetSdk' : 30
]

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
Expand All @@ -25,6 +24,13 @@
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sphinx.chat" android:host="" tools:ignore="AppLinkUrlError" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="jitsi.sphinx.chat" />
</intent-filter>
</activity>
</application>

Expand Down
1 change: 1 addition & 0 deletions sphinx/screens/dashboard/dashboard/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ dependencies {
implementation deps.jna.sdk
implementation deps.lottie.sdk
implementation deps.square.moshi
implementation deps.jitsi.sdk
kapt kaptDeps.google.hilt

testImplementation testDeps.junit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ import chat.sphinx.wrapper_common.dashboard.RestoreProgressViewState
import chat.sphinx.wrapper_common.dashboard.toChatId
import chat.sphinx.wrapper_common.feed.*
import chat.sphinx.wrapper_common.lightning.*
import chat.sphinx.wrapper_common.message.SphinxCallLink
import chat.sphinx.wrapper_common.message.toSphinxCallLink
import chat.sphinx.wrapper_common.tribe.TribeJoinLink
import chat.sphinx.wrapper_common.tribe.isValidTribeJoinLink
import chat.sphinx.wrapper_common.tribe.toTribeJoinLink
Expand All @@ -76,6 +78,9 @@ import io.matthewnelson.concept_coroutines.CoroutineDispatchers
import io.matthewnelson.concept_views.viewstate.ViewStateContainer
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*
import org.jitsi.meet.sdk.JitsiMeetActivity
import org.jitsi.meet.sdk.JitsiMeetConferenceOptions
import org.jitsi.meet.sdk.JitsiMeetUserInfo
import javax.inject.Inject

@HiltViewModel
Expand Down Expand Up @@ -195,6 +200,37 @@ internal class DashboardViewModel @Inject constructor(
handleFeedItemLink(feedItemLink)
} ?: deepLink?.toPushNotificationLink()?.let { pushNotificationLink ->
handlePushNotification(pushNotificationLink)
} ?: deepLink?.toSphinxCallLink()?.let { sphinxCallLink ->
joinCall(sphinxCallLink, sphinxCallLink.startAudioOnly)
}
}
}

private fun joinCall(link: SphinxCallLink, audioOnly: Boolean) {
link.callServerUrl?.let { nnCallUrl ->

viewModelScope.launch(mainImmediate) {

val owner = getOwner()

val userInfo = JitsiMeetUserInfo()
userInfo.displayName = owner.alias?.value ?: ""

owner.avatarUrl?.let { nnAvatarUrl ->
userInfo.avatar = nnAvatarUrl
}

val options = JitsiMeetConferenceOptions.Builder()
.setServerURL(nnCallUrl)
.setRoom(link.callRoom)
.setAudioMuted(false)
.setVideoMuted(false)
.setFeatureFlag("welcomepage.enabled", false)
.setAudioOnly(audioOnly)
.setUserInfo(userInfo)
.build()

JitsiMeetActivity.launch(app, options)
}
}
}
Expand Down
Loading