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
fc1de20c
Commit
fc1de20c
authored
Sep 21, 2017
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update RoomListPresenter.kt
parent
a156dc67
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
12 deletions
+28
-12
RoomListPresenter.kt
...ocket/android/fragment/chatroom/list/RoomListPresenter.kt
+28
-12
No files found.
app/src/main/java/chat/rocket/android/fragment/chatroom/list/RoomListPresenter.kt
View file @
fc1de20c
...
...
@@ -18,21 +18,23 @@ import org.json.JSONObject
import
java.io.IOException
import
java.sql.Timestamp
class
RoomListPresenter
(
val
context
:
Context
,
val
view
:
RoomListContract
.
View
):
RoomListContract
.
Presenter
{
class
RoomListPresenter
(
val
context
:
Context
,
val
view
:
RoomListContract
.
View
)
:
RoomListContract
.
Presenter
{
val
mainHandler
=
Handler
(
context
.
mainLooper
)
override
fun
requestPinnedMessages
(
roomId
:
String
,
roomType
:
String
,
hostname
:
String
,
token
:
String
,
userId
:
String
)
{
userId
:
String
,
offset
:
String
)
{
OkHttpHelper
.
getClient
()
.
newCall
(
RestApiHelper
.
getRequestForPinnedMessages
(
roomId
,
roomType
,
hostname
,
token
,
userId
))
userId
,
offset
))
.
enqueue
(
object
:
Callback
{
override
fun
onFailure
(
call
:
Call
,
e
:
IOException
)
{
mainHandler
.
post
{
view
.
showMessage
(
context
.
getString
(
R
.
string
.
fragment_room_list_could_not_load_your_request
,
e
.
message
))
}
...
...
@@ -58,7 +60,9 @@ class RoomListPresenter(val context: Context, val view: RoomListContract.View):
.
build
()
val
timestampString
=
messagesJSONArray
.
getJSONObject
(
it
).
optString
(
"ts"
)
val
timestamp
=
if
(
timestampString
.
isBlank
())
{
0
}
else
{
val
timestamp
=
if
(
timestampString
.
isBlank
())
{
0
}
else
{
Timestamp
.
valueOf
(
timestampString
.
replace
(
"T"
,
" "
)
.
replace
(
"Z"
,
""
))
...
...
@@ -66,7 +70,9 @@ class RoomListPresenter(val context: Context, val view: RoomListContract.View):
}
val
editedAtString
=
messagesJSONArray
.
getJSONObject
(
it
).
optString
(
"_updatedAt"
)
val
editedAt
=
if
(
editedAtString
.
isBlank
())
{
0
}
else
{
val
editedAt
=
if
(
editedAtString
.
isBlank
())
{
0
}
else
{
Timestamp
.
valueOf
(
editedAtString
.
replace
(
"T"
,
" "
)
.
replace
(
"Z"
,
""
))
...
...
@@ -96,13 +102,15 @@ class RoomListPresenter(val context: Context, val view: RoomListContract.View):
roomType
:
String
,
hostname
:
String
,
token
:
String
,
userId
:
String
)
{
userId
:
String
,
offset
:
String
)
{
OkHttpHelper
.
getClient
()
.
newCall
(
RestApiHelper
.
getRequestForFavoriteMessages
(
roomId
,
roomType
,
hostname
,
token
,
userId
))
userId
,
offset
))
.
enqueue
(
object
:
Callback
{
override
fun
onFailure
(
call
:
Call
,
e
:
IOException
)
{
mainHandler
.
post
{
view
.
showMessage
(
context
.
getString
(
R
.
string
.
fragment_room_list_could_not_load_your_request
,
e
.
message
))
}
...
...
@@ -128,7 +136,9 @@ class RoomListPresenter(val context: Context, val view: RoomListContract.View):
.
build
()
val
timestampString
=
messagesJSONArray
.
getJSONObject
(
it
).
optString
(
"ts"
)
val
timestamp
=
if
(
timestampString
.
isBlank
())
{
0
}
else
{
val
timestamp
=
if
(
timestampString
.
isBlank
())
{
0
}
else
{
Timestamp
.
valueOf
(
timestampString
.
replace
(
"T"
,
" "
)
.
replace
(
"Z"
,
""
))
...
...
@@ -136,7 +146,9 @@ class RoomListPresenter(val context: Context, val view: RoomListContract.View):
}
val
editedAtString
=
messagesJSONArray
.
getJSONObject
(
it
).
optString
(
"_updatedAt"
)
val
editedAt
=
if
(
editedAtString
.
isBlank
())
{
0
}
else
{
val
editedAt
=
if
(
editedAtString
.
isBlank
())
{
0
}
else
{
Timestamp
.
valueOf
(
editedAtString
.
replace
(
"T"
,
" "
)
.
replace
(
"Z"
,
""
))
...
...
@@ -167,7 +179,8 @@ class RoomListPresenter(val context: Context, val view: RoomListContract.View):
roomType
:
String
,
hostname
:
String
,
token
:
String
,
userId
:
String
)
{
userId
:
String
,
offset
:
String
)
{
// OkHttpHelper.getClient()
// .newCall(RestApiHelper.getRequestForFileList(roomId,
// roomType,
...
...
@@ -214,13 +227,16 @@ class RoomListPresenter(val context: Context, val view: RoomListContract.View):
roomType
:
String
,
hostname
:
String
,
token
:
String
,
userId
:
String
)
{
userId
:
String
,
offset
:
String
)
{
OkHttpHelper
.
getClient
()
.
newCall
(
RestApiHelper
.
getRequestForMemberList
(
roomId
,
roomType
,
hostname
,
token
,
userId
))
userId
,
offset
))
.
enqueue
(
object
:
Callback
{
override
fun
onFailure
(
call
:
Call
,
e
:
IOException
)
{
mainHandler
.
post
{
view
.
showMessage
(
context
.
getString
(
R
.
string
.
fragment_room_list_could_not_load_your_request
,
e
.
message
))
}
...
...
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