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
30e54bd8
Commit
30e54bd8
authored
Apr 12, 2018
by
Aniket Singh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
channel creation successful
parent
874ae7e4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
12 deletions
+26
-12
CreateNewChannelPresenter.kt
...d/createChannel/presentation/CreateNewChannelPresenter.kt
+11
-5
CreateNewChannelView.kt
...ndroid/createChannel/presentation/CreateNewChannelView.kt
+4
-1
CreateNewChannelActivity.kt
...cket/android/createChannel/ui/CreateNewChannelActivity.kt
+10
-6
strings.xml
app/src/main/res/values/strings.xml
+1
-0
No files found.
app/src/main/java/chat/rocket/android/createChannel/presentation/CreateNewChannelPresenter.kt
View file @
30e54bd8
package
chat.rocket.android.createChannel.presentation
package
chat.rocket.android.createChannel.presentation
import
android.widget.Toast
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.android.util.extensions.launchUI
import
chat.rocket.android.util.extensions.launchUI
import
chat.rocket.common.RocketChatException
import
chat.rocket.common.RocketChatException
import
chat.rocket.common.model.RoomType
import
chat.rocket.common.model.RoomType
import
chat.rocket.common.util.ifNull
import
chat.rocket.core.RocketChatClient
import
chat.rocket.core.RocketChatClient
import
chat.rocket.core.internal.rest.createChannel
import
chat.rocket.core.internal.rest.createChannel
import
chat.rocket.core.model.Room
import
javax.inject.Inject
import
javax.inject.Inject
...
@@ -21,11 +24,14 @@ class CreateNewChannelPresenter @Inject constructor(private val view: CreateNewC
...
@@ -21,11 +24,14 @@ class CreateNewChannelPresenter @Inject constructor(private val view: CreateNewC
launchUI
(
strategy
)
{
launchUI
(
strategy
)
{
view
.
showLoading
()
view
.
showLoading
()
try
{
try
{
client
.
createChannel
(
roomType
,
channelName
,
usersList
,
readOnly
)
val
channelCreated
:
Room
?
=
client
.
createChannel
(
roomType
,
channelName
,
usersList
,
readOnly
)
view
.
showMessage
(
"Channel Created successfully"
)
view
.
showChannelCreatedSuccessfullyMessage
()
}
catch
(
ex
:
RocketChatException
)
{
}
catch
(
exception
:
RocketChatException
)
{
//TODO remove this and add Log message instead
exception
.
message
?.
let
{
ex
.
printStackTrace
()
view
.
showMessage
(
it
)
}.
ifNull
{
view
.
showGenericErrorMessage
()
}
}
finally
{
}
finally
{
view
.
hideLoading
()
view
.
hideLoading
()
}
}
...
...
app/src/main/java/chat/rocket/android/createChannel/presentation/CreateNewChannelView.kt
View file @
30e54bd8
...
@@ -4,6 +4,9 @@ import chat.rocket.android.core.behaviours.LoadingView
...
@@ -4,6 +4,9 @@ import chat.rocket.android.core.behaviours.LoadingView
import
chat.rocket.android.core.behaviours.MessageView
import
chat.rocket.android.core.behaviours.MessageView
interface
CreateNewChannelView
:
LoadingView
,
MessageView
{
interface
CreateNewChannelView
:
LoadingView
,
MessageView
{
//TODO add functions to be implemented
/*
Show a message that a channel was successfully created
*/
fun
showChannelCreatedSuccessfullyMessage
()
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/createChannel/ui/CreateNewChannelActivity.kt
View file @
30e54bd8
...
@@ -4,11 +4,11 @@ import android.graphics.drawable.GradientDrawable
...
@@ -4,11 +4,11 @@ import android.graphics.drawable.GradientDrawable
import
android.os.Bundle
import
android.os.Bundle
import
android.support.v7.app.AppCompatActivity
import
android.support.v7.app.AppCompatActivity
import
android.view.MenuItem
import
android.view.MenuItem
import
android.widget.Toast
import
chat.rocket.android.R
import
chat.rocket.android.R
import
chat.rocket.android.createChannel.presentation.CreateNewChannelPresenter
import
chat.rocket.android.createChannel.presentation.CreateNewChannelPresenter
import
chat.rocket.android.createChannel.presentation.CreateNewChannelView
import
chat.rocket.android.createChannel.presentation.CreateNewChannelView
import
chat.rocket.android.util.extensions.setVisible
import
chat.rocket.android.util.extensions.setVisible
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.common.model.roomTypeOf
import
chat.rocket.common.model.roomTypeOf
import
com.jakewharton.rxbinding2.widget.RxTextView
import
com.jakewharton.rxbinding2.widget.RxTextView
import
dagger.android.AndroidInjection
import
dagger.android.AndroidInjection
...
@@ -30,16 +30,20 @@ class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView {
...
@@ -30,16 +30,20 @@ class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView {
layout_container
.
isEnabled
=
true
layout_container
.
isEnabled
=
true
}
}
override
fun
showChannelCreatedSuccessfullyMessage
()
{
showToast
(
getString
(
R
.
string
.
msg_channel_created_successfully
))
}
override
fun
showMessage
(
resId
:
Int
)
{
override
fun
showMessage
(
resId
:
Int
)
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
showToast
(
getString
(
resId
))
}
}
override
fun
showMessage
(
message
:
String
)
{
override
fun
showMessage
(
message
:
String
)
{
Toast
.
makeText
(
this
,
message
,
Toast
.
LENGTH_LONG
).
show
(
)
showToast
(
message
)
}
}
override
fun
showGenericErrorMessage
()
{
override
fun
showGenericErrorMessage
()
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
showMessage
(
getString
(
R
.
string
.
msg_generic_error
))
}
}
@Inject
@Inject
...
@@ -86,7 +90,7 @@ class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView {
...
@@ -86,7 +90,7 @@ class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView {
channelType
=
"c"
channelType
=
"c"
channel_type
.
text
=
getString
(
R
.
string
.
public_channel_type
)
channel_type
.
text
=
getString
(
R
.
string
.
public_channel_type
)
channel_description
.
text
=
getString
(
R
.
string
.
p
rivate_channel_type
_description
)
channel_description
.
text
=
getString
(
R
.
string
.
p
ublic_channel
_description
)
placeholder
.
setImageDrawable
(
getDrawable
(
R
.
drawable
.
ic_hashtag_black
))
placeholder
.
setImageDrawable
(
getDrawable
(
R
.
drawable
.
ic_hashtag_black
))
...
@@ -104,7 +108,7 @@ class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView {
...
@@ -104,7 +108,7 @@ class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView {
channelType
=
"p"
channelType
=
"p"
channel_type
.
text
=
getString
(
R
.
string
.
private_channel_type
)
channel_type
.
text
=
getString
(
R
.
string
.
private_channel_type
)
channel_description
.
text
=
getString
(
R
.
string
.
p
ublic_channel
_description
)
channel_description
.
text
=
getString
(
R
.
string
.
p
rivate_channel_type
_description
)
placeholder
.
setImageDrawable
(
getDrawable
(
R
.
drawable
.
ic_room_lock
))
placeholder
.
setImageDrawable
(
getDrawable
(
R
.
drawable
.
ic_room_lock
))
...
...
app/src/main/res/values/strings.xml
View file @
30e54bd8
...
@@ -49,6 +49,7 @@
...
@@ -49,6 +49,7 @@
<string
name=
"msg_generic_error"
>
Sorry, an error has occurred, please try again
</string>
<string
name=
"msg_generic_error"
>
Sorry, an error has occurred, please try again
</string>
<string
name=
"msg_no_data_to_display"
>
No data to display
</string>
<string
name=
"msg_no_data_to_display"
>
No data to display
</string>
<string
name=
"msg_profile_update_successfully"
>
Profile update successfully
</string>
<string
name=
"msg_profile_update_successfully"
>
Profile update successfully
</string>
<string
name=
"msg_channel_created_successfully"
>
"Channel created successfully
</string>
<string
name=
"msg_username"
>
username
</string>
<string
name=
"msg_username"
>
username
</string>
<string
name=
"msg_username_or_email"
>
username or email
</string>
<string
name=
"msg_username_or_email"
>
username or email
</string>
<string
name=
"msg_password"
>
password
</string>
<string
name=
"msg_password"
>
password
</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