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
7e52ba15
Commit
7e52ba15
authored
Sep 26, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix login with deep link and activity lifecycle
parent
1a427032
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
48 additions
and
33 deletions
+48
-33
OnBoardingFragment.kt
...ndroid/authentication/onboarding/ui/OnBoardingFragment.kt
+2
-4
AuthenticationNavigator.kt
...id/authentication/presentation/AuthenticationNavigator.kt
+0
-6
AuthenticationPresenter.kt
...id/authentication/presentation/AuthenticationPresenter.kt
+2
-1
ServerPresenter.kt
...oid/authentication/server/presentation/ServerPresenter.kt
+1
-3
AuthenticationActivity.kt
...ocket/android/authentication/ui/AuthenticationActivity.kt
+30
-12
Animation.kt
...ain/java/chat/rocket/android/util/extensions/Animation.kt
+4
-2
RocketChatClient.kt
...a/chat/rocket/android/util/extensions/RocketChatClient.kt
+0
-2
fragment_authentication_login_options.xml
...main/res/layout/fragment_authentication_login_options.xml
+9
-3
No files found.
app/src/main/java/chat/rocket/android/authentication/onboarding/ui/OnBoardingFragment.kt
View file @
7e52ba15
...
...
@@ -22,6 +22,8 @@ import kotlinx.android.synthetic.main.app_bar.*
import
kotlinx.android.synthetic.main.fragment_authentication_on_boarding.*
import
javax.inject.Inject
fun
newInstance
()
=
OnBoardingFragment
()
class
OnBoardingFragment
:
Fragment
(),
OnBoardingView
{
@Inject
lateinit
var
presenter
:
OnBoardingPresenter
...
...
@@ -102,8 +104,4 @@ class OnBoardingFragment : Fragment(), OnBoardingView {
getString
(
R
.
string
.
create_server_url
)
)
}
companion
object
{
fun
newInstance
()
=
OnBoardingFragment
()
}
}
app/src/main/java/chat/rocket/android/authentication/presentation/AuthenticationNavigator.kt
View file @
7e52ba15
...
...
@@ -5,7 +5,6 @@ import chat.rocket.android.R
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.authentication.domain.model.LoginDeepLinkInfo
import
chat.rocket.android.authentication.ui.AuthenticationActivity
import
chat.rocket.android.authentication.ui.newServerIntent
import
chat.rocket.android.main.ui.MainActivity
import
chat.rocket.android.server.ui.changeServerIntent
import
chat.rocket.android.util.extensions.addFragmentBackStack
...
...
@@ -83,9 +82,4 @@ class AuthenticationNavigator(internal val activity: AuthenticationActivity) {
activity
.
startActivity
(
activity
.
changeServerIntent
(
serverUrl
))
activity
.
finish
()
}
fun
toServerScreen
()
{
activity
.
startActivity
(
activity
.
newServerIntent
())
activity
.
finish
()
}
}
app/src/main/java/chat/rocket/android/authentication/presentation/AuthenticationPresenter.kt
View file @
7e52ba15
...
...
@@ -42,7 +42,6 @@ class AuthenticationPresenter @Inject constructor(
callback
(
false
)
}
else
{
callback
(
true
)
navigator
.
toChatList
()
}
}
}
...
...
@@ -52,4 +51,6 @@ class AuthenticationPresenter @Inject constructor(
fun
privacyPolicy
(
toolbarTitle
:
String
)
=
serverInteractor
.
get
()
?.
let
{
navigator
.
toWebPage
(
it
.
privacyPolicyUrl
(),
toolbarTitle
)
}
fun
toChatList
()
=
navigator
.
toChatList
()
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/authentication/server/presentation/ServerPresenter.kt
View file @
7e52ba15
...
...
@@ -64,9 +64,7 @@ class ServerPresenter @Inject constructor(
fun
deepLink
(
deepLinkInfo
:
LoginDeepLinkInfo
)
{
connectToServer
(
deepLinkInfo
.
url
)
{
navigator
.
toLoginOptions
(
deepLinkInfo
.
url
,
deepLinkInfo
)
navigator
.
toLoginOptions
(
deepLinkInfo
.
url
,
deepLinkInfo
)
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/authentication/ui/AuthenticationActivity.kt
View file @
7e52ba15
...
...
@@ -9,14 +9,17 @@ import androidx.appcompat.app.AppCompatActivity
import
androidx.fragment.app.Fragment
import
chat.rocket.android.R
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.authentication.onboarding.ui.OnBoardingFragment
import
chat.rocket.android.authentication.domain.model.LoginDeepLinkInfo
import
chat.rocket.android.authentication.domain.model.getLoginDeepLinkInfo
import
chat.rocket.android.authentication.presentation.AuthenticationPresenter
import
chat.rocket.android.util.extensions.addFragment
import
chat.rocket.common.util.ifNull
import
dagger.android.AndroidInjection
import
dagger.android.AndroidInjector
import
dagger.android.DispatchingAndroidInjector
import
dagger.android.support.HasSupportFragmentInjector
import
kotlinx.android.synthetic.main.app_bar.*
import
kotlinx.coroutines.experimental.Job
import
javax.inject.Inject
class
AuthenticationActivity
:
AppCompatActivity
(),
HasSupportFragmentInjector
{
...
...
@@ -24,12 +27,14 @@ class AuthenticationActivity : AppCompatActivity(), HasSupportFragmentInjector {
lateinit
var
fragmentDispatchingAndroidInjector
:
DispatchingAndroidInjector
<
Fragment
>
@Inject
lateinit
var
presenter
:
AuthenticationPresenter
val
job
=
Job
()
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
AndroidInjection
.
inject
(
this
)
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_authentication
)
setupToolbar
()
loadCredentials
()
}
private
fun
setupToolbar
()
{
...
...
@@ -41,11 +46,6 @@ class AuthenticationActivity : AppCompatActivity(), HasSupportFragmentInjector {
supportActionBar
?.
setDisplayShowTitleEnabled
(
false
)
}
override
fun
onStart
()
{
super
.
onStart
()
loadCredentials
()
}
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
val
currentFragment
=
supportFragmentManager
.
findFragmentById
(
R
.
id
.
fragment_container
)
...
...
@@ -69,23 +69,41 @@ class AuthenticationActivity : AppCompatActivity(), HasSupportFragmentInjector {
}
private
fun
loadCredentials
()
{
val
newServer
=
intent
.
getBooleanExtra
(
INTENT_ADD_NEW_SERVER
,
false
)
presenter
.
loadCredentials
(
newServer
)
{
isAuthenticated
->
if
(!
isAuthenticated
)
{
showOnBoarding
()
intent
.
getLoginDeepLinkInfo
()
?.
let
{
showServerFragment
(
it
)
}.
ifNull
{
val
newServer
=
intent
.
getBooleanExtra
(
INTENT_ADD_NEW_SERVER
,
false
)
presenter
.
loadCredentials
(
newServer
)
{
isAuthenticated
->
if
(
isAuthenticated
)
{
showChatList
()
}
else
{
showOnBoardingFragment
()
}
}
}
}
private
fun
showOnBoarding
()
{
private
fun
showOnBoarding
Fragment
()
{
addFragment
(
ScreenViewEvent
.
OnBoarding
.
screenName
,
R
.
id
.
fragment_container
,
allowStateLoss
=
true
)
{
OnBoardingFragment
.
newInstance
()
chat
.
rocket
.
android
.
authentication
.
onboarding
.
ui
.
newInstance
()
}
}
private
fun
showServerFragment
(
deepLinkInfo
:
LoginDeepLinkInfo
)
{
addFragment
(
ScreenViewEvent
.
Server
.
screenName
,
R
.
id
.
fragment_container
,
allowStateLoss
=
true
)
{
chat
.
rocket
.
android
.
authentication
.
server
.
ui
.
newInstance
(
deepLinkInfo
)
}
}
private
fun
showChatList
()
=
presenter
.
toChatList
()
}
const
val
INTENT_ADD_NEW_SERVER
=
"INTENT_ADD_NEW_SERVER"
...
...
app/src/main/java/chat/rocket/android/util/extensions/Animation.kt
View file @
7e52ba15
...
...
@@ -27,7 +27,8 @@ fun View.fadeIn(startValue: Float = 0f, finishValue: Float = 1f, duration: Long
animate
()
.
alpha
(
finishValue
)
.
setDuration
(
duration
/
2
)
.
setInterpolator
(
AccelerateInterpolator
()).
start
()
.
setInterpolator
(
AccelerateInterpolator
())
.
start
()
}.
start
()
isVisible
=
true
...
...
@@ -47,7 +48,8 @@ fun View.fadeOut(startValue: Float = 1f, finishValue: Float = 0f, duration: Long
animate
()
.
alpha
(
finishValue
)
.
setDuration
(
duration
)
.
setInterpolator
(
AccelerateInterpolator
()).
start
()
.
setInterpolator
(
AccelerateInterpolator
())
.
start
()
}.
start
()
isVisible
=
false
...
...
app/src/main/java/chat/rocket/android/util/extensions/RocketChatClient.kt
View file @
7e52ba15
...
...
@@ -3,10 +3,8 @@ package chat.rocket.android.util.extensions
import
chat.rocket.android.server.domain.model.Account
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.android.util.retryIO
import
chat.rocket.core.RocketChatClient
import
chat.rocket.core.internal.rest.registerPushToken
import
kotlinx.coroutines.experimental.CommonPool
import
kotlinx.coroutines.experimental.launch
import
kotlinx.coroutines.experimental.withContext
import
timber.log.Timber
...
...
app/src/main/res/layout/fragment_authentication_login_options.xml
View file @
7e52ba15
...
...
@@ -33,9 +33,11 @@
android:textAllCaps=
"false"
android:textColor=
"@color/colorPrimary"
android:textSize=
"16sp"
android:visibility=
"gone"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"parent"
tools:visibility=
"visible"
/>
<Button
android:id=
"@+id/button_github"
...
...
@@ -53,9 +55,11 @@
android:textAllCaps=
"false"
android:textColor=
"@color/colorPrimary"
android:textSize=
"16sp"
android:visibility=
"gone"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/button_facebook"
/>
app:layout_constraintTop_toBottomOf=
"@+id/button_facebook"
tools:visibility=
"visible"
/>
<Button
android:id=
"@+id/button_google"
...
...
@@ -73,9 +77,11 @@
android:textAllCaps=
"false"
android:textColor=
"@color/colorPrimary"
android:textSize=
"16sp"
android:visibility=
"gone"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/button_github"
/>
app:layout_constraintTop_toBottomOf=
"@+id/button_github"
tools:visibility=
"visible"
/>
<Button
android:id=
"@+id/button_linkedin"
...
...
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