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
8ce5d9d3
Commit
8ce5d9d3
authored
Aug 28, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the support for the Google Analytics For Firebase
parent
aaf1bedd
Changes
42
Hide whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
575 additions
and
370 deletions
+575
-370
AnswersAnalytics.kt
...ss/java/chat/rocket/android/analytics/AnswersAnalytics.kt
+5
-5
GoogleAnalyticsForFirebase.kt
...at/rocket/android/analytics/GoogleAnalyticsForFirebase.kt
+39
-0
AboutFragment.kt
...c/main/java/chat/rocket/android/about/ui/AboutFragment.kt
+4
-7
Analytics.kt
app/src/main/java/chat/rocket/android/analytics/Analytics.kt
+4
-4
AnalyticsManager.kt
...in/java/chat/rocket/android/analytics/AnalyticsManager.kt
+67
-0
AuthenticationEvent.kt
...hat/rocket/android/analytics/event/AuthenticationEvent.kt
+3
-1
ScreenViewEvent.kt
...va/chat/rocket/android/analytics/event/ScreenViewEvent.kt
+2
-2
SubscriptionTypeEvent.kt
...t/rocket/android/analytics/event/SubscriptionTypeEvent.kt
+3
-2
LoginPresenter.kt
...droid/authentication/login/presentation/LoginPresenter.kt
+5
-9
LoginFragment.kt
...t/rocket/android/authentication/login/ui/LoginFragment.kt
+19
-12
RegisterUsernamePresenter.kt
...egisterusername/presentation/RegisterUsernamePresenter.kt
+8
-10
RegisterUsernameFragment.kt
...ntication/registerusername/ui/RegisterUsernameFragment.kt
+13
-9
ResetPasswordFragment.kt
.../authentication/resetpassword/ui/ResetPasswordFragment.kt
+13
-9
ServerFragment.kt
...rocket/android/authentication/server/ui/ServerFragment.kt
+13
-9
SignupPresenter.kt
...oid/authentication/signup/presentation/SignupPresenter.kt
+11
-16
SignupFragment.kt
...rocket/android/authentication/signup/ui/SignupFragment.kt
+4
-7
TwoFAPresenter.kt
...d/authentication/twofactor/presentation/TwoFAPresenter.kt
+20
-16
TwoFAFragment.kt
...cket/android/authentication/twofactor/ui/TwoFAFragment.kt
+4
-7
MessageInfoFragment.kt
.../rocket/android/chatinformation/ui/MessageInfoFragment.kt
+4
-7
ChatRoomPresenter.kt
...rocket/android/chatroom/presentation/ChatRoomPresenter.kt
+16
-23
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+42
-29
ChatRoomsFragment.kt
...ava/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
+51
-30
CreateChannelFragment.kt
.../rocket/android/createchannel/ui/CreateChannelFragment.kt
+4
-7
AppModule.kt
.../main/java/chat/rocket/android/dagger/module/AppModule.kt
+80
-16
FavoriteMessagesFragment.kt
...t/android/favoritemessages/ui/FavoriteMessagesFragment.kt
+4
-7
FilesFragment.kt
...c/main/java/chat/rocket/android/files/ui/FilesFragment.kt
+4
-7
MemberBottomSheetFragment.kt
...at/rocket/android/members/ui/MemberBottomSheetFragment.kt
+4
-7
MembersFragment.kt
...in/java/chat/rocket/android/members/ui/MembersFragment.kt
+7
-10
MentionsFragment.kt
.../java/chat/rocket/android/mentions/ui/MentionsFragment.kt
+4
-7
PinnedMessagesFragment.kt
...ocket/android/pinnedmessages/ui/PinnedMessagesFragment.kt
+4
-6
PreferencesFragment.kt
...chat/rocket/android/preferences/ui/PreferencesFragment.kt
+6
-9
ProfileFragment.kt
...in/java/chat/rocket/android/profile/ui/ProfileFragment.kt
+4
-7
AccountsRepository.kt
...a/chat/rocket/android/server/domain/AccountsRepository.kt
+3
-3
GetAccountsInteractor.kt
...hat/rocket/android/server/domain/GetAccountsInteractor.kt
+1
-1
SharedPreferencesAccountsRepository.kt
...er/infraestructure/SharedPreferencesAccountsRepository.kt
+16
-22
ChangeServerPresenter.kt
...cket/android/server/presentation/ChangeServerPresenter.kt
+3
-6
PasswordFragment.kt
...t/rocket/android/settings/password/ui/PasswordFragment.kt
+4
-7
SettingsFragment.kt
.../java/chat/rocket/android/settings/ui/SettingsFragment.kt
+10
-8
AnswersAnalytics.kt
...ay/java/chat/rocket/android/analytics/AnswersAnalytics.kt
+5
-6
GoogleAnalyticsForFirebase.kt
...at/rocket/android/analytics/GoogleAnalyticsForFirebase.kt
+61
-0
dependencies.gradle
dependencies.gradle
+1
-1
build.gradle
util/build.gradle
+0
-19
No files found.
util/src/foss/java/chat/rocket/android/util/helper/analytics/AnalyticsManager
.kt
→
app/src/foss/java/chat/rocket/android/analytics/AnswersAnalytics
.kt
View file @
8ce5d9d3
package
chat.rocket.android.
util.helper.
analytics
package
chat.rocket.android.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
chat.rocket.android.analytics.event.AuthenticationEvent
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.analytics.event.SubscriptionTypeEvent
object
AnalyticsManager
:
Analytics
{
class
AnswersAnalytics
:
Analytics
{
override
fun
logLogin
(
event
:
AuthenticationEvent
,
loginSucceeded
:
Boolean
)
{
// Do absolutely nothing
...
...
app/src/foss/java/chat/rocket/android/analytics/GoogleAnalyticsForFirebase.kt
0 → 100644
View file @
8ce5d9d3
package
chat.rocket.android.analytics
import
android.content.Context
import
chat.rocket.android.analytics.event.AuthenticationEvent
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.analytics.event.SubscriptionTypeEvent
import
javax.inject.Inject
class
GoogleAnalyticsForFirebase
@Inject
constructor
(
val
context
:
Context
)
:
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
}
}
app/src/main/java/chat/rocket/android/about/ui/AboutFragment.kt
View file @
8ce5d9d3
...
...
@@ -7,10 +7,9 @@ import android.view.ViewGroup
import
androidx.fragment.app.Fragment
import
chat.rocket.android.BuildConfig
import
chat.rocket.android.R
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.main.ui.MainActivity
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
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
...
...
@@ -19,7 +18,7 @@ internal const val TAG_ABOUT_FRAGMENT = "AboutFragment"
class
AboutFragment
:
Fragment
()
{
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
...
...
@@ -32,9 +31,7 @@ class AboutFragment : Fragment() {
setupToolbar
()
setupViews
()
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
About
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
About
)
}
private
fun
setupViews
()
{
...
...
util/src/main/java/chat/rocket/android/util/helper/analytics/event
/Analytics.kt
→
app/src/main/java/chat/rocket/android/analytics
/Analytics.kt
View file @
8ce5d9d3
package
chat.rocket.android.
util.helper.
analytics
package
chat.rocket.android.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
chat.rocket.android.analytics.event.AuthenticationEvent
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.analytics.event.SubscriptionTypeEvent
interface
Analytics
{
...
...
app/src/main/java/chat/rocket/android/analytics/AnalyticsManager.kt
0 → 100644
View file @
8ce5d9d3
package
chat.rocket.android.analytics
import
chat.rocket.android.analytics.event.AuthenticationEvent
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.analytics.event.SubscriptionTypeEvent
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.server.domain.GetAccountsInteractor
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
javax.inject.Inject
class
AnalyticsManager
@Inject
constructor
(
private
val
analyticsTrackingInteractor
:
AnalyticsTrackingInteractor
,
getCurrentServerInteractor
:
GetCurrentServerInteractor
,
getAccountsInteractor
:
GetAccountsInteractor
,
private
val
analytics
:
List
<
Analytics
>
)
{
val
serverUrl
=
getCurrentServerInteractor
.
get
()
val
accounts
=
getAccountsInteractor
.
get
()
fun
logLogin
(
event
:
AuthenticationEvent
,
loginSucceeded
:
Boolean
)
{
if
(
analyticsTrackingInteractor
.
get
())
{
analytics
.
forEach
{
it
.
logLogin
(
event
,
loginSucceeded
)
}
}
}
fun
logSignUp
(
event
:
AuthenticationEvent
,
signUpSucceeded
:
Boolean
)
{
if
(
analyticsTrackingInteractor
.
get
())
{
analytics
.
forEach
{
it
.
logSignUp
(
event
,
signUpSucceeded
)
}
}
}
fun
logScreenView
(
event
:
ScreenViewEvent
)
{
if
(
analyticsTrackingInteractor
.
get
())
{
analytics
.
forEach
{
it
.
logScreenView
(
event
)
}
}
}
fun
logMessageSent
(
event
:
SubscriptionTypeEvent
)
{
if
(
analyticsTrackingInteractor
.
get
()
&&
serverUrl
!=
null
)
{
analytics
.
forEach
{
it
.
logMessageSent
(
event
,
serverUrl
)
}
}
}
fun
logMediaUploaded
(
event
:
SubscriptionTypeEvent
,
mimeType
:
String
)
{
if
(
analyticsTrackingInteractor
.
get
())
{
analytics
.
forEach
{
it
.
logMediaUploaded
(
event
,
mimeType
)
}
}
}
fun
logReaction
(
event
:
SubscriptionTypeEvent
)
{
if
(
analyticsTrackingInteractor
.
get
())
{
analytics
.
forEach
{
it
.
logReaction
(
event
)
}
}
}
fun
logServerSwitch
()
{
if
(
analyticsTrackingInteractor
.
get
()
&&
serverUrl
!=
null
)
{
analytics
.
forEach
{
it
.
logServerSwitch
(
serverUrl
,
accounts
.
size
)
}
}
}
}
util/src/main/java/chat/rocket/android/util/helper/analytics/event
/event/AuthenticationEvent.kt
→
app/src/main/java/chat/rocket/android/analytics
/event/AuthenticationEvent.kt
View file @
8ce5d9d3
package
chat.rocket.android.
util.helper.
analytics.event
package
chat.rocket.android.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/main/java/chat/rocket/android/util/helper/analytics/event
/event/ScreenViewEvent.kt
→
app/src/main/java/chat/rocket/android/analytics
/event/ScreenViewEvent.kt
View file @
8ce5d9d3
package
chat.rocket.android.
util.helper.
analytics.event
package
chat.rocket.android.analytics.event
sealed
class
ScreenViewEvent
(
val
screenName
:
String
)
{
...
...
@@ -23,4 +23,4 @@ sealed class ScreenViewEvent(val screenName: String) {
object
Settings
:
ScreenViewEvent
(
"SettingsFragment"
)
object
SignUp
:
ScreenViewEvent
(
"SignupFragment"
)
object
TwoFa
:
ScreenViewEvent
(
"TwoFAFragment"
)
}
\ No newline at end of file
}
util/src/main/java/chat/rocket/android/util/helper/analytics/event
/event/SubscriptionTypeEvent.kt
→
app/src/main/java/chat/rocket/android/analytics
/event/SubscriptionTypeEvent.kt
View file @
8ce5d9d3
package
chat.rocket.android.
util.helper.
analytics.event
package
chat.rocket.android.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
}
app/src/main/java/chat/rocket/android/authentication/login/presentation/LoginPresenter.kt
View file @
8ce5d9d3
package
chat.rocket.android.authentication.login.presentation
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.AuthenticationEvent
import
chat.rocket.android.authentication.domain.model.LoginDeepLinkInfo
import
chat.rocket.android.authentication.presentation.AuthenticationNavigator
import
chat.rocket.android.core.lifecycle.CancelStrategy
...
...
@@ -18,8 +20,6 @@ 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.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
...
...
@@ -62,7 +62,7 @@ class LoginPresenter @Inject constructor(
private
val
localRepository
:
LocalRepository
,
private
val
getAccountsInteractor
:
GetAccountsInteractor
,
private
val
settingsInteractor
:
GetSettingsInteractor
,
private
val
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
,
private
val
analytics
Manager
:
AnalyticsManage
r
,
serverInteractor
:
GetConnectingServerInteractor
,
private
val
saveCurrentServer
:
SaveCurrentServerInteractor
,
private
val
saveAccountInteractor
:
SaveAccountInteractor
,
...
...
@@ -457,9 +457,7 @@ class LoginPresenter @Inject constructor(
saveAccount
(
myself
.
username
!!
)
saveToken
(
token
)
registerPushToken
()
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logLogin
(
loginMethod
,
true
)
}
analyticsManager
.
logLogin
(
loginMethod
,
true
)
if
(
loginType
==
TYPE_LOGIN_USER_EMAIL
)
{
view
.
saveSmartLockCredentials
(
usernameOrEmail
,
password
)
}
...
...
@@ -473,9 +471,7 @@ class LoginPresenter @Inject constructor(
navigator
.
toTwoFA
(
usernameOrEmail
,
password
)
}
else
->
{
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logLogin
(
loginMethod
,
false
)
}
analyticsManager
.
logLogin
(
loginMethod
,
false
)
exception
.
message
?.
let
{
view
.
showMessage
(
it
)
}.
ifNull
{
...
...
app/src/main/java/chat/rocket/android/authentication/login/ui/LoginFragment.kt
View file @
8ce5d9d3
...
...
@@ -6,7 +6,6 @@ import android.content.Intent
import
android.graphics.PorterDuff
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
...
...
@@ -18,20 +17,30 @@ import android.widget.LinearLayout
import
android.widget.ScrollView
import
androidx.core.view.isVisible
import
androidx.core.view.postDelayed
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.LoginDeepLinkInfo
import
chat.rocket.android.authentication.login.presentation.LoginPresenter
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.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.helper.KeyboardHelper
import
chat.rocket.android.helper.TextHelper
import
chat.rocket.android.helper.getCredentials
import
chat.rocket.android.helper.hasCredentialsSupport
import
chat.rocket.android.helper.requestStoredCredentials
import
chat.rocket.android.helper.saveCredentials
import
chat.rocket.android.util.extensions.inflate
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.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.oauthWebViewIntent
import
chat.rocket.android.webview.sso.ui.INTENT_SSO_TOKEN
import
chat.rocket.android.webview.sso.ui.ssoWebViewIntent
import
chat.rocket.common.util.ifNull
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_authentication_log_in.*
...
...
@@ -49,7 +58,7 @@ class LoginFragment : Fragment(), LoginView {
@Inject
lateinit
var
presenter
:
LoginPresenter
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
private
var
isOauthViewEnable
=
false
private
val
layoutListener
=
ViewTreeObserver
.
OnGlobalLayoutListener
{
areLoginOptionsNeeded
()
...
...
@@ -97,9 +106,7 @@ class LoginFragment : Fragment(), LoginView {
image_key
.
isVisible
=
false
}
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
Login
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
Login
)
}
override
fun
onDestroyView
()
{
...
...
app/src/main/java/chat/rocket/android/authentication/registerusername/presentation/RegisterUsernamePresenter.kt
View file @
8ce5d9d3
package
chat.rocket.android.authentication.registerusername.presentation
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.AuthenticationEvent
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.AnalyticsTrackingInteractor
import
chat.rocket.android.server.domain.GetAccountsInteractor
import
chat.rocket.android.server.domain.GetConnectingServerInteractor
import
chat.rocket.android.server.domain.GetSettingsInteractor
...
...
@@ -19,8 +20,6 @@ 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.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
...
...
@@ -38,7 +37,7 @@ class RegisterUsernamePresenter @Inject constructor(
private
val
factory
:
RocketChatClientFactory
,
private
val
saveAccountInteractor
:
SaveAccountInteractor
,
private
val
getAccountsInteractor
:
GetAccountsInteractor
,
private
val
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
,
private
val
analytics
Manager
:
AnalyticsManage
r
,
serverInteractor
:
GetConnectingServerInteractor
,
private
val
saveCurrentServer
:
SaveCurrentServerInteractor
,
settingsInteractor
:
GetSettingsInteractor
...
...
@@ -63,15 +62,14 @@ class RegisterUsernamePresenter @Inject constructor(
saveCurrentServer
.
save
(
currentServer
)
tokenRepository
.
save
(
currentServer
,
Token
(
userId
,
authToken
))
registerPushToken
()
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logSignUp
(
AuthenticationEvent
.
AuthenticationWithOauth
,
true
)
}
analyticsManager
.
logSignUp
(
AuthenticationEvent
.
AuthenticationWithOauth
,
true
)
navigator
.
toChatList
()
}
}
catch
(
exception
:
RocketChatException
)
{
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logSignUp
(
AuthenticationEvent
.
AuthenticationWithOauth
,
false
)
}
analyticsManager
.
logSignUp
(
AuthenticationEvent
.
AuthenticationWithOauth
,
false
)
exception
.
message
?.
let
{
view
.
showMessage
(
it
)
}.
ifNull
{
...
...
app/src/main/java/chat/rocket/android/authentication/registerusername/ui/RegisterUsernameFragment.kt
View file @
8ce5d9d3
...
...
@@ -3,17 +3,23 @@ package chat.rocket.android.authentication.registerusername.ui
import
DrawableHelper
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
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.registerusername.presentation.RegisterUsernamePresenter
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.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
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.showKeyboard
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
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_authentication_register_username.*
import
javax.inject.Inject
...
...
@@ -24,7 +30,7 @@ class RegisterUsernameFragment : Fragment(), RegisterUsernameView {
@Inject
lateinit
var
presenter
:
RegisterUsernamePresenter
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
private
lateinit
var
userId
:
String
private
lateinit
var
authToken
:
String
...
...
@@ -69,9 +75,7 @@ class RegisterUsernameFragment : Fragment(), RegisterUsernameView {
setupOnClickListener
()
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
RegisterUsername
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
RegisterUsername
)
}
override
fun
alertBlankUsername
()
{
...
...
app/src/main/java/chat/rocket/android/authentication/resetpassword/ui/ResetPasswordFragment.kt
View file @
8ce5d9d3
...
...
@@ -3,18 +3,24 @@ package chat.rocket.android.authentication.resetpassword.ui
import
DrawableHelper
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.widget.Toast
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.resetpassword.presentation.ResetPasswordPresenter
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.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
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.showKeyboard
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
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_authentication_reset_password.*
import
javax.inject.Inject
...
...
@@ -25,7 +31,7 @@ class ResetPasswordFragment : Fragment(), ResetPasswordView {
@Inject
lateinit
var
presenter
:
ResetPasswordPresenter
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
...
...
@@ -52,9 +58,7 @@ class ResetPasswordFragment : Fragment(), ResetPasswordView {
setupOnClickListener
()
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
ResetPassword
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
ResetPassword
)
}
override
fun
alertBlankEmail
()
{
...
...
app/src/main/java/chat/rocket/android/authentication/server/ui/ServerFragment.kt
View file @
8ce5d9d3
...
...
@@ -3,23 +3,29 @@ package chat.rocket.android.authentication.server.ui
import
android.app.AlertDialog
import
android.net.Uri
import
android.os.Bundle
import
androidx.fragment.app.Fragment
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewTreeObserver
import
android.widget.AdapterView
import
android.widget.ArrayAdapter
import
androidx.fragment.app.Fragment
import
chat.rocket.android.BuildConfig
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.LoginDeepLinkInfo
import
chat.rocket.android.authentication.server.presentation.ServerPresenter
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.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
chat.rocket.android.util.extensions.hintContent
import
chat.rocket.android.util.extensions.ifEmpty
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.sanitize
import
chat.rocket.android.util.extensions.setVisible
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.textContent
import
chat.rocket.android.util.extensions.ui
import
chat.rocket.common.util.ifNull
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_authentication_server.*
...
...
@@ -32,7 +38,7 @@ class ServerFragment : Fragment(), ServerView {
@Inject
lateinit
var
presenter
:
ServerPresenter
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
private
var
deepLinkInfo
:
LoginDeepLinkInfo
?
=
null
private
val
layoutListener
=
ViewTreeObserver
.
OnGlobalLayoutListener
{
text_server_url
.
isCursorVisible
=
KeyboardHelper
.
isSoftKeyboardShown
(
relative_layout
.
rootView
)
...
...
@@ -97,9 +103,7 @@ class ServerFragment : Fragment(), ServerView {
}
}
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
Server
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
Server
)
}
override
fun
onDestroyView
()
{
...
...
app/src/main/java/chat/rocket/android/authentication/signup/presentation/SignupPresenter.kt
View file @
8ce5d9d3
package
chat.rocket.android.authentication.signup.presentation
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.AuthenticationEvent
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.AnalyticsTrackingInteractor
import
chat.rocket.android.server.domain.GetAccountsInteractor
import
chat.rocket.android.server.domain.GetConnectingServerInteractor
import
chat.rocket.android.server.domain.GetSettingsInteractor
...
...
@@ -20,8 +21,6 @@ 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
...
...
@@ -39,7 +38,7 @@ class SignupPresenter @Inject constructor(
private
val
localRepository
:
LocalRepository
,
private
val
serverInteractor
:
GetConnectingServerInteractor
,
private
val
saveCurrentServerInteractor
:
SaveCurrentServerInteractor
,
private
val
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
,
private
val
analytics
Manager
:
AnalyticsManage
r
,
private
val
factory
:
RocketChatClientFactory
,
private
val
saveAccountInteractor
:
SaveAccountInteractor
,
private
val
getAccountsInteractor
:
GetAccountsInteractor
,
...
...
@@ -81,21 +80,17 @@ class SignupPresenter @Inject constructor(
localRepository
.
save
(
LocalRepository
.
CURRENT_USERNAME_KEY
,
me
.
username
)
saveAccount
(
me
)
registerPushToken
()
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logSignUp
(
AuthenticationEvent
.
AuthenticationWithUserAndPassword
,
true
)
}
analyticsManager
.
logSignUp
(
AuthenticationEvent
.
AuthenticationWithUserAndPassword
,
true
)
view
.
saveSmartLockCredentials
(
username
,
password
)
navigator
.
toChatList
()
}
catch
(
exception
:
RocketChatException
)
{
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logSignUp
(
AuthenticationEvent
.
AuthenticationWithUserAndPassword
,
false
)
}
analyticsManager
.
logSignUp
(
AuthenticationEvent
.
AuthenticationWithUserAndPassword
,
false
)
exception
.
message
?.
let
{
view
.
showMessage
(
it
)
}.
ifNull
{
...
...
app/src/main/java/chat/rocket/android/authentication/signup/ui/SignupFragment.kt
View file @
8ce5d9d3
...
...
@@ -13,20 +13,19 @@ 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.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.authentication.signup.presentation.SignupPresenter
import
chat.rocket.android.authentication.signup.presentation.SignupView
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.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
...
...
@@ -38,7 +37,7 @@ class SignupFragment : Fragment(), SignupView {
@Inject
lateinit
var
presenter
:
SignupPresenter
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
private
val
layoutListener
=
ViewTreeObserver
.
OnGlobalLayoutListener
{
if
(
KeyboardHelper
.
isSoftKeyboardShown
(
relative_layout
.
rootView
))
{
bottom_container
.
setVisible
(
false
)
...
...
@@ -82,9 +81,7 @@ class SignupFragment : Fragment(), SignupView {
)
}
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
SignUp
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
SignUp
)
}
override
fun
onDestroyView
()
{
...
...
app/src/main/java/chat/rocket/android/authentication/twofactor/presentation/TwoFAPresenter.kt
View file @
8ce5d9d3
package
chat.rocket.android.authentication.twofactor.presentation
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.AuthenticationEvent
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.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.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
...
...
@@ -30,7 +38,7 @@ class TwoFAPresenter @Inject constructor(
private
val
localRepository
:
LocalRepository
,
private
val
serverInteractor
:
GetConnectingServerInteractor
,
private
val
saveCurrentServerInteractor
:
SaveCurrentServerInteractor
,
private
val
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
,
private
val
analytics
Manager
:
AnalyticsManage
r
,
private
val
factory
:
RocketChatClientFactory
,
private
val
saveAccountInteractor
:
SaveAccountInteractor
,
private
val
getAccountsInteractor
:
GetAccountsInteractor
,
...
...
@@ -68,23 +76,19 @@ class TwoFAPresenter @Inject constructor(
saveCurrentServerInteractor
.
save
(
currentServer
)
tokenRepository
.
save
(
server
,
token
)
registerPushToken
()
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logLogin
(
AuthenticationEvent
.
AuthenticationWithUserAndPassword
,
true
)
}
analyticsManager
.
logLogin
(
AuthenticationEvent
.
AuthenticationWithUserAndPassword
,
true
)
navigator
.
toChatList
()
}
catch
(
exception
:
RocketChatException
)
{
if
(
exception
is
RocketChatAuthException
)
{
view
.
alertInvalidTwoFactorAuthenticationCode
()
}
else
{
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logLogin
(
AuthenticationEvent
.
AuthenticationWithUserAndPassword
,
false
)
}
analyticsManager
.
logLogin
(
AuthenticationEvent
.
AuthenticationWithUserAndPassword
,
false
)
exception
.
message
?.
let
{
view
.
showMessage
(
it
)
}.
ifNull
{
...
...
app/src/main/java/chat/rocket/android/authentication/twofactor/ui/TwoFAFragment.kt
View file @
8ce5d9d3
...
...
@@ -10,9 +10,10 @@ import android.view.ViewGroup
import
android.view.inputmethod.InputMethodManager
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.twofactor.presentation.TwoFAPresenter
import
chat.rocket.android.authentication.twofactor.presentation.TwoFAView
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.setVisible
import
chat.rocket.android.util.extensions.shake
...
...
@@ -20,8 +21,6 @@ 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
...
...
@@ -32,7 +31,7 @@ class TwoFAFragment : Fragment(), TwoFAView {
@Inject
lateinit
var
presenter
:
TwoFAPresenter
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
lateinit
var
username
:
String
lateinit
var
password
:
String
...
...
@@ -66,9 +65,7 @@ class TwoFAFragment : Fragment(), TwoFAView {
setupOnClickListener
()
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
TwoFa
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
TwoFa
)
}
override
fun
alertBlankTwoFactorAuthenticationCode
()
{
...
...
app/src/main/java/chat/rocket/android/chatinformation/ui/MessageInfoFragment.kt
View file @
8ce5d9d3
...
...
@@ -9,15 +9,14 @@ import androidx.recyclerview.widget.DefaultItemAnimator
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
chat.rocket.android.R
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.ScreenViewEvent
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.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extensions.setVisible
import
chat.rocket.android.util.extensions.showToast
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_message_info.*
import
javax.inject.Inject
...
...
@@ -37,7 +36,7 @@ class MessageInfoFragment : Fragment(), MessageInfoView {
@Inject
lateinit
var
presenter
:
MessageInfoPresenter
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
private
lateinit
var
adapter
:
ReadReceiptAdapter
private
lateinit
var
messageId
:
String
...
...
@@ -67,9 +66,7 @@ class MessageInfoFragment : Fragment(), MessageInfoView {
setupRecyclerView
()
presenter
.
loadReadReceipts
(
messageId
=
messageId
)
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
MessageInfo
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
MessageInfo
)
}
private
fun
setupRecyclerView
()
{
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomPresenter.kt
View file @
8ce5d9d3
...
...
@@ -2,6 +2,8 @@ package chat.rocket.android.chatroom.presentation
import
android.net.Uri
import
chat.rocket.android.R
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.SubscriptionTypeEvent
import
chat.rocket.android.chatroom.adapter.AutoCompleteType
import
chat.rocket.android.chatroom.adapter.PEOPLE
import
chat.rocket.android.chatroom.adapter.ROOMS
...
...
@@ -17,7 +19,6 @@ import chat.rocket.android.db.DatabaseManager
import
chat.rocket.android.helper.MessageHelper
import
chat.rocket.android.helper.UserHelper
import
chat.rocket.android.infrastructure.LocalRepository
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.GetSettingsInteractor
import
chat.rocket.android.server.domain.JobSchedulerInteractor
...
...
@@ -34,8 +35,6 @@ 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.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
...
...
@@ -93,7 +92,7 @@ class ChatRoomPresenter @Inject constructor(
private
val
usersRepository
:
UsersRepository
,
private
val
roomsRepository
:
RoomRepository
,
private
val
localRepository
:
LocalRepository
,
private
val
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
,
private
val
analytics
Manager
:
AnalyticsManage
r
,
private
val
userHelper
:
UserHelper
,
private
val
mapper
:
UiModelMapper
,
private
val
jobSchedulerInteractor
:
JobSchedulerInteractor
,
...
...
@@ -300,9 +299,7 @@ class ChatRoomPresenter @Inject constructor(
),
false
)
client
.
sendMessage
(
id
,
chatRoomId
,
text
)
if
(
analyticsTrackingInteractor
.
get
())
{
logMessageSent
(
currentServer
)
}
logMessageSent
()
}
catch
(
ex
:
Exception
)
{
// Ok, not very beautiful, but the backend sends us a not valid response
// When someone sends a message on a read-only channel, so we just ignore it
...
...
@@ -370,9 +367,7 @@ class ChatRoomPresenter @Inject constructor(
inputStream
}
}
if
(
analyticsTrackingInteractor
.
get
())
{
logMediaUploaded
(
mimeType
)
}
logMediaUploaded
(
mimeType
)
}
}
}
...
...
@@ -944,9 +939,7 @@ class ChatRoomPresenter @Inject constructor(
retryIO
(
"toggleEmoji($messageId, $emoji)"
)
{
client
.
toggleReaction
(
messageId
,
emoji
.
removeSurrounding
(
":"
))
}
if
(
analyticsTrackingInteractor
.
get
())
{
logReactionEvent
()
}
logReactionEvent
()
}
catch
(
ex
:
RocketChatException
)
{
Timber
.
e
(
ex
)
}
...
...
@@ -956,30 +949,30 @@ class ChatRoomPresenter @Inject constructor(
private
fun
logReactionEvent
()
{
when
{
roomTypeOf
(
chatRoomType
)
is
RoomType
.
DirectMessage
->
A
nalyticsManager
.
logReaction
(
SubscriptionTypeEvent
.
DirectMessage
)
a
nalyticsManager
.
logReaction
(
SubscriptionTypeEvent
.
DirectMessage
)
roomTypeOf
(
chatRoomType
)
is
RoomType
.
Channel
->
A
nalyticsManager
.
logReaction
(
SubscriptionTypeEvent
.
Channel
)
else
->
A
nalyticsManager
.
logReaction
(
SubscriptionTypeEvent
.
Group
)
a
nalyticsManager
.
logReaction
(
SubscriptionTypeEvent
.
Channel
)
else
->
a
nalyticsManager
.
logReaction
(
SubscriptionTypeEvent
.
Group
)
}
}
private
fun
logMediaUploaded
(
mimeType
:
String
)
{
when
{
roomTypeOf
(
chatRoomType
)
is
RoomType
.
DirectMessage
->
A
nalyticsManager
.
logMediaUploaded
(
SubscriptionTypeEvent
.
DirectMessage
,
mimeType
)
a
nalyticsManager
.
logMediaUploaded
(
SubscriptionTypeEvent
.
DirectMessage
,
mimeType
)
roomTypeOf
(
chatRoomType
)
is
RoomType
.
Channel
->
A
nalyticsManager
.
logMediaUploaded
(
SubscriptionTypeEvent
.
Channel
,
mimeType
)
else
->
A
nalyticsManager
.
logMediaUploaded
(
SubscriptionTypeEvent
.
Group
,
mimeType
)
a
nalyticsManager
.
logMediaUploaded
(
SubscriptionTypeEvent
.
Channel
,
mimeType
)
else
->
a
nalyticsManager
.
logMediaUploaded
(
SubscriptionTypeEvent
.
Group
,
mimeType
)
}
}
private
fun
logMessageSent
(
serverUrl
:
String
)
{
private
fun
logMessageSent
()
{
when
{
roomTypeOf
(
chatRoomType
)
is
RoomType
.
DirectMessage
->
AnalyticsManager
.
logMessageSent
(
SubscriptionTypeEvent
.
DirectMessage
,
serverUrl
)
analyticsManager
.
logMessageSent
(
SubscriptionTypeEvent
.
DirectMessage
)
roomTypeOf
(
chatRoomType
)
is
RoomType
.
Channel
->
AnalyticsManager
.
logMessageSent
(
SubscriptionTypeEvent
.
Channel
,
serverUr
l
)
else
->
AnalyticsManager
.
logMessageSent
(
SubscriptionTypeEvent
.
Group
,
serverUrl
)
analyticsManager
.
logMessageSent
(
SubscriptionTypeEvent
.
Channe
l
)
else
->
analyticsManager
.
logMessageSent
(
SubscriptionTypeEvent
.
Group
)
}
}
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
8ce5d9d3
...
...
@@ -29,6 +29,8 @@ import androidx.recyclerview.widget.DefaultItemAnimator
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
chat.rocket.android.R
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.chatroom.adapter.ChatRoomAdapter
import
chat.rocket.android.chatroom.adapter.CommandSuggestionsAdapter
import
chat.rocket.android.chatroom.adapter.PEOPLE
...
...
@@ -55,7 +57,6 @@ import chat.rocket.android.helper.EndlessRecyclerViewScrollListener
import
chat.rocket.android.helper.ImageHelper
import
chat.rocket.android.helper.KeyboardHelper
import
chat.rocket.android.helper.MessageParser
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extension.asObservable
import
chat.rocket.android.util.extensions.circularRevealOrUnreveal
import
chat.rocket.android.util.extensions.fadeIn
...
...
@@ -66,8 +67,6 @@ 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.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
...
...
@@ -138,7 +137,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
@Inject
lateinit
var
parser
:
MessageParser
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
private
lateinit
var
adapter
:
ChatRoomAdapter
internal
lateinit
var
chatRoomId
:
String
private
lateinit
var
chatRoomName
:
String
...
...
@@ -209,8 +208,10 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
requireNotNull
(
bundle
)
{
"no arguments supplied when the fragment was instantiated"
}
}
adapter
=
ChatRoomAdapter
(
chatRoomType
,
chatRoomName
,
this
,
reactionListener
=
this
)
adapter
=
ChatRoomAdapter
(
chatRoomType
,
chatRoomName
,
this
,
reactionListener
=
this
)
}
override
fun
onCreateView
(
...
...
@@ -236,9 +237,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
it
.
showToolbarChatRoomIcon
(
chatRoomType
)
}
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
ChatRoom
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
ChatRoom
)
}
override
fun
onActivityCreated
(
savedInstanceState
:
Bundle
?)
{
...
...
@@ -476,17 +475,17 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
when
(
usernameList
.
size
)
{
1
->
{
text_typing_status
.
text
=
SpannableStringBuilder
()
.
bold
{
append
(
usernameList
[
0
])
}
.
append
(
getString
(
R
.
string
.
msg_is_typing
))
SpannableStringBuilder
()
.
bold
{
append
(
usernameList
[
0
])
}
.
append
(
getString
(
R
.
string
.
msg_is_typing
))
}
2
->
{
text_typing_status
.
text
=
SpannableStringBuilder
()
.
bold
{
append
(
usernameList
[
0
])
}
.
append
(
getString
(
R
.
string
.
msg_and
))
.
bold
{
append
(
usernameList
[
1
])
}
.
append
(
getString
(
R
.
string
.
msg_are_typing
))
SpannableStringBuilder
()
.
bold
{
append
(
usernameList
[
0
])
}
.
append
(
getString
(
R
.
string
.
msg_and
))
.
bold
{
append
(
usernameList
[
1
])
}
.
append
(
getString
(
R
.
string
.
msg_are_typing
))
}
else
->
{
text_typing_status
.
text
=
getString
(
R
.
string
.
msg_several_users_are_typing
)
...
...
@@ -711,15 +710,15 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
handler
.
postDelayed
(
dismissStatus
,
2000
)
}
is
State
.
Disconnected
->
text_connection_status
.
text
=
getString
(
R
.
string
.
status_disconnected
)
getString
(
R
.
string
.
status_disconnected
)
is
State
.
Connecting
->
text_connection_status
.
text
=
getString
(
R
.
string
.
status_connecting
)
getString
(
R
.
string
.
status_connecting
)
is
State
.
Authenticating
->
text_connection_status
.
text
=
getString
(
R
.
string
.
status_authenticating
)
getString
(
R
.
string
.
status_authenticating
)
is
State
.
Disconnecting
->
text_connection_status
.
text
=
getString
(
R
.
string
.
status_disconnecting
)
getString
(
R
.
string
.
status_disconnecting
)
is
State
.
Waiting
->
text_connection_status
.
text
=
getString
(
R
.
string
.
status_waiting
,
state
.
seconds
)
getString
(
R
.
string
.
status_waiting
,
state
.
seconds
)
}
}
}
...
...
@@ -779,7 +778,11 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
activity
?.
supportFragmentManager
?.
registerFragmentLifecycleCallbacks
(
object
:
FragmentManager
.
FragmentLifecycleCallbacks
()
{
override
fun
onFragmentAttached
(
fm
:
FragmentManager
,
f
:
Fragment
,
context
:
Context
)
{
override
fun
onFragmentAttached
(
fm
:
FragmentManager
,
f
:
Fragment
,
context
:
Context
)
{
if
(
f
is
MessageActionsBottomSheet
)
{
setReactionButtonIcon
(
R
.
drawable
.
ic_reaction_24dp
)
emojiKeyboardPopup
.
dismiss
()
...
...
@@ -790,7 +793,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
)
subscribeComposeTextMessage
()
emojiKeyboardPopup
=
EmojiKeyboardPopup
(
activity
!!
,
activity
!!
.
findViewById
(
R
.
id
.
fragment_container
))
EmojiKeyboardPopup
(
activity
!!
,
activity
!!
.
findViewById
(
R
.
id
.
fragment_container
))
emojiKeyboardPopup
.
listener
=
this
text_message
.
listener
=
object
:
ComposerEditText
.
ComposerEditTextListener
{
override
fun
onKeyboardOpened
()
{
...
...
@@ -980,7 +983,12 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
presenter
.
messageInfo
(
id
)
}
override
fun
citeMessage
(
roomName
:
String
,
roomType
:
String
,
messageId
:
String
,
mentionAuthor
:
Boolean
)
{
override
fun
citeMessage
(
roomName
:
String
,
roomType
:
String
,
messageId
:
String
,
mentionAuthor
:
Boolean
)
{
presenter
.
citeMessage
(
roomName
,
roomType
,
messageId
,
mentionAuthor
)
}
...
...
@@ -1012,10 +1020,15 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
ui
{
val
builder
=
AlertDialog
.
Builder
(
it
)
builder
.
setTitle
(
it
.
getString
(
R
.
string
.
msg_delete_message
))
.
setMessage
(
it
.
getString
(
R
.
string
.
msg_delete_description
))
.
setPositiveButton
(
it
.
getString
(
R
.
string
.
msg_ok
))
{
_
,
_
->
presenter
.
deleteMessage
(
roomId
,
id
)
}
.
setNegativeButton
(
it
.
getString
(
R
.
string
.
msg_cancel
))
{
_
,
_
->
}
.
show
()
.
setMessage
(
it
.
getString
(
R
.
string
.
msg_delete_description
))
.
setPositiveButton
(
it
.
getString
(
R
.
string
.
msg_ok
))
{
_
,
_
->
presenter
.
deleteMessage
(
roomId
,
id
)
}
.
setNegativeButton
(
it
.
getString
(
R
.
string
.
msg_cancel
))
{
_
,
_
->
}
.
show
()
}
}
...
...
app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
View file @
8ce5d9d3
...
...
@@ -21,6 +21,8 @@ import androidx.lifecycle.ViewModelProviders
import
androidx.recyclerview.widget.DefaultItemAnimator
import
androidx.recyclerview.widget.LinearLayoutManager
import
chat.rocket.android.R
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.chatrooms.adapter.RoomsAdapter
import
chat.rocket.android.chatrooms.presentation.ChatRoomsPresenter
import
chat.rocket.android.chatrooms.presentation.ChatRoomsView
...
...
@@ -32,15 +34,12 @@ import chat.rocket.android.db.DatabaseManager
import
chat.rocket.android.helper.ChatRoomsSortOrder
import
chat.rocket.android.helper.Constants
import
chat.rocket.android.helper.SharedPreferenceHelper
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extension.onQueryTextListener
import
chat.rocket.android.util.extensions.fadeIn
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.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
...
...
@@ -60,7 +59,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
@Inject
lateinit
var
dbManager
:
DatabaseManager
// TODO - remove when moving ChatRoom screen to DB
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
lateinit
var
viewModel
:
ChatRoomsViewModel
private
var
searchView
:
SearchView
?
=
null
private
var
sortView
:
MenuItem
?
=
null
...
...
@@ -112,9 +111,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
setupToolbar
()
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
ChatRooms
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
ChatRooms
)
}
private
fun
subscribeUi
()
{
...
...
@@ -124,9 +121,13 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
}
recycler_view
.
layoutManager
=
LinearLayoutManager
(
it
)
recycler_view
.
addItemDecoration
(
DividerItemDecoration
(
it
,
recycler_view
.
addItemDecoration
(
DividerItemDecoration
(
it
,
resources
.
getDimensionPixelSize
(
R
.
dimen
.
divider_item_decorator_bound_start
),
resources
.
getDimensionPixelSize
(
R
.
dimen
.
divider_item_decorator_bound_end
)))
resources
.
getDimensionPixelSize
(
R
.
dimen
.
divider_item_decorator_bound_end
)
)
)
recycler_view
.
itemAnimator
=
DefaultItemAnimator
()
recycler_view
.
adapter
=
adapter
...
...
@@ -141,7 +142,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
})
viewModel
.
loadingState
.
observe
(
viewLifecycleOwner
,
Observer
{
state
->
when
(
state
)
{
when
(
state
)
{
is
LoadingState
.
Loading
->
if
(
state
.
count
==
0L
)
showLoading
()
is
LoadingState
.
Loaded
->
{
hideLoading
()
...
...
@@ -195,29 +196,41 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
// TODO - simplify this
R
.
id
.
action_sort
->
{
val
dialogLayout
=
layoutInflater
.
inflate
(
R
.
layout
.
chatroom_sort_dialog
,
null
)
val
sortType
=
SharedPreferenceHelper
.
getInt
(
Constants
.
CHATROOM_SORT_TYPE_KEY
,
ChatRoomsSortOrder
.
ACTIVITY
)
val
groupByType
=
SharedPreferenceHelper
.
getBoolean
(
Constants
.
CHATROOM_GROUP_BY_TYPE_KEY
,
false
)
val
sortType
=
SharedPreferenceHelper
.
getInt
(
Constants
.
CHATROOM_SORT_TYPE_KEY
,
ChatRoomsSortOrder
.
ACTIVITY
)
val
groupByType
=
SharedPreferenceHelper
.
getBoolean
(
Constants
.
CHATROOM_GROUP_BY_TYPE_KEY
,
false
)
val
radioGroup
=
dialogLayout
.
findViewById
<
RadioGroup
>(
R
.
id
.
radio_group_sort
)
val
groupByTypeCheckBox
=
dialogLayout
.
findViewById
<
CheckBox
>(
R
.
id
.
checkbox_group_by_type
)
val
groupByTypeCheckBox
=
dialogLayout
.
findViewById
<
CheckBox
>(
R
.
id
.
checkbox_group_by_type
)
radioGroup
.
check
(
when
(
sortType
)
{
0
->
R
.
id
.
radio_sort_alphabetical
else
->
R
.
id
.
radio_sort_activity
})
radioGroup
.
check
(
when
(
sortType
)
{
0
->
R
.
id
.
radio_sort_alphabetical
else
->
R
.
id
.
radio_sort_activity
}
)
radioGroup
.
setOnCheckedChangeListener
{
_
,
checkedId
->
run
{
SharedPreferenceHelper
.
putInt
(
Constants
.
CHATROOM_SORT_TYPE_KEY
,
when
(
checkedId
)
{
R
.
id
.
radio_sort_alphabetical
->
0
R
.
id
.
radio_sort_activity
->
1
else
->
1
})
SharedPreferenceHelper
.
putInt
(
Constants
.
CHATROOM_SORT_TYPE_KEY
,
when
(
checkedId
)
{
R
.
id
.
radio_sort_alphabetical
->
0
R
.
id
.
radio_sort_activity
->
1
else
->
1
}
)
}
}
groupByTypeCheckBox
.
isChecked
=
groupByType
groupByTypeCheckBox
.
setOnCheckedChangeListener
{
_
,
isChecked
->
SharedPreferenceHelper
.
putBoolean
(
Constants
.
CHATROOM_GROUP_BY_TYPE_KEY
,
isChecked
)
SharedPreferenceHelper
.
putBoolean
(
Constants
.
CHATROOM_GROUP_BY_TYPE_KEY
,
isChecked
)
}
AlertDialog
.
Builder
(
context
)
...
...
@@ -234,10 +247,13 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
}
private
fun
updateSort
()
{
val
sortType
=
SharedPreferenceHelper
.
getInt
(
Constants
.
CHATROOM_SORT_TYPE_KEY
,
ChatRoomsSortOrder
.
ACTIVITY
)
val
sortType
=
SharedPreferenceHelper
.
getInt
(
Constants
.
CHATROOM_SORT_TYPE_KEY
,
ChatRoomsSortOrder
.
ACTIVITY
)
val
grouped
=
SharedPreferenceHelper
.
getBoolean
(
Constants
.
CHATROOM_GROUP_BY_TYPE_KEY
,
false
)
val
query
=
when
(
sortType
)
{
val
query
=
when
(
sortType
)
{
ChatRoomsSortOrder
.
ALPHABETICAL
->
{
Query
.
ByName
(
grouped
)
}
...
...
@@ -304,11 +320,16 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
text_connection_status
.
text
=
getString
(
R
.
string
.
status_connected
)
handler
.
postDelayed
(
dismissStatus
,
2000
)
}
is
State
.
Disconnected
->
text_connection_status
.
text
=
getString
(
R
.
string
.
status_disconnected
)
is
State
.
Connecting
->
text_connection_status
.
text
=
getString
(
R
.
string
.
status_connecting
)
is
State
.
Authenticating
->
text_connection_status
.
text
=
getString
(
R
.
string
.
status_authenticating
)
is
State
.
Disconnecting
->
text_connection_status
.
text
=
getString
(
R
.
string
.
status_disconnecting
)
is
State
.
Waiting
->
text_connection_status
.
text
=
getString
(
R
.
string
.
status_waiting
,
state
.
seconds
)
is
State
.
Disconnected
->
text_connection_status
.
text
=
getString
(
R
.
string
.
status_disconnected
)
is
State
.
Connecting
->
text_connection_status
.
text
=
getString
(
R
.
string
.
status_connecting
)
is
State
.
Authenticating
->
text_connection_status
.
text
=
getString
(
R
.
string
.
status_authenticating
)
is
State
.
Disconnecting
->
text_connection_status
.
text
=
getString
(
R
.
string
.
status_disconnecting
)
is
State
.
Waiting
->
text_connection_status
.
text
=
getString
(
R
.
string
.
status_waiting
,
state
.
seconds
)
}
}
}
...
...
app/src/main/java/chat/rocket/android/createchannel/ui/CreateChannelFragment.kt
View file @
8ce5d9d3
...
...
@@ -15,18 +15,17 @@ import androidx.recyclerview.widget.DividerItemDecoration
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
chat.rocket.android.R
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.createchannel.presentation.CreateChannelPresenter
import
chat.rocket.android.createchannel.presentation.CreateChannelView
import
chat.rocket.android.main.ui.MainActivity
import
chat.rocket.android.members.adapter.MembersAdapter
import
chat.rocket.android.members.uimodel.MemberUiModel
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.showToast
import
chat.rocket.android.util.extensions.ui
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
...
...
@@ -43,7 +42,7 @@ class CreateChannelFragment : Fragment(), CreateChannelView, ActionMode.Callback
@Inject
lateinit
var
createChannelPresenter
:
CreateChannelPresenter
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
private
var
actionMode
:
ActionMode
?
=
null
private
val
adapter
:
MembersAdapter
=
MembersAdapter
{
if
(
it
.
username
!=
null
)
{
...
...
@@ -77,9 +76,7 @@ class CreateChannelFragment : Fragment(), CreateChannelView, ActionMode.Callback
setupRecyclerView
()
subscribeEditTexts
()
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
CreateChannel
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
CreateChannel
)
}
override
fun
onDestroyView
()
{
...
...
app/src/main/java/chat/rocket/android/dagger/module/AppModule.kt
View file @
8ce5d9d3
...
...
@@ -9,6 +9,10 @@ import android.content.Context
import
android.content.SharedPreferences
import
chat.rocket.android.BuildConfig
import
chat.rocket.android.R
import
chat.rocket.android.analytics.Analytics
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.AnswersAnalytics
import
chat.rocket.android.analytics.GoogleAnalyticsForFirebase
import
chat.rocket.android.authentication.infraestructure.SharedPreferencesMultiServerTokenRepository
import
chat.rocket.android.authentication.infraestructure.SharedPreferencesTokenRepository
import
chat.rocket.android.chatroom.service.MessageService
...
...
@@ -23,10 +27,12 @@ import chat.rocket.android.push.GroupedPush
import
chat.rocket.android.push.PushManager
import
chat.rocket.android.server.domain.AccountsRepository
import
chat.rocket.android.server.domain.ActiveUsersRepository
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.server.domain.AnalyticsTrackingRepository
import
chat.rocket.android.server.domain.ChatRoomsRepository
import
chat.rocket.android.server.domain.CurrentServerRepository
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.GetSettingsInteractor
import
chat.rocket.android.server.domain.JobSchedulerInteractor
...
...
@@ -115,7 +121,10 @@ class AppModule {
@Provides
@Singleton
fun
provideImagePipelineConfig
(
context
:
Context
,
okHttpClient
:
OkHttpClient
):
ImagePipelineConfig
{
fun
provideImagePipelineConfig
(
context
:
Context
,
okHttpClient
:
OkHttpClient
):
ImagePipelineConfig
{
val
listeners
=
setOf
(
RequestLoggingListener
())
return
OkHttpImagePipelineConfigFactory
.
newBuilder
(
context
,
okHttpClient
)
...
...
@@ -185,7 +194,10 @@ class AppModule {
@Provides
@Singleton
fun
providePermissionsRepository
(
localRepository
:
LocalRepository
,
moshi
:
Moshi
):
PermissionsRepository
{
fun
providePermissionsRepository
(
localRepository
:
LocalRepository
,
moshi
:
Moshi
):
PermissionsRepository
{
return
SharedPreferencesPermissionsRepository
(
localRepository
,
moshi
)
}
...
...
@@ -234,15 +246,20 @@ class AppModule {
@Provides
@Singleton
fun
provideMultiServerTokenRepository
(
repository
:
LocalRepository
,
moshi
:
Moshi
):
MultiServerTokenRepository
{
fun
provideMultiServerTokenRepository
(
repository
:
LocalRepository
,
moshi
:
Moshi
):
MultiServerTokenRepository
{
return
SharedPreferencesMultiServerTokenRepository
(
repository
,
moshi
)
}
@Provides
@Singleton
fun
provideMessageRepository
(
@ForMessages
preferences
:
SharedPreferences
,
moshi
:
Moshi
,
currentServerInteractor
:
GetCurrentServerInteractor
):
MessagesRepository
{
fun
provideMessageRepository
(
@ForMessages
preferences
:
SharedPreferences
,
moshi
:
Moshi
,
currentServerInteractor
:
GetCurrentServerInteractor
):
MessagesRepository
{
return
SharedPreferencesMessagesRepository
(
preferences
,
moshi
,
currentServerInteractor
)
}
...
...
@@ -257,10 +274,12 @@ class AppModule {
fun
provideConfiguration
(
context
:
Application
):
SpannableConfiguration
{
val
res
=
context
.
resources
return
SpannableConfiguration
.
builder
(
context
)
.
theme
(
SpannableTheme
.
builder
()
.
blockMargin
(
0
)
.
linkColor
(
res
.
getColor
(
R
.
color
.
colorAccent
))
.
build
())
.
theme
(
SpannableTheme
.
builder
()
.
blockMargin
(
0
)
.
linkColor
(
res
.
getColor
(
R
.
color
.
colorAccent
))
.
build
()
)
.
build
()
}
...
...
@@ -277,7 +296,10 @@ class AppModule {
@Provides
@Singleton
fun
provideAccountsRepository
(
preferences
:
SharedPreferences
,
moshi
:
Moshi
):
AccountsRepository
=
fun
provideAccountsRepository
(
preferences
:
SharedPreferences
,
moshi
:
Moshi
):
AccountsRepository
=
SharedPreferencesAccountsRepository
(
preferences
,
moshi
)
@Provides
...
...
@@ -296,8 +318,16 @@ class AppModule {
manager
:
NotificationManager
,
moshi
:
Moshi
,
getAccountInteractor
:
GetAccountInteractor
,
getSettingsInteractor
:
GetSettingsInteractor
):
PushManager
{
return
PushManager
(
groupedPushes
,
manager
,
moshi
,
getAccountInteractor
,
getSettingsInteractor
,
context
)
getSettingsInteractor
:
GetSettingsInteractor
):
PushManager
{
return
PushManager
(
groupedPushes
,
manager
,
moshi
,
getAccountInteractor
,
getSettingsInteractor
,
context
)
}
@Provides
...
...
@@ -307,14 +337,19 @@ class AppModule {
@Provides
fun
provideSendMessageJob
(
context
:
Application
):
JobInfo
{
return
JobInfo
.
Builder
(
MessageService
.
RETRY_SEND_MESSAGE_ID
,
ComponentName
(
context
,
MessageService
::
class
.
java
))
return
JobInfo
.
Builder
(
MessageService
.
RETRY_SEND_MESSAGE_ID
,
ComponentName
(
context
,
MessageService
::
class
.
java
)
)
.
setRequiredNetworkType
(
JobInfo
.
NETWORK_TYPE_ANY
)
.
build
()
}
@Provides
fun
provideJobSchedulerInteractor
(
jobScheduler
:
JobScheduler
,
jobInfo
:
JobInfo
):
JobSchedulerInteractor
{
fun
provideJobSchedulerInteractor
(
jobScheduler
:
JobScheduler
,
jobInfo
:
JobInfo
):
JobSchedulerInteractor
{
return
JobSchedulerInteractorImpl
(
jobScheduler
,
jobInfo
)
}
...
...
@@ -331,4 +366,33 @@ class AppModule {
):
DatabaseManager
{
return
factory
.
create
(
currentServer
)
}
@Provides
@Singleton
fun
provideAnswersAnalytics
():
AnswersAnalytics
{
return
AnswersAnalytics
()
}
@Provides
@Singleton
fun
provideGoogleAnalyticsForFirebase
(
context
:
Application
):
GoogleAnalyticsForFirebase
{
return
GoogleAnalyticsForFirebase
(
context
)
}
@Provides
@Singleton
fun
provideAnalyticsManager
(
analyticsTrackingInteractor
:
AnalyticsTrackingInteractor
,
getCurrentServerInteractor
:
GetCurrentServerInteractor
,
getAccountsInteractor
:
GetAccountsInteractor
,
answersAnalytics
:
AnswersAnalytics
,
googleAnalyticsForFirebase
:
GoogleAnalyticsForFirebase
):
AnalyticsManager
{
return
AnalyticsManager
(
analyticsTrackingInteractor
,
getCurrentServerInteractor
,
getAccountsInteractor
,
listOf
(
answersAnalytics
,
googleAnalyticsForFirebase
)
)
}
}
app/src/main/java/chat/rocket/android/favoritemessages/ui/FavoriteMessagesFragment.kt
View file @
8ce5d9d3
...
...
@@ -10,18 +10,17 @@ import androidx.recyclerview.widget.DefaultItemAnimator
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
chat.rocket.android.R
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.chatroom.adapter.ChatRoomAdapter
import
chat.rocket.android.chatroom.ui.ChatRoomActivity
import
chat.rocket.android.chatroom.uimodel.BaseUiModel
import
chat.rocket.android.favoritemessages.presentation.FavoriteMessagesPresenter
import
chat.rocket.android.favoritemessages.presentation.FavoriteMessagesView
import
chat.rocket.android.helper.EndlessRecyclerViewScrollListener
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.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
...
...
@@ -41,7 +40,7 @@ class FavoriteMessagesFragment : Fragment(), FavoriteMessagesView {
@Inject
lateinit
var
presenter
:
FavoriteMessagesPresenter
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
private
lateinit
var
chatRoomId
:
String
private
val
adapter
=
ChatRoomAdapter
(
enableActions
=
false
)
...
...
@@ -68,9 +67,7 @@ class FavoriteMessagesFragment : Fragment(), FavoriteMessagesView {
setupToolbar
()
presenter
.
loadFavoriteMessages
(
chatRoomId
)
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
FavoriteMessages
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
FavoriteMessages
)
}
override
fun
showFavoriteMessages
(
favoriteMessages
:
List
<
BaseUiModel
<*
>>)
{
...
...
app/src/main/java/chat/rocket/android/files/ui/FilesFragment.kt
View file @
8ce5d9d3
...
...
@@ -13,6 +13,8 @@ import androidx.recyclerview.widget.DividerItemDecoration.HORIZONTAL
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
chat.rocket.android.R
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.chatroom.ui.ChatRoomActivity
import
chat.rocket.android.files.adapter.FilesAdapter
import
chat.rocket.android.files.presentation.FilesPresenter
...
...
@@ -21,12 +23,9 @@ import chat.rocket.android.files.uimodel.FileUiModel
import
chat.rocket.android.helper.EndlessRecyclerViewScrollListener
import
chat.rocket.android.helper.ImageHelper
import
chat.rocket.android.player.PlayerActivity
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.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
...
...
@@ -46,7 +45,7 @@ class FilesFragment : Fragment(), FilesView {
@Inject
lateinit
var
presenter
:
FilesPresenter
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
private
val
adapter
:
FilesAdapter
=
FilesAdapter
{
fileUiModel
->
presenter
.
openFile
(
fileUiModel
)
}
private
val
linearLayoutManager
=
LinearLayoutManager
(
context
)
...
...
@@ -75,9 +74,7 @@ class FilesFragment : Fragment(), FilesView {
setupRecyclerView
()
presenter
.
loadFiles
(
chatRoomId
)
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
Files
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
Files
)
}
override
fun
showFiles
(
dataSet
:
List
<
FileUiModel
>,
total
:
Long
)
{
...
...
app/src/main/java/chat/rocket/android/members/ui/MemberBottomSheetFragment.kt
View file @
8ce5d9d3
...
...
@@ -6,11 +6,10 @@ import android.view.View
import
android.view.ViewGroup
import
androidx.core.view.isVisible
import
chat.rocket.android.R
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.util.extensions.content
import
chat.rocket.android.util.extensions.textContent
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
...
...
@@ -43,7 +42,7 @@ private const val BUNDLE_UTC_OFFSET = "utc_offset"
class
MemberBottomSheetFragment
:
BottomSheetDialogFragment
()
{
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
private
lateinit
var
avatarUri
:
String
private
lateinit
var
realName
:
String
private
lateinit
var
username
:
String
...
...
@@ -76,9 +75,7 @@ class MemberBottomSheetFragment : BottomSheetDialogFragment() {
super
.
onViewCreated
(
view
,
savedInstanceState
)
showMemberDetails
()
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
MemberBottomSheet
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
MemberBottomSheet
)
}
private
fun
showMemberDetails
()
{
...
...
app/src/main/java/chat/rocket/android/members/ui/MembersFragment.kt
View file @
8ce5d9d3
package
chat.rocket.android.members.ui
import
android.os.Bundle
import
androidx.fragment.app.Fragment
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.DividerItemDecoration
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
chat.rocket.android.R
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.chatroom.ui.ChatRoomActivity
import
chat.rocket.android.helper.EndlessRecyclerViewScrollListener
import
chat.rocket.android.members.adapter.MembersAdapter
import
chat.rocket.android.members.presentation.MembersPresenter
import
chat.rocket.android.members.presentation.MembersView
import
chat.rocket.android.members.uimodel.MemberUiModel
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.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
...
...
@@ -41,7 +40,7 @@ class MembersFragment : Fragment(), MembersView {
@Inject
lateinit
var
presenter
:
MembersPresenter
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
private
val
adapter
:
MembersAdapter
=
MembersAdapter
{
memberUiModel
->
presenter
.
toMemberDetails
(
memberUiModel
)
}
private
val
linearLayoutManager
=
LinearLayoutManager
(
context
)
...
...
@@ -70,9 +69,7 @@ class MembersFragment : Fragment(), MembersView {
setupRecyclerView
()
presenter
.
loadChatRoomsMembers
(
chatRoomId
)
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
Members
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
Members
)
}
override
fun
showMembers
(
dataSet
:
List
<
MemberUiModel
>,
total
:
Long
)
{
...
...
app/src/main/java/chat/rocket/android/mentions/ui/MentionsFragment.kt
View file @
8ce5d9d3
...
...
@@ -10,18 +10,17 @@ import androidx.recyclerview.widget.DefaultItemAnimator
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
chat.rocket.android.R
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.chatroom.adapter.ChatRoomAdapter
import
chat.rocket.android.chatroom.ui.ChatRoomActivity
import
chat.rocket.android.chatroom.uimodel.BaseUiModel
import
chat.rocket.android.helper.EndlessRecyclerViewScrollListener
import
chat.rocket.android.mentions.presentention.MentionsPresenter
import
chat.rocket.android.mentions.presentention.MentionsView
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.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
...
...
@@ -44,7 +43,7 @@ class MentionsFragment : Fragment(), MentionsView {
@Inject
lateinit
var
presenter
:
MentionsPresenter
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
...
...
@@ -70,9 +69,7 @@ class MentionsFragment : Fragment(), MentionsView {
setupToolbar
()
presenter
.
loadMentions
(
chatRoomId
)
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
Mentions
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
Mentions
)
}
override
fun
showMentions
(
mentions
:
List
<
BaseUiModel
<*
>>)
{
...
...
app/src/main/java/chat/rocket/android/pinnedmessages/ui/PinnedMessagesFragment.kt
View file @
8ce5d9d3
...
...
@@ -10,6 +10,8 @@ import androidx.recyclerview.widget.DefaultItemAnimator
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
chat.rocket.android.R
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.chatroom.adapter.ChatRoomAdapter
import
chat.rocket.android.chatroom.ui.ChatRoomActivity
import
chat.rocket.android.chatroom.uimodel.BaseUiModel
...
...
@@ -20,8 +22,6 @@ 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.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
...
...
@@ -41,7 +41,7 @@ class PinnedMessagesFragment : Fragment(), PinnedMessagesView {
@Inject
lateinit
var
presenter
:
PinnedMessagesPresenter
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
private
lateinit
var
chatRoomId
:
String
private
val
adapter
=
ChatRoomAdapter
(
enableActions
=
false
)
...
...
@@ -69,9 +69,7 @@ class PinnedMessagesFragment : Fragment(), PinnedMessagesView {
setupToolbar
()
presenter
.
loadPinnedMessages
(
chatRoomId
)
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
PinnedMessages
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
PinnedMessages
)
}
override
fun
showPinnedMessages
(
pinnedMessages
:
List
<
BaseUiModel
<*
>>)
{
...
...
app/src/main/java/chat/rocket/android/preferences/ui/PreferencesFragment.kt
View file @
8ce5d9d3
...
...
@@ -7,12 +7,11 @@ import android.view.ViewGroup
import
androidx.fragment.app.Fragment
import
chat.rocket.android.BuildConfig
import
chat.rocket.android.R
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.ScreenViewEvent
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.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.*
...
...
@@ -24,7 +23,7 @@ class PreferencesFragment : Fragment(), PreferencesView {
@Inject
lateinit
var
presenter
:
PreferencesPresenter
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
...
...
@@ -43,17 +42,15 @@ class PreferencesFragment : Fragment(), PreferencesView {
setupListeners
()
presenter
.
loadAnalyticsTrackingInformation
()
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
Preferences
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
Preferences
)
}
override
fun
setupAnalyticsTrackingView
(
isAnalyticsTrackingEnabled
:
Boolean
)
{
if
(
BuildConfig
.
FLAVOR
==
"foss"
)
{
text_analytics_tracking_description
.
text
=
getString
(
R
.
string
.
msg_not_applicable_since_it_is_a_foss_version
)
switch_analytics_tracking
.
isChecked
=
false
switch_analytics_tracking
.
isEnabled
=
false
text_analytics_tracking_description
.
text
=
getString
(
R
.
string
.
msg_not_applicable_since_it_is_a_foss_version
)
return
}
...
...
app/src/main/java/chat/rocket/android/profile/ui/ProfileFragment.kt
View file @
8ce5d9d3
...
...
@@ -17,10 +17,11 @@ import androidx.core.net.toUri
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.main.ui.MainActivity
import
chat.rocket.android.profile.presentation.ProfilePresenter
import
chat.rocket.android.profile.presentation.ProfileView
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.util.extension.asObservable
import
chat.rocket.android.util.extension.dispatchImageSelection
import
chat.rocket.android.util.extension.dispatchTakePicture
...
...
@@ -28,8 +29,6 @@ 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.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
...
...
@@ -48,7 +47,7 @@ class ProfileFragment : Fragment(), ProfileView, ActionMode.Callback {
@Inject
lateinit
var
presenter
:
ProfilePresenter
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
private
var
currentName
=
""
private
var
currentUsername
=
""
private
var
currentEmail
=
""
...
...
@@ -81,9 +80,7 @@ class ProfileFragment : Fragment(), ProfileView, ActionMode.Callback {
presenter
.
loadUserProfile
()
subscribeEditTexts
()
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
Profile
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
Profile
)
}
override
fun
onDestroyView
()
{
...
...
app/src/main/java/chat/rocket/android/server/domain/AccountsRepository.kt
View file @
8ce5d9d3
...
...
@@ -3,7 +3,7 @@ package chat.rocket.android.server.domain
import
chat.rocket.android.server.domain.model.Account
interface
AccountsRepository
{
suspend
fun
save
(
account
:
Account
)
suspend
fun
load
():
List
<
Account
>
suspend
fun
remove
(
serverUrl
:
String
)
fun
save
(
account
:
Account
)
fun
load
():
List
<
Account
>
fun
remove
(
serverUrl
:
String
)
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/server/domain/GetAccountsInteractor.kt
View file @
8ce5d9d3
...
...
@@ -3,5 +3,5 @@ package chat.rocket.android.server.domain
import
javax.inject.Inject
class
GetAccountsInteractor
@Inject
constructor
(
val
repository
:
AccountsRepository
)
{
suspend
fun
get
()
=
repository
.
load
()
fun
get
()
=
repository
.
load
()
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/server/infraestructure/SharedPreferencesAccountsRepository.kt
View file @
8ce5d9d3
...
...
@@ -6,41 +6,37 @@ import chat.rocket.android.server.domain.AccountsRepository
import
chat.rocket.android.server.domain.model.Account
import
com.squareup.moshi.Moshi
import
com.squareup.moshi.Types
import
kotlinx.coroutines.experimental.CommonPool
import
kotlinx.coroutines.experimental.withContext
private
const
val
ACCOUNTS_KEY
=
"ACCOUNTS_KEY"
class
SharedPreferencesAccountsRepository
(
private
val
preferences
:
SharedPreferences
,
private
val
moshi
:
Moshi
)
:
AccountsRepository
{
override
suspend
fun
save
(
newAccount
:
Account
)
{
withContext
(
CommonPool
)
{
val
accounts
=
load
()
override
fun
save
(
newAccount
:
Account
)
{
val
accounts
=
load
()
val
newList
=
accounts
.
filter
{
account
->
newAccount
.
serverUrl
!=
account
.
serverUrl
}
.
toMutableList
()
newList
.
add
(
0
,
newAccount
)
save
(
newList
)
}
val
newList
=
accounts
.
filter
{
account
->
newAccount
.
serverUrl
!=
account
.
serverUrl
}
.
toMutableList
()
newList
.
add
(
0
,
newAccount
)
save
(
newList
)
}
override
suspend
fun
load
():
List
<
Account
>
=
withContext
(
CommonPool
)
{
override
fun
load
():
List
<
Account
>
{
val
json
=
preferences
.
getString
(
ACCOUNTS_KEY
,
"[]"
)
val
type
=
Types
.
newParameterizedType
(
List
::
class
.
java
,
Account
::
class
.
java
)
val
adapter
=
moshi
.
adapter
<
List
<
Account
>>(
type
)
adapter
.
fromJson
(
json
)
?:
emptyList
()
return
adapter
.
fromJson
(
json
)
?:
emptyList
()
}
override
suspend
fun
remove
(
serverUrl
:
String
)
{
withContext
(
CommonPool
)
{
val
accounts
=
load
()
override
fun
remove
(
serverUrl
:
String
)
{
val
accounts
=
load
()
val
newList
=
accounts
.
filter
{
account
->
serverUrl
!=
account
.
serverUrl
}
.
toMutableList
()
save
(
newList
)
}
val
newList
=
accounts
.
filter
{
account
->
serverUrl
!=
account
.
serverUrl
}
.
toMutableList
()
save
(
newList
)
}
private
fun
save
(
accounts
:
List
<
Account
>)
{
...
...
@@ -50,6 +46,4 @@ class SharedPreferencesAccountsRepository(
putString
(
ACCOUNTS_KEY
,
adapter
.
toJson
(
accounts
))
}
}
}
private
const
val
ACCOUNTS_KEY
=
"ACCOUNTS_KEY"
\ No newline at end of file
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/server/presentation/ChangeServerPresenter.kt
View file @
8ce5d9d3
package
chat.rocket.android.server.presentation
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.infrastructure.LocalRepository
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
...
...
@@ -11,7 +11,6 @@ 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.analytics.AnalyticsManager
import
chat.rocket.common.util.ifNull
import
javax.inject.Inject
...
...
@@ -23,7 +22,7 @@ class ChangeServerPresenter @Inject constructor(
private
val
getCurrentServerInteractor
:
GetCurrentServerInteractor
,
private
val
getAccountInteractor
:
GetAccountInteractor
,
private
val
getAccountsInteractor
:
GetAccountsInteractor
,
private
val
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
,
private
val
analytics
Manager
:
AnalyticsManage
r
,
private
val
settingsRepository
:
SettingsRepository
,
private
val
tokenRepository
:
TokenRepository
,
private
val
localRepository
:
LocalRepository
,
...
...
@@ -66,9 +65,7 @@ class ChangeServerPresenter @Inject constructor(
saveCurrentServerInteractor
.
save
(
serverUrl
)
view
.
hideProgress
()
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logServerSwitch
(
serverUrl
,
accounts
.
size
)
}
analyticsManager
.
logServerSwitch
()
navigator
.
toChatRooms
(
chatRoomId
)
}.
ifNull
{
view
.
hideProgress
()
...
...
app/src/main/java/chat/rocket/android/settings/password/ui/PasswordFragment.kt
View file @
8ce5d9d3
...
...
@@ -10,15 +10,14 @@ 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.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.settings.password.presentation.PasswordPresenter
import
chat.rocket.android.settings.password.presentation.PasswordView
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.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
...
...
@@ -32,7 +31,7 @@ class PasswordFragment : Fragment(), PasswordView, ActionMode.Callback {
@Inject
lateinit
var
presenter
:
PasswordPresenter
@Inject
lateinit
var
analytics
TrackingInteractor
:
AnalyticsTrackingInteracto
r
lateinit
var
analytics
Manager
:
AnalyticsManage
r
private
var
actionMode
:
ActionMode
?
=
null
private
val
disposables
=
CompositeDisposable
()
...
...
@@ -56,9 +55,7 @@ class PasswordFragment : Fragment(), PasswordView, ActionMode.Callback {
disposables
.
add
(
listenToChanges
())
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
Password
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
Password
)
}
override
fun
onDestroyView
()
{
...
...
app/src/main/java/chat/rocket/android/settings/ui/SettingsFragment.kt
View file @
8ce5d9d3
...
...
@@ -11,16 +11,16 @@ import androidx.fragment.app.Fragment
import
chat.rocket.android.R
import
chat.rocket.android.about.ui.AboutFragment
import
chat.rocket.android.about.ui.TAG_ABOUT_FRAGMENT
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.main.ui.MainActivity
import
chat.rocket.android.preferences.ui.PreferencesFragment
import
chat.rocket.android.preferences.ui.TAG_PREFERENCES_FRAGMENT
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
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.analytics.AnalyticsManager
import
chat.rocket.android.util.helper.analytics.event.ScreenViewEvent
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_settings.*
import
javax.inject.Inject
import
kotlin.reflect.KClass
...
...
@@ -29,7 +29,12 @@ internal const val TAG_SETTINGS_FRAGMENT = "SettingsFragment"
class
SettingsFragment
:
Fragment
(),
SettingsView
,
AdapterView
.
OnItemClickListener
{
@Inject
lateinit
var
analyticsTrackingInteractor
:
AnalyticsTrackingInteractor
lateinit
var
analyticsManager
:
AnalyticsManager
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
AndroidSupportInjection
.
inject
(
this
)
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
...
...
@@ -41,10 +46,7 @@ class SettingsFragment : Fragment(), SettingsView, AdapterView.OnItemClickListen
super
.
onViewCreated
(
view
,
savedInstanceState
)
setupToolbar
()
setupListView
()
if
(
analyticsTrackingInteractor
.
get
())
{
AnalyticsManager
.
logScreenView
(
ScreenViewEvent
.
Settings
)
}
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
Settings
)
}
override
fun
onResume
()
{
...
...
util/src/play/java/chat/rocket/android/util/helper/analytics/AnalyticsManager
.kt
→
app/src/play/java/chat/rocket/android/analytics/AnswersAnalytics
.kt
View file @
8ce5d9d3
package
chat.rocket.android.
util.helper.
analytics
package
chat.rocket.android.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
chat.rocket.android.analytics.event.AuthenticationEvent
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.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
// TODO inject the and analyticsTrackingInteractor and GetCurrentServerInteractor
object
AnalyticsManager
:
Analytics
{
class
AnswersAnalytics
:
Analytics
{
override
fun
logLogin
(
event
:
AuthenticationEvent
,
loginSucceeded
:
Boolean
)
=
Answers
.
getInstance
()
...
...
app/src/play/java/chat/rocket/android/analytics/GoogleAnalyticsForFirebase.kt
0 → 100644
View file @
8ce5d9d3
package
chat.rocket.android.analytics
import
android.content.Context
import
android.os.Bundle
import
chat.rocket.android.analytics.event.AuthenticationEvent
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.analytics.event.SubscriptionTypeEvent
import
com.google.firebase.analytics.FirebaseAnalytics
import
javax.inject.Inject
class
GoogleAnalyticsForFirebase
@Inject
constructor
(
val
context
:
Context
)
:
Analytics
{
private
val
firebaseAnalytics
=
FirebaseAnalytics
.
getInstance
(
context
)
override
fun
logLogin
(
event
:
AuthenticationEvent
,
loginSucceeded
:
Boolean
)
{
firebaseAnalytics
.
logEvent
(
FirebaseAnalytics
.
Event
.
LOGIN
,
Bundle
(
1
).
apply
{
putString
(
FirebaseAnalytics
.
Param
.
METHOD
,
event
.
methodName
)
putLong
(
FirebaseAnalytics
.
Param
.
SUCCESS
,
if
(
loginSucceeded
)
1
else
0
)
})
}
override
fun
logSignUp
(
event
:
AuthenticationEvent
,
signUpSucceeded
:
Boolean
)
{
firebaseAnalytics
.
logEvent
(
FirebaseAnalytics
.
Event
.
SIGN_UP
,
Bundle
(
1
).
apply
{
putString
(
FirebaseAnalytics
.
Param
.
METHOD
,
event
.
methodName
)
putLong
(
FirebaseAnalytics
.
Param
.
SUCCESS
,
if
(
signUpSucceeded
)
1
else
0
)
})
}
override
fun
logScreenView
(
event
:
ScreenViewEvent
)
{
firebaseAnalytics
.
logEvent
(
"screen_view"
,
Bundle
(
1
).
apply
{
putString
(
"screen"
,
event
.
screenName
)
})
}
override
fun
logMessageSent
(
event
:
SubscriptionTypeEvent
,
serverUrl
:
String
)
{
firebaseAnalytics
.
logEvent
(
"message_sent"
,
Bundle
(
1
).
apply
{
putString
(
"subscription_type"
,
event
.
subscriptionTypeName
)
putString
(
"server"
,
serverUrl
)
})
}
override
fun
logMediaUploaded
(
event
:
SubscriptionTypeEvent
,
mimeType
:
String
)
{
firebaseAnalytics
.
logEvent
(
"media_upload"
,
Bundle
(
1
).
apply
{
putString
(
"subscription_type"
,
event
.
subscriptionTypeName
)
putString
(
"media_type"
,
mimeType
)
})
}
override
fun
logReaction
(
event
:
SubscriptionTypeEvent
)
{
firebaseAnalytics
.
logEvent
(
"reaction"
,
Bundle
(
1
).
apply
{
putString
(
"subscription_type"
,
event
.
subscriptionTypeName
)
})
}
override
fun
logServerSwitch
(
serverUrl
:
String
,
serverCount
:
Int
)
{
firebaseAnalytics
.
logEvent
(
"server_switch"
,
Bundle
(
1
).
apply
{
putString
(
"server_url"
,
serverUrl
)
putInt
(
"server_count"
,
serverCount
)
})
}
}
dependencies.gradle
View file @
8ce5d9d3
...
...
@@ -21,7 +21,7 @@ ext {
dagger
:
'2.16'
,
firebaseCloudMessage
:
'17.1.0'
,
firebaseAnalytics
:
'16.0.
1
'
,
firebaseAnalytics
:
'16.0.
3
'
,
playServices
:
'15.0.1'
,
exoPlayer
:
'2.8.2'
,
flexbox
:
'1.0.0'
,
...
...
util/build.gradle
View file @
8ce5d9d3
...
...
@@ -23,20 +23,6 @@ android {
proguardFiles
getDefaultProguardFile
(
'proguard-android.txt'
),
'proguard-rules.pro'
}
}
flavorDimensions
"type"
productFlavors
{
// includes proprietary libs
play
{
dimension
"type"
}
// only foss
foss
{
dimension
"type"
}
}
}
dependencies
{
...
...
@@ -55,9 +41,4 @@ dependencies {
// TODO This is a dependency from the core module, but the util module are unable to get that dependencies. Check why it is occurring since transitive is enable by default
implementation
libraries
.
lifecycleExtensions
kapt
libraries
.
lifecycleCompiler
// Proprietary libraries
playImplementation
(
'com.crashlytics.sdk.android:answers:1.4.2@aar'
)
{
transitive
=
true
}
}
\ 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