Skip to content

Commit

Permalink
hide reset button on auth0
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-alfresco committed Jul 16, 2024
1 parent ebcd8d2 commit bce3912
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.activityViewModels
import com.alfresco.android.aims.R
import com.alfresco.android.aims.databinding.FragmentAuthSettingsBinding
import com.alfresco.auth.AuthType
import com.alfresco.auth.activity.LoginViewModel
import com.alfresco.auth.ui.observe
import com.alfresco.common.FragmentBuilder
Expand All @@ -29,12 +30,6 @@ class AdvancedSettingsFragment : DialogFragment() {
private val rootView: View get() = requireView()
private lateinit var binding: FragmentAuthSettingsBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

setHasOptionsMenu(true)
}

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
Expand All @@ -56,6 +51,7 @@ class AdvancedSettingsFragment : DialogFragment() {
binding.tieAuthType.setSafeOnClickListener {
openAuthSelection()
}
onAuthChange(viewModel.authConfigEditor.authTypeValue.value ?: "")
}

override fun onStart() {
Expand Down Expand Up @@ -104,16 +100,31 @@ class AdvancedSettingsFragment : DialogFragment() {
ComponentBuilder(requireContext(), componentData)
.onApply { name, query, _ ->
viewModel.authConfigEditor.onAuthChange(name, query)
onAuthChange(query)
}
.onReset { name, query, _ ->
viewModel.authConfigEditor.onAuthChange(name, query)
onAuthChange(query)
}
.onCancel {
viewModel.authConfigEditor.onAuthChange(authName, authValue)
onAuthChange(authValue)
}
.show()
}

private fun onAuthChange(auth: String) {
when (auth.lowercase()) {
AuthType.PKCE.value.lowercase() -> {
setHasOptionsMenu(true)
}

else -> {
setHasOptionsMenu(false)
}
}
}

class Builder(parent: FragmentActivity) : FragmentBuilder(parent) {
override val fragmentTag = TAG

Expand Down
2 changes: 1 addition & 1 deletion auth/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="auth_app_name">Auth Library</string>
<string name="auth_copyright_notice"2023 Hyland Software, Inc. und Tochtergesellschaften. Alle Rechte vorbehalten.</string>
<string name="auth_copyright_notice"2024 Hyland Software, Inc. und Tochtergesellschaften. Alle Rechte vorbehalten.</string>

<string name="auth_connect_field_hint">Verbinden mit</string>
<string name="auth_connect_button">Verbinden</string>
Expand Down
2 changes: 1 addition & 1 deletion auth/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="auth_app_name">Auth Library</string>
<string name="auth_copyright_notice"2023 Hyland Software, Inc. y sus afiliados. Todos los derechos reservados.</string>
<string name="auth_copyright_notice"2024 Hyland Software, Inc. y sus afiliados. Todos los derechos reservados.</string>

<string name="auth_connect_field_hint">Conectar a</string>
<string name="auth_connect_button">Conectar</string>
Expand Down
2 changes: 1 addition & 1 deletion auth/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="auth_app_name">Auth Library</string>
<string name="auth_copyright_notice"2023 Hyland Software, Inc. et ses filiales. Tous droits réservés.</string>
<string name="auth_copyright_notice"2024 Hyland Software, Inc. et ses filiales. Tous droits réservés.</string>

<string name="auth_connect_field_hint">Connexion à</string>
<string name="auth_connect_button">Connexion</string>
Expand Down
2 changes: 1 addition & 1 deletion auth/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="auth_app_name">Auth Library</string>
<string name="auth_copyright_notice"2023 Hyland Software, Inc. e sue affiliate. Tutti i diritti riservati.</string>
<string name="auth_copyright_notice"2024 Hyland Software, Inc. e sue affiliate. Tutti i diritti riservati.</string>

<string name="auth_connect_field_hint">Connetti a</string>
<string name="auth_connect_button">Connetti</string>
Expand Down
2 changes: 1 addition & 1 deletion auth/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="auth_app_name">Auth Library</string>
<string name="auth_copyright_notice"2023 Hyland Software, Inc. en haar gelieerde bedrijven. Alle rechten voorbehouden.</string>
<string name="auth_copyright_notice"2024 Hyland Software, Inc. en haar gelieerde bedrijven. Alle rechten voorbehouden.</string>

<string name="auth_connect_field_hint">Verbinden met</string>
<string name="auth_connect_button">Verbinden</string>
Expand Down
2 changes: 1 addition & 1 deletion auth/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="auth_app_name">Auth Library</string>
<string name="auth_copyright_notice"2023 Alfresco Software, Inc. All rights reserved.</string>
<string name="auth_copyright_notice"2024 Alfresco Software, Inc. All rights reserved.</string>

<string name="auth_connect_field_hint">Connect to</string>
<string name="auth_connect_button">Connect</string>
Expand Down

0 comments on commit bce3912

Please sign in to comment.