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
03e702cb
Commit
03e702cb
authored
Aug 06, 2018
by
Lucio Maciel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move smartlock to Play flavor...
parent
3c260fe3
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
86 additions
and
21 deletions
+86
-21
build.gradle
app/build.gradle
+3
-3
ActivityKt.kt
app/src/foss/java/chat/rocket/android/helper/ActivityKt.kt
+14
-0
AboutFragment.kt
...c/main/java/chat/rocket/android/about/ui/AboutFragment.kt
+2
-0
LoginView.kt
...et/android/authentication/login/presentation/LoginView.kt
+0
-1
LoginFragment.kt
...t/rocket/android/authentication/login/ui/LoginFragment.kt
+19
-12
SignupView.kt
.../android/authentication/signup/presentation/SignupView.kt
+0
-1
SignupFragment.kt
...rocket/android/authentication/signup/ui/SignupFragment.kt
+2
-3
fragment_about.xml
app/src/main/res/layout/fragment_about.xml
+12
-0
fragment_authentication_log_in.xml
app/src/main/res/layout/fragment_authentication_log_in.xml
+1
-0
strings.xml
app/src/main/res/values/strings.xml
+3
-1
ActivityKt.kt
app/src/play/java/chat/rocket/android/helper/ActivityKt.kt
+30
-0
SmartLockHelper.kt
...c/play/java/chat/rocket/android/helper/SmartLockHelper.kt
+0
-0
No files found.
app/build.gradle
View file @
03e702cb
...
@@ -108,9 +108,6 @@ dependencies {
...
@@ -108,9 +108,6 @@ dependencies {
kapt
libraries
.
daggerProcessor
kapt
libraries
.
daggerProcessor
kapt
libraries
.
daggerAndroidApt
kapt
libraries
.
daggerAndroidApt
playImplementation
libraries
.
fcm
playImplementation
libraries
.
playServicesAuth
implementation
libraries
.
room
implementation
libraries
.
room
kapt
libraries
.
roomProcessor
kapt
libraries
.
roomProcessor
implementation
libraries
.
lifecycleExtensions
implementation
libraries
.
lifecycleExtensions
...
@@ -143,6 +140,9 @@ dependencies {
...
@@ -143,6 +140,9 @@ dependencies {
implementation
"com.github.luciofm:livedata-ktx:b1e8bbc25a"
implementation
"com.github.luciofm:livedata-ktx:b1e8bbc25a"
playImplementation
libraries
.
fcm
playImplementation
libraries
.
playServicesAuth
playImplementation
(
'com.crashlytics.sdk.android:crashlytics:2.9.4@aar'
)
{
playImplementation
(
'com.crashlytics.sdk.android:crashlytics:2.9.4@aar'
)
{
transitive
=
true
transitive
=
true
}
}
...
...
app/src/foss/java/chat/rocket/android/helper/ActivityKt.kt
0 → 100644
View file @
03e702cb
package
chat.rocket.android.helper
import
android.app.Activity
import
android.content.Intent
import
androidx.fragment.app.FragmentActivity
fun
FragmentActivity
.
saveCredentials
(
id
:
String
,
password
:
String
)
{
}
fun
Activity
.
requestStoredCredentials
():
Pair
<
String
,
String
>?
=
null
fun
getCredentials
(
data
:
Intent
):
Pair
<
String
,
String
>?
=
null
fun
hasCredentialsSupport
()
=
false
\ No newline at end of file
app/src/main/java/chat/rocket/android/about/ui/AboutFragment.kt
View file @
03e702cb
...
@@ -4,6 +4,7 @@ import android.os.Bundle
...
@@ -4,6 +4,7 @@ import android.os.Bundle
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
androidx.core.view.isVisible
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.Fragment
import
chat.rocket.android.BuildConfig
import
chat.rocket.android.BuildConfig
import
chat.rocket.android.R
import
chat.rocket.android.R
...
@@ -31,6 +32,7 @@ class AboutFragment : Fragment() {
...
@@ -31,6 +32,7 @@ class AboutFragment : Fragment() {
private
fun
setupViews
()
{
private
fun
setupViews
()
{
text_version_name
.
text
=
getString
(
R
.
string
.
msg_version
,
BuildConfig
.
VERSION_NAME
)
text_version_name
.
text
=
getString
(
R
.
string
.
msg_version
,
BuildConfig
.
VERSION_NAME
)
text_build_number
.
text
=
getString
(
R
.
string
.
msg_build
,
BuildConfig
.
VERSION_CODE
)
text_build_number
.
text
=
getString
(
R
.
string
.
msg_build
,
BuildConfig
.
VERSION_CODE
)
text_foss
.
isVisible
=
BuildConfig
.
FLAVOR
==
"foss"
}
}
private
fun
setupToolbar
()
{
private
fun
setupToolbar
()
{
...
...
app/src/main/java/chat/rocket/android/authentication/login/presentation/LoginView.kt
View file @
03e702cb
...
@@ -2,7 +2,6 @@ package chat.rocket.android.authentication.login.presentation
...
@@ -2,7 +2,6 @@ package chat.rocket.android.authentication.login.presentation
import
chat.rocket.android.core.behaviours.LoadingView
import
chat.rocket.android.core.behaviours.LoadingView
import
chat.rocket.android.core.behaviours.MessageView
import
chat.rocket.android.core.behaviours.MessageView
import
com.google.android.gms.auth.api.credentials.Credential
interface
LoginView
:
LoadingView
,
MessageView
{
interface
LoginView
:
LoadingView
,
MessageView
{
...
...
app/src/main/java/chat/rocket/android/authentication/login/ui/LoginFragment.kt
View file @
03e702cb
...
@@ -30,11 +30,13 @@ import chat.rocket.android.webview.oauth.ui.INTENT_OAUTH_CREDENTIAL_SECRET
...
@@ -30,11 +30,13 @@ import chat.rocket.android.webview.oauth.ui.INTENT_OAUTH_CREDENTIAL_SECRET
import
chat.rocket.android.webview.oauth.ui.INTENT_OAUTH_CREDENTIAL_TOKEN
import
chat.rocket.android.webview.oauth.ui.INTENT_OAUTH_CREDENTIAL_TOKEN
import
chat.rocket.android.webview.oauth.ui.oauthWebViewIntent
import
chat.rocket.android.webview.oauth.ui.oauthWebViewIntent
import
chat.rocket.common.util.ifNull
import
chat.rocket.common.util.ifNull
import
com.google.android.gms.auth.api.credentials.*
import
dagger.android.support.AndroidSupportInjection
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_authentication_log_in.*
import
kotlinx.android.synthetic.main.fragment_authentication_log_in.*
import
javax.inject.Inject
import
javax.inject.Inject
internal
const
val
REQUEST_CODE_FOR_SIGN_IN_REQUIRED
=
1
internal
const
val
REQUEST_CODE_FOR_MULTIPLE_ACCOUNTS_RESOLUTION
=
2
internal
const
val
REQUEST_CODE_FOR_SAVE_RESOLUTION
=
3
internal
const
val
REQUEST_CODE_FOR_CAS
=
4
internal
const
val
REQUEST_CODE_FOR_CAS
=
4
internal
const
val
REQUEST_CODE_FOR_SAML
=
5
internal
const
val
REQUEST_CODE_FOR_SAML
=
5
internal
const
val
REQUEST_CODE_FOR_OAUTH
=
6
internal
const
val
REQUEST_CODE_FOR_OAUTH
=
6
...
@@ -48,7 +50,6 @@ class LoginFragment : Fragment(), LoginView {
...
@@ -48,7 +50,6 @@ class LoginFragment : Fragment(), LoginView {
}
}
private
var
isGlobalLayoutListenerSetUp
=
false
private
var
isGlobalLayoutListenerSetUp
=
false
private
var
deepLinkInfo
:
LoginDeepLinkInfo
?
=
null
private
var
deepLinkInfo
:
LoginDeepLinkInfo
?
=
null
private
val
credentialsClient
by
lazy
{
Credentials
.
getClient
(
requireActivity
())
}
companion
object
{
companion
object
{
private
const
val
DEEP_LINK_INFO
=
"DeepLinkInfo"
private
const
val
DEEP_LINK_INFO
=
"DeepLinkInfo"
...
@@ -85,6 +86,10 @@ class LoginFragment : Fragment(), LoginView {
...
@@ -85,6 +86,10 @@ class LoginFragment : Fragment(), LoginView {
}.
ifNull
{
}.
ifNull
{
presenter
.
setupView
()
presenter
.
setupView
()
}
}
if
(!
hasCredentialsSupport
())
{
image_key
.
isVisible
=
false
}
}
}
override
fun
onDestroyView
()
{
override
fun
onDestroyView
()
{
...
@@ -100,13 +105,15 @@ class LoginFragment : Fragment(), LoginView {
...
@@ -100,13 +105,15 @@ class LoginFragment : Fragment(), LoginView {
if
(
data
!=
null
)
{
if
(
data
!=
null
)
{
when
(
requestCode
)
{
when
(
requestCode
)
{
REQUEST_CODE_FOR_MULTIPLE_ACCOUNTS_RESOLUTION
->
{
REQUEST_CODE_FOR_MULTIPLE_ACCOUNTS_RESOLUTION
->
{
onCredentialRetrieved
(
data
.
getParcelableExtra
(
Credential
.
EXTRA_KEY
))
getCredentials
(
data
)
?.
let
{
onCredentialRetrieved
(
it
.
first
,
it
.
second
)
}
}
}
REQUEST_CODE_FOR_SIGN_IN_REQUIRED
->
{
REQUEST_CODE_FOR_SIGN_IN_REQUIRED
->
{
//use the hints to autofill sign in forms to reduce the info to be filled.
getCredentials
(
data
)
?.
let
{
credential
->
val
credential
:
Credential
=
data
.
getParcelableExtra
(
Credential
.
EXTRA_KEY
)
text_username_or_email
.
setText
(
credential
.
first
)
text_username_or_email
.
setText
(
credential
.
i
d
)
text_password
.
setText
(
credential
.
secon
d
)
text_password
.
setText
(
credential
.
password
)
}
}
}
REQUEST_CODE_FOR_SAVE_RESOLUTION
->
{
REQUEST_CODE_FOR_SAVE_RESOLUTION
->
{
showMessage
(
getString
(
R
.
string
.
message_credentials_saved_successfully
))
showMessage
(
getString
(
R
.
string
.
message_credentials_saved_successfully
))
...
@@ -154,19 +161,19 @@ class LoginFragment : Fragment(), LoginView {
...
@@ -154,19 +161,19 @@ class LoginFragment : Fragment(), LoginView {
private
fun
requestStoredCredentials
()
{
private
fun
requestStoredCredentials
()
{
activity
?.
let
{
activity
?.
let
{
SmartLockHelper
.
requestStoredCredentials
(
credentialsClient
,
it
)
?.
let
{
it
.
requestStoredCredentials
()
?.
let
{
credentials
->
onCredentialRetrieved
(
it
)
onCredentialRetrieved
(
credentials
.
first
,
credentials
.
second
)
}
}
}
}
}
}
private
fun
onCredentialRetrieved
(
credential
:
Credential
)
{
private
fun
onCredentialRetrieved
(
id
:
String
,
password
:
String
)
{
presenter
.
authenticateWithUserAndPassword
(
credential
.
id
,
credential
.
password
.
toString
()
)
presenter
.
authenticateWithUserAndPassword
(
id
,
password
)
}
}
override
fun
saveSmartLockCredentials
(
id
:
String
,
password
:
String
)
{
override
fun
saveSmartLockCredentials
(
id
:
String
,
password
:
String
)
{
activity
?.
let
{
activity
?.
let
{
SmartLockHelper
.
save
(
credentialsClient
,
it
,
id
,
password
)
it
.
saveCredentials
(
id
,
password
)
}
}
}
}
...
...
app/src/main/java/chat/rocket/android/authentication/signup/presentation/SignupView.kt
View file @
03e702cb
...
@@ -2,7 +2,6 @@ package chat.rocket.android.authentication.signup.presentation
...
@@ -2,7 +2,6 @@ package chat.rocket.android.authentication.signup.presentation
import
chat.rocket.android.core.behaviours.LoadingView
import
chat.rocket.android.core.behaviours.LoadingView
import
chat.rocket.android.core.behaviours.MessageView
import
chat.rocket.android.core.behaviours.MessageView
import
com.google.android.gms.auth.api.credentials.Credential
interface
SignupView
:
LoadingView
,
MessageView
{
interface
SignupView
:
LoadingView
,
MessageView
{
...
...
app/src/main/java/chat/rocket/android/authentication/signup/ui/SignupFragment.kt
View file @
03e702cb
...
@@ -16,10 +16,9 @@ import chat.rocket.android.R.string.message_credentials_saved_successfully
...
@@ -16,10 +16,9 @@ import chat.rocket.android.R.string.message_credentials_saved_successfully
import
chat.rocket.android.authentication.signup.presentation.SignupPresenter
import
chat.rocket.android.authentication.signup.presentation.SignupPresenter
import
chat.rocket.android.authentication.signup.presentation.SignupView
import
chat.rocket.android.authentication.signup.presentation.SignupView
import
chat.rocket.android.helper.KeyboardHelper
import
chat.rocket.android.helper.KeyboardHelper
import
chat.rocket.android.helper.SmartLockHelper
import
chat.rocket.android.helper.TextHelper
import
chat.rocket.android.helper.TextHelper
import
chat.rocket.android.helper.saveCredentials
import
chat.rocket.android.util.extensions.*
import
chat.rocket.android.util.extensions.*
import
com.google.android.gms.auth.api.credentials.Credentials
import
dagger.android.support.AndroidSupportInjection
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_authentication_sign_up.*
import
kotlinx.android.synthetic.main.fragment_authentication_sign_up.*
import
javax.inject.Inject
import
javax.inject.Inject
...
@@ -156,7 +155,7 @@ class SignupFragment : Fragment(), SignupView {
...
@@ -156,7 +155,7 @@ class SignupFragment : Fragment(), SignupView {
override
fun
saveSmartLockCredentials
(
id
:
String
,
password
:
String
)
{
override
fun
saveSmartLockCredentials
(
id
:
String
,
password
:
String
)
{
activity
?.
let
{
activity
?.
let
{
SmartLockHelper
.
save
(
Credentials
.
getClient
(
it
),
it
,
id
,
password
)
it
.
saveCredentials
(
id
,
password
)
}
}
}
}
...
...
app/src/main/res/layout/fragment_about.xml
View file @
03e702cb
...
@@ -48,4 +48,16 @@
...
@@ -48,4 +48,16 @@
android:layout_marginTop=
"8dp"
android:layout_marginTop=
"8dp"
android:textColor=
"@color/colorSecondaryText"
/>
android:textColor=
"@color/colorSecondaryText"
/>
<TextView
android:id=
"@+id/text_foss"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/foss"
android:visibility=
"gone"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/text_build_number"
android:layout_marginTop=
"8dp"
android:textColor=
"@color/colorSecondaryText"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
app/src/main/res/layout/fragment_authentication_log_in.xml
View file @
03e702cb
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
android:src=
"@drawable/ic_vpn_key_black_24dp"
android:src=
"@drawable/ic_vpn_key_black_24dp"
android:tint=
"@color/colorDrawableTintGrey"
android:tint=
"@color/colorDrawableTintGrey"
android:visibility=
"gone"
android:visibility=
"gone"
tools:visibility=
"visible"
app:layout_constraintBottom_toBottomOf=
"@+id/text_username_or_email"
app:layout_constraintBottom_toBottomOf=
"@+id/text_username_or_email"
app:layout_constraintEnd_toEndOf=
"@+id/text_username_or_email"
app:layout_constraintEnd_toEndOf=
"@+id/text_username_or_email"
app:layout_constraintTop_toTopOf=
"@+id/text_username_or_email"
/>
app:layout_constraintTop_toTopOf=
"@+id/text_username_or_email"
/>
...
...
app/src/main/res/values/strings.xml
View file @
03e702cb
<resources>
<resources
xmlns:tools=
"http://schemas.android.com/tools"
>
<string
name=
"app_name"
translatable=
"false"
>
Rocket.Chat
</string>
<string
name=
"app_name"
translatable=
"false"
>
Rocket.Chat
</string>
<!-- Titles -->
<!-- Titles -->
...
@@ -276,4 +276,6 @@
...
@@ -276,4 +276,6 @@
<string
name=
"notif_success_sending"
>
Message sent to %1$s!
</string>
<string
name=
"notif_success_sending"
>
Message sent to %1$s!
</string>
<string
name=
"read_by"
>
Read by
</string>
<string
name=
"read_by"
>
Read by
</string>
<string
name=
"message_information_title"
>
Message information
</string>
<string
name=
"message_information_title"
>
Message information
</string>
<string
name=
"foss"
tools:ignore=
"MissingTranslation"
>
(FOSS)
</string>
</resources>
</resources>
\ No newline at end of file
app/src/play/java/chat/rocket/android/helper/ActivityKt.kt
0 → 100644
View file @
03e702cb
package
chat.rocket.android.helper
import
android.app.Activity
import
android.content.Intent
import
androidx.fragment.app.FragmentActivity
import
com.google.android.gms.auth.api.credentials.Credential
import
com.google.android.gms.auth.api.credentials.Credentials
fun
FragmentActivity
.
saveCredentials
(
id
:
String
,
password
:
String
)
{
val
credentialsClient
=
Credentials
.
getClient
(
this
)
SmartLockHelper
.
save
(
credentialsClient
,
this
,
id
,
password
)
}
fun
Activity
.
requestStoredCredentials
():
Pair
<
String
,
String
>?
{
val
credentialsClient
=
Credentials
.
getClient
(
this
)
return
SmartLockHelper
.
requestStoredCredentials
(
credentialsClient
,
this
)
?.
let
{
null
}
}
fun
getCredentials
(
data
:
Intent
):
Pair
<
String
,
String
>?
{
val
credentials
:
Credential
=
data
.
getParcelableExtra
(
Credential
.
EXTRA_KEY
)
return
credentials
?.
let
{
cred
->
cred
.
password
?.
let
{
Pair
(
cred
.
id
,
it
)
}
}
}
fun
hasCredentialsSupport
()
=
true
\ No newline at end of file
app/src/
main
/java/chat/rocket/android/helper/SmartLockHelper.kt
→
app/src/
play
/java/chat/rocket/android/helper/SmartLockHelper.kt
View file @
03e702cb
File moved
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