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 {
private var isGlobalLayoutListenerSetUp = false
companion object {
private const val SERVER_URL = "server_url"
fun newInstance(url: String) = LoginFragment().apply {
arguments = Bundle(1).apply {
putString(SERVER_URL, url)
}
}
fun newInstance() = LoginFragment()
}
// Todo remove
private lateinit var serverUrl: String
override fun onCreate(savedInstanceState: Bundle?) {
AndroidSupportInjection.inject(this)
super.onCreate(savedInstanceState)
// TODO - research a better way to initialize parameters on fragments.
serverUrl = arguments?.getString(SERVER_URL) ?: "https://open.rocket.chat"
AndroidSupportInjection.inject(this)
}
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 {
override fun showLoading() {
enableUserInput(false)
view_loading.show()
view_loading.setVisibility(true)
}
override fun hideLoading() {
view_loading.hide()
view_loading.setVisibility(false)
enableUserInput(true)
}
......
......@@ -40,7 +40,7 @@ class ServerFragment : Fragment(), ServerView {
super.onViewCreated(view, savedInstanceState)
relative_layout.viewTreeObserver.addOnGlobalLayoutListener(layoutListener)
activity?.applicationContext?.apply {
activity?.apply {
button_connect.setOnClickListener {
val url = text_server_url.textContent.ifEmpty(text_server_url.hintContent)
presenter.connect(text_server_protocol.textContent + url)
......@@ -55,15 +55,14 @@ class ServerFragment : Fragment(), ServerView {
override fun showLoading() {
enableUserInput(false)
view_loading.show()
view_loading.setVisibility(true)
}
override fun hideLoading() {
view_loading.hide()
view_loading.setVisibility(false)
enableUserInput(true)
}
override fun showMessage(message: String) {
Toast.makeText(activity, message, Toast.LENGTH_SHORT).show()
}
......
......@@ -32,25 +32,13 @@ class SignupFragment : Fragment(), SignupView {
}
}
// TODO delete
lateinit var serverUrl: String
companion object {
private const val SERVER_URL = "server_url"
fun newInstance(url: String) = SignupFragment().apply {
arguments = Bundle(1).apply {
putString(SERVER_URL, url)
}
}
fun newInstance() = SignupFragment()
}
override fun onCreate(savedInstanceState: Bundle?) {
AndroidSupportInjection.inject(this)
super.onCreate(savedInstanceState)
// TODO - research a better way to initialize parameters on fragments.
serverUrl = arguments?.getString(SERVER_URL) ?: "https://open.rocket.chat"
AndroidSupportInjection.inject(this)
}
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 {
override fun showLoading() {
enableUserInput(false)
view_loading.show()
view_loading.setVisibility(true)
}
override fun hideLoading() {
view_loading.hide()
view_loading.setVisibility(false)
enableUserInput(true)
}
......
......@@ -23,32 +23,14 @@ import javax.inject.Inject
class TwoFAFragment : Fragment(), TwoFAView {
@Inject lateinit var presenter: TwoFAPresenter
@Inject lateinit var appContext: Context
lateinit var serverUrl: String
lateinit var username: String
lateinit var password: String
companion object {
private const val SERVER_URL = "server_url"
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)
}
}
fun newInstance() = TwoFAFragment()
}
override fun onCreate(savedInstanceState: Bundle?) {
AndroidSupportInjection.inject(this)
super.onCreate(savedInstanceState)
// 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) ?: ""
AndroidSupportInjection.inject(this)
}
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 {
}
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 {
override fun showLoading() {
enableUserInput(false)
view_loading.show()
view_loading.setVisibility(true)
}
override fun hideLoading() {
view_loading.hide()
view_loading.setVisibility(false)
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