Commit 00be1d67 authored by Samer Alabi's avatar Samer Alabi

Merge branch 'develop' into room-info

parents 666dff13 fd74ea32
...@@ -61,7 +61,14 @@ interface Analytics { ...@@ -61,7 +61,14 @@ interface Analytics {
fun logServerSwitch(serverUrl: String, serverCount: Int) {} fun logServerSwitch(serverUrl: String, serverCount: Int) {}
/** /**
* Logs the admin opening. * Logs the admin opening event.
*/ */
fun logOpenAdmin() {} fun logOpenAdmin() {}
/**
* Logs the reset password event.
*
* @param resetPasswordSucceeded True if successful reset password, false otherwise.
*/
fun logResetPassword(resetPasswordSucceeded: Boolean) {}
} }
...@@ -70,4 +70,10 @@ class AnalyticsManager @Inject constructor( ...@@ -70,4 +70,10 @@ class AnalyticsManager @Inject constructor(
analytics.forEach { it.logOpenAdmin() } analytics.forEach { it.logOpenAdmin() }
} }
} }
fun logResetPassword(resetPasswordSucceeded: Boolean) {
if (analyticsTrackingInteractor.get()) {
analytics.forEach { it.logResetPassword(resetPasswordSucceeded) }
}
}
} }
package chat.rocket.android.settings.password.presentation package chat.rocket.android.settings.password.presentation
import chat.rocket.android.analytics.AnalyticsManager
import chat.rocket.android.core.lifecycle.CancelStrategy import chat.rocket.android.core.lifecycle.CancelStrategy
import chat.rocket.android.server.domain.GetCurrentServerInteractor import chat.rocket.android.server.domain.GetCurrentServerInteractor
import chat.rocket.android.server.infraestructure.RocketChatClientFactory import chat.rocket.android.server.infraestructure.RocketChatClientFactory
...@@ -14,6 +15,7 @@ import javax.inject.Inject ...@@ -14,6 +15,7 @@ import javax.inject.Inject
class PasswordPresenter @Inject constructor( class PasswordPresenter @Inject constructor(
private val view: PasswordView, private val view: PasswordView,
private val strategy: CancelStrategy, private val strategy: CancelStrategy,
private val analyticsManager: AnalyticsManager,
serverInteractor: GetCurrentServerInteractor, serverInteractor: GetCurrentServerInteractor,
factory: RocketChatClientFactory factory: RocketChatClientFactory
) { ) {
...@@ -30,10 +32,12 @@ class PasswordPresenter @Inject constructor( ...@@ -30,10 +32,12 @@ class PasswordPresenter @Inject constructor(
client.updateProfile(me.id, null, null, password, null) client.updateProfile(me.id, null, null, password, null)
} }
analyticsManager.logResetPassword(true)
view.showPasswordSuccessfullyUpdatedMessage() view.showPasswordSuccessfullyUpdatedMessage()
view.hideLoading()
} catch (exception: RocketChatException) { } catch (exception: RocketChatException) {
analyticsManager.logResetPassword(false)
view.showPasswordFailsUpdateMessage(exception.message) view.showPasswordFailsUpdateMessage(exception.message)
} finally {
view.hideLoading() view.hideLoading()
} }
} }
......
...@@ -67,4 +67,11 @@ class AnswersAnalytics : Analytics { ...@@ -67,4 +67,11 @@ class AnswersAnalytics : Analytics {
) )
override fun logOpenAdmin() = Answers.getInstance().logCustom(CustomEvent("open_admin")) override fun logOpenAdmin() = Answers.getInstance().logCustom(CustomEvent("open_admin"))
override fun logResetPassword(resetPasswordSucceeded: Boolean) =
Answers.getInstance()
.logCustom(
CustomEvent("reset_password")
.putCustomAttribute("resetPasswordSucceeded", resetPasswordSucceeded.toString())
)
} }
...@@ -60,4 +60,9 @@ class GoogleAnalyticsForFirebase @Inject constructor(val context: Context) : ...@@ -60,4 +60,9 @@ class GoogleAnalyticsForFirebase @Inject constructor(val context: Context) :
} }
override fun logOpenAdmin() = firebaseAnalytics.logEvent("open_admin", null) override fun logOpenAdmin() = firebaseAnalytics.logEvent("open_admin", null)
override fun logResetPassword(resetPasswordSucceeded: Boolean) =
firebaseAnalytics.logEvent("reset_password", Bundle(1).apply {
putBoolean("resetPasswordSucceeded", resetPasswordSucceeded)
})
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment