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
a6877b4e
Commit
a6877b4e
authored
Sep 14, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates the ServerFragment
parent
62253b1f
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
148 additions
and
105 deletions
+148
-105
ScreenViewEvent.kt
...va/chat/rocket/android/analytics/event/ScreenViewEvent.kt
+1
-0
OnBoardingFragment.kt
...ndroid/authentication/onboarding/ui/OnBoardingFragment.kt
+6
-0
ServerPresenter.kt
...oid/authentication/server/presentation/ServerPresenter.kt
+3
-9
ServerView.kt
.../android/authentication/server/presentation/ServerView.kt
+11
-0
VersionCheckView.kt
...id/authentication/server/presentation/VersionCheckView.kt
+1
-0
ServerFragment.kt
...rocket/android/authentication/server/ui/ServerFragment.kt
+94
-74
CreateChannelFragment.kt
.../rocket/android/createchannel/ui/CreateChannelFragment.kt
+4
-2
CheckServerPresenter.kt
...ocket/android/server/presentation/CheckServerPresenter.kt
+22
-16
style_total_unread_messages.xml
app/src/main/res/drawable/style_total_unread_messages.xml
+1
-2
fragment_authentication_server.xml
app/src/main/res/layout/fragment_authentication_server.xml
+3
-1
colors.xml
app/src/main/res/values/colors.xml
+1
-0
strings.xml
app/src/main/res/values/strings.xml
+1
-1
No files found.
app/src/main/java/chat/rocket/android/analytics/event/ScreenViewEvent.kt
View file @
a6877b4e
...
...
@@ -23,4 +23,5 @@ sealed class ScreenViewEvent(val screenName: String) {
object
Settings
:
ScreenViewEvent
(
"SettingsFragment"
)
object
SignUp
:
ScreenViewEvent
(
"SignupFragment"
)
object
TwoFa
:
ScreenViewEvent
(
"TwoFAFragment"
)
object
OnBoarding
:
ScreenViewEvent
(
"OnBoardingFragment"
)
}
app/src/main/java/chat/rocket/android/authentication/onboarding/ui/OnBoardingFragment.kt
View file @
a6877b4e
...
...
@@ -7,6 +7,8 @@ import android.view.ViewGroup
import
androidx.core.view.isVisible
import
androidx.fragment.app.Fragment
import
chat.rocket.android.R
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.authentication.domain.model.getLoginDeepLinkInfo
import
chat.rocket.android.authentication.onboarding.presentation.OnBoardingPresenter
import
chat.rocket.android.authentication.onboarding.presentation.OnBoardingView
...
...
@@ -23,6 +25,8 @@ import javax.inject.Inject
class
OnBoardingFragment
:
Fragment
(),
OnBoardingView
{
@Inject
lateinit
var
presenter
:
OnBoardingPresenter
@Inject
lateinit
var
analyticsManager
:
AnalyticsManager
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
...
...
@@ -38,6 +42,8 @@ class OnBoardingFragment : Fragment(), OnBoardingView {
super
.
onViewCreated
(
view
,
savedInstanceState
)
setupToobar
()
setupOnClickListener
()
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
OnBoarding
)
}
private
fun
setupToobar
()
{
...
...
app/src/main/java/chat/rocket/android/authentication/server/presentation/ServerPresenter.kt
View file @
a6877b4e
...
...
@@ -9,8 +9,8 @@ import chat.rocket.android.server.domain.RefreshSettingsInteractor
import
chat.rocket.android.server.domain.SaveConnectingServerInteractor
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.android.server.presentation.CheckServerPresenter
import
chat.rocket.android.util.extensions.isValidUrl
import
chat.rocket.android.util.extension.launchUI
import
chat.rocket.android.util.extensions.isValidUrl
import
javax.inject.Inject
class
ServerPresenter
@Inject
constructor
(
...
...
@@ -33,10 +33,7 @@ class ServerPresenter @Inject constructor(
}
fun
connect
(
server
:
String
)
{
//code that leads to login screen (smart lock will be implemented after this)
connectToServer
(
server
)
{
navigator
.
toLoginOptions
(
server
)
}
connectToServer
(
server
)
{
navigator
.
toLoginOptions
(
server
)
}
}
private
fun
connectToServer
(
server
:
String
,
block
:
()
->
Unit
)
{
...
...
@@ -66,9 +63,6 @@ class ServerPresenter @Inject constructor(
}
fun
deepLink
(
deepLinkInfo
:
LoginDeepLinkInfo
)
{
//code that leads to login screen (smart lock will be implemented after this)
connectToServer
(
deepLinkInfo
.
url
)
{
navigator
.
toLogin
(
deepLinkInfo
)
}
connectToServer
(
deepLinkInfo
.
url
)
{
navigator
.
toLogin
(
deepLinkInfo
)
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/authentication/server/presentation/ServerView.kt
View file @
a6877b4e
...
...
@@ -9,4 +9,15 @@ interface ServerView : LoadingView, MessageView, VersionCheckView {
* Shows an invalid server URL message.
*/
fun
showInvalidServerUrlMessage
()
/**
* Enables the button to connect to the server when the user inputs a valid url.
*/
fun
enableButtonConnect
()
/**
* Disables the button to connect to the server when the server address entered by the user
* is not a valid url.
*/
fun
disableButtonConnect
()
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/authentication/server/presentation/VersionCheckView.kt
View file @
a6877b4e
...
...
@@ -3,6 +3,7 @@ package chat.rocket.android.authentication.server.presentation
import
okhttp3.HttpUrl
interface
VersionCheckView
{
/**
* Alerts the user about the server version not meeting the recommended server version.
*/
...
...
app/src/main/java/chat/rocket/android/authentication/server/ui/ServerFragment.kt
View file @
a6877b4e
This diff is collapsed.
Click to expand it.
app/src/main/java/chat/rocket/android/createchannel/ui/CreateChannelFragment.kt
View file @
a6877b4e
...
...
@@ -227,7 +227,9 @@ class CreateChannelFragment : Fragment(), CreateChannelView, ActionMode.Callback
ui
{
recycler_view
.
layoutManager
=
LinearLayoutManager
(
context
,
RecyclerView
.
VERTICAL
,
false
)
recycler_view
.
addItemDecoration
(
DividerItemDecoration
(
it
,
DividerItemDecoration
.
HORIZONTAL
))
recycler_view
.
addItemDecoration
(
DividerItemDecoration
(
it
,
DividerItemDecoration
.
HORIZONTAL
)
)
recycler_view
.
adapter
=
adapter
}
}
...
...
app/src/main/java/chat/rocket/android/server/presentation/CheckServerPresenter.kt
View file @
a6877b4e
...
...
@@ -14,9 +14,11 @@ import chat.rocket.core.internal.rest.serverInfo
import
kotlinx.coroutines.experimental.Job
import
timber.log.Timber
abstract
class
CheckServerPresenter
constructor
(
private
val
strategy
:
CancelStrategy
,
abstract
class
CheckServerPresenter
constructor
(
private
val
strategy
:
CancelStrategy
,
private
val
factory
:
RocketChatClientFactory
,
private
val
view
:
VersionCheckView
)
{
private
val
view
:
VersionCheckView
)
{
private
lateinit
var
currentServer
:
String
private
lateinit
var
client
:
RocketChatClient
...
...
@@ -49,12 +51,8 @@ abstract class CheckServerPresenter constructor(private val strategy: CancelStra
}
catch
(
ex
:
Exception
)
{
Timber
.
d
(
ex
,
"Error getting server info"
)
when
(
ex
)
{
is
RocketChatInvalidProtocolException
->
{
view
.
errorInvalidProtocol
()
}
else
->
{
view
.
errorCheckingServerVersion
()
}
is
RocketChatInvalidProtocolException
->
view
.
errorInvalidProtocol
()
else
->
view
.
errorCheckingServerVersion
()
}
}
}
...
...
@@ -64,6 +62,7 @@ abstract class CheckServerPresenter constructor(private val strategy: CancelStra
val
thisServerVersion
=
serverInfo
.
version
val
isRequiredVersion
=
isRequiredServerVersion
(
thisServerVersion
)
val
isRecommendedVersion
=
isRecommendedServerVersion
(
thisServerVersion
)
return
if
(
isRequiredVersion
)
{
if
(
isRecommendedVersion
)
{
Timber
.
i
(
"Your version is nice! (Requires: 0.62.0, Yours: $thisServerVersion)"
)
...
...
@@ -81,7 +80,10 @@ abstract class CheckServerPresenter constructor(private val strategy: CancelStra
}
private
fun
isRecommendedServerVersion
(
version
:
String
):
Boolean
{
return
isMinimumVersion
(
version
,
getVersionDistilled
(
BuildConfig
.
RECOMMENDED_SERVER_VERSION
))
return
isMinimumVersion
(
version
,
getVersionDistilled
(
BuildConfig
.
RECOMMENDED_SERVER_VERSION
)
)
}
private
fun
isMinimumVersion
(
version
:
String
,
required
:
VersionInfo
):
Boolean
{
...
...
@@ -115,12 +117,14 @@ abstract class CheckServerPresenter constructor(private val strategy: CancelStra
val
major
=
getVersionNumber
(
split
,
0
)
val
minor
=
getVersionNumber
(
split
,
1
)
val
update
=
getVersionNumber
(
split
,
2
)
return
VersionInfo
(
major
=
major
,
minor
=
minor
,
update
=
update
,
release
=
release
,
full
=
version
)
full
=
version
)
}
private
fun
getVersionNumber
(
split
:
List
<
String
>,
index
:
Int
):
Int
{
...
...
@@ -133,7 +137,9 @@ abstract class CheckServerPresenter constructor(private val strategy: CancelStra
sealed
class
Version
(
val
version
:
String
)
{
data class
VersionOk
(
private
val
currentVersion
:
String
)
:
Version
(
currentVersion
)
data class
RecommendedVersionWarning
(
private
val
currentVersion
:
String
)
:
Version
(
currentVersion
)
data class
RecommendedVersionWarning
(
private
val
currentVersion
:
String
)
:
Version
(
currentVersion
)
data class
OutOfDateError
(
private
val
currentVersion
:
String
)
:
Version
(
currentVersion
)
}
}
\ No newline at end of file
app/src/main/res/drawable/style_total_unread_messages.xml
View file @
a6877b4e
...
...
@@ -3,5 +3,4 @@
android:shape=
"oval"
>
<solid
android:color=
"@color/colorAccent"
/>
</shape>
app/src/main/res/layout/fragment_authentication_server.xml
View file @
a6877b4e
...
...
@@ -68,10 +68,12 @@
android:inputType=
"text|textUri"
/>
</RelativeLayout>
<Button
<
androidx.appcompat.widget.AppCompat
Button
android:id=
"@+id/button_connect"
style=
"@style/Authentication.Button"
android:layout_marginTop=
"20dp"
android:backgroundTint=
"@color/colorAuthenticationOnBoardingButtonDisabled"
android:enabled=
"false"
android:text=
"@string/action_connect"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
...
...
app/src/main/res/values/colors.xml
View file @
a6877b4e
...
...
@@ -24,6 +24,7 @@
<!-- Authentication colors -->
<color
name=
"colorAuthenticationOnBoardingButtonBorder"
>
#FFE1E5E8
</color>
<color
name=
"colorAuthenticationOnBoardingButtonDisabled"
>
#FFE1E5E8
</color>
<color
name=
"colorAuthenticationOnBoardingChevron"
>
#FFCBCED1
</color>
<color
name=
"colorAuthenticationOnBoardingSecondaryText"
>
#FF9EA2A8
</color>
...
...
app/src/main/res/values/strings.xml
View file @
a6877b4e
...
...
@@ -131,7 +131,7 @@ https://github.com/RocketChat/java-code-styles/blob/master/CODING_STYLE.md#strin
<string
name=
"msg_no_chat_title"
>
No chat messages
</string>
<string
name=
"msg_no_chat_description"
>
Start conversing to see your\nmessages here.
</string>
<string
name=
"msg_cancel"
>
CANCEL
</string>
<string
name=
"msg_http_insecure"
>
When using HTTP
,
you\'re connecting to an insecure server. We don\'t recommend you doing that.
</string>
<string
name=
"msg_http_insecure"
>
When using HTTP you\'re connecting to an insecure server. We don\'t recommend you doing that.
</string>
<string
name=
"msg_error_checking_server_version"
>
An error has occurred while checking your server version, please try again
</string>
<string
name=
"msg_invalid_server_protocol"
>
The selected protocol is not accepted by this server, try using HTTPS
</string>
<string
name=
"msg_image_saved_successfully"
>
Image has been saved to gallery
</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