Direct registration button
This commit is contained in:
parent
3a24274a2a
commit
e52b54017e
5 changed files with 32 additions and 1 deletions
|
@ -30,6 +30,7 @@ android {
|
||||||
buildConfigField("String", "CUSTOM_LOGO_URL", "\"$CUSTOM_LOGO_URL\"")
|
buildConfigField("String", "CUSTOM_LOGO_URL", "\"$CUSTOM_LOGO_URL\"")
|
||||||
buildConfigField("String", "CUSTOM_INSTANCE", "\"$CUSTOM_INSTANCE\"")
|
buildConfigField("String", "CUSTOM_INSTANCE", "\"$CUSTOM_INSTANCE\"")
|
||||||
buildConfigField("String", "SUPPORT_ACCOUNT_URL", "\"$SUPPORT_ACCOUNT_URL\"")
|
buildConfigField("String", "SUPPORT_ACCOUNT_URL", "\"$SUPPORT_ACCOUNT_URL\"")
|
||||||
|
buildConfigField("String", "REGISTER_ACCOUNT_URL", "\"$REGISTER_ACCOUNT_URL\"")
|
||||||
|
|
||||||
kapt {
|
kapt {
|
||||||
arguments {
|
arguments {
|
||||||
|
|
|
@ -80,6 +80,7 @@ class LoginActivity : BaseActivity(), Injectable {
|
||||||
getString(R.string.preferences_file_key), Context.MODE_PRIVATE)
|
getString(R.string.preferences_file_key), Context.MODE_PRIVATE)
|
||||||
|
|
||||||
loginButton.setOnClickListener { onButtonClick() }
|
loginButton.setOnClickListener { onButtonClick() }
|
||||||
|
registerButton.setOnClickListener { onRegisterClick() }
|
||||||
|
|
||||||
whatsAnInstanceTextView.setOnClickListener {
|
whatsAnInstanceTextView.setOnClickListener {
|
||||||
val dialog = AlertDialog.Builder(this)
|
val dialog = AlertDialog.Builder(this)
|
||||||
|
@ -119,6 +120,21 @@ class LoginActivity : BaseActivity(), Injectable {
|
||||||
return super.onOptionsItemSelected(item)
|
return super.onOptionsItemSelected(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun onRegisterClick() {
|
||||||
|
registerButton.isEnabled = false
|
||||||
|
|
||||||
|
val uri = Uri.parse(BuildConfig.REGISTER_ACCOUNT_URL)
|
||||||
|
if (!openInCustomTab(uri, this)) {
|
||||||
|
val viewIntent = Intent(Intent.ACTION_VIEW, uri)
|
||||||
|
if (viewIntent.resolveActivity(packageManager) != null) {
|
||||||
|
startActivity(viewIntent)
|
||||||
|
} else {
|
||||||
|
domainEditText.error = getString(R.string.error_no_web_browser_found)
|
||||||
|
setLoading(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain the oauth client credentials for this app. This is only necessary the first time the
|
* Obtain the oauth client credentials for this app. This is only necessary the first time the
|
||||||
* app is run on a given server instance. So, after the first authentication, they are
|
* app is run on a given server instance. So, after the first authentication, they are
|
||||||
|
|
|
@ -62,6 +62,15 @@
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/action_login" />
|
android:text="@string/action_login" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/registerButton"
|
||||||
|
style="@style/TuskyButton"
|
||||||
|
android:layout_width="250dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/action_register" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/whatsAnInstanceTextView"
|
android:id="@+id/whatsAnInstanceTextView"
|
||||||
android:layout_width="250dp"
|
android:layout_width="250dp"
|
||||||
|
|
|
@ -578,4 +578,6 @@
|
||||||
<string name="account_note_hint">Your private note about this account</string>
|
<string name="account_note_hint">Your private note about this account</string>
|
||||||
<string name="account_note_saved">Saved!</string>
|
<string name="account_note_saved">Saved!</string>
|
||||||
|
|
||||||
|
<string name="action_register">Register New Account</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -16,4 +16,7 @@ ext.CUSTOM_LOGO_URL = "https://static.chinwag.org/chinwag-logo-simple-1024.png"
|
||||||
ext.CUSTOM_INSTANCE = "social.chinwag.org"
|
ext.CUSTOM_INSTANCE = "social.chinwag.org"
|
||||||
|
|
||||||
// link to your support account. Will be linked on the about page when not empty.
|
// link to your support account. Will be linked on the about page when not empty.
|
||||||
ext.SUPPORT_ACCOUNT_URL = "https://social.chinwag.org/@ChinwagNews"
|
ext.SUPPORT_ACCOUNT_URL = "https://social.chinwag.org/@ChinwagNews"
|
||||||
|
|
||||||
|
// New account registration link
|
||||||
|
ext.REGISTER_ACCOUNT_URL = "https://social.chinwag.org/auth/sign_up"
|
||||||
|
|
Loading…
Reference in a new issue