Skip to content

Commit

Permalink
Merge pull request #720 from stakwork/tt/feature/universal-links
Browse files Browse the repository at this point in the history
Universal links for jitsi calls implemented (not fully tested)
  • Loading branch information
tomastiminskas authored Feb 27, 2024
2 parents d9e5cd5 + bc06a71 commit c663e6e
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
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 @@ -57,6 +57,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 @@ -74,6 +76,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


Expand Down Expand Up @@ -241,6 +246,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

0 comments on commit c663e6e

Please sign in to comment.