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
8d07f279
Commit
8d07f279
authored
Jan 17, 2019
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Jitsi public settings.
(check if Jitsi is enabled before showing the respective icons)
parent
68587727
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
67 additions
and
20 deletions
+67
-20
ChatDetailsFragment.kt
...chat/rocket/android/chatdetails/ui/ChatDetailsFragment.kt
+7
-0
Menu.kt
app/src/main/java/chat/rocket/android/chatdetails/ui/Menu.kt
+11
-6
RefreshSettingsInteractor.kt
...rocket/android/server/domain/RefreshSettingsInteractor.kt
+6
-1
SettingsRepository.kt
...a/chat/rocket/android/server/domain/SettingsRepository.kt
+18
-3
UserDetailsPresenter.kt
.../android/userdetails/presentation/UserDetailsPresenter.kt
+9
-4
UserDetailsView.kt
...ocket/android/userdetails/presentation/UserDetailsView.kt
+4
-2
UserDetailsFragment.kt
...chat/rocket/android/userdetails/ui/UserDetailsFragment.kt
+9
-3
fragment_user_details.xml
app/src/main/res/layout/fragment_user_details.xml
+3
-1
No files found.
app/src/main/java/chat/rocket/android/chatdetails/ui/ChatDetailsFragment.kt
View file @
8d07f279
...
...
@@ -19,6 +19,9 @@ import chat.rocket.android.chatdetails.presentation.ChatDetailsView
import
chat.rocket.android.chatdetails.viewmodel.ChatDetailsViewModel
import
chat.rocket.android.chatdetails.viewmodel.ChatDetailsViewModelFactory
import
chat.rocket.android.chatroom.ui.ChatRoomActivity
import
chat.rocket.android.server.domain.CurrentServerRepository
import
chat.rocket.android.server.domain.GetSettingsInteractor
import
chat.rocket.android.server.domain.PublicSettings
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.ui
...
...
@@ -62,6 +65,10 @@ class ChatDetailsFragment : Fragment(), ChatDetailsView {
lateinit
var
presenter
:
ChatDetailsPresenter
@Inject
lateinit
var
factory
:
ChatDetailsViewModelFactory
@Inject
lateinit
var
serverUrl
:
CurrentServerRepository
@Inject
lateinit
var
settings
:
GetSettingsInteractor
private
var
adapter
:
ChatDetailsAdapter
?
=
null
private
lateinit
var
viewModel
:
ChatDetailsViewModel
...
...
app/src/main/java/chat/rocket/android/chatdetails/ui/Menu.kt
View file @
8d07f279
...
...
@@ -3,14 +3,19 @@ package chat.rocket.android.chatdetails.ui
import
android.view.Menu
import
android.view.MenuItem
import
chat.rocket.android.R
import
chat.rocket.android.server.domain.isJitsiEnabled
internal
fun
ChatDetailsFragment
.
setupMenu
(
menu
:
Menu
)
{
serverUrl
.
get
()
?.
let
{
if
(
settings
.
get
(
it
).
isJitsiEnabled
())
{
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_VIDEO_CALL
,
Menu
.
NONE
,
R
.
string
.
msg_video_call
).
setIcon
(
R
.
drawable
.
ic_video_24dp
).
setShowAsAction
(
MenuItem
.
SHOW_AS_ACTION_IF_ROOM
)
}
}
if
(
isFavorite
)
{
menu
.
add
(
...
...
app/src/main/java/chat/rocket/android/server/domain/RefreshSettingsInteractor.kt
View file @
8d07f279
...
...
@@ -21,7 +21,6 @@ class RefreshSettingsInteractor @Inject constructor(
LDAP_ENABLE
,
CAS_ENABLE
,
CAS_LOGIN_URL
,
ACCOUNT_REGISTRATION
,
ACCOUNT_LOGIN_FORM
,
ACCOUNT_PASSWORD_RESET
,
...
...
@@ -37,6 +36,12 @@ class RefreshSettingsInteractor @Inject constructor(
ACCOUNT_WORDPRESS
,
ACCOUNT_WORDPRESS_URL
,
JITSI_ENABLED
,
JISTI_ENABLE_CHANNELS
,
JITSI_SSL
,
JITSI_DOMAIN
,
JITSI_URL_ROOM_PREFIX
,
SITE_URL
,
SITE_NAME
,
FAVICON_512
,
...
...
app/src/main/java/chat/rocket/android/server/domain/SettingsRepository.kt
View file @
8d07f279
...
...
@@ -5,7 +5,7 @@ import chat.rocket.core.model.Value
typealias
PublicSettings
=
Map
<
String
,
Value
<
Any
>>
// Authentication methods
.
// Authentication methods
const
val
LDAP_ENABLE
=
"LDAP_Enable"
const
val
CAS_ENABLE
=
"CAS_enabled"
const
val
CAS_LOGIN_URL
=
"CAS_login_url"
...
...
@@ -24,6 +24,13 @@ const val ACCOUNT_GITLAB_URL = "API_Gitlab_URL"
const
val
ACCOUNT_WORDPRESS
=
"Accounts_OAuth_Wordpress"
const
val
ACCOUNT_WORDPRESS_URL
=
"API_Wordpress_URL"
// Video call
const
val
JITSI_ENABLED
=
"Jitsi_Enabled"
const
val
JISTI_ENABLE_CHANNELS
=
"Jisti_Enable_Channels"
const
val
JITSI_SSL
=
"Jitsi_SSL"
const
val
JITSI_DOMAIN
=
"Jitsi_Domain"
const
val
JITSI_URL_ROOM_PREFIX
=
"Jitsi_URL_Room_Prefix"
const
val
SITE_URL
=
"Site_Url"
const
val
SITE_NAME
=
"Site_Name"
const
val
FAVICON_196
=
"Assets_favicon_192"
...
...
@@ -54,10 +61,11 @@ const val MESSAGE_READ_RECEIPT_STORE_USERS = "Message_Read_Receipt_Store_Users"
* Extension functions for Public Settings.
*
* If you need to access a Setting, add a const val key above, add it to the filter on
*
ServerPresenter.kt and a extension function to access it
*
RefreshSettingsInteractor.kt and a extension function to access it.
*/
fun
PublicSettings
.
isLdapAuthenticationEnabled
():
Boolean
=
this
[
LDAP_ENABLE
]
?.
value
==
true
// Authentication
fun
PublicSettings
.
isLdapAuthenticationEnabled
():
Boolean
=
this
[
LDAP_ENABLE
]
?.
value
==
true
fun
PublicSettings
.
isCasAuthenticationEnabled
():
Boolean
=
this
[
CAS_ENABLE
]
?.
value
==
true
fun
PublicSettings
.
casLoginUrl
():
String
=
this
[
CAS_LOGIN_URL
]
?.
value
.
toString
()
fun
PublicSettings
.
isRegistrationEnabledForNewUsers
():
Boolean
=
this
[
ACCOUNT_REGISTRATION
]
?.
value
==
"Public"
...
...
@@ -74,6 +82,13 @@ fun PublicSettings.gitlabUrl(): String? = this[ACCOUNT_GITLAB_URL]?.value as Str
fun
PublicSettings
.
isWordpressAuthenticationEnabled
():
Boolean
=
this
[
ACCOUNT_WORDPRESS
]
?.
value
==
true
fun
PublicSettings
.
wordpressUrl
():
String
?
=
this
[
ACCOUNT_WORDPRESS_URL
]
?.
value
as
String
?
// Video call
fun
PublicSettings
.
isJitsiEnabled
():
Boolean
=
this
[
JITSI_ENABLED
]
?.
value
==
true
fun
PublicSettings
.
isJitsiEnabledForChannels
():
Boolean
=
this
[
JISTI_ENABLE_CHANNELS
]
?.
value
==
true
fun
PublicSettings
.
isJitsiSSL
():
Boolean
=
this
[
JITSI_SSL
]
?.
value
==
true
fun
PublicSettings
.
jitsiDomain
():
String
?
=
this
[
JITSI_DOMAIN
]
?.
value
as
String
?
fun
PublicSettings
.
jitsiPrefix
():
String
?
=
this
[
JITSI_URL_ROOM_PREFIX
]
?.
value
as
String
?
fun
PublicSettings
.
useRealName
():
Boolean
=
this
[
USE_REALNAME
]
?.
value
==
true
fun
PublicSettings
.
useSpecialCharsOnRoom
():
Boolean
=
this
[
ALLOW_ROOM_NAME_SPECIAL_CHARS
]
?.
value
==
true
fun
PublicSettings
.
faviconLarge
():
String
?
=
this
[
FAVICON_512
]
?.
value
as
String
?
...
...
app/src/main/java/chat/rocket/android/userdetails/presentation/UserDetailsPresenter.kt
View file @
8d07f279
...
...
@@ -6,7 +6,9 @@ import chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.db.DatabaseManager
import
chat.rocket.android.db.model.ChatRoomEntity
import
chat.rocket.android.db.model.UserEntity
import
chat.rocket.android.server.domain.GetConnectingServerInteractor
import
chat.rocket.android.server.domain.CurrentServerRepository
import
chat.rocket.android.server.domain.GetSettingsInteractor
import
chat.rocket.android.server.domain.isJitsiEnabled
import
chat.rocket.android.server.infraestructure.ConnectionManagerFactory
import
chat.rocket.android.util.extension.launchUI
import
chat.rocket.android.util.extensions.avatarUrl
...
...
@@ -24,13 +26,15 @@ class UserDetailsPresenter @Inject constructor(
private
val
dbManager
:
DatabaseManager
,
private
val
strategy
:
CancelStrategy
,
private
val
navigator
:
ChatRoomNavigator
,
serverInteractor
:
GetConnectingServerInteractor
,
settingsInteractor
:
GetSettingsInteractor
,
serverInteractor
:
CurrentServerRepository
,
factory
:
ConnectionManagerFactory
)
{
private
var
currentServer
=
serverInteractor
.
get
()
!!
private
val
manager
=
factory
.
create
(
currentServer
)
private
val
client
=
manager
.
client
private
val
interactor
=
FetchChatRoomsInteractor
(
client
,
dbManager
)
private
val
settings
=
settingsInteractor
.
get
(
currentServer
)
private
lateinit
var
userEntity
:
UserEntity
fun
loadUserDetails
(
userId
:
String
)
{
...
...
@@ -47,12 +51,13 @@ class UserDetailsPresenter @Inject constructor(
userEntity
.
utcOffset
// TODO Convert UTC and display like the mockup
if
(
avatarUrl
!=
null
&&
username
!=
null
&&
name
!=
null
&&
utcOffset
!=
null
)
{
view
.
showUserDetails
(
view
.
showUserDetails
AndActions
(
avatarUrl
=
avatarUrl
,
name
=
name
,
username
=
username
,
status
=
userEntity
.
status
,
utcOffset
=
utcOffset
.
toString
()
utcOffset
=
utcOffset
.
toString
(),
isVideoCallAllowed
=
settings
.
isJitsiEnabled
()
)
}
else
{
throw
Exception
()
...
...
app/src/main/java/chat/rocket/android/userdetails/presentation/UserDetailsView.kt
View file @
8d07f279
...
...
@@ -13,12 +13,14 @@ interface UserDetailsView : LoadingView, MessageView {
* @param username The user's username.
* @param status The user's status.
* @param utcOffset The user's UTC offset.
* @param isVideoCallAllowed True if the video call is allowed, false otherwise.
*/
fun
showUserDetails
(
fun
showUserDetails
AndActions
(
avatarUrl
:
String
,
name
:
String
,
username
:
String
,
status
:
String
,
utcOffset
:
String
utcOffset
:
String
,
isVideoCallAllowed
:
Boolean
)
}
app/src/main/java/chat/rocket/android/userdetails/ui/UserDetailsFragment.kt
View file @
8d07f279
...
...
@@ -81,12 +81,13 @@ class UserDetailsFragment : Fragment(), UserDetailsView {
super
.
onDestroyView
()
}
override
fun
showUserDetails
(
override
fun
showUserDetails
AndActions
(
avatarUrl
:
String
,
name
:
String
,
username
:
String
,
status
:
String
,
utcOffset
:
String
utcOffset
:
String
,
isVideoCallAllowed
:
Boolean
)
{
val
requestBuilder
=
Glide
.
with
(
this
).
load
(
avatarUrl
)
...
...
@@ -105,7 +106,12 @@ class UserDetailsFragment : Fragment(), UserDetailsView {
// We should also setup the user details listeners.
text_message
.
setOnClickListener
{
presenter
.
createDirectMessage
(
username
)
}
if
(
isVideoCallAllowed
)
{
text_video_call
.
isVisible
=
true
text_video_call
.
setOnClickListener
{
presenter
.
startVideoCall
()
}
}
else
{
text_video_call
.
isVisible
=
false
}
}
override
fun
showLoading
()
{
...
...
app/src/main/res/layout/fragment_user_details.xml
View file @
8d07f279
...
...
@@ -79,9 +79,11 @@
android:layout_marginTop=
"24dp"
android:drawableTop=
"@drawable/ic_video_24dp"
android:text=
"@string/msg_video_call"
android:visibility=
"gone"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@+id/text_message"
app:layout_constraintTop_toBottomOf=
"@+id/text_username"
/>
app:layout_constraintTop_toBottomOf=
"@+id/text_username"
tools:visibility=
"visible"
/>
<TextView
android:id=
"@+id/text_title_status"
...
...
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