Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
38893736
Commit
38893736
authored
Mar 15, 2019
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Configure Jitsi view.
parent
619af264
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
172 additions
and
106 deletions
+172
-106
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-1
ChatDetailsPresenter.kt
.../android/chatdetails/presentation/ChatDetailsPresenter.kt
+1
-2
Menu.kt
app/src/main/java/chat/rocket/android/chatdetails/ui/Menu.kt
+1
-2
ChatRoomAdapter.kt
...a/chat/rocket/android/chatroom/adapter/ChatRoomAdapter.kt
+1
-1
ChatRoomNavigator.kt
...rocket/android/chatroom/presentation/ChatRoomNavigator.kt
+3
-3
ActivityBuilder.kt
...java/chat/rocket/android/dagger/module/ActivityBuilder.kt
+4
-4
JitsiHelper.kt
app/src/main/java/chat/rocket/android/helper/JitsiHelper.kt
+8
-12
UserDetailsPresenter.kt
.../android/userdetails/presentation/UserDetailsPresenter.kt
+2
-2
UserDetailsFragment.kt
...chat/rocket/android/userdetails/ui/UserDetailsFragment.kt
+1
-1
VideoConferenceModule.kt
...ocket/android/videoconference/di/VideoConferenceModule.kt
+6
-6
JitsiVideoConferenceView.kt
...oid/videoconference/presenter/JitsiVideoConferenceView.kt
+25
-0
VideoConferencePresenter.kt
...oid/videoconference/presenter/VideoConferencePresenter.kt
+29
-18
VideoConferenceActivity.kt
...ket/android/videoconference/ui/VideoConferenceActivity.kt
+90
-0
VideoConferencingView.kt
...roid/videoconferencing/presenter/VideoConferencingView.kt
+0
-13
VideoConferencingActivity.kt
...android/videoconferencing/ui/VideoConferencingActivity.kt
+0
-41
No files found.
app/src/main/AndroidManifest.xml
View file @
38893736
...
...
@@ -76,7 +76,7 @@
android:windowSoftInputMode=
"adjustResize|stateAlwaysHidden"
/>
<activity
android:name=
".videoconferenc
ing.ui.VideoConferencing
Activity"
android:name=
".videoconferenc
e.ui.VideoConference
Activity"
android:theme=
"@style/AppTheme"
android:windowSoftInputMode=
"adjustResize|stateAlwaysHidden"
/>
...
...
app/src/main/java/chat/rocket/android/chatdetails/presentation/ChatDetailsPresenter.kt
View file @
38893736
...
...
@@ -46,8 +46,7 @@ class ChatDetailsPresenter @Inject constructor(
}
}
// TODO
fun
startVideoCall
()
{}
fun
toVideoConference
(
roomId
:
String
)
=
navigator
.
toVideoConference
(
roomId
)
fun
getDetails
(
chatRoomId
:
String
,
chatRoomType
:
String
)
{
launchUI
(
strategy
)
{
...
...
app/src/main/java/chat/rocket/android/chatdetails/ui/Menu.kt
View file @
38893736
...
...
@@ -5,7 +5,6 @@ import android.view.MenuItem
import
chat.rocket.android.R
import
chat.rocket.android.server.domain.isJitsiEnabled
import
chat.rocket.android.server.domain.isJitsiEnabledForChannels
import
chat.rocket.android.videoconferencing.ui.videoConferencingIntent
import
chat.rocket.common.model.RoomType
import
chat.rocket.common.model.roomTypeOf
...
...
@@ -48,6 +47,6 @@ internal fun ChatDetailsFragment.setOnMenuItemClickListener(item: MenuItem) {
if
(
item
.
itemId
==
MENU_ACTION_FAVORITE_REMOVE_FAVORITE
)
{
presenter
.
toggleFavoriteChatRoom
(
chatRoomId
,
isFavorite
)
}
else
if
(
item
.
itemId
==
MENU_ACTION_VIDEO_CALL
)
{
startActivity
(
activity
?.
videoConferencingIntent
(
chatRoomId
)
)
presenter
.
toVideoConference
(
chatRoomId
)
}
}
app/src/main/java/chat/rocket/android/chatroom/adapter/ChatRoomAdapter.kt
View file @
38893736
...
...
@@ -41,7 +41,7 @@ class ChatRoomAdapter(
actionsListener
,
reactionListener
,
{
userId
->
navigator
?.
toUserDetails
(
userId
)
},
{
roomId
?.
let
{
navigator
?.
toVideoConferenc
ing
(
it
)
}
}
{
roomId
?.
let
{
navigator
?.
toVideoConferenc
e
(
it
)
}
}
)
}
BaseUiModel
.
ViewType
.
URL_PREVIEW
->
{
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomNavigator.kt
View file @
38893736
...
...
@@ -13,7 +13,7 @@ import chat.rocket.android.pinnedmessages.ui.TAG_PINNED_MESSAGES_FRAGMENT
import
chat.rocket.android.server.ui.changeServerIntent
import
chat.rocket.android.userdetails.ui.TAG_USER_DETAILS_FRAGMENT
import
chat.rocket.android.util.extensions.addFragmentBackStack
import
chat.rocket.android.videoconferenc
ing.ui.videoConferencing
Intent
import
chat.rocket.android.videoconferenc
e.ui.videoConference
Intent
class
ChatRoomNavigator
(
internal
val
activity
:
ChatRoomActivity
)
{
...
...
@@ -23,8 +23,8 @@ class ChatRoomNavigator(internal val activity: ChatRoomActivity) {
}
}
fun
toVideoConferenc
ing
(
chatRoomId
:
String
)
{
activity
.
startActivity
(
activity
.
videoConferenc
ing
Intent
(
chatRoomId
))
fun
toVideoConferenc
e
(
chatRoomId
:
String
)
{
activity
.
startActivity
(
activity
.
videoConferenc
e
Intent
(
chatRoomId
))
}
fun
toChatRoom
(
...
...
app/src/main/java/chat/rocket/android/dagger/module/ActivityBuilder.kt
View file @
38893736
...
...
@@ -37,8 +37,8 @@ import chat.rocket.android.settings.di.SettingsFragmentProvider
import
chat.rocket.android.settings.password.di.PasswordFragmentProvider
import
chat.rocket.android.settings.password.ui.PasswordActivity
import
chat.rocket.android.userdetails.di.UserDetailsFragmentProvider
import
chat.rocket.android.videoconferenc
ing.di.VideoConferencing
Module
import
chat.rocket.android.videoconferenc
ing.ui.VideoConferencing
Activity
import
chat.rocket.android.videoconferenc
e.di.VideoConference
Module
import
chat.rocket.android.videoconferenc
e.ui.VideoConference
Activity
import
chat.rocket.android.webview.adminpanel.di.AdminPanelWebViewFragmentProvider
import
dagger.Module
import
dagger.android.ContributesAndroidInjector
...
...
@@ -107,6 +107,6 @@ abstract class ActivityBuilder {
abstract
fun
bindDrawingActivity
():
DrawingActivity
@PerActivity
@ContributesAndroidInjector
(
modules
=
[
VideoConferenc
ing
Module
::
class
])
abstract
fun
bindVideoConferenc
ingActivity
():
VideoConferencing
Activity
@ContributesAndroidInjector
(
modules
=
[
VideoConferenc
e
Module
::
class
])
abstract
fun
bindVideoConferenc
eActivity
():
VideoConference
Activity
}
app/src/main/java/chat/rocket/android/helper/JitsiHelper.kt
View file @
38893736
package
chat.rocket.android.helper
import
java.net.URL
object
JitsiHelper
{
/**
* Returns the
[URL] for the Jitsi video conferencing
.
* Returns the
for the Jitsi video conferencing URL
.
*
* @param isSecureProtocol True if using SSL, false otherwise - from the public settings.
* @param domain The Jitsi domain - from public settings.
...
...
@@ -19,15 +17,13 @@ object JitsiHelper {
prefix
:
String
?,
uniqueIdentifier
:
String
?,
chatRoomId
:
String
?
):
URL
=
URL
(
getJitsiProtocol
(
isSecureProtocol
)
+
domain
+
"/"
+
prefix
+
uniqueIdentifier
+
chatRoomId
)
):
String
=
getJitsiProtocol
(
isSecureProtocol
)
+
domain
+
"/"
+
prefix
+
uniqueIdentifier
+
chatRoomId
private
fun
getJitsiProtocol
(
isSecureProtocol
:
Boolean
)
=
if
(
isSecureProtocol
)
"https://"
else
"http://"
...
...
app/src/main/java/chat/rocket/android/userdetails/presentation/UserDetailsPresenter.kt
View file @
38893736
...
...
@@ -124,14 +124,14 @@ class UserDetailsPresenter @Inject constructor(
}
}
fun
toVideoConferenc
ing
(
username
:
String
)
{
fun
toVideoConferenc
e
(
username
:
String
)
{
launchUI
(
strategy
)
{
try
{
withContext
(
Dispatchers
.
Default
)
{
val
directMessage
=
retryIO
(
"createDirectMessage($username"
)
{
client
.
createDirectMessage
(
username
)
}
navigator
.
toVideoConferenc
ing
(
directMessage
.
id
)
navigator
.
toVideoConferenc
e
(
directMessage
.
id
)
}
}
catch
(
ex
:
Exception
)
{
Timber
.
e
(
ex
)
...
...
app/src/main/java/chat/rocket/android/userdetails/ui/UserDetailsFragment.kt
View file @
38893736
...
...
@@ -104,7 +104,7 @@ class UserDetailsFragment : Fragment(), UserDetailsView {
if
(
isVideoCallAllowed
)
{
text_video_call
.
isVisible
=
true
text_video_call
.
setOnClickListener
{
presenter
.
toVideoConferenc
ing
(
username
)
}
text_video_call
.
setOnClickListener
{
presenter
.
toVideoConferenc
e
(
username
)
}
}
else
{
text_video_call
.
isVisible
=
false
}
...
...
app/src/main/java/chat/rocket/android/videoconferenc
ing/di/VideoConferencing
Module.kt
→
app/src/main/java/chat/rocket/android/videoconferenc
e/di/VideoConference
Module.kt
View file @
38893736
package
chat.rocket.android.videoconferenc
ing
.di
package
chat.rocket.android.videoconferenc
e
.di
import
androidx.lifecycle.LifecycleOwner
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.dagger.scope.PerActivity
import
chat.rocket.android.videoconferenc
ing.presenter.VideoConferencing
View
import
chat.rocket.android.videoconferenc
ing.ui.VideoConferencing
Activity
import
chat.rocket.android.videoconferenc
e.presenter.JitsiVideoConference
View
import
chat.rocket.android.videoconferenc
e.ui.VideoConference
Activity
import
dagger.Module
import
dagger.Provides
import
kotlinx.coroutines.Job
@Module
class
VideoConferenc
ing
Module
{
class
VideoConferenc
e
Module
{
@Provides
@PerActivity
fun
provideVideoConferenc
ingView
(
activity
:
VideoConferencingActivity
):
VideoConferencing
View
{
fun
provideVideoConferenc
eView
(
activity
:
VideoConferenceActivity
):
JitsiVideoConference
View
{
return
activity
}
...
...
@@ -24,7 +24,7 @@ class VideoConferencingModule {
@Provides
@PerActivity
fun
provideLifecycleOwner
(
activity
:
VideoConferenc
ing
Activity
):
LifecycleOwner
=
activity
fun
provideLifecycleOwner
(
activity
:
VideoConferenc
e
Activity
):
LifecycleOwner
=
activity
@Provides
@PerActivity
...
...
app/src/main/java/chat/rocket/android/videoconference/presenter/JitsiVideoConferenceView.kt
0 → 100644
View file @
38893736
package
chat.rocket.android.videoconference.presenter
interface
JitsiVideoConferenceView
{
/**
* Starts the Jitsi video conference.
*
* @param url The video conference URL to be loaded.
* @param name The user name to be show on the video conference.
*/
fun
startJitsiVideoConference
(
url
:
String
,
name
:
String
?)
/**
* Closes the Jitsi video conference.
*/
fun
closeJitsiVideoConference
()
/**
* Logs the state of the Jitsi Meet conference displayed in a JitsiMeetView.
*
* @param message The message to log.
* @param map the map information by Jitsi
*/
fun
logJitsiMeetViewState
(
message
:
String
,
map
:
MutableMap
<
String
,
Any
>?)
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/videoconferenc
ing/presenter/VideoConferencing
Presenter.kt
→
app/src/main/java/chat/rocket/android/videoconferenc
e/presenter/VideoConference
Presenter.kt
View file @
38893736
package
chat.rocket.android.videoconferenc
ing
.presenter
package
chat.rocket.android.videoconferenc
e
.presenter
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.helper.JitsiHelper
import
chat.rocket.android.helper.UserHelper
import
chat.rocket.android.server.domain.*
import
chat.rocket.android.server.infraestructure.ConnectionManagerFactory
import
chat.rocket.android.util.extension.launchUI
import
chat.rocket.core.RocketChatClient
import
chat.rocket.core.internal.re
altime
.updateJitsiTimeout
import
chat.rocket.core.internal.re
st
.updateJitsiTimeout
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.launch
import
timber.log.Timber
import
java.util.*
import
javax.inject.Inject
import
kotlin.concurrent.timer
class
VideoConferenc
ing
Presenter
@Inject
constructor
(
private
val
view
:
VideoConferencing
View
,
class
VideoConferenc
e
Presenter
@Inject
constructor
(
private
val
view
:
JitsiVideoConference
View
,
private
val
strategy
:
CancelStrategy
,
private
val
currentServerRepository
:
CurrentServerRepository
,
private
val
connectionManagerFactory
:
ConnectionManagerFactory
,
private
val
settings
:
GetSettingsInteractor
private
val
settings
:
GetSettingsInteractor
,
private
val
userHelp
:
UserHelper
)
{
private
lateinit
var
client
:
RocketChatClient
private
lateinit
var
publicSettings
:
PublicSettings
...
...
@@ -34,23 +37,32 @@ class VideoConferencingPresenter @Inject constructor(
this
.
chatRoomId
=
chatRoomId
}
fun
setupVideoConferencing
()
{
fun
initVideoConference
()
{
launchUI
(
strategy
)
{
with
(
publicSettings
)
{
view
.
startVideoConferencing
(
JitsiHelper
.
getJitsiUrl
(
isJitsiSSL
(),
jitsiDomain
(),
jitsiPrefix
(),
uniqueIdentifier
(),
chatRoomId
try
{
with
(
publicSettings
)
{
view
.
startJitsiVideoConference
(
JitsiHelper
.
getJitsiUrl
(
isJitsiSSL
(),
jitsiDomain
(),
jitsiPrefix
(),
uniqueIdentifier
(),
chatRoomId
),
userHelp
.
user
()
?.
username
)
)
updateJitsiTimeout
()
updateJitsiTimeout
()
}
}
catch
(
ex
:
Exception
)
{
Timber
.
e
(
ex
)
view
.
closeJitsiVideoConference
()
}
}
}
fun
invalidateTimer
()
=
timer
.
cancel
()
// Jitsi update call needs to be called every 10 seconds to make sure call is not ended and is available to web users.
private
fun
updateJitsiTimeout
()
{
timer
=
timer
(
daemon
=
false
,
initialDelay
=
0L
,
period
=
10000
)
{
...
...
@@ -59,6 +71,5 @@ class VideoConferencingPresenter @Inject constructor(
}
}
}
fun
invalidateTimer
()
=
timer
.
cancel
()
}
app/src/main/java/chat/rocket/android/videoconference/ui/VideoConferenceActivity.kt
0 → 100644
View file @
38893736
package
chat.rocket.android.videoconference.ui
import
android.content.Context
import
android.content.Intent
import
android.os.Bundle
import
androidx.core.os.bundleOf
import
chat.rocket.android.videoconference.presenter.JitsiVideoConferenceView
import
chat.rocket.android.videoconference.presenter.VideoConferencePresenter
import
dagger.android.AndroidInjection
import
org.jitsi.meet.sdk.JitsiMeetActivity
import
org.jitsi.meet.sdk.JitsiMeetView
import
org.jitsi.meet.sdk.JitsiMeetViewListener
import
timber.log.Timber
import
javax.inject.Inject
fun
Context
.
videoConferenceIntent
(
chatRoomId
:
String
):
Intent
=
Intent
(
this
,
VideoConferenceActivity
::
class
.
java
).
putExtra
(
INTENT_CHAT_ROOM_ID
,
chatRoomId
)
private
const
val
INTENT_CHAT_ROOM_ID
=
"chat_room_id"
class
VideoConferenceActivity
:
JitsiMeetActivity
(),
JitsiVideoConferenceView
,
JitsiMeetViewListener
{
@Inject
lateinit
var
presenter
:
VideoConferencePresenter
private
lateinit
var
chatRoomId
:
String
private
var
view
:
JitsiMeetView
?
=
null
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
AndroidInjection
.
inject
(
this
)
super
.
onCreate
(
savedInstanceState
)
chatRoomId
=
intent
.
getStringExtra
(
INTENT_CHAT_ROOM_ID
)
requireNotNull
(
chatRoomId
)
{
"no chat_room_id provided in Intent extras"
}
view
=
JitsiMeetView
(
this
)
view
?.
listener
=
this
setContentView
(
view
)
presenter
.
setup
(
chatRoomId
)
presenter
.
initVideoConference
()
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
presenter
.
invalidateTimer
()
view
?.
dispose
()
view
=
null
}
override
fun
onConferenceWillJoin
(
map
:
MutableMap
<
String
,
Any
>?)
=
logJitsiMeetViewState
(
"Joining video conferencing"
,
map
)
override
fun
onConferenceJoined
(
map
:
MutableMap
<
String
,
Any
>?)
=
logJitsiMeetViewState
(
"Joined video conferencing"
,
map
)
override
fun
onConferenceWillLeave
(
map
:
MutableMap
<
String
,
Any
>?)
=
logJitsiMeetViewState
(
"Leaving video conferencing"
,
map
)
override
fun
onConferenceLeft
(
map
:
MutableMap
<
String
,
Any
>?)
{
logJitsiMeetViewState
(
"Left video conferencing"
,
map
)
closeJitsiVideoConference
()
}
override
fun
onLoadConfigError
(
map
:
MutableMap
<
String
,
Any
>?)
=
logJitsiMeetViewState
(
"Error loading video conference config"
,
map
)
override
fun
onConferenceFailed
(
map
:
MutableMap
<
String
,
Any
>?)
=
logJitsiMeetViewState
(
"Video conference failed"
,
map
)
override
fun
startJitsiVideoConference
(
url
:
String
,
name
:
String
?)
{
view
?.
loadURLObject
(
bundleOf
(
"config"
to
bundleOf
(
"startWithAudioMuted"
to
true
,
"startWithVideoMuted"
to
true
),
"context"
to
bundleOf
(
"user"
to
bundleOf
(
"name"
to
name
),
"iss"
to
"rocketchat-android"
),
"url"
to
url
)
)
}
override
fun
closeJitsiVideoConference
()
=
finish
()
override
fun
logJitsiMeetViewState
(
message
:
String
,
map
:
MutableMap
<
String
,
Any
>?)
=
Timber
.
i
(
"$message: $map"
)
}
app/src/main/java/chat/rocket/android/videoconferencing/presenter/VideoConferencingView.kt
deleted
100644 → 0
View file @
619af264
package
chat.rocket.android.videoconferencing.presenter
import
java.net.URL
interface
VideoConferencingView
{
/**
* Starts the video conferencing.
*
* @param url The video conferencing URL to be loaded.
*/
fun
startVideoConferencing
(
url
:
URL
)
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/videoconferencing/ui/VideoConferencingActivity.kt
deleted
100644 → 0
View file @
619af264
package
chat.rocket.android.videoconferencing.ui
import
android.content.Context
import
android.content.Intent
import
android.os.Bundle
import
chat.rocket.android.videoconferencing.presenter.VideoConferencingPresenter
import
chat.rocket.android.videoconferencing.presenter.VideoConferencingView
import
dagger.android.AndroidInjection
import
org.jitsi.meet.sdk.JitsiMeetActivity
import
java.net.URL
import
javax.inject.Inject
fun
Context
.
videoConferencingIntent
(
chatRoomId
:
String
):
Intent
=
Intent
(
this
,
VideoConferencingActivity
::
class
.
java
).
putExtra
(
INTENT_CHAT_ROOM_ID
,
chatRoomId
)
private
const
val
INTENT_CHAT_ROOM_ID
=
"chat_room_id"
class
VideoConferencingActivity
:
JitsiMeetActivity
(),
VideoConferencingView
{
@Inject
lateinit
var
presenter
:
VideoConferencingPresenter
private
lateinit
var
chatRoomId
:
String
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
AndroidInjection
.
inject
(
this
)
super
.
onCreate
(
savedInstanceState
)
chatRoomId
=
intent
.
getStringExtra
(
INTENT_CHAT_ROOM_ID
)
requireNotNull
(
chatRoomId
)
{
"no chat_room_id provided in Intent extras"
}
presenter
.
setup
(
chatRoomId
)
presenter
.
setupVideoConferencing
()
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
presenter
.
invalidateTimer
()
}
override
fun
startVideoConferencing
(
url
:
URL
)
=
loadURL
(
url
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment