Commit 25d27da0 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Add functions.

parent ffa849ce
package chat.rocket.android.authentication.presentation package chat.rocket.android.authentication.presentation
import android.content.Context
import android.content.Intent import android.content.Intent
import chat.rocket.android.R import chat.rocket.android.R
import chat.rocket.android.app.MainActivity import chat.rocket.android.app.MainActivity
import chat.rocket.android.authentication.ui.AuthenticationActivity
import chat.rocket.android.authentication.login.ui.LoginFragment import chat.rocket.android.authentication.login.ui.LoginFragment
import chat.rocket.android.authentication.signup.ui.SignupFragment import chat.rocket.android.authentication.signup.ui.SignupFragment
import chat.rocket.android.authentication.twofactor.ui.TwoFAFragment import chat.rocket.android.authentication.twofactor.ui.TwoFAFragment
import chat.rocket.android.authentication.ui.AuthenticationActivity
import chat.rocket.android.util.addFragmentBackStack import chat.rocket.android.util.addFragmentBackStack
import chat.rocket.android.webview.webViewIntent
class AuthenticationNavigator(internal val activity: AuthenticationActivity) { class AuthenticationNavigator(internal val activity: AuthenticationActivity, internal val context: Context) {
var currentServer: String? = null var currentServer: String? = null
fun toLogin(server: String) { fun toLogin(server: String) {
...@@ -33,6 +35,16 @@ class AuthenticationNavigator(internal val activity: AuthenticationActivity) { ...@@ -33,6 +35,16 @@ class AuthenticationNavigator(internal val activity: AuthenticationActivity) {
} }
} }
fun toTermsOfService() {
val webPageUrl = currentServer + "/terms-of-service"
activity.startActivity(context.webViewIntent(webPageUrl))
}
fun toPrivacyPolicy() {
val webPageUrl = currentServer + "/privacy-policy"
activity.startActivity(context.webViewIntent(webPageUrl))
}
fun toChatList() { fun toChatList() {
val chatRoom = Intent(activity, MainActivity::class.java).apply { val chatRoom = Intent(activity, MainActivity::class.java).apply {
//TODO any parameter to pass //TODO any parameter to pass
......
...@@ -60,4 +60,12 @@ class SignupPresenter @Inject constructor(private val view: SignupView, ...@@ -60,4 +60,12 @@ class SignupPresenter @Inject constructor(private val view: SignupView,
} }
} }
} }
fun termsOfService() {
navigator.toTermsOfService()
}
fun privacyPolicy() {
navigator.toPrivacyPolicy()
}
} }
\ No newline at end of file
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