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
ef8a4f4a
Commit
ef8a4f4a
authored
Aug 22, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor Analytics code.
parent
b4cb004e
Changes
34
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
436 additions
and
187 deletions
+436
-187
AboutFragment.kt
...c/main/java/chat/rocket/android/about/ui/AboutFragment.kt
+3
-2
LoginPresenter.kt
...droid/authentication/login/presentation/LoginPresenter.kt
+11
-10
LoginFragment.kt
...t/rocket/android/authentication/login/ui/LoginFragment.kt
+3
-2
RegisterUsernamePresenter.kt
...egisterusername/presentation/RegisterUsernamePresenter.kt
+14
-4
RegisterUsernameFragment.kt
...ntication/registerusername/ui/RegisterUsernameFragment.kt
+3
-2
ResetPasswordFragment.kt
.../authentication/resetpassword/ui/ResetPasswordFragment.kt
+3
-2
ServerFragment.kt
...rocket/android/authentication/server/ui/ServerFragment.kt
+3
-2
SignupPresenter.kt
...oid/authentication/signup/presentation/SignupPresenter.kt
+20
-7
SignupFragment.kt
...rocket/android/authentication/signup/ui/SignupFragment.kt
+11
-5
TwoFAPresenter.kt
...d/authentication/twofactor/presentation/TwoFAPresenter.kt
+6
-5
TwoFAFragment.kt
...cket/android/authentication/twofactor/ui/TwoFAFragment.kt
+19
-7
MessageInfoFragment.kt
.../rocket/android/chatinformation/ui/MessageInfoFragment.kt
+3
-4
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+35
-4
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+3
-2
ChatRoomsFragment.kt
...ava/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
+3
-2
CreateChannelFragment.kt
.../rocket/android/createchannel/ui/CreateChannelFragment.kt
+3
-2
FavoriteMessagesFragment.kt
...t/android/favoritemessages/ui/FavoriteMessagesFragment.kt
+3
-2
FilesFragment.kt
...c/main/java/chat/rocket/android/files/ui/FilesFragment.kt
+3
-2
MemberBottomSheetFragment.kt
...at/rocket/android/members/ui/MemberBottomSheetFragment.kt
+19
-11
MembersFragment.kt
...in/java/chat/rocket/android/members/ui/MembersFragment.kt
+3
-2
MentionsFragment.kt
.../java/chat/rocket/android/mentions/ui/MentionsFragment.kt
+3
-2
PinnedMessagesFragment.kt
...ocket/android/pinnedmessages/ui/PinnedMessagesFragment.kt
+7
-6
PreferencesFragment.kt
...chat/rocket/android/preferences/ui/PreferencesFragment.kt
+4
-3
ProfileFragment.kt
...in/java/chat/rocket/android/profile/ui/ProfileFragment.kt
+8
-3
ChangeServerPresenter.kt
...cket/android/server/presentation/ChangeServerPresenter.kt
+9
-3
PasswordFragment.kt
...t/rocket/android/settings/password/ui/PasswordFragment.kt
+26
-12
SettingsFragment.kt
.../java/chat/rocket/android/settings/ui/SettingsFragment.kt
+3
-2
AnswersEvent.kt
...foss/java/chat/rocket/android/util/helper/AnswersEvent.kt
+0
-77
AnalyticsManager.kt
.../rocket/android/util/helper/analytics/AnalyticsManager.kt
+32
-0
Analytics.kt
...va/chat/rocket/android/util/helper/analytics/Analytics.kt
+62
-0
AnalyticsManager.kt
.../rocket/android/util/helper/analytics/AnalyticsManager.kt
+69
-0
AuthenticationEvent.kt
...ndroid/util/helper/analytics/event/AuthenticationEvent.kt
+9
-0
ScreenViewEvent.kt
...et/android/util/helper/analytics/event/ScreenViewEvent.kt
+26
-0
SubscriptionTypeEvent.kt
...roid/util/helper/analytics/event/SubscriptionTypeEvent.kt
+7
-0
No files found.
app/src/main/java/chat/rocket/android/about/ui/AboutFragment.kt
View file @
ef8a4f4a
...
...
@@ -9,7 +9,8 @@ import chat.rocket.android.BuildConfig
import
chat.rocket.android.R
import
chat.rocket.android.main.ui.MainActivity
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
kotlinx.android.synthetic.main.app_bar.*
import
kotlinx.android.synthetic.main.fragment_about.*
import
javax.inject.Inject
...
...
@@ -32,7 +33,7 @@ class AboutFragment : Fragment() {
setupViews
()
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_ABOUT_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
About
)
}
}
...
...
app/src/main/java/chat/rocket/android/authentication/login/presentation/LoginPresenter.kt
View file @
ef8a4f4a
...
...
@@ -18,7 +18,8 @@ import chat.rocket.android.util.extensions.parseColor
import
chat.rocket.android.util.extensions.registerPushToken
import
chat.rocket.android.util.extensions.samlUrl
import
chat.rocket.android.util.extensions.serverLogoUrl
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.AuthenticationEvent
import
chat.rocket.android.util.retryIO
import
chat.rocket.common.RocketChatAuthException
import
chat.rocket.common.RocketChatException
...
...
@@ -77,7 +78,7 @@ class LoginPresenter @Inject constructor(
private
lateinit
var
credentialSecret
:
String
private
lateinit
var
deepLinkUserId
:
String
private
lateinit
var
deepLinkToken
:
String
private
lateinit
var
loginMethod
:
String
// For Answers Log In event.
private
lateinit
var
loginMethod
:
AuthenticationEvent
fun
setupView
()
{
setupConnectionInfo
(
currentServer
)
...
...
@@ -99,7 +100,7 @@ class LoginPresenter @Inject constructor(
else
->
{
this
.
usernameOrEmail
=
usernameOrEmail
this
.
password
=
password
loginMethod
=
A
nswersEvent
.
LOGIN_OR_SIGN_UP_BY_USER_AND_PASSWORD
loginMethod
=
A
uthenticationEvent
.
AuthenticationWithUserAndPassword
doAuthentication
(
TYPE_LOGIN_USER_EMAIL
)
}
}
...
...
@@ -107,20 +108,20 @@ class LoginPresenter @Inject constructor(
fun
authenticateWithCas
(
casToken
:
String
)
{
credentialToken
=
casToken
loginMethod
=
A
nswersEvent
.
LOGIN_BY_CAS
loginMethod
=
A
uthenticationEvent
.
AuthenticationWithCas
doAuthentication
(
TYPE_LOGIN_CAS
)
}
fun
authenticateWithSaml
(
samlToken
:
String
)
{
credentialToken
=
samlToken
loginMethod
=
A
nswersEvent
.
LOGIN_BY_SAML
loginMethod
=
A
uthenticationEvent
.
AuthenticationWithSaml
doAuthentication
(
TYPE_LOGIN_SAML
)
}
fun
authenticateWithOauth
(
oauthToken
:
String
,
oauthSecret
:
String
)
{
credentialToken
=
oauthToken
credentialSecret
=
oauthSecret
loginMethod
=
A
nswersEvent
.
LOGIN_OR_SIGN_UP_BY_OAUTH
loginMethod
=
A
uthenticationEvent
.
AuthenticationWithOauth
doAuthentication
(
TYPE_LOGIN_OAUTH
)
}
...
...
@@ -131,7 +132,7 @@ class LoginPresenter @Inject constructor(
deepLinkUserId
=
deepLinkInfo
.
userId
deepLinkToken
=
deepLinkInfo
.
token
tokenRepository
.
save
(
serverUrl
,
Token
(
deepLinkUserId
,
deepLinkToken
))
loginMethod
=
A
nswersEvent
.
LOGIN_BY_DEEP_LINK
loginMethod
=
A
uthenticationEvent
.
AuthenticationWithDeeplink
doAuthentication
(
TYPE_LOGIN_DEEP_LINK
)
}
else
{
// If we don't have the login credentials, just go through normal setup and user input.
...
...
@@ -432,7 +433,7 @@ class LoginPresenter @Inject constructor(
if
(
myself
.
id
==
deepLinkUserId
)
{
Token
(
deepLinkUserId
,
deepLinkToken
)
}
else
{
throw
RocketChatAuthException
(
"Invalid Authentication Deep Link Credentials..."
)
throw
RocketChatAuthException
(
"Invalid Authentication
Event
Deep Link Credentials..."
)
}
}
else
->
{
...
...
@@ -457,7 +458,7 @@ class LoginPresenter @Inject constructor(
saveToken
(
token
)
registerPushToken
()
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logLogin
(
loginMethod
,
true
)
An
alyticsManager
.
logLogin
(
loginMethod
,
true
)
}
if
(
loginType
==
TYPE_LOGIN_USER_EMAIL
)
{
view
.
saveSmartLockCredentials
(
usernameOrEmail
,
password
)
...
...
@@ -473,7 +474,7 @@ class LoginPresenter @Inject constructor(
}
else
->
{
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logLogin
(
loginMethod
,
false
)
An
alyticsManager
.
logLogin
(
loginMethod
,
false
)
}
exception
.
message
?.
let
{
view
.
showMessage
(
it
)
...
...
app/src/main/java/chat/rocket/android/authentication/login/ui/LoginFragment.kt
View file @
ef8a4f4a
...
...
@@ -25,7 +25,8 @@ import chat.rocket.android.authentication.login.presentation.LoginView
import
chat.rocket.android.helper.*
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extensions.*
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
chat.rocket.android.webview.sso.ui.INTENT_SSO_TOKEN
import
chat.rocket.android.webview.sso.ui.ssoWebViewIntent
import
chat.rocket.android.webview.oauth.ui.INTENT_OAUTH_CREDENTIAL_SECRET
...
...
@@ -97,7 +98,7 @@ class LoginFragment : Fragment(), LoginView {
}
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_LOGIN_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
Login
)
}
}
...
...
app/src/main/java/chat/rocket/android/authentication/registerusername/presentation/RegisterUsernamePresenter.kt
View file @
ef8a4f4a
...
...
@@ -3,14 +3,24 @@ package chat.rocket.android.authentication.registerusername.presentation
import
chat.rocket.android.authentication.presentation.AuthenticationNavigator
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.infrastructure.LocalRepository
import
chat.rocket.android.server.domain.*
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.server.domain.GetAccountsInteractor
import
chat.rocket.android.server.domain.GetConnectingServerInteractor
import
chat.rocket.android.server.domain.GetSettingsInteractor
import
chat.rocket.android.server.domain.PublicSettings
import
chat.rocket.android.server.domain.SaveAccountInteractor
import
chat.rocket.android.server.domain.SaveCurrentServerInteractor
import
chat.rocket.android.server.domain.TokenRepository
import
chat.rocket.android.server.domain.favicon
import
chat.rocket.android.server.domain.model.Account
import
chat.rocket.android.server.domain.wideTile
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.android.util.extension.launchUI
import
chat.rocket.android.util.extensions.avatarUrl
import
chat.rocket.android.util.extensions.registerPushToken
import
chat.rocket.android.util.extensions.serverLogoUrl
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.AuthenticationEvent
import
chat.rocket.android.util.retryIO
import
chat.rocket.common.RocketChatException
import
chat.rocket.common.model.Token
...
...
@@ -54,13 +64,13 @@ class RegisterUsernamePresenter @Inject constructor(
tokenRepository
.
save
(
currentServer
,
Token
(
userId
,
authToken
))
registerPushToken
()
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logSignUp
(
AnswersEvent
.
LOGIN_OR_SIGN_UP_BY_OAUTH
,
true
)
An
alyticsManager
.
logSignUp
(
AuthenticationEvent
.
AuthenticationWithOauth
,
true
)
}
navigator
.
toChatList
()
}
}
catch
(
exception
:
RocketChatException
)
{
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logSignUp
(
AnswersEvent
.
LOGIN_OR_SIGN_UP_BY_OAUTH
,
false
)
An
alyticsManager
.
logSignUp
(
AuthenticationEvent
.
AuthenticationWithOauth
,
false
)
}
exception
.
message
?.
let
{
view
.
showMessage
(
it
)
...
...
app/src/main/java/chat/rocket/android/authentication/registerusername/ui/RegisterUsernameFragment.kt
View file @
ef8a4f4a
...
...
@@ -12,7 +12,8 @@ import chat.rocket.android.authentication.registerusername.presentation.Register
import
chat.rocket.android.authentication.registerusername.presentation.RegisterUsernameView
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extensions.*
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_authentication_register_username.*
import
javax.inject.Inject
...
...
@@ -69,7 +70,7 @@ class RegisterUsernameFragment : Fragment(), RegisterUsernameView {
setupOnClickListener
()
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_REGISTER_USERNAME_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
RegisterUsername
)
}
}
...
...
app/src/main/java/chat/rocket/android/authentication/resetpassword/ui/ResetPasswordFragment.kt
View file @
ef8a4f4a
...
...
@@ -13,7 +13,8 @@ import chat.rocket.android.authentication.resetpassword.presentation.ResetPasswo
import
chat.rocket.android.authentication.resetpassword.presentation.ResetPasswordView
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extensions.*
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_authentication_reset_password.*
import
javax.inject.Inject
...
...
@@ -52,7 +53,7 @@ class ResetPasswordFragment : Fragment(), ResetPasswordView {
setupOnClickListener
()
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_RESET_PASSWORD_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
ResetPassword
)
}
}
...
...
app/src/main/java/chat/rocket/android/authentication/server/ui/ServerFragment.kt
View file @
ef8a4f4a
...
...
@@ -18,7 +18,8 @@ import chat.rocket.android.authentication.server.presentation.ServerView
import
chat.rocket.android.helper.KeyboardHelper
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extensions.*
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
chat.rocket.common.util.ifNull
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_authentication_server.*
...
...
@@ -97,7 +98,7 @@ class ServerFragment : Fragment(), ServerView {
}
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_SERVER_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
Server
)
}
}
...
...
app/src/main/java/chat/rocket/android/authentication/signup/presentation/SignupPresenter.kt
View file @
ef8a4f4a
...
...
@@ -3,12 +3,25 @@ package chat.rocket.android.authentication.signup.presentation
import
chat.rocket.android.authentication.presentation.AuthenticationNavigator
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.infrastructure.LocalRepository
import
chat.rocket.android.server.domain.*
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.server.domain.GetAccountsInteractor
import
chat.rocket.android.server.domain.GetConnectingServerInteractor
import
chat.rocket.android.server.domain.GetSettingsInteractor
import
chat.rocket.android.server.domain.PublicSettings
import
chat.rocket.android.server.domain.SaveAccountInteractor
import
chat.rocket.android.server.domain.SaveCurrentServerInteractor
import
chat.rocket.android.server.domain.favicon
import
chat.rocket.android.server.domain.model.Account
import
chat.rocket.android.server.domain.wideTile
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.android.util.extension.launchUI
import
chat.rocket.android.util.extensions.*
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.extensions.avatarUrl
import
chat.rocket.android.util.extensions.privacyPolicyUrl
import
chat.rocket.android.util.extensions.registerPushToken
import
chat.rocket.android.util.extensions.serverLogoUrl
import
chat.rocket.android.util.extensions.termsOfServiceUrl
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.AuthenticationEvent
import
chat.rocket.android.util.retryIO
import
chat.rocket.common.RocketChatException
import
chat.rocket.common.util.ifNull
...
...
@@ -69,8 +82,8 @@ class SignupPresenter @Inject constructor(
saveAccount
(
me
)
registerPushToken
()
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logSignUp
(
A
nswersEvent
.
LOGIN_OR_SIGN_UP_BY_USER_AND_PASSWORD
,
An
alyticsManager
.
logSignUp
(
A
uthenticationEvent
.
AuthenticationWithUserAndPassword
,
true
)
}
...
...
@@ -78,8 +91,8 @@ class SignupPresenter @Inject constructor(
navigator
.
toChatList
()
}
catch
(
exception
:
RocketChatException
)
{
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logSignUp
(
A
nswersEvent
.
LOGIN_OR_SIGN_UP_BY_USER_AND_PASSWORD
,
An
alyticsManager
.
logSignUp
(
A
uthenticationEvent
.
AuthenticationWithUserAndPassword
,
false
)
}
...
...
app/src/main/java/chat/rocket/android/authentication/signup/ui/SignupFragment.kt
View file @
ef8a4f4a
...
...
@@ -5,12 +5,12 @@ import android.app.Activity
import
android.content.Intent
import
android.os.Build
import
android.os.Bundle
import
androidx.fragment.app.Fragment
import
android.text.style.ClickableSpan
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewTreeObserver
import
androidx.fragment.app.Fragment
import
chat.rocket.android.R
import
chat.rocket.android.R.string.message_credentials_saved_successfully
import
chat.rocket.android.authentication.signup.presentation.SignupPresenter
...
...
@@ -19,8 +19,14 @@ import chat.rocket.android.helper.KeyboardHelper
import
chat.rocket.android.helper.TextHelper
import
chat.rocket.android.helper.saveCredentials
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extensions.*
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.extensions.setVisible
import
chat.rocket.android.util.extensions.shake
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.textContent
import
chat.rocket.android.util.extensions.ui
import
chat.rocket.android.util.extensions.vibrateSmartPhone
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_authentication_sign_up.*
import
javax.inject.Inject
...
...
@@ -76,8 +82,8 @@ class SignupFragment : Fragment(), SignupView {
)
}
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_SIGNUP_FRAGMENT
)
if
(
analyticsTrackingInteractor
.
get
())
{
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
SignUp
)
}
}
...
...
app/src/main/java/chat/rocket/android/authentication/twofactor/presentation/TwoFAPresenter.kt
View file @
ef8a4f4a
...
...
@@ -10,7 +10,8 @@ import chat.rocket.android.util.extension.launchUI
import
chat.rocket.android.util.extensions.avatarUrl
import
chat.rocket.android.util.extensions.registerPushToken
import
chat.rocket.android.util.extensions.serverLogoUrl
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.AuthenticationEvent
import
chat.rocket.android.util.retryIO
import
chat.rocket.common.RocketChatAuthException
import
chat.rocket.common.RocketChatException
...
...
@@ -68,8 +69,8 @@ class TwoFAPresenter @Inject constructor(
tokenRepository
.
save
(
server
,
token
)
registerPushToken
()
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logLogin
(
A
nswersEvent
.
LOGIN_OR_SIGN_UP_BY_USER_AND_PASSWORD
,
An
alyticsManager
.
logLogin
(
A
uthenticationEvent
.
AuthenticationWithUserAndPassword
,
true
)
}
...
...
@@ -79,8 +80,8 @@ class TwoFAPresenter @Inject constructor(
view
.
alertInvalidTwoFactorAuthenticationCode
()
}
else
{
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logLogin
(
A
nswersEvent
.
LOGIN_OR_SIGN_UP_BY_USER_AND_PASSWORD
,
An
alyticsManager
.
logLogin
(
A
uthenticationEvent
.
AuthenticationWithUserAndPassword
,
false
)
}
...
...
app/src/main/java/chat/rocket/android/authentication/twofactor/ui/TwoFAFragment.kt
View file @
ef8a4f4a
...
...
@@ -4,17 +4,24 @@ import DrawableHelper
import
android.content.Context
import
android.os.Build
import
android.os.Bundle
import
androidx.fragment.app.Fragment
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.view.inputmethod.InputMethodManager
import
androidx.fragment.app.Fragment
import
chat.rocket.android.R
import
chat.rocket.android.authentication.twofactor.presentation.TwoFAPresenter
import
chat.rocket.android.authentication.twofactor.presentation.TwoFAView
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extensions.*
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.setVisible
import
chat.rocket.android.util.extensions.shake
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.textContent
import
chat.rocket.android.util.extensions.ui
import
chat.rocket.android.util.extensions.vibrateSmartPhone
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_authentication_two_fa.*
import
javax.inject.Inject
...
...
@@ -38,7 +45,11 @@ class TwoFAFragment : Fragment(), TwoFAView {
password
=
arguments
?.
getString
(
PASSWORD
)
?:
""
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
=
container
?.
inflate
(
R
.
layout
.
fragment_authentication_two_fa
)
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
?
=
container
?.
inflate
(
R
.
layout
.
fragment_authentication_two_fa
)
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
...
...
@@ -55,8 +66,8 @@ class TwoFAFragment : Fragment(), TwoFAView {
setupOnClickListener
()
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_TWO_FA_FRAGMENT
)
if
(
analyticsTrackingInteractor
.
get
())
{
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
TwoFa
)
}
}
...
...
@@ -101,7 +112,8 @@ class TwoFAFragment : Fragment(), TwoFAView {
private
fun
tintEditTextDrawableStart
()
{
ui
{
val
lockDrawable
=
DrawableHelper
.
getDrawableFromId
(
R
.
drawable
.
ic_vpn_key_black_24dp
,
it
)
val
lockDrawable
=
DrawableHelper
.
getDrawableFromId
(
R
.
drawable
.
ic_vpn_key_black_24dp
,
it
)
DrawableHelper
.
wrapDrawable
(
lockDrawable
)
DrawableHelper
.
tintDrawable
(
lockDrawable
,
it
,
R
.
color
.
colorDrawableTintGrey
)
DrawableHelper
.
compoundDrawable
(
text_two_factor_auth
,
lockDrawable
)
...
...
app/src/main/java/chat/rocket/android/chatinformation/ui/MessageInfoFragment.kt
View file @
ef8a4f4a
...
...
@@ -13,12 +13,11 @@ import chat.rocket.android.chatinformation.adapter.ReadReceiptAdapter
import
chat.rocket.android.chatinformation.presentation.MessageInfoPresenter
import
chat.rocket.android.chatinformation.presentation.MessageInfoView
import
chat.rocket.android.chatinformation.viewmodel.ReadReceiptViewModel
import
chat.rocket.android.helper.EndlessRecyclerViewScrollListener
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extensions.setVisible
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.helper.
AnswersEvent
import
chat.rocket.
core.model.ReadReceip
t
import
chat.rocket.android.util.helper.
analytics.AnalyticsManager
import
chat.rocket.
android.util.helper.analytics.event.ScreenViewEven
t
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_message_info.*
import
javax.inject.Inject
...
...
@@ -69,7 +68,7 @@ class MessageInfoFragment : Fragment(), MessageInfoView {
presenter
.
loadReadReceipts
(
messageId
=
messageId
)
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_MESSAGE_INFO_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
MessageInfo
)
}
}
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
ef8a4f4a
...
...
@@ -34,7 +34,8 @@ import chat.rocket.android.server.infraestructure.state
import
chat.rocket.android.util.extension.compressImageAndGetInputStream
import
chat.rocket.android.util.extension.launchUI
import
chat.rocket.android.util.extensions.avatarUrl
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.SubscriptionTypeEvent
import
chat.rocket.android.util.retryIO
import
chat.rocket.common.RocketChatException
import
chat.rocket.common.model.RoomType
...
...
@@ -300,7 +301,7 @@ class ChatRoomPresenter @Inject constructor(
)
client
.
sendMessage
(
id
,
chatRoomId
,
text
)
if
(
analyticsTrackingInteractor
.
get
())
{
AnswersEvent
.
logMessageSent
(
chatRoomType
,
currentServer
)
logMessageSent
(
currentServer
)
}
}
catch
(
ex
:
Exception
)
{
// Ok, not very beautiful, but the backend sends us a not valid response
...
...
@@ -370,7 +371,7 @@ class ChatRoomPresenter @Inject constructor(
}
}
if
(
analyticsTrackingInteractor
.
get
())
{
AnswersEvent
.
logMediaUploaded
(
chatRoomType
,
mimeType
)
logMediaUploaded
(
mimeType
)
}
}
}
...
...
@@ -944,7 +945,7 @@ class ChatRoomPresenter @Inject constructor(
client
.
toggleReaction
(
messageId
,
emoji
.
removeSurrounding
(
":"
))
}
if
(
analyticsTrackingInteractor
.
get
())
{
AnswersEvent
.
logReaction
(
chatRoomType
)
logReactionEvent
(
)
}
}
catch
(
ex
:
RocketChatException
)
{
Timber
.
e
(
ex
)
...
...
@@ -952,6 +953,36 @@ class ChatRoomPresenter @Inject constructor(
}
}
private
fun
logReactionEvent
()
{
when
{
roomTypeOf
(
chatRoomType
)
is
RoomType
.
DirectMessage
->
AnalyticsManager
.
logReaction
(
SubscriptionTypeEvent
.
DirectMessage
)
roomTypeOf
(
chatRoomType
)
is
RoomType
.
Channel
->
AnalyticsManager
.
logReaction
(
SubscriptionTypeEvent
.
Channel
)
else
->
AnalyticsManager
.
logReaction
(
SubscriptionTypeEvent
.
Group
)
}
}
private
fun
logMediaUploaded
(
mimeType
:
String
)
{
when
{
roomTypeOf
(
chatRoomType
)
is
RoomType
.
DirectMessage
->
AnalyticsManager
.
logMediaUploaded
(
SubscriptionTypeEvent
.
DirectMessage
,
mimeType
)
roomTypeOf
(
chatRoomType
)
is
RoomType
.
Channel
->
AnalyticsManager
.
logMediaUploaded
(
SubscriptionTypeEvent
.
Channel
,
mimeType
)
else
->
AnalyticsManager
.
logMediaUploaded
(
SubscriptionTypeEvent
.
Group
,
mimeType
)
}
}
private
fun
logMessageSent
(
serverUrl
:
String
)
{
when
{
roomTypeOf
(
chatRoomType
)
is
RoomType
.
DirectMessage
->
AnalyticsManager
.
logMessageSent
(
SubscriptionTypeEvent
.
DirectMessage
,
serverUrl
)
roomTypeOf
(
chatRoomType
)
is
RoomType
.
Channel
->
AnalyticsManager
.
logMessageSent
(
SubscriptionTypeEvent
.
Channel
,
serverUrl
)
else
->
AnalyticsManager
.
logMessageSent
(
SubscriptionTypeEvent
.
Group
,
serverUrl
)
}
}
fun
showReactions
(
messageId
:
String
)
{
view
.
showReactionsPopup
(
messageId
)
}
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
ef8a4f4a
...
...
@@ -66,7 +66,8 @@ import chat.rocket.android.util.extensions.rotateBy
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.textContent
import
chat.rocket.android.util.extensions.ui
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
chat.rocket.common.model.RoomType
import
chat.rocket.common.model.roomTypeOf
import
chat.rocket.core.internal.realtime.socket.model.State
...
...
@@ -236,7 +237,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_CHAT_ROOM_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
ChatRoom
)
}
}
...
...
app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
View file @
ef8a4f4a
...
...
@@ -39,7 +39,8 @@ import chat.rocket.android.util.extensions.fadeOut
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.ui
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
chat.rocket.android.widget.DividerItemDecoration
import
chat.rocket.core.internal.realtime.socket.model.State
import
dagger.android.support.AndroidSupportInjection
...
...
@@ -112,7 +113,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
setupToolbar
()
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_CHAT_ROOMS_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
ChatRooms
)
}
}
...
...
app/src/main/java/chat/rocket/android/createchannel/ui/CreateChannelFragment.kt
View file @
ef8a4f4a
...
...
@@ -25,7 +25,8 @@ import chat.rocket.android.util.extension.asObservable
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.ui
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
chat.rocket.common.model.RoomType
import
chat.rocket.common.model.roomTypeOf
import
com.google.android.material.chip.Chip
...
...
@@ -77,7 +78,7 @@ class CreateChannelFragment : Fragment(), CreateChannelView, ActionMode.Callback
subscribeEditTexts
()
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_CREATE_CHANNEL_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
CreateChannel
)
}
}
...
...
app/src/main/java/chat/rocket/android/favoritemessages/ui/FavoriteMessagesFragment.kt
View file @
ef8a4f4a
...
...
@@ -20,7 +20,8 @@ import chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.ui
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_favorite_messages.*
import
javax.inject.Inject
...
...
@@ -68,7 +69,7 @@ class FavoriteMessagesFragment : Fragment(), FavoriteMessagesView {
presenter
.
loadFavoriteMessages
(
chatRoomId
)
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_FAVORITE_MESSAGES_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
FavoriteMessages
)
}
}
...
...
app/src/main/java/chat/rocket/android/files/ui/FilesFragment.kt
View file @
ef8a4f4a
...
...
@@ -25,7 +25,8 @@ import chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.ui
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_files.*
import
javax.inject.Inject
...
...
@@ -75,7 +76,7 @@ class FilesFragment : Fragment(), FilesView {
presenter
.
loadFiles
(
chatRoomId
)
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_FILES_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
Files
)
}
}
...
...
app/src/main/java/chat/rocket/android/members/ui/MemberBottomSheetFragment.kt
View file @
ef8a4f4a
package
chat.rocket.android.members.ui
import
android.os.Bundle
import
com.google.android.material.bottomsheet.BottomSheetDialogFragment
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
...
...
@@ -10,15 +9,19 @@ import chat.rocket.android.R
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extensions.content
import
chat.rocket.android.util.extensions.textContent
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
com.google.android.material.bottomsheet.BottomSheetDialogFragment
import
kotlinx.android.synthetic.main.fragment_member_bottom_sheet.*
import
javax.inject.Inject
fun
newInstance
(
avatarUri
:
String
,
realName
:
String
,
username
:
String
,
email
:
String
,
utcOffset
:
String
):
BottomSheetDialogFragment
{
fun
newInstance
(
avatarUri
:
String
,
realName
:
String
,
username
:
String
,
email
:
String
,
utcOffset
:
String
):
BottomSheetDialogFragment
{
return
MemberBottomSheetFragment
().
apply
{
arguments
=
Bundle
(
1
).
apply
{
putString
(
BUNDLE_AVATAR_URI
,
avatarUri
)
...
...
@@ -38,7 +41,7 @@ private const val BUNDLE_USERNAME = "username"
private
const
val
BUNDLE_EMAIL
=
"email"
private
const
val
BUNDLE_UTC_OFFSET
=
"utc_offset"
class
MemberBottomSheetFragment
:
BottomSheetDialogFragment
()
{
class
MemberBottomSheetFragment
:
BottomSheetDialogFragment
()
{
@Inject
lateinit
var
analyticsTrackingInteractor
:
AnalyticsTrackingInteractor
private
lateinit
var
avatarUri
:
String
...
...
@@ -61,7 +64,12 @@ class MemberBottomSheetFragment: BottomSheetDialogFragment() {
requireNotNull
(
bundle
)
{
"no arguments supplied when the fragment was instantiated"
}
}
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
=
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
?
=
inflater
.
inflate
(
R
.
layout
.
fragment_member_bottom_sheet
,
container
,
false
)
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
...
...
@@ -69,7 +77,7 @@ class MemberBottomSheetFragment: BottomSheetDialogFragment() {
showMemberDetails
()
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_MEMBER_BOTTOM_SHEET_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
MemberBottomSheet
)
}
}
...
...
@@ -85,7 +93,7 @@ class MemberBottomSheetFragment: BottomSheetDialogFragment() {
text_member_email_address
.
isVisible
=
false
}
if
(
utcOffset
.
isNotEmpty
()){
if
(
utcOffset
.
isNotEmpty
())
{
text_member_utc
.
content
=
utcOffset
}
else
{
text_utc
.
isVisible
=
false
...
...
app/src/main/java/chat/rocket/android/members/ui/MembersFragment.kt
View file @
ef8a4f4a
...
...
@@ -20,7 +20,8 @@ import chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.ui
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_members.*
import
javax.inject.Inject
...
...
@@ -70,7 +71,7 @@ class MembersFragment : Fragment(), MembersView {
presenter
.
loadChatRoomsMembers
(
chatRoomId
)
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_MEMBERS_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
Members
)
}
}
...
...
app/src/main/java/chat/rocket/android/mentions/ui/MentionsFragment.kt
View file @
ef8a4f4a
...
...
@@ -20,7 +20,8 @@ import chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.ui
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_mentions.*
import
javax.inject.Inject
...
...
@@ -70,7 +71,7 @@ class MentionsFragment : Fragment(), MentionsView {
presenter
.
loadMentions
(
chatRoomId
)
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_MENTIONS_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
Mentions
)
}
}
...
...
app/src/main/java/chat/rocket/android/pinnedmessages/ui/PinnedMessagesFragment.kt
View file @
ef8a4f4a
package
chat.rocket.android.pinnedmessages.ui
import
android.os.Bundle
import
androidx.fragment.app.Fragment
import
androidx.recyclerview.widget.DefaultItemAnimator
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
androidx.core.view.isVisible
import
androidx.fragment.app.Fragment
import
androidx.recyclerview.widget.DefaultItemAnimator
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
chat.rocket.android.R
import
chat.rocket.android.chatroom.adapter.ChatRoomAdapter
import
chat.rocket.android.chatroom.ui.ChatRoomActivity
...
...
@@ -20,7 +20,8 @@ import chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.ui
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_pinned_messages.*
import
javax.inject.Inject
...
...
@@ -69,7 +70,7 @@ class PinnedMessagesFragment : Fragment(), PinnedMessagesView {
presenter
.
loadPinnedMessages
(
chatRoomId
)
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_PINNED_MESSAGES_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
PinnedMessages
)
}
}
...
...
app/src/main/java/chat/rocket/android/preferences/ui/PreferencesFragment.kt
View file @
ef8a4f4a
...
...
@@ -11,7 +11,8 @@ import chat.rocket.android.main.ui.MainActivity
import
chat.rocket.android.preferences.presentation.PreferencesPresenter
import
chat.rocket.android.preferences.presentation.PreferencesView
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.app_bar.*
import
kotlinx.android.synthetic.main.fragment_preferences.*
...
...
@@ -42,8 +43,8 @@ class PreferencesFragment : Fragment(), PreferencesView {
setupListeners
()
presenter
.
loadAnalyticsTrackingInformation
()
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_PREFERENCES_FRAGMENT
)
if
(
analyticsTrackingInteractor
.
get
())
{
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
Preferences
)
}
}
...
...
app/src/main/java/chat/rocket/android/profile/ui/ProfileFragment.kt
View file @
ef8a4f4a
...
...
@@ -6,7 +6,11 @@ import android.content.Intent
import
android.graphics.Bitmap
import
android.os.Build
import
android.os.Bundle
import
android.view.*
import
android.view.LayoutInflater
import
android.view.Menu
import
android.view.MenuItem
import
android.view.View
import
android.view.ViewGroup
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.view.ActionMode
import
androidx.core.net.toUri
...
...
@@ -24,7 +28,8 @@ import chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.textContent
import
chat.rocket.android.util.extensions.ui
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
com.facebook.drawee.backends.pipeline.Fresco
import
dagger.android.support.AndroidSupportInjection
import
io.reactivex.disposables.CompositeDisposable
...
...
@@ -77,7 +82,7 @@ class ProfileFragment : Fragment(), ProfileView, ActionMode.Callback {
subscribeEditTexts
()
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_PROFILE_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
Profile
)
}
}
...
...
app/src/main/java/chat/rocket/android/server/presentation/ChangeServerPresenter.kt
View file @
ef8a4f4a
...
...
@@ -2,10 +2,16 @@ package chat.rocket.android.server.presentation
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.infrastructure.LocalRepository
import
chat.rocket.android.server.domain.*
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.server.domain.GetAccountInteractor
import
chat.rocket.android.server.domain.GetAccountsInteractor
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.SaveCurrentServerInteractor
import
chat.rocket.android.server.domain.SettingsRepository
import
chat.rocket.android.server.domain.TokenRepository
import
chat.rocket.android.server.infraestructure.ConnectionManagerFactory
import
chat.rocket.android.util.extension.launchUI
import
chat.rocket.android.util.helper.
AnswersEvent
import
chat.rocket.android.util.helper.
analytics.AnalyticsManager
import
chat.rocket.common.util.ifNull
import
javax.inject.Inject
...
...
@@ -61,7 +67,7 @@ class ChangeServerPresenter @Inject constructor(
saveCurrentServerInteractor
.
save
(
serverUrl
)
view
.
hideProgress
()
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logServerSwitch
(
serverUrl
,
accounts
.
size
)
An
alyticsManager
.
logServerSwitch
(
serverUrl
,
accounts
.
size
)
}
navigator
.
toChatRooms
(
chatRoomId
)
}.
ifNull
{
...
...
app/src/main/java/chat/rocket/android/settings/password/ui/PasswordFragment.kt
View file @
ef8a4f4a
package
chat.rocket.android.settings.password.ui
import
android.os.Bundle
import
androidx.fragment.app.Fragment
import
android.view.*
import
android.view.LayoutInflater
import
android.view.Menu
import
android.view.MenuItem
import
android.view.View
import
android.view.ViewGroup
import
android.widget.Toast
import
androidx.appcompat.view.ActionMode
import
androidx.fragment.app.Fragment
import
chat.rocket.android.R
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.settings.password.presentation.PasswordPresenter
import
chat.rocket.android.settings.password.presentation.PasswordView
import
chat.rocket.android.util.extensions.inflate
import
androidx.appcompat.view.ActionMode
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extension.asObservable
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.textContent
import
chat.rocket.android.util.extensions.ui
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
dagger.android.support.AndroidSupportInjection
import
io.reactivex.disposables.CompositeDisposable
import
io.reactivex.disposables.Disposable
...
...
@@ -23,7 +28,7 @@ import javax.inject.Inject
internal
const
val
TAG_PASSWORD_FRAGMENT
=
"PasswordFragment"
class
PasswordFragment
:
Fragment
(),
PasswordView
,
ActionMode
.
Callback
{
class
PasswordFragment
:
Fragment
(),
PasswordView
,
ActionMode
.
Callback
{
@Inject
lateinit
var
presenter
:
PasswordPresenter
@Inject
...
...
@@ -40,7 +45,11 @@ class PasswordFragment: Fragment(), PasswordView, ActionMode.Callback {
super
.
onCreate
(
savedInstanceState
)
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
=
container
?.
inflate
(
R
.
layout
.
fragment_password
)
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
?
=
container
?.
inflate
(
R
.
layout
.
fragment_password
)
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
...
...
@@ -48,7 +57,7 @@ class PasswordFragment: Fragment(), PasswordView, ActionMode.Callback {
disposables
.
add
(
listenToChanges
())
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_PASSWORD_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
Password
)
}
}
...
...
@@ -109,12 +118,17 @@ class PasswordFragment: Fragment(), PasswordView, ActionMode.Callback {
private
fun
finishActionMode
()
=
actionMode
?.
finish
()
private
fun
listenToChanges
():
Disposable
{
return
Observables
.
combineLatest
(
text_new_password
.
asObservable
(),
text_confirm_password
.
asObservable
()).
subscribe
{
return
Observables
.
combineLatest
(
text_new_password
.
asObservable
(),
text_confirm_password
.
asObservable
()
).
subscribe
{
val
textPassword
=
text_new_password
.
textContent
val
textConfirmPassword
=
text_confirm_password
.
textContent
if
(
textPassword
.
length
>
5
&&
textConfirmPassword
.
length
>
5
&&
textPassword
.
equals
(
textConfirmPassword
))
if
(
textPassword
.
length
>
5
&&
textConfirmPassword
.
length
>
5
&&
textPassword
.
equals
(
textConfirmPassword
)
)
startActionMode
()
else
finishActionMode
()
...
...
app/src/main/java/chat/rocket/android/settings/ui/SettingsFragment.kt
View file @
ef8a4f4a
...
...
@@ -19,7 +19,8 @@ import chat.rocket.android.settings.password.ui.PasswordActivity
import
chat.rocket.android.settings.presentation.SettingsView
import
chat.rocket.android.util.extensions.addFragmentBackStack
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.helper.AnswersEvent
import
chat.rocket.android.util.helper.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
kotlinx.android.synthetic.main.fragment_settings.*
import
javax.inject.Inject
import
kotlin.reflect.KClass
...
...
@@ -42,7 +43,7 @@ class SettingsFragment : Fragment(), SettingsView, AdapterView.OnItemClickListen
setupListView
()
if
(
analyticsTrackingInteractor
.
get
())
{
An
swersEvent
.
logScreenView
(
TAG_SETTINGS_FRAGMENT
)
An
alyticsManager
.
logScreenView
(
ScreenViewEvent
.
Settings
)
}
}
...
...
util/src/foss/java/chat/rocket/android/util/helper/AnswersEvent.kt
deleted
100644 → 0
View file @
b4cb004e
package
chat.rocket.android.util.helper
object
AnswersEvent
{
const
val
LOGIN_OR_SIGN_UP_BY_USER_AND_PASSWORD
=
"USER-AND-PASSWORD"
const
val
LOGIN_BY_CAS
=
"CAS"
const
val
LOGIN_BY_SAML
=
"SAML"
const
val
LOGIN_OR_SIGN_UP_BY_OAUTH
=
"OAUTH"
const
val
LOGIN_BY_DEEP_LINK
=
"DEEP-LINK"
/**
* Logs the Log In event.
*
* @param loginMethod The method that the user used to log in.
* @param loginSucceeded True if the user successful logged in, false otherwise.
*/
fun
logLogin
(
loginMethod
:
String
,
loginSucceeded
:
Boolean
)
{
// Do absolutely nothing
}
/**
* Logs the Sign Up event.
*
* @param signUpMethod The method that the user used to sign up.
* @param signUpSucceeded True if the user successful signed up, false otherwise.
*/
fun
logSignUp
(
signUpMethod
:
String
,
signUpSucceeded
:
Boolean
)
{
// Do absolutely nothing
}
/**
* Logs the screen view custom event.
*
* @param screenName The name of the screen to log.
*/
fun
logScreenView
(
screenName
:
String
)
{
// Do absolutely nothing
}
/**
* Logs the message sent custom event.
*
* @param roomType The room type to log.
* @param serverUrl The server URL to log.
*/
fun
logMessageSent
(
roomType
:
String
,
serverUrl
:
String
)
{
// Do absolutely nothing
}
/**
* Logs the media upload custom event.
*
* @param roomType The room type to log.
* @param mimeType The mime type of the media to log.
*/
fun
logMediaUploaded
(
roomType
:
String
,
mimeType
:
String
)
{
// Do absolutely nothing
}
/**
* Logs the reaction custom event.
*
* @param roomType The room type to log.
*/
fun
logReaction
(
roomType
:
String
)
{
// Do absolutely nothing
}
/**
* Logs the server switch custom event.
*
* @param serverUrl The server URL to log.
* @param serverCount The number of server(s) the use own.
*/
fun
logServerSwitch
(
serverUrl
:
String
,
serverCount
:
Int
)
{
// Do absolutely nothing
}
}
\ No newline at end of file
util/src/foss/java/chat/rocket/android/util/helper/analytics/AnalyticsManager.kt
0 → 100644
View file @
ef8a4f4a
package
chat.rocket.android.util.helper.analytics
object
AnalyticsManager
:
Analytics
{
override
fun
logLogin
(
event
:
AuthenticationEvent
,
loginSucceeded
:
Boolean
)
{
// Do absolutely nothing
}
override
fun
logSignUp
(
event
:
AuthenticationEvent
,
signUpSucceeded
:
Boolean
)
{
// Do absolutely nothing
}
override
fun
logScreenView
(
event
:
ScreenViewEvent
)
{
// Do absolutely nothing
}
override
fun
logMessageSent
(
event
:
SubscriptionTypeEvent
,
serverUrl
:
String
)
{
// Do absolutely nothing
}
override
fun
logMediaUploaded
(
event
:
SubscriptionTypeEvent
,
mimeType
:
String
)
{
// Do absolutely nothing
}
override
fun
logReaction
(
event
:
SubscriptionTypeEvent
)
{
// Do absolutely nothing
}
override
fun
logServerSwitch
(
serverUrl
:
String
,
serverCount
:
Int
)
{
// Do absolutely nothing
}
}
util/src/play/java/chat/rocket/android/util/helper/analytics/Analytics.kt
0 → 100644
View file @
ef8a4f4a
package
chat.rocket.android.util.helper.analytics
import
chat.rocket.android.util.helper.analytics.event.AuthenticationEvent
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
chat.rocket.android.util.helper.analytics.event.SubscriptionTypeEvent
interface
Analytics
{
/**
* Logs the login event.
*
* @param event The [AuthenticationEvent] used to log in.
* @param loginSucceeded True if successful logged in, false otherwise.
*/
fun
logLogin
(
event
:
AuthenticationEvent
,
loginSucceeded
:
Boolean
)
/**
* Logs the sign up event.
*
* @param event The [AuthenticationEvent] used to sign up.
* @param signUpSucceeded True if successful signed up, false otherwise.
*/
fun
logSignUp
(
event
:
AuthenticationEvent
,
signUpSucceeded
:
Boolean
)
/**
* Logs the screen view event.
*
* @param event The [ScreenViewEvent] to log.
*/
fun
logScreenView
(
event
:
ScreenViewEvent
)
/**
* Logs the message sent event.
*
* @param event The [SubscriptionTypeEvent] to log.
* @param serverUrl The server URL to log.
*/
fun
logMessageSent
(
event
:
SubscriptionTypeEvent
,
serverUrl
:
String
)
/**
* Logs the media upload event.
*
* @param event The [SubscriptionTypeEvent] to log.
* @param mimeType The mime type of the media uploaded to log.
*/
fun
logMediaUploaded
(
event
:
SubscriptionTypeEvent
,
mimeType
:
String
)
/**
* Logs the reaction event.
*
* @param event The [SubscriptionTypeEvent] to log.
*/
fun
logReaction
(
event
:
SubscriptionTypeEvent
)
/**
* Logs the server switch event.
*
* @param serverUrl The server URL to log.
* @param serverCount The number of server(s) the use own.
*/
fun
logServerSwitch
(
serverUrl
:
String
,
serverCount
:
Int
)
}
util/src/play/java/chat/rocket/android/util/helper/
AnswersEvent
.kt
→
util/src/play/java/chat/rocket/android/util/helper/
analytics/AnalyticsManager
.kt
View file @
ef8a4f4a
package
chat.rocket.android.util.helper
package
chat.rocket.android.util.helper
.analytics
import
chat.rocket.android.util.helper.analytics.event.AuthenticationEvent
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
chat.rocket.android.util.helper.analytics.event.SubscriptionTypeEvent
import
com.crashlytics.android.answers.Answers
import
com.crashlytics.android.answers.CustomEvent
import
com.crashlytics.android.answers.LoginEvent
import
com.crashlytics.android.answers.SignUpEvent
object
AnswersEvent
{
const
val
LOGIN_OR_SIGN_UP_BY_USER_AND_PASSWORD
=
"USER-AND-PASSWORD"
const
val
LOGIN_BY_CAS
=
"CAS"
const
val
LOGIN_BY_SAML
=
"SAML"
const
val
LOGIN_OR_SIGN_UP_BY_OAUTH
=
"OAUTH"
const
val
LOGIN_BY_DEEP_LINK
=
"DEEP-LINK"
// TODO inject the and analyticsTrackingInteractor and GetCurrentServerInteractor
object
AnalyticsManager
:
Analytics
{
/**
* Logs the Log In event.
*
* @param loginMethod The method that the user used to log in.
* @param loginSucceeded True if the user successful logged in, false otherwise.
*/
fun
logLogin
(
loginMethod
:
String
,
loginSucceeded
:
Boolean
)
=
override
fun
logLogin
(
event
:
AuthenticationEvent
,
loginSucceeded
:
Boolean
)
=
Answers
.
getInstance
()
.
logLogin
(
LoginEvent
()
.
putMethod
(
loginMethod
)
.
putMethod
(
event
.
methodName
)
.
putSuccess
(
loginSucceeded
)
)
/**
* Logs the Sign Up event.
*
* @param signUpMethod The method that the user used to sign up.
* @param signUpSucceeded True if the user successful signed up, false otherwise.
*/
fun
logSignUp
(
signUpMethod
:
String
,
signUpSucceeded
:
Boolean
)
=
override
fun
logSignUp
(
event
:
AuthenticationEvent
,
signUpSucceeded
:
Boolean
)
=
Answers
.
getInstance
()
.
logSignUp
(
SignUpEvent
()
.
putMethod
(
signUpMethod
)
.
putMethod
(
event
.
methodName
)
.
putSuccess
(
signUpSucceeded
)
)
/**
* Logs the screen view custom event.
*
* @param screenName The name of the screen to log.
*/
fun
logScreenView
(
screenName
:
String
)
=
override
fun
logScreenView
(
event
:
ScreenViewEvent
)
=
Answers
.
getInstance
()
.
logCustom
(
CustomEvent
(
"screen_view"
).
putCustomAttribute
(
"screen"
,
screenName
))
.
logCustom
(
CustomEvent
(
"screen_view"
).
putCustomAttribute
(
"screen"
,
event
.
screenName
))
/**
* Logs the message sent custom event.
*
* @param roomType The room type to log.
* @param serverUrl The server URL to log.
*/
fun
logMessageSent
(
roomType
:
String
,
serverUrl
:
String
)
=
override
fun
logMessageSent
(
event
:
SubscriptionTypeEvent
,
serverUrl
:
String
)
=
Answers
.
getInstance
()
.
logCustom
(
CustomEvent
(
"message_sent"
)
.
putCustomAttribute
(
"subscription_type"
,
roomTyp
e
)
.
putCustomAttribute
(
"subscription_type"
,
event
.
subscriptionTypeNam
e
)
.
putCustomAttribute
(
"server"
,
serverUrl
)
)
/**
* Logs the media upload custom event.
*
* @param roomType The room type to log.
* @param mimeType The mime type of the media to log.
*/
fun
logMediaUploaded
(
roomType
:
String
,
mimeType
:
String
)
=
override
fun
logMediaUploaded
(
event
:
SubscriptionTypeEvent
,
mimeType
:
String
)
=
Answers
.
getInstance
()
.
logCustom
(
CustomEvent
(
"media_upload"
)
.
putCustomAttribute
(
"subscription_type"
,
roomTyp
e
)
.
putCustomAttribute
(
"subscription_type"
,
event
.
subscriptionTypeNam
e
)
.
putCustomAttribute
(
"media_type"
,
mimeType
)
)
/**
* Logs the reaction custom event.
*
* @param roomType The room type to log.
*/
fun
logReaction
(
roomType
:
String
)
=
override
fun
logReaction
(
event
:
SubscriptionTypeEvent
)
=
Answers
.
getInstance
()
.
logCustom
(
CustomEvent
(
"reaction"
).
putCustomAttribute
(
"subscription_type"
,
roomType
)
CustomEvent
(
"reaction"
)
.
putCustomAttribute
(
"subscription_type"
,
event
.
subscriptionTypeName
)
)
/**
* Logs the server switch custom event.
*
* @param serverUrl The server URL to log.
* @param serverCount The number of server(s) the use own.
*/
fun
logServerSwitch
(
serverUrl
:
String
,
serverCount
:
Int
)
=
override
fun
logServerSwitch
(
serverUrl
:
String
,
serverCount
:
Int
)
=
Answers
.
getInstance
()
.
logCustom
(
CustomEvent
(
"server_switch"
)
.
putCustomAttribute
(
"server_url"
,
serverUrl
)
.
putCustomAttribute
(
"server_count"
,
serverCount
)
)
}
\ No newline at end of file
}
util/src/play/java/chat/rocket/android/util/helper/analytics/event/AuthenticationEvent.kt
0 → 100644
View file @
ef8a4f4a
package
chat.rocket.android.util.helper.analytics.event
sealed
class
AuthenticationEvent
(
val
methodName
:
String
)
{
object
AuthenticationWithUserAndPassword
:
AuthenticationEvent
(
"User and password"
)
object
AuthenticationWithCas
:
AuthenticationEvent
(
"CAS"
)
object
AuthenticationWithSaml
:
AuthenticationEvent
(
"SAML"
)
object
AuthenticationWithOauth
:
AuthenticationEvent
(
"Oauth"
)
object
AuthenticationWithDeeplink
:
AuthenticationEvent
(
"Deep link"
)
}
util/src/play/java/chat/rocket/android/util/helper/analytics/event/ScreenViewEvent.kt
0 → 100644
View file @
ef8a4f4a
package
chat.rocket.android.util.helper.analytics.event
sealed
class
ScreenViewEvent
(
val
screenName
:
String
)
{
object
About
:
ScreenViewEvent
(
"AboutFragment"
)
object
ChatRoom
:
ScreenViewEvent
(
"ChatRoomFragment"
)
object
ChatRooms
:
ScreenViewEvent
(
"ChatRoomsFragment"
)
object
CreateChannel
:
ScreenViewEvent
(
"CreateChannelFragment"
)
object
FavoriteMessages
:
ScreenViewEvent
(
"FavoriteMessagesFragment"
)
object
Files
:
ScreenViewEvent
(
"FilesFragment"
)
object
Login
:
ScreenViewEvent
(
"LoginFragment"
)
object
MemberBottomSheet
:
ScreenViewEvent
(
"MemberBottomSheetFragment"
)
object
Members
:
ScreenViewEvent
(
"MembersFragment"
)
object
Mentions
:
ScreenViewEvent
(
"MentionsFragment"
)
object
MessageInfo
:
ScreenViewEvent
(
"MessageInfoFragment"
)
object
Password
:
ScreenViewEvent
(
"PasswordFragment"
)
object
PinnedMessages
:
ScreenViewEvent
(
"PinnedMessagesFragment"
)
object
Preferences
:
ScreenViewEvent
(
"PreferencesFragment"
)
object
Profile
:
ScreenViewEvent
(
"ProfileFragment"
)
object
RegisterUsername
:
ScreenViewEvent
(
"RegisterUsernameFragment"
)
object
ResetPassword
:
ScreenViewEvent
(
"ResetPasswordFragment"
)
object
Server
:
ScreenViewEvent
(
"ServerFragment"
)
object
Settings
:
ScreenViewEvent
(
"SettingsFragment"
)
object
SignUp
:
ScreenViewEvent
(
"SignupFragment"
)
object
TwoFa
:
ScreenViewEvent
(
"TwoFAFragment"
)
}
\ No newline at end of file
util/src/play/java/chat/rocket/android/util/helper/analytics/event/SubscriptionTypeEvent.kt
0 → 100644
View file @
ef8a4f4a
package
chat.rocket.android.util.helper.analytics.event
sealed
class
SubscriptionTypeEvent
(
val
subscriptionTypeName
:
String
)
{
object
DirectMessage
:
SubscriptionTypeEvent
(
"Direct Message"
)
object
Channel
:
SubscriptionTypeEvent
(
"Channel"
)
object
Group
:
SubscriptionTypeEvent
(
"Group"
)
}
\ No newline at end of file
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