add build customization options (#1532)
This commit is contained in:
parent
47f2d1bf42
commit
83ced20e4a
8 changed files with 69 additions and 14 deletions
|
@ -3,6 +3,8 @@ apply plugin: 'kotlin-android'
|
||||||
apply plugin: 'kotlin-android-extensions'
|
apply plugin: 'kotlin-android-extensions'
|
||||||
apply plugin: 'kotlin-kapt'
|
apply plugin: 'kotlin-kapt'
|
||||||
|
|
||||||
|
apply from: "../instance-build.gradle"
|
||||||
|
|
||||||
def getGitSha = { ->
|
def getGitSha = { ->
|
||||||
def stdout = new ByteArrayOutputStream()
|
def stdout = new ByteArrayOutputStream()
|
||||||
exec {
|
exec {
|
||||||
|
@ -15,7 +17,7 @@ def getGitSha = { ->
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 29
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.keylesspalace.tusky"
|
applicationId APP_ID
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 68
|
versionCode 68
|
||||||
|
@ -23,6 +25,12 @@ android {
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
|
|
||||||
|
resValue "string", "app_name", APP_NAME
|
||||||
|
|
||||||
|
buildConfigField("String", "CUSTOM_LOGO_URL", "\"$CUSTOM_LOGO_URL\"")
|
||||||
|
buildConfigField("String", "CUSTOM_INSTANCE", "\"$CUSTOM_INSTANCE\"")
|
||||||
|
buildConfigField("String", "SUPPORT_ACCOUNT_URL", "\"$SUPPORT_ACCOUNT_URL\"")
|
||||||
|
|
||||||
kapt {
|
kapt {
|
||||||
arguments {
|
arguments {
|
||||||
arg("room.schemaLocation", "$projectDir/schemas")
|
arg("room.schemaLocation", "$projectDir/schemas")
|
||||||
|
|
|
@ -12,6 +12,7 @@ import android.view.MenuItem
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import com.keylesspalace.tusky.di.Injectable
|
import com.keylesspalace.tusky.di.Injectable
|
||||||
import com.keylesspalace.tusky.util.CustomURLSpan
|
import com.keylesspalace.tusky.util.CustomURLSpan
|
||||||
|
import com.keylesspalace.tusky.util.hide
|
||||||
import kotlinx.android.synthetic.main.activity_about.*
|
import kotlinx.android.synthetic.main.activity_about.*
|
||||||
import kotlinx.android.synthetic.main.toolbar_basic.*
|
import kotlinx.android.synthetic.main.toolbar_basic.*
|
||||||
|
|
||||||
|
@ -29,14 +30,18 @@ class AboutActivity : BottomSheetActivity(), Injectable {
|
||||||
|
|
||||||
setTitle(R.string.about_title_activity)
|
setTitle(R.string.about_title_activity)
|
||||||
|
|
||||||
versionTextView.text = getString(R.string.about_tusky_version, BuildConfig.VERSION_NAME)
|
versionTextView.text = getString(R.string.about_app_version, getString(R.string.app_name), BuildConfig.VERSION_NAME)
|
||||||
|
|
||||||
|
if(BuildConfig.CUSTOM_INSTANCE.isBlank()) {
|
||||||
|
aboutPoweredByTusky.hide()
|
||||||
|
}
|
||||||
|
|
||||||
aboutLicenseInfoTextView.setClickableTextWithoutUnderlines(R.string.about_tusky_license)
|
aboutLicenseInfoTextView.setClickableTextWithoutUnderlines(R.string.about_tusky_license)
|
||||||
aboutWebsiteInfoTextView.setClickableTextWithoutUnderlines(R.string.about_project_site)
|
aboutWebsiteInfoTextView.setClickableTextWithoutUnderlines(R.string.about_project_site)
|
||||||
aboutBugsFeaturesInfoTextView.setClickableTextWithoutUnderlines(R.string.about_bug_feature_request_site)
|
aboutBugsFeaturesInfoTextView.setClickableTextWithoutUnderlines(R.string.about_bug_feature_request_site)
|
||||||
|
|
||||||
tuskyProfileButton.setOnClickListener {
|
tuskyProfileButton.setOnClickListener {
|
||||||
onAccountButtonClick()
|
viewUrl(BuildConfig.SUPPORT_ACCOUNT_URL)
|
||||||
}
|
}
|
||||||
|
|
||||||
aboutLicensesButton.setOnClickListener {
|
aboutLicensesButton.setOnClickListener {
|
||||||
|
@ -45,10 +50,6 @@ class AboutActivity : BottomSheetActivity(), Injectable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onAccountButtonClick() {
|
|
||||||
viewUrl("https://mastodon.social/@Tusky")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
android.R.id.home -> {
|
android.R.id.home -> {
|
||||||
|
|
|
@ -28,6 +28,7 @@ import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
import com.bumptech.glide.Glide
|
||||||
import com.keylesspalace.tusky.di.Injectable
|
import com.keylesspalace.tusky.di.Injectable
|
||||||
import com.keylesspalace.tusky.entity.AccessToken
|
import com.keylesspalace.tusky.entity.AccessToken
|
||||||
import com.keylesspalace.tusky.entity.AppCredentials
|
import com.keylesspalace.tusky.entity.AppCredentials
|
||||||
|
@ -62,6 +63,18 @@ class LoginActivity : BaseActivity(), Injectable {
|
||||||
|
|
||||||
setContentView(R.layout.activity_login)
|
setContentView(R.layout.activity_login)
|
||||||
|
|
||||||
|
if(savedInstanceState == null && BuildConfig.CUSTOM_INSTANCE.isNotBlank() && !isAdditionalLogin()) {
|
||||||
|
domainEditText.setText(BuildConfig.CUSTOM_INSTANCE)
|
||||||
|
domainEditText.setSelection(BuildConfig.CUSTOM_INSTANCE.length)
|
||||||
|
}
|
||||||
|
|
||||||
|
if(BuildConfig.CUSTOM_LOGO_URL.isNotBlank()) {
|
||||||
|
Glide.with(loginLogo)
|
||||||
|
.load(BuildConfig.CUSTOM_LOGO_URL)
|
||||||
|
.placeholder(null)
|
||||||
|
.into(loginLogo)
|
||||||
|
}
|
||||||
|
|
||||||
preferences = getSharedPreferences(
|
preferences = getSharedPreferences(
|
||||||
getString(R.string.preferences_file_key), Context.MODE_PRIVATE)
|
getString(R.string.preferences_file_key), Context.MODE_PRIVATE)
|
||||||
|
|
||||||
|
@ -162,7 +175,7 @@ class LoginActivity : BaseActivity(), Injectable {
|
||||||
|
|
||||||
mastodonApi
|
mastodonApi
|
||||||
.authenticateApp(domain, getString(R.string.app_name), oauthRedirectUri,
|
.authenticateApp(domain, getString(R.string.app_name), oauthRedirectUri,
|
||||||
OAUTH_SCOPES, getString(R.string.app_website))
|
OAUTH_SCOPES, getString(R.string.tusky_website))
|
||||||
.enqueue(callback)
|
.enqueue(callback)
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,18 @@
|
||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/aboutPoweredByTusky"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:drawablePadding="16dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:text="@string/about_powered_by_tusky"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/aboutLicenseInfoTextView"
|
android:id="@+id/aboutLicenseInfoTextView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
android:layout_height="178dp"
|
android:layout_height="178dp"
|
||||||
android:layout_marginBottom="50dp"
|
android:layout_marginBottom="50dp"
|
||||||
android:contentDescription="@null"
|
android:contentDescription="@null"
|
||||||
|
android:id="@+id/loginLogo"
|
||||||
app:srcCompat="@drawable/elephant_friend" />
|
app:srcCompat="@drawable/elephant_friend" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name" translatable="false">Tusky</string>
|
<string name="tusky_website" translatable="false">https://tusky.app</string>
|
||||||
<string name="app_website" translatable="false">https://tusky.app</string>
|
<string name="about_app_version">%1$s %2$s</string>
|
||||||
|
|
||||||
<string name="oauth_scheme" translatable="false">oauth2redirect</string>
|
<string name="oauth_scheme" translatable="false">oauth2redirect</string>
|
||||||
<string name="preferences_file_key" translatable="false">com.keylesspalace.tusky.PREFERENCES</string>
|
<string name="preferences_file_key" translatable="false">com.keylesspalace.tusky.PREFERENCES</string>
|
||||||
|
|
|
@ -277,6 +277,7 @@
|
||||||
|
|
||||||
<string name="about_title_activity">About</string>
|
<string name="about_title_activity">About</string>
|
||||||
<string name="about_tusky_version">Tusky %s</string>
|
<string name="about_tusky_version">Tusky %s</string>
|
||||||
|
<string name="about_powered_by_tusky">Powered by Tusky</string>
|
||||||
<string name="about_tusky_license">Tusky is free and open-source software.
|
<string name="about_tusky_license">Tusky is free and open-source software.
|
||||||
It is licensed under the GNU General Public License Version 3.
|
It is licensed under the GNU General Public License Version 3.
|
||||||
You can view the license here: https://www.gnu.org/licenses/gpl-3.0.en.html</string>
|
You can view the license here: https://www.gnu.org/licenses/gpl-3.0.en.html</string>
|
||||||
|
|
19
instance-build.gradle
Normal file
19
instance-build.gradle
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/**
|
||||||
|
Edit this file to create a Tusky build that is customized for your Fediverse instance.
|
||||||
|
Note: Publishing a custom build on Google Play may violate the Google Play developer policy (Repetetive Content)
|
||||||
|
*/
|
||||||
|
|
||||||
|
// The app name
|
||||||
|
ext.APP_NAME = "Tusky"
|
||||||
|
|
||||||
|
// The application id. Must be unique, e.g. based on your domain
|
||||||
|
ext.APP_ID = "com.keylesspalace.tusky"
|
||||||
|
|
||||||
|
// url of a custom app logo. Recommended size at least 600x600. Keep empty to use the Tusky elephant friend.
|
||||||
|
ext.CUSTOM_LOGO_URL = ""
|
||||||
|
|
||||||
|
// e.g. mastodon.social. Keep empty to not suggest any instance on the signup screen
|
||||||
|
ext.CUSTOM_INSTANCE = ""
|
||||||
|
|
||||||
|
// link to your support account. Will be linked on the about page when not empty.
|
||||||
|
ext.SUPPORT_ACCOUNT_URL = "https://mastodon.social/@Tusky"
|
Loading…
Reference in a new issue