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
464a414e
Unverified
Commit
464a414e
authored
Jul 21, 2018
by
Filipe de Lima Brito
Committed by
GitHub
Jul 21, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1515 from RocketChat/fix/more-fixes-for-2.5.0
[FIX] More fixes for 2.5.0 release
parents
043df051
7e9682d9
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
32 additions
and
19 deletions
+32
-19
MessageActionsBottomSheet.kt
...roid/chatroom/ui/bottomsheet/MessageActionsBottomSheet.kt
+2
-3
DatabaseManager.kt
app/src/main/java/chat/rocket/android/db/DatabaseManager.kt
+3
-2
MainPresenter.kt
...va/chat/rocket/android/main/presentation/MainPresenter.kt
+1
-1
MainActivity.kt
...src/main/java/chat/rocket/android/main/ui/MainActivity.kt
+7
-6
RefreshSettingsInteractor.kt
...rocket/android/server/domain/RefreshSettingsInteractor.kt
+6
-3
SettingsFragment.kt
.../java/chat/rocket/android/settings/ui/SettingsFragment.kt
+9
-0
String.kt
...c/main/java/chat/rocket/android/util/extensions/String.kt
+4
-4
No files found.
app/src/main/java/chat/rocket/android/chatroom/ui/bottomsheet/MessageActionsBottomSheet.kt
View file @
464a414e
...
...
@@ -14,20 +14,18 @@ import kotlinx.android.synthetic.main.message_bottomsheet.*
class
MessageActionsBottomSheet
:
BottomSheetDialogFragment
()
{
private
lateinit
var
adapter
:
MessageActionAdapter
private
val
adapter
=
MessageActionAdapter
()
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
{
return
inflater
.
inflate
(
R
.
layout
.
message_bottomsheet
,
container
,
false
)
}
fun
addItems
(
items
:
List
<
MenuItem
>,
itemClickListener
:
MenuItem
.
OnMenuItemClickListener
)
{
adapter
=
MessageActionAdapter
()
adapter
.
addItems
(
items
,
ActionItemClickListener
(
dismissAction
=
{
dismiss
()
},
itemClickListener
=
itemClickListener
))
}
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
bottomsheet_recycler_view
.
layoutManager
=
LinearLayoutManager
(
context
)
bottomsheet_recycler_view
.
adapter
=
adapter
}
...
...
@@ -58,6 +56,7 @@ class MessageActionsBottomSheet : BottomSheetDialogFragment() {
this
.
itemClickListener
=
itemClickListener
menuItems
.
clear
()
menuItems
.
addAll
(
items
)
notifyDataSetChanged
()
}
}
...
...
app/src/main/java/chat/rocket/android/db/DatabaseManager.kt
View file @
464a414e
...
...
@@ -249,7 +249,7 @@ class DatabaseManager(val context: Application,
id
=
roomId
,
subscriptionId
=
id
,
type
=
type
.
toString
(),
name
=
name
,
name
=
name
?:
throw
NullPointerException
(),
// this should be filtered on the SDK
fullname
=
fullName
?:
chatRoom
.
fullname
,
userId
=
userId
?:
chatRoom
.
userId
,
readonly
=
readonly
?:
chatRoom
.
readonly
,
...
...
@@ -330,7 +330,7 @@ class DatabaseManager(val context: Application,
id
=
room
.
id
,
subscriptionId
=
subscription
.
id
,
type
=
room
.
type
.
toString
(),
name
=
room
.
name
?:
subscription
.
name
,
name
=
room
.
name
?:
subscription
.
name
?:
throw
NullPointerException
(),
// this should be filtered on the SDK
fullname
=
subscription
.
fullName
?:
room
.
fullName
,
userId
=
userId
,
ownerId
=
room
.
user
?.
id
,
...
...
@@ -436,6 +436,7 @@ private fun String.databaseName(): String {
val
tmp
=
this
.
removePrefix
(
"https://"
)
.
removePrefix
(
"http://"
)
.
removeTrailingSlash
()
.
replace
(
"/"
,
"-"
)
.
replace
(
"."
,
"_"
)
return
"$tmp.db"
...
...
app/src/main/java/chat/rocket/android/main/presentation/MainPresenter.kt
View file @
464a414e
...
...
@@ -152,7 +152,7 @@ class MainPresenter @Inject constructor(
}
fun
connect
()
{
launch
{
refreshSettingsInteractor
.
refresh
(
currentServer
)
}
refreshSettingsInteractor
.
refreshAsync
(
currentServer
)
manager
.
connect
()
}
...
...
app/src/main/java/chat/rocket/android/main/ui/MainActivity.kt
View file @
464a414e
...
...
@@ -169,7 +169,7 @@ class MainActivity : AppCompatActivity(), MainView, HasActivityInjector,
}
headerLayout
.
image_avatar
.
setOnClickListener
{
view_navigation
.
menu
.
findItem
(
R
.
id
.
action_
update_
profile
).
isChecked
=
true
view_navigation
.
menu
.
findItem
(
R
.
id
.
action_profile
).
isChecked
=
true
presenter
.
toUserProfile
()
drawer_layout
.
closeDrawer
(
Gravity
.
START
)
}
...
...
@@ -218,19 +218,20 @@ class MainActivity : AppCompatActivity(), MainView, HasActivityInjector,
private
fun
setupToolbar
()
{
setSupportActionBar
(
toolbar
)
toolbar
.
setNavigationIcon
(
R
.
drawable
.
ic_menu_white_24dp
)
toolbar
.
setNavigationOnClickListener
{
openDrawer
()
}
}
private
fun
setupNavigationView
()
{
fun
setupNavigationView
()
{
view_navigation
.
setNavigationItemSelectedListener
{
menuItem
->
menuItem
.
isChecked
=
true
closeDrawer
()
onNavDrawerItemSelected
(
menuItem
)
true
}
toolbar
.
setNavigationIcon
(
R
.
drawable
.
ic_menu_white_24dp
)
toolbar
.
setNavigationOnClickListener
{
openDrawer
()
}
}
private
fun
onNavDrawerItemSelected
(
menuItem
:
MenuItem
)
{
...
...
app/src/main/java/chat/rocket/android/server/domain/RefreshSettingsInteractor.kt
View file @
464a414e
...
...
@@ -5,7 +5,9 @@ import chat.rocket.android.util.retryIO
import
chat.rocket.core.internal.rest.settings
import
kotlinx.coroutines.experimental.CommonPool
import
kotlinx.coroutines.experimental.async
import
kotlinx.coroutines.experimental.launch
import
kotlinx.coroutines.experimental.withContext
import
timber.log.Timber
import
javax.inject.Inject
class
RefreshSettingsInteractor
@Inject
constructor
(
...
...
@@ -30,7 +32,8 @@ class RefreshSettingsInteractor @Inject constructor(
suspend
fun
refresh
(
server
:
String
)
{
withContext
(
CommonPool
)
{
factory
.
create
(
server
).
let
{
client
->
val
settings
=
retryIO
(
description
=
"settings"
,
times
=
5
)
{
val
settings
=
retryIO
(
description
=
"settings"
,
times
=
5
,
maxDelay
=
5000
,
initialDelay
=
300
)
{
client
.
settings
(*
settingsFilter
)
}
repository
.
save
(
server
,
settings
)
...
...
@@ -39,11 +42,11 @@ class RefreshSettingsInteractor @Inject constructor(
}
fun
refreshAsync
(
server
:
String
)
{
async
{
launch
(
CommonPool
)
{
try
{
refresh
(
server
)
}
catch
(
ex
:
Exception
)
{
ex
.
printStackTrace
(
)
Timber
.
e
(
ex
,
"Error refreshing settings for: $server"
)
}
}
}
...
...
app/src/main/java/chat/rocket/android/settings/ui/SettingsFragment.kt
View file @
464a414e
...
...
@@ -10,6 +10,7 @@ import android.view.ViewGroup
import
android.widget.AdapterView
import
chat.rocket.android.R
import
chat.rocket.android.about.ui.AboutFragment
import
chat.rocket.android.main.ui.MainActivity
import
chat.rocket.android.settings.password.ui.PasswordActivity
import
chat.rocket.android.settings.presentation.SettingsView
import
chat.rocket.android.util.extensions.addFragmentBackStack
...
...
@@ -34,6 +35,14 @@ class SettingsFragment : Fragment(), SettingsView, AdapterView.OnItemClickListen
setupListView
()
}
override
fun
onResume
()
{
// FIXME - gambiarra ahead. will fix when moving to new androidx Navigation
(
activity
as
?
MainActivity
)
?.
let
{
it
.
setupNavigationView
()
}
super
.
onResume
()
}
override
fun
onItemClick
(
parent
:
AdapterView
<
*
>?,
view
:
View
?,
position
:
Int
,
id
:
Long
)
{
when
(
parent
?.
getItemAtPosition
(
position
).
toString
())
{
resources
.
getString
(
R
.
string
.
title_password
)
->
{
...
...
app/src/main/java/chat/rocket/android/util/extensions/String.kt
View file @
464a414e
...
...
@@ -6,11 +6,11 @@ import chat.rocket.common.model.Token
import
timber.log.Timber
fun
String
.
removeTrailingSlash
():
String
{
return
if
(
isNotEmpty
()
&&
this
[
length
-
1
]
==
'/'
)
{
this
.
substring
(
0
,
length
-
1
)
}
else
{
this
var
removed
=
this
while
(
removed
.
isNotEmpty
()
&&
removed
[
removed
.
length
-
1
]
==
'/'
)
{
removed
=
removed
.
substring
(
0
,
removed
.
length
-
1
)
}
return
removed
}
fun
String
.
sanitize
():
String
{
...
...
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