Commit fe22aa68 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Delete unneeded code.

parent 43b32108
...@@ -41,24 +41,12 @@ class LoginFragment : Fragment(), LoginView { ...@@ -41,24 +41,12 @@ class LoginFragment : Fragment(), LoginView {
private var isGlobalLayoutListenerSetUp = false private var isGlobalLayoutListenerSetUp = false
companion object { companion object {
private const val SERVER_URL = "server_url" fun newInstance() = LoginFragment()
fun newInstance(url: String) = LoginFragment().apply {
arguments = Bundle(1).apply {
putString(SERVER_URL, url)
}
}
} }
// Todo remove
private lateinit var serverUrl: String
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
AndroidSupportInjection.inject(this)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
AndroidSupportInjection.inject(this)
// TODO - research a better way to initialize parameters on fragments.
serverUrl = arguments?.getString(SERVER_URL) ?: "https://open.rocket.chat"
} }
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? = inflater.inflate(R.layout.fragment_authentication_log_in, container, false) override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? = inflater.inflate(R.layout.fragment_authentication_log_in, container, false)
...@@ -170,11 +158,11 @@ class LoginFragment : Fragment(), LoginView { ...@@ -170,11 +158,11 @@ class LoginFragment : Fragment(), LoginView {
override fun showLoading() { override fun showLoading() {
enableUserInput(false) enableUserInput(false)
view_loading.show() view_loading.setVisibility(true)
} }
override fun hideLoading() { override fun hideLoading() {
view_loading.hide() view_loading.setVisibility(false)
enableUserInput(true) enableUserInput(true)
} }
......
...@@ -40,7 +40,7 @@ class ServerFragment : Fragment(), ServerView { ...@@ -40,7 +40,7 @@ class ServerFragment : Fragment(), ServerView {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
relative_layout.viewTreeObserver.addOnGlobalLayoutListener(layoutListener) relative_layout.viewTreeObserver.addOnGlobalLayoutListener(layoutListener)
activity?.applicationContext?.apply { activity?.apply {
button_connect.setOnClickListener { button_connect.setOnClickListener {
val url = text_server_url.textContent.ifEmpty(text_server_url.hintContent) val url = text_server_url.textContent.ifEmpty(text_server_url.hintContent)
presenter.connect(text_server_protocol.textContent + url) presenter.connect(text_server_protocol.textContent + url)
...@@ -55,15 +55,14 @@ class ServerFragment : Fragment(), ServerView { ...@@ -55,15 +55,14 @@ class ServerFragment : Fragment(), ServerView {
override fun showLoading() { override fun showLoading() {
enableUserInput(false) enableUserInput(false)
view_loading.show() view_loading.setVisibility(true)
} }
override fun hideLoading() { override fun hideLoading() {
view_loading.hide() view_loading.setVisibility(false)
enableUserInput(true) enableUserInput(true)
} }
override fun showMessage(message: String) { override fun showMessage(message: String) {
Toast.makeText(activity, message, Toast.LENGTH_SHORT).show() Toast.makeText(activity, message, Toast.LENGTH_SHORT).show()
} }
......
...@@ -32,25 +32,13 @@ class SignupFragment : Fragment(), SignupView { ...@@ -32,25 +32,13 @@ class SignupFragment : Fragment(), SignupView {
} }
} }
// TODO delete
lateinit var serverUrl: String
companion object { companion object {
private const val SERVER_URL = "server_url" fun newInstance() = SignupFragment()
fun newInstance(url: String) = SignupFragment().apply {
arguments = Bundle(1).apply {
putString(SERVER_URL, url)
}
}
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
AndroidSupportInjection.inject(this)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
AndroidSupportInjection.inject(this)
// TODO - research a better way to initialize parameters on fragments.
serverUrl = arguments?.getString(SERVER_URL) ?: "https://open.rocket.chat"
} }
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? = inflater.inflate(R.layout.fragment_authentication_sign_up, container, false) override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? = inflater.inflate(R.layout.fragment_authentication_sign_up, container, false)
...@@ -104,11 +92,11 @@ class SignupFragment : Fragment(), SignupView { ...@@ -104,11 +92,11 @@ class SignupFragment : Fragment(), SignupView {
override fun showLoading() { override fun showLoading() {
enableUserInput(false) enableUserInput(false)
view_loading.show() view_loading.setVisibility(true)
} }
override fun hideLoading() { override fun hideLoading() {
view_loading.hide() view_loading.setVisibility(false)
enableUserInput(true) enableUserInput(true)
} }
......
...@@ -23,32 +23,14 @@ import javax.inject.Inject ...@@ -23,32 +23,14 @@ import javax.inject.Inject
class TwoFAFragment : Fragment(), TwoFAView { class TwoFAFragment : Fragment(), TwoFAView {
@Inject lateinit var presenter: TwoFAPresenter @Inject lateinit var presenter: TwoFAPresenter
@Inject lateinit var appContext: Context @Inject lateinit var appContext: Context
lateinit var serverUrl: String
lateinit var username: String
lateinit var password: String
companion object { companion object {
private const val SERVER_URL = "server_url" fun newInstance() = TwoFAFragment()
private const val USERNAME = "username"
private const val PASSWORD = "password"
fun newInstance(url: String, username: String, password: String) = TwoFAFragment().apply {
arguments = Bundle(1).apply {
putString(SERVER_URL, url)
putString(USERNAME, username)
putString(PASSWORD, password)
}
}
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
AndroidSupportInjection.inject(this)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
AndroidSupportInjection.inject(this)
// TODO - research a better way to initialize parameters on fragments.
serverUrl = arguments?.getString(SERVER_URL) ?: "https://open.rocket.chat"
username = arguments?.getString(USERNAME) ?: ""
password = arguments?.getString(PASSWORD) ?: ""
} }
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? = inflater.inflate(R.layout.fragment_authentication_two_fa, container, false) override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? = inflater.inflate(R.layout.fragment_authentication_two_fa, container, false)
...@@ -63,7 +45,7 @@ class TwoFAFragment : Fragment(), TwoFAView { ...@@ -63,7 +45,7 @@ class TwoFAFragment : Fragment(), TwoFAView {
} }
button_log_in.setOnClickListener { button_log_in.setOnClickListener {
presenter.authenticate(username, password, text_two_factor_auth.textContent) presenter.authenticate(text_two_factor_auth.textContent)
} }
} }
...@@ -78,11 +60,11 @@ class TwoFAFragment : Fragment(), TwoFAView { ...@@ -78,11 +60,11 @@ class TwoFAFragment : Fragment(), TwoFAView {
override fun showLoading() { override fun showLoading() {
enableUserInput(false) enableUserInput(false)
view_loading.show() view_loading.setVisibility(true)
} }
override fun hideLoading() { override fun hideLoading() {
view_loading.hide() view_loading.setVisibility(false)
enableUserInput(true) enableUserInput(true)
} }
......
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