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
07c5c0bf
Commit
07c5c0bf
authored
Oct 03, 2018
by
Lucio Maciel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up unused code
parent
25f39958
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
11 additions
and
213 deletions
+11
-213
LoginPresenter.kt
...droid/authentication/login/presentation/LoginPresenter.kt
+1
-1
ActionsListAdapter.kt
...hat/rocket/android/chatroom/adapter/ActionsListAdapter.kt
+1
-1
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+2
-6
UiModelMapper.kt
...ava/chat/rocket/android/chatroom/uimodel/UiModelMapper.kt
+2
-2
ChatRoomSuggestionUiModel.kt
.../chatroom/uimodel/suggestion/ChatRoomSuggestionUiModel.kt
+1
-2
AppModule.kt
.../main/java/chat/rocket/android/dagger/module/AppModule.kt
+0
-17
BaseDao.kt
app/src/main/java/chat/rocket/android/db/BaseDao.kt
+1
-1
ActiveUsersRepository.kt
...hat/rocket/android/server/domain/ActiveUsersRepository.kt
+0
-10
GetActiveUsersInteractor.kt
.../rocket/android/server/domain/GetActiveUsersInteractor.kt
+0
-23
RoomRepository.kt
.../java/chat/rocket/android/server/domain/RoomRepository.kt
+0
-41
SaveActiveUsersInteractor.kt
...rocket/android/server/domain/SaveActiveUsersInteractor.kt
+0
-45
Server.kt
...in/java/chat/rocket/android/server/domain/model/Server.kt
+0
-8
MemoryActiveUsersRepository.kt
...oid/server/infraestructure/MemoryActiveUsersRepository.kt
+0
-15
MemoryRoomRepository.kt
...et/android/server/infraestructure/MemoryRoomRepository.kt
+0
-38
quality.gradle
config/quality/quality.gradle
+1
-1
EmojiRepository.kt
...rc/main/java/chat/rocket/android/emoji/EmojiRepository.kt
+1
-1
OverKeyboardPopupWindow.kt
...java/chat/rocket/android/emoji/OverKeyboardPopupWindow.kt
+1
-1
No files found.
app/src/main/java/chat/rocket/android/authentication/login/presentation/LoginPresenter.kt
View file @
07c5c0bf
...
...
@@ -326,7 +326,7 @@ class LoginPresenter @Inject constructor(
getCustomOauthScope
(
serviceMap
)
?:
"openid"
)
}
wordpressOauthUrl
?
.
let
{
wordpressOauthUrl
.
let
{
view
.
setupWordpressButtonListener
(
it
,
state
)
view
.
enableLoginByWordpress
()
totalSocialAccountsEnabled
++
...
...
app/src/main/java/chat/rocket/android/chatroom/adapter/ActionsListAdapter.kt
View file @
07c5c0bf
...
...
@@ -51,7 +51,7 @@ class ActionsListAdapter(actions: List<Action>, var actionAttachmentOnClickListe
action_button
.
isVisible
=
true
action_image_button
.
isVisible
=
false
this
.
action_button
.
setText
(
action
.
text
)
this
.
action_button
.
text
=
action
.
text
}
}
}
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
07c5c0bf
...
...
@@ -28,7 +28,6 @@ import chat.rocket.android.server.domain.JobSchedulerInteractor
import
chat.rocket.android.server.domain.MessagesRepository
import
chat.rocket.android.server.domain.PermissionsInteractor
import
chat.rocket.android.server.domain.PublicSettings
import
chat.rocket.android.server.domain.RoomRepository
import
chat.rocket.android.server.domain.UsersRepository
import
chat.rocket.android.server.domain.uploadMaxFileSize
import
chat.rocket.android.server.domain.uploadMimeTypeFilter
...
...
@@ -92,7 +91,6 @@ class ChatRoomPresenter @Inject constructor(
private
val
uriInteractor
:
UriInteractor
,
private
val
messagesRepository
:
MessagesRepository
,
private
val
usersRepository
:
UsersRepository
,
private
val
roomsRepository
:
RoomRepository
,
private
val
localRepository
:
LocalRepository
,
private
val
analyticsManager
:
AnalyticsManager
,
private
val
userHelper
:
UserHelper
,
...
...
@@ -505,7 +503,7 @@ class ChatRoomPresenter @Inject constructor(
val
messages
=
retryIO
(
description
=
"history($chatRoomId, $roomType, $instant)"
)
{
client
.
history
(
chatRoomId
!!
,
roomType
,
count
=
50
,
chatRoomId
,
roomType
,
count
=
50
,
oldest
=
instant
)
}
...
...
@@ -714,6 +712,7 @@ class ChatRoomPresenter @Inject constructor(
client
.
getMembers
(
chatRoomId
,
roomTypeOf
(
chatRoomType
),
offset
,
50
).
result
}.
take
(
50
)
// Get only 50, the backend is returning 7k+ users
usersRepository
.
saveAll
(
members
)
dbManager
.
processUsersBatch
(
members
)
val
self
=
localRepository
.
get
(
LocalRepository
.
CURRENT_USERNAME_KEY
)
// Take at most the 100 most recent messages distinguished by user. Can return less.
val
recentMessages
=
messagesRepository
.
getRecentMessages
(
chatRoomId
,
100
)
...
...
@@ -786,9 +785,6 @@ class ChatRoomPresenter @Inject constructor(
}.
filterNot
{
filterSelfOut
&&
self
!=
null
&&
self
==
it
.
text
})
}
ROOMS
->
{
if
(
rooms
.
isNotEmpty
())
{
roomsRepository
.
saveAll
(
rooms
)
}
view
.
populateRoomSuggestions
(
rooms
.
map
{
val
fullName
=
it
.
fullName
?:
""
val
name
=
it
.
name
?:
""
...
...
app/src/main/java/chat/rocket/android/chatroom/uimodel/UiModelMapper.kt
View file @
07c5c0bf
...
...
@@ -175,7 +175,7 @@ class UiModelMapper @Inject constructor(
broadcast
=
broadcast
?:
false
,
alert
=
alert
,
fullName
=
fullname
,
name
=
name
?:
""
,
name
=
name
,
favorite
=
favorite
?:
false
,
default
=
isDefault
?:
false
,
readonly
=
readonly
,
...
...
@@ -477,7 +477,7 @@ class UiModelMapper @Inject constructor(
val
time
=
getTime
(
message
.
timestamp
)
val
avatar
=
getUserAvatar
(
message
)
val
preview
=
mapMessagePreview
(
message
)
val
synced
=
message
.
synced
?:
true
val
synced
=
message
.
synced
val
unread
=
if
(
settings
.
messageReadReceiptEnabled
())
{
message
.
unread
?:
false
}
else
{
...
...
app/src/main/java/chat/rocket/android/chatroom/uimodel/suggestion/ChatRoomSuggestionUiModel.kt
View file @
07c5c0bf
...
...
@@ -5,5 +5,4 @@ import chat.rocket.android.suggestions.model.SuggestionModel
class
ChatRoomSuggestionUiModel
(
text
:
String
,
val
fullName
:
String
,
val
name
:
String
,
searchList
:
List
<
String
>)
:
SuggestionModel
(
text
,
searchList
,
false
)
{
}
\ No newline at end of file
searchList
:
List
<
String
>)
:
SuggestionModel
(
text
,
searchList
,
false
)
\ No newline at end of file
app/src/main/java/chat/rocket/android/dagger/module/AppModule.kt
View file @
07c5c0bf
...
...
@@ -9,7 +9,6 @@ import android.content.Context
import
android.content.SharedPreferences
import
chat.rocket.android.BuildConfig
import
chat.rocket.android.R
import
chat.rocket.android.analytics.Analytics
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.AnswersAnalytics
import
chat.rocket.android.analytics.GoogleAnalyticsForFirebase
...
...
@@ -26,7 +25,6 @@ import chat.rocket.android.infrastructure.SharedPreferencesLocalRepository
import
chat.rocket.android.push.GroupedPush
import
chat.rocket.android.push.PushManager
import
chat.rocket.android.server.domain.AccountsRepository
import
chat.rocket.android.server.domain.ActiveUsersRepository
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.server.domain.AnalyticsTrackingRepository
import
chat.rocket.android.server.domain.ChatRoomsRepository
...
...
@@ -39,16 +37,13 @@ import chat.rocket.android.server.domain.JobSchedulerInteractor
import
chat.rocket.android.server.domain.MessagesRepository
import
chat.rocket.android.server.domain.MultiServerTokenRepository
import
chat.rocket.android.server.domain.PermissionsRepository
import
chat.rocket.android.server.domain.RoomRepository
import
chat.rocket.android.server.domain.SettingsRepository
import
chat.rocket.android.server.domain.TokenRepository
import
chat.rocket.android.server.domain.UsersRepository
import
chat.rocket.android.server.infraestructure.DatabaseMessageMapper
import
chat.rocket.android.server.infraestructure.DatabaseMessagesRepository
import
chat.rocket.android.server.infraestructure.JobSchedulerInteractorImpl
import
chat.rocket.android.server.infraestructure.MemoryActiveUsersRepository
import
chat.rocket.android.server.infraestructure.MemoryChatRoomsRepository
import
chat.rocket.android.server.infraestructure.MemoryRoomRepository
import
chat.rocket.android.server.infraestructure.MemoryUsersRepository
import
chat.rocket.android.server.infraestructure.SharedPreferencesAccountsRepository
import
chat.rocket.android.server.infraestructure.SharedPreferencesPermissionsRepository
...
...
@@ -202,24 +197,12 @@ class AppModule {
return
SharedPreferencesPermissionsRepository
(
localRepository
,
moshi
)
}
@Provides
@Singleton
fun
provideRoomRepository
():
RoomRepository
{
return
MemoryRoomRepository
()
}
@Provides
@Singleton
fun
provideChatRoomRepository
():
ChatRoomsRepository
{
return
MemoryChatRoomsRepository
()
}
@Provides
@Singleton
fun
provideActiveUsersRepository
():
ActiveUsersRepository
{
return
MemoryActiveUsersRepository
()
}
@Provides
@Singleton
fun
provideMoshi
(
...
...
app/src/main/java/chat/rocket/android/db/BaseDao.kt
View file @
07c5c0bf
...
...
@@ -4,7 +4,7 @@ import androidx.room.Insert
import
androidx.room.OnConflictStrategy
interface
BaseDao
<
T
>
{
@Insert
@Insert
(
onConflict
=
OnConflictStrategy
.
REPLACE
)
fun
insert
(
vararg
obj
:
T
)
@Insert
(
onConflict
=
OnConflictStrategy
.
REPLACE
)
...
...
app/src/main/java/chat/rocket/android/server/domain/ActiveUsersRepository.kt
deleted
100644 → 0
View file @
25f39958
package
chat.rocket.android.server.domain
import
chat.rocket.common.model.User
interface
ActiveUsersRepository
{
fun
save
(
url
:
String
,
activeUsers
:
List
<
User
>)
fun
get
(
url
:
String
):
List
<
User
>
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/server/domain/GetActiveUsersInteractor.kt
deleted
100644 → 0
View file @
25f39958
package
chat.rocket.android.server.domain
import
chat.rocket.common.model.User
import
javax.inject.Inject
class
GetActiveUsersInteractor
@Inject
constructor
(
private
val
repository
:
ActiveUsersRepository
)
{
fun
isActiveUserOnRepository
(
url
:
String
,
user
:
User
):
Boolean
{
return
repository
.
get
(
url
).
any
{
user_
->
user_
.
id
==
user
.
id
}
}
fun
getAllActiveUsers
(
url
:
String
):
List
<
User
>
{
return
repository
.
get
(
url
)
}
fun
getActiveUserById
(
url
:
String
,
id
:
String
):
User
?
{
return
repository
.
get
(
url
).
find
{
user
->
user
.
id
==
id
}
}
fun
getActiveUserByUsername
(
url
:
String
,
username
:
String
):
User
?
{
return
repository
.
get
(
url
).
find
{
user
->
user
.
username
==
username
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/server/domain/RoomRepository.kt
deleted
100644 → 0
View file @
25f39958
package
chat.rocket.android.server.domain
import
chat.rocket.common.model.RoomType
import
chat.rocket.core.model.Room
interface
RoomRepository
{
/**
* Get all rooms. Use carefully!
*
* @return All rooms or an empty list.
*/
fun
getAll
():
List
<
Room
>
fun
get
(
query
:
Query
.()
->
Unit
):
List
<
Room
>
/**
* Save a single room object.
*
* @param room The room object to save.
*/
fun
save
(
room
:
Room
)
/**
* Save a list of rooms.
*
* @param roomList The list of rooms to save.
*/
fun
saveAll
(
roomList
:
List
<
Room
>)
/**
* Removes all rooms.
*/
fun
clear
()
data class
Query
(
var
id
:
String
?
=
null
,
var
name
:
String
?
=
null
,
var
fullName
:
String
?
=
null
,
var
type
:
RoomType
?
=
null
,
var
readonly
:
Boolean
?
=
null
)
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/server/domain/SaveActiveUsersInteractor.kt
deleted
100644 → 0
View file @
25f39958
package
chat.rocket.android.server.domain
import
chat.rocket.common.model.User
import
javax.inject.Inject
class
SaveActiveUsersInteractor
@Inject
constructor
(
private
val
repository
:
ActiveUsersRepository
,
private
val
getActiveUsersInteractor
:
GetActiveUsersInteractor
)
{
fun
save
(
url
:
String
,
activeUsers
:
List
<
User
>)
{
repository
.
save
(
url
,
activeUsers
)
}
fun
addActiveUser
(
url
:
String
,
user
:
User
)
{
val
activeUserList
:
MutableList
<
User
>
=
getActiveUsersInteractor
.
getAllActiveUsers
(
url
).
toMutableList
()
synchronized
(
this
)
{
activeUserList
.
add
(
user
)
}
save
(
url
,
activeUserList
)
}
fun
updateActiveUser
(
url
:
String
,
user
:
User
)
{
getActiveUsersInteractor
.
getActiveUserById
(
url
,
user
.
id
)
?.
let
{
val
newUser
=
User
(
id
=
user
.
id
,
name
=
user
.
name
?:
it
.
name
,
username
=
user
.
username
?:
it
.
username
,
status
=
user
.
status
?:
it
.
status
,
emails
=
user
.
emails
?:
it
.
emails
,
utcOffset
=
user
.
utcOffset
?:
it
.
utcOffset
,
roles
=
user
.
roles
?:
it
.
roles
)
val
activeUserList
:
MutableList
<
User
>
=
getActiveUsersInteractor
.
getAllActiveUsers
(
url
).
toMutableList
()
synchronized
(
this
)
{
activeUserList
.
removeAll
{
user_
->
user_
.
id
==
user
.
id
}
}
activeUserList
.
add
(
newUser
)
save
(
url
,
activeUserList
)
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/server/domain/model/Server.kt
deleted
100644 → 0
View file @
25f39958
package
chat.rocket.android.server.domain.model
data class
Server
(
val
id
:
Long
,
val
name
:
String
,
val
url
:
String
,
val
avatar
:
String
)
\ No newline at end of file
app/src/main/java/chat/rocket/android/server/infraestructure/MemoryActiveUsersRepository.kt
deleted
100644 → 0
View file @
25f39958
package
chat.rocket.android.server.infraestructure
import
chat.rocket.android.server.domain.ActiveUsersRepository
import
chat.rocket.common.model.User
class
MemoryActiveUsersRepository
:
ActiveUsersRepository
{
val
cache
=
HashMap
<
String
,
List
<
User
>>()
override
fun
save
(
url
:
String
,
activeUsers
:
List
<
User
>)
{
cache
[
url
]
=
activeUsers
}
override
fun
get
(
url
:
String
):
List
<
User
>
=
cache
[
url
]
?:
emptyList
()
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/server/infraestructure/MemoryRoomRepository.kt
deleted
100644 → 0
View file @
25f39958
package
chat.rocket.android.server.infraestructure
import
chat.rocket.android.server.domain.RoomRepository
import
chat.rocket.android.server.domain.RoomRepository.Query
import
chat.rocket.core.model.Room
import
java.util.concurrent.CopyOnWriteArrayList
class
MemoryRoomRepository
:
RoomRepository
{
private
val
rooms
=
CopyOnWriteArrayList
<
Room
>()
override
fun
getAll
()
=
rooms
.
toList
()
override
fun
get
(
query
:
Query
.()
->
Unit
):
List
<
Room
>
{
val
q
=
Query
().
apply
(
query
)
return
rooms
.
filter
{
with
(
q
)
{
if
(
name
!=
null
&&
it
.
name
?.
contains
(
name
!!
.
toRegex
())
==
true
)
return
@filter
false
if
(
fullName
!=
null
&&
it
.
fullName
?.
contains
(
fullName
!!
.
toRegex
())
==
true
)
return
@filter
false
if
(
id
!=
null
&&
id
==
it
.
id
)
return
@filter
false
if
(
readonly
!=
null
&&
readonly
==
it
.
readonly
)
return
@filter
false
if
(
type
!=
null
&&
type
==
it
.
type
)
return
@filter
false
return
@filter
true
}
}
}
override
fun
save
(
room
:
Room
)
{
rooms
.
addIfAbsent
(
room
)
}
override
fun
saveAll
(
roomList
:
List
<
Room
>)
{
rooms
.
addAllAbsent
(
roomList
)
}
override
fun
clear
()
{
rooms
.
clear
()
}
}
\ No newline at end of file
config/quality/quality.gradle
View file @
07c5c0bf
...
...
@@ -17,7 +17,7 @@ dependencies {
checkstyle
'com.puppycrawl.tools:checkstyle:7.2'
}
def
qualityConfigDir
=
"$project.rootDir/config/quality"
;
def
qualityConfigDir
=
"$project.rootDir/config/quality"
def
reportsDir
=
"$project.buildDir/reports"
check
.
dependsOn
'checkstyle'
,
'findbugs'
,
'pmd'
...
...
emoji/src/main/java/chat/rocket/android/emoji/EmojiRepository.kt
View file @
07c5c0bf
...
...
@@ -267,7 +267,7 @@ object EmojiRepository {
private
fun
loadEmojis
(
stream
:
InputStream
):
MutableList
<
Emoji
>
{
val
emojisJSON
=
JSONArray
(
inputStreamToString
(
stream
))
val
emojis
=
ArrayList
<
Emoji
>(
emojisJSON
.
length
())
;
val
emojis
=
ArrayList
<
Emoji
>(
emojisJSON
.
length
())
for
(
i
in
0
until
emojisJSON
.
length
())
{
val
emoji
=
buildEmojiFromJSON
(
emojisJSON
.
getJSONObject
(
i
))
emoji
?.
let
{
...
...
emoji/src/main/java/chat/rocket/android/emoji/OverKeyboardPopupWindow.kt
View file @
07c5c0bf
...
...
@@ -123,7 +123,7 @@ abstract class OverKeyboardPopupWindow(
private
fun
calculateScreenHeight
():
Int
{
val
wm
=
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
)
as
WindowManager
val
display
=
wm
.
getDefaultDisplay
()
val
display
=
wm
.
defaultDisplay
val
size
=
Point
()
display
.
getSize
(
size
)
return
size
.
y
...
...
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