New flavors: dev and newhusky

As I explained earlier when I took over Husky maintenance, I'm making
changes in the application to add stuff that would make it more
maintenable in the long term, that is, an architecture, new stuff that
would make the application better in performance, while also keeping all
the good stuff of Husky.

The flavor 'newhusky' is for that matter. I'm going to keep working on
keeping Husky maintained, and at the same time I'll make the "new" Husky
in another flavor. It won't change anything because, being two flavors,
releases will be made with the current application, so be patient,
please.
This commit is contained in:
Adolfo Santiago 2022-01-24 11:03:16 +01:00
parent 68e9138d62
commit 22a0efd273
No known key found for this signature in database
GPG key ID: 244D6F9A317B4A65
22 changed files with 166 additions and 69 deletions

View file

@ -1,5 +1,5 @@
import com.project.starter.easylauncher.filter.ColorRibbonFilter
import com.android.build.gradle.internal.api.BaseVariantOutputImpl
import com.project.starter.easylauncher.filter.ColorRibbonFilter
plugins {
id(AppPlugins.androidApplication)
@ -81,10 +81,34 @@ android {
)
)
productFlavors {
create(Flavors.newhusky) {
dimension = Flavors.Dimensions.release
applicationId = DefaultConfig.NewHusky.applicationID
minSdk = DefaultConfig.minSdk
targetSdk = DefaultConfig.targetSdk
versionCode = DefaultConfig.NewHusky.versionCode
versionName = DefaultConfig.NewHusky.versionName
}
create(Flavors.husky) {
dimension = Flavors.Dimensions.husky
}
create(Flavors.dev) {
dimension = Flavors.Dimensions.release
applicationId = DefaultConfig.Dev.applicationID
minSdk = DefaultConfig.minSdk
targetSdk = DefaultConfig.targetSdk
versionCode = DefaultConfig.Dev.versionCode
versionName = DefaultConfig.Dev.versionName
}
create(Flavors.beta) {
dimension = Flavors.Dimensions.release
@ -258,5 +282,16 @@ easylauncher {
)
)
}
register(Flavors.newhusky) {
filters(
customRibbon(
label = "NEW",
gravity = ColorRibbonFilter.Gravity.TOPRIGHT,
ribbonColor = "#DCDCDC",
labelColor = "#000000"
)
)
}
}
}

View file

@ -22,7 +22,8 @@ package com.keylesspalace.tusky.core.utils
enum class Flavor(private val flavor: String) {
BETA("huskyBeta"),
STABLE("huskyStable");
STABLE("huskyStable"),
NEW_HUSKY("huskyNewhusky");
companion object {
@ -35,6 +36,7 @@ enum class Flavor(private val flavor: String) {
fun getFlavor(flavor: String) =
when(flavor) {
BETA.flavor -> BETA
NEW_HUSKY.flavor -> NEW_HUSKY
else -> STABLE
}
}

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.keylesspalace.tusky">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="com.husky.project.HuskyApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/TuskyTheme"
android:usesCleartextTraffic="false"
tools:replace="android:name">
<activity
android:name="com.husky.project.core.navigation.NavigationActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Remove Husky's LAUNCH original activity -->
<activity
android:name=".SplashActivity"
tools:node="remove" />
<!-- Disable automatic WorkManager initialization -->
<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
android:exported="false"
tools:node="remove" />
</application>
</manifest>

View file

@ -1,4 +1,4 @@
package com.keylesspalace.tusky.refactor_features
package com.husky.project
import android.app.Application
import com.keylesspalace.tusky.core.logging.HyperlinkDebugTree

View file

@ -1,4 +1,4 @@
package com.keylesspalace.tusky.core.di
package com.husky.project.core.di
import android.content.Context
import com.zhuinden.simplestack.GlobalServices

View file

@ -17,14 +17,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.keylesspalace.tusky.core.navigation
package com.husky.project.core.navigation
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.keylesspalace.tusky.core.di.HuskyServices
import com.husky.project.core.di.HuskyServices
import com.keylesspalace.tusky.core.extensions.viewBinding
import com.keylesspalace.tusky.databinding.ActivityNavigationBinding
import com.keylesspalace.tusky.refactor_features.splash.view.navigation.SplashKey
import com.husky.project.features.splash.view.navigation.SplashKey
import com.zhuinden.simplestack.History
import com.zhuinden.simplestack.SimpleStateChanger
import com.zhuinden.simplestack.StateChange

View file

@ -1,4 +1,4 @@
package com.keylesspalace.tusky.core.ui.fragment
package com.husky.project.core.ui.fragment
abstract class BaseBackFragment(layoutRes: Int) : BaseFragment(layoutRes) {

View file

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.keylesspalace.tusky.core.ui.fragment
package com.husky.project.core.ui.fragment
import com.zhuinden.simplestackextensions.fragments.KeyedFragment

View file

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.keylesspalace.tusky.core.ui.navigation
package com.husky.project.core.ui.navigation
import com.zhuinden.simplestackextensions.fragments.DefaultFragmentKey

View file

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.keylesspalace.tusky.core.ui.navigation
package com.husky.project.core.ui.navigation
import com.zhuinden.simplestackextensions.services.DefaultServiceProvider

View file

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.keylesspalace.tusky.core.ui.viewmodel
package com.husky.project.core.ui.viewmodel
import com.zhuinden.simplestack.Bundleable

View file

@ -1,10 +1,10 @@
package com.keylesspalace.tusky.core.ui.viewmodel
package com.husky.project.core.ui.viewmodel
import com.zhuinden.simplestack.ScopedServices
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable
abstract class RegisteredViewModel : BaseViewModel(), ScopedServices.Registered {
abstract class ServicesViewModel : BaseViewModel(), ScopedServices.Registered {
private val compositeDisposable = CompositeDisposable()

View file

@ -1,4 +1,4 @@
package com.keylesspalace.tusky.refactor_features.login.view.fragments
package com.husky.project.features.login.view.fragments
import android.os.Bundle
import android.view.View
@ -8,9 +8,9 @@ import com.keylesspalace.tusky.core.extensions.addHttpsProtocolUrl
import com.keylesspalace.tusky.core.extensions.dialogWithLink
import com.keylesspalace.tusky.core.extensions.viewBinding
import com.keylesspalace.tusky.core.extensions.viewObserve
import com.keylesspalace.tusky.core.ui.fragment.BaseFragment
import com.husky.project.core.ui.fragment.BaseFragment
import com.keylesspalace.tusky.databinding.ActivityLoginBinding
import com.keylesspalace.tusky.refactor_features.login.view.viewmodel.LoginViewModel
import com.husky.project.features.login.view.viewmodel.LoginViewModel
import com.keylesspalace.tusky.util.afterTextChanged
import com.zhuinden.simplestackextensions.fragmentsktx.lookup

View file

@ -1,9 +1,9 @@
package com.keylesspalace.tusky.refactor_features.login.view.navigation
package com.husky.project.features.login.view.navigation
import androidx.fragment.app.Fragment
import com.keylesspalace.tusky.core.ui.navigation.BaseServiceKey
import com.keylesspalace.tusky.refactor_features.login.view.fragments.LoginFragment
import com.keylesspalace.tusky.refactor_features.login.view.viewmodel.LoginViewModel
import com.husky.project.core.ui.navigation.BaseServiceKey
import com.husky.project.features.login.view.fragments.LoginFragment
import com.husky.project.features.login.view.viewmodel.LoginViewModel
import com.zhuinden.simplestack.ServiceBinder
import com.zhuinden.simplestackextensions.servicesktx.add
import kotlinx.android.parcel.Parcelize

View file

@ -1,13 +1,14 @@
package com.keylesspalace.tusky.refactor_features.login.view.viewmodel
package com.husky.project.features.login.view.viewmodel
import android.util.Patterns
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.husky.project.features.login.view.viewmodel.LoginViewModelKeys.Bundle
import com.keylesspalace.tusky.core.extensions.orEmpty
import com.keylesspalace.tusky.core.ui.viewmodel.RegisteredViewModel
import com.husky.project.core.ui.viewmodel.ServicesViewModel
import com.zhuinden.statebundle.StateBundle
class LoginViewModel : RegisteredViewModel() {
class LoginViewModel : ServicesViewModel() {
private val mVerifyUrl = MutableLiveData<Boolean>()
val verifyUrl: LiveData<Boolean>
@ -15,14 +16,14 @@ class LoginViewModel : RegisteredViewModel() {
override fun toBundle(): StateBundle = StateBundle().apply {
putBoolean(
LoginViewModelKeys.Bundle.VERIFY_URL,
Bundle.VERIFY_URL,
mVerifyUrl.value.orEmpty()
)
}
override fun fromBundle(bundle: StateBundle?) {
bundle?.run {
mVerifyUrl.value = getBoolean(LoginViewModelKeys.Bundle.VERIFY_URL)
mVerifyUrl.value = getBoolean(Bundle.VERIFY_URL)
}
}

View file

@ -1,4 +1,4 @@
package com.keylesspalace.tusky.refactor_features.login.view.viewmodel
package com.husky.project.features.login.view.viewmodel
sealed class LoginViewModelKeys {

View file

@ -1,13 +1,13 @@
package com.keylesspalace.tusky.refactor_features.splash.view.fragments
package com.husky.project.features.splash.view.fragments
import android.os.Bundle
import android.view.View
import com.keylesspalace.tusky.R
import com.keylesspalace.tusky.core.extensions.viewBinding
import com.keylesspalace.tusky.core.ui.fragment.BaseFragment
import com.husky.project.core.ui.fragment.BaseFragment
import com.keylesspalace.tusky.databinding.FragmentSplashBinding
import com.keylesspalace.tusky.refactor_features.login.view.navigation.LoginKey
import com.keylesspalace.tusky.refactor_features.splash.view.viewmodel.SplashViewModel
import com.husky.project.features.login.view.navigation.LoginKey
import com.husky.project.features.splash.view.viewmodel.SplashViewModel
import com.zhuinden.simplestack.History
import com.zhuinden.simplestack.StateChange
import com.zhuinden.simplestackextensions.fragmentsktx.backstack

View file

@ -1,9 +1,9 @@
package com.keylesspalace.tusky.refactor_features.splash.view.navigation
package com.husky.project.features.splash.view.navigation
import androidx.fragment.app.Fragment
import com.keylesspalace.tusky.core.ui.navigation.BaseServiceKey
import com.keylesspalace.tusky.refactor_features.splash.view.fragments.SplashFragment
import com.keylesspalace.tusky.refactor_features.splash.view.viewmodel.SplashViewModel
import com.husky.project.core.ui.navigation.BaseServiceKey
import com.husky.project.features.splash.view.fragments.SplashFragment
import com.husky.project.features.splash.view.viewmodel.SplashViewModel
import com.zhuinden.simplestack.ServiceBinder
import com.zhuinden.simplestackextensions.servicesktx.add
import kotlinx.android.parcel.Parcelize

View file

@ -1,6 +1,6 @@
package com.keylesspalace.tusky.refactor_features.splash.view.viewmodel
package com.husky.project.features.splash.view.viewmodel
import com.keylesspalace.tusky.core.ui.viewmodel.BaseViewModel
import com.husky.project.core.ui.viewmodel.BaseViewModel
import com.zhuinden.statebundle.StateBundle
class SplashViewModel : BaseViewModel() {

View file

@ -1,48 +1,48 @@
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
buildscript {
addRepos(repositories)
addRepos(repositories)
dependencies {
// Base
classpath(GradlePlugins.android)
classpath(GradlePlugins.kotlin)
dependencies {
// Base
classpath(GradlePlugins.android)
classpath(GradlePlugins.kotlin)
// Plugins
classpath(GradlePlugins.gradleVersions)
}
// Plugins
classpath(GradlePlugins.gradleVersions)
}
}
allprojects {
addRepos(repositories)
addRepos(repositories)
tasks.withType<JavaCompile> {
options.encoding = DefaultConfig.encoding
options.compilerArgs.addAll(
listOf(
"-Xlint:all",
"-Xlint:unchecked",
"-Xlint:-deprecation"
)
)
}
tasks.withType<JavaCompile> {
options.encoding = DefaultConfig.encoding
options.compilerArgs.addAll(
listOf(
"-Xlint:all",
"-Xlint:unchecked",
"-Xlint:-deprecation"
)
)
}
apply {
plugin(AppPlugins.manesVersions)
}
apply {
plugin(AppPlugins.manesVersions)
}
tasks.withType<DependencyUpdatesTask> {
gradleReleaseChannel = "current"
tasks.withType<DependencyUpdatesTask> {
gradleReleaseChannel = "current"
rejectVersionIf {
!isNonStable(candidate.version)
}
}
rejectVersionIf {
!isNonStable(candidate.version)
}
}
}
tasks.register<Delete>(BuildTasks.taskTypeClean) {
delete(buildDir)
delete("${projectDir}/buildSrc/build")
delete("${projectDir}/app/huskyBeta")
delete("${projectDir}/app/huskyStable")
delete(buildDir)
delete("${projectDir}/buildSrc/build")
delete("${projectDir}/app/huskyBeta")
delete("${projectDir}/app/huskyStable")
}

View file

@ -30,6 +30,20 @@ object DefaultConfig {
const val instrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
const val encoding = "UTF-8"
object Dev {
const val applicationID = "su.xash.husky.dev"
const val versionCode = 1
const val versionName = "1.0.0"
}
object NewHusky {
const val applicationID = "su.xash.husky.alpha"
const val versionCode = 1
const val versionName = "2.0.0"
}
}
object BetaConfig {
@ -49,8 +63,11 @@ object Flavors {
}
const val husky = "husky"
const val dev = "dev"
const val beta = "beta"
const val stable = "stable"
const val newhusky = "newhusky"
}
object ProguardFile {