Skip to content

Commit

Permalink
Merge branch 'ShiftHackZ:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Itsfitts authored Jan 26, 2024
2 parents fc7a860 + 396b1ea commit 1de3a42
Show file tree
Hide file tree
Showing 146 changed files with 422 additions and 2,363 deletions.
16 changes: 2 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

[![Google Play](docs/assets/google_play.png)](https://play.google.com/store/apps/details?id=com.shifthackz.aisdv1.app)
[![F-Droid](docs/assets/fdroid.png)](https://f-droid.org/packages/com.shifthackz.aisdv1.app.foss)
[![Izzy On Droid](docs/assets/izzy_on_droid.png)](https://apt.izzysoft.de/fdroid/index/apk/com.shifthackz.aisdv1.app.foss?repo=main)

Stable Diffusion AI is an easy-to-use app that lets you quickly generate images from text or other images with just a few clicks. With this app, you can communicate with your own server and generate high-quality images in seconds.

Expand Down Expand Up @@ -60,16 +59,6 @@ If for some reason you have no ability to run your server instance, you can togg

AI Horde requires to use API KEY, this mobile app alows to use either default API KEY (which is "0000000000"), or type your own. You can sign up and get your own AI Horde API KEY [here](https://stablehorde.net/register).

### Option 3: Use SDAI Cloud

**Disclaimer: This option is only available in [GooglePlay](https://play.google.com/store/apps/details?id=com.shifthackz.aisdv1.app) app version.**

**Google Play app version includes some proprietary libraries (like Firebase and Google AdMob) to monetize this option. This functionality is NOT a part of the FOSS build and will be never included in FOSS build**

SDAI Cloud is the AUTOMATIC1111 hosted by author of this app as an option for users that for some reason are not able to run or host their own AUTOMATIC1111 instance.

Hosting this instance costs some money, and as this project is non-profitable the usage of SDAI Cloud is monetized by ads. Also the SDAI Cloud may not be available full-time, as this is running on the app author's own bare-metal machine which is hosted in Ukraine, as this area now is a warzone electricity and network downtimes can happen sometimes.

## Supported languages

App uses the language provided by OS default settings.
Expand All @@ -86,9 +75,8 @@ Any contributions to the translations are welcome.

## Donate

Main **foss** flavor of the app is open source, and you are welcome to use it for free.
Only **play** flavor contains small ad-banner at the bottom navigation.
This software is open source, provided with no warranty, and you are welcome to use it for free.

The donation is optional, if you'd like to say thanks and show a little support, here is the button:
In case you find this software valuable, and you'd like to say thanks and show a little support, here is the button:

[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/shifthackz)
26 changes: 5 additions & 21 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,15 @@ plugins {
id 'kotlin-kapt'
}

def taskRequests = getGradle().getStartParameter().getTaskRequests().toString()
def isPlay = !(taskRequests.contains("Foss") || taskRequests.contains("foss"))

if (isPlay) {
apply from: "$project.rootDir/gradle/plugins.gradle"
}

apply from: "$project.rootDir/gradle/common.gradle"

android {
namespace 'com.shifthackz.aisdv1.app'
defaultConfig {
applicationId "com.shifthackz.aisdv1.app"
versionName "0.5.2"
versionCode 165
versionName "0.5.3"
versionCode 166

buildConfigField "String", "CLOUD_AI_URL", "\"https://sdai.moroz.cc\""
buildConfigField "String", "IMAGE_CDN_URL", "\"https://random.imagecdn.app\""
buildConfigField "String", "HORDE_AI_URL", "\"https://stablehorde.net\""
buildConfigField "String", "HORDE_AI_SIGN_UP_URL", "\"https://stablehorde.net/register\""
Expand Down Expand Up @@ -56,13 +48,8 @@ android {
foss {
dimension "type"
applicationIdSuffix = ".foss"
resValue "string", "app_name", "SDAI FOSS"
buildConfigField "String", "BUILD_FLAVOR_TYPE", "\"FOSS\""
}
playstore {
dimension "type"
resValue "string", "app_name", "SDAI"
buildConfigField "String", "BUILD_FLAVOR_TYPE", "\"GOOGLE_PLAY\""
buildConfigField "String", "BUILD_FLAVOR_TYPE", "\"FOSS\""
}
}
}
Expand All @@ -75,7 +62,6 @@ dependencies {
implementation project(":network")
implementation project(":storage")
implementation project(":domain")
implementation project(":feature:ads")
implementation project(":feature:analytics")
implementation project(":feature:auth")
implementation project(":feature:diffusion")
Expand All @@ -87,10 +73,8 @@ dependencies {
implementation reactive.rxkotlin
implementation reactive.rxandroid
implementation log.timber

playstoreImplementation platform(proprietary.fbBom)
playstoreImplementation proprietary.fbA
playstoreImplementation proprietary.fbC
implementation ui.catppuccinSplashscreen
implementation ui.catppuccinLegacy
}

kapt {
Expand Down
47 changes: 0 additions & 47 deletions app/google-services.json

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:theme="@style/Theme.AiSdCompose"
android:theme="@style/Theme.AiSdCompose.Splash"
android:usesCleartextTraffic="true">

<activity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.shifthackz.aisdv1.app.di

import com.shifthackz.aisdv1.feature.ads.di.adFeatureOldModule
import com.shifthackz.aisdv1.feature.analytics.di.analyticsModule
import com.shifthackz.aisdv1.feature.auth.di.authModule
import com.shifthackz.aisdv1.feature.diffusion.di.diffusionModule

val featureModule = (
adFeatureOldModule
+ analyticsModule
analyticsModule
+ authModule
+ diffusionModule
).toTypedArray()
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.shifthackz.aisdv1.app.di

import com.shifthackz.aisdv1.app.BuildConfig
import com.shifthackz.aisdv1.core.common.appbuild.BuildInfoProvider
import com.shifthackz.aisdv1.core.common.appbuild.BuildType
import com.shifthackz.aisdv1.core.common.appbuild.BuildVersion
import com.shifthackz.aisdv1.core.common.file.FileProviderDescriptor
import com.shifthackz.aisdv1.core.common.links.LinksProvider
Expand Down Expand Up @@ -34,7 +33,6 @@ val providersModule = module {
object : ApiUrlProvider {
override val stableDiffusionAutomaticApiUrl: String = DEFAULT_SERVER_URL
override val stableDiffusionAppApiUrl: String = BuildConfig.UPDATE_API_URL
override val stableDiffusionCloudAiApiUrl: String = BuildConfig.CLOUD_AI_URL
override val hordeApiUrl: String = BuildConfig.HORDE_AI_URL
override val imageCdnApiUrl: String = BuildConfig.IMAGE_CDN_URL
}
Expand All @@ -61,7 +59,6 @@ val providersModule = module {

single<LinksProvider> {
object : LinksProvider {
override val cloudUrl: String = BuildConfig.CLOUD_AI_URL
override val hordeUrl: String = BuildConfig.HORDE_AI_URL
override val hordeSignUpUrl: String = BuildConfig.HORDE_AI_SIGN_UP_URL
override val privacyPolicyUrl: String = BuildConfig.POLICY_URL
Expand All @@ -76,13 +73,12 @@ val providersModule = module {
override val isDebug: Boolean = BuildConfig.DEBUG
override val buildNumber: Int = BuildConfig.VERSION_CODE
override val version: BuildVersion = BuildVersion(BuildConfig.VERSION_NAME)
override val buildType: BuildType = BuildType.parse(BuildConfig.BUILD_FLAVOR_TYPE)

override fun toString(): String = buildString {
append("$version")
if (BuildConfig.DEBUG) append("-dev")
append(" ($buildNumber)")
buildType.takeIf { it == BuildType.FOSS }?.let { append(" $it") }
append(" FOSS")
}
}
}
Expand Down
30 changes: 16 additions & 14 deletions app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<resources>

<style name="Theme.AiSdCompose" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/catppuccin_frappe_mauve</item>
<item name="colorPrimaryVariant">@color/catppuccin_frappe_mauve</item>
<item name="colorOnPrimary">@color/catppuccin_frappe_base</item>
<item name="colorSecondary">@color/catppuccin_frappe_mauve</item>
<item name="colorSecondaryVariant">@color/catppuccin_frappe_mauve</item>
<item name="colorOnSecondary">@color/catppuccin_frappe_base</item>
<item name="android:statusBarColor">@color/catppuccin_frappe_mantle</item>
</style>
</resources>

<style name="Theme.AiSdCompose.Splash" parent="Theme.Catppuccin.Frappe.SplashScreen">
<item name="windowSplashScreenAnimatedIcon">@mipmap/ic_launcher</item>
<item name="windowSplashScreenAnimationDuration">500</item>
<item name="postSplashScreenTheme">@style/Theme.AiSdCompose</item>
</style>
</resources>
28 changes: 15 additions & 13 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<resources>

<style name="Theme.AiSdCompose" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/catppuccin_latte_mauve</item>
<item name="colorPrimaryVariant">@color/catppuccin_latte_mauve</item>
<item name="colorOnPrimary">@color/catppuccin_latte_base</item>
<item name="colorSecondary">@color/catppuccin_latte_mauve</item>
<item name="colorSecondaryVariant">@color/catppuccin_latte_mauve</item>
<item name="colorOnSecondary">@color/catppuccin_latte_base</item>
<item name="android:statusBarColor">@color/catppuccin_latte_mantle</item>
</style>

<style name="Theme.AiSdCompose.Splash" parent="Theme.Catppuccin.Latte.SplashScreen">
<item name="windowSplashScreenAnimatedIcon">@mipmap/ic_launcher</item>
<item name="windowSplashScreenAnimationDuration">500</item>
<item name="postSplashScreenTheme">@style/Theme.AiSdCompose</item>
</style>
</resources>
16 changes: 4 additions & 12 deletions build.gradle
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
buildscript {
ext {
minSdk = 23
targetSdk = 33
}
def taskRequests = getGradle().getStartParameter().getTaskRequests().toString()
def isPlay = !(taskRequests.contains("Foss") || taskRequests.contains("foss"))
dependencies {
if (isPlay) {
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.7'
}
targetSdk = 34
}
}

plugins {
id 'com.android.application' version '8.1.0' apply false
id 'com.android.library' version '8.1.0' apply false
id 'org.jetbrains.kotlin.android' version '1.8.21' apply false
id 'com.android.application' version '8.2.0' apply false
id 'com.android.library' version '8.2.0' apply false
id 'org.jetbrains.kotlin.android' version '1.9.21' apply false
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ interface BuildInfoProvider {
val isDebug: Boolean
val buildNumber: Int
val version: BuildVersion
val buildType: BuildType
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import androidx.annotation.ChecksSdkIntAtLeast
import androidx.core.content.FileProvider
import java.io.File

private const val APP_MARKET_PACKAGE = "com.shifthackz.aisdv1.app"

@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.S_V2)
fun shouldUseNewMediaStore(): Boolean {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S_V2
Expand All @@ -29,6 +27,3 @@ fun Context.openUrl(url: String) {
openUri(uri)
}

fun Context.openMarket() {
openUri(Uri.parse("market://details?id=$APP_MARKET_PACKAGE"))
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.shifthackz.aisdv1.core.common.links

interface LinksProvider {
val cloudUrl: String
val hordeUrl: String
val hordeSignUpUrl: String
val privacyPolicyUrl: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import timber.log.Timber
import java.io.File
import java.io.FileOutputStream
import java.text.SimpleDateFormat
import java.util.*
import java.util.Date
import java.util.Locale

class FileLoggingTree : Timber.Tree(), KoinComponent {

Expand Down Expand Up @@ -42,7 +43,6 @@ class FileLoggingTree : Timber.Tree(), KoinComponent {
appendLine("=== APP SESSION STARTED ===")
appendLine()
appendLine("Version : $buildInfoProvider")
appendLine("Type : ${buildInfoProvider.buildType}")
appendLine()
})
}
Expand Down
2 changes: 1 addition & 1 deletion core/ui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.7"
kotlinCompilerExtensionVersion = "1.5.7"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract class Screen {
val statusBarDarkIcons = statusBarDarkIcons()
val navigationBarColor = navigationBarColor()
SideEffect {
systemUiController.setStatusBarColor(statusBarColor, statusBarDarkIcons)
// systemUiController.setStatusBarColor(statusBarColor, statusBarDarkIcons)
systemUiController.setNavigationBarColor(navigationBarColor)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ internal class DimensionValidatorImpl(
)
input.toInt() > maximum -> ValidationResult(
isValid = false,
validationError = DimensionValidator.Error.LessThanMinimum(maximum),
validationError = DimensionValidator.Error.BiggerThanMaximum(maximum),
)
else -> ValidationResult(isValid = true)
}

companion object {
private const val MINIMUM = 64
private const val MAXIMUM = 1024
private const val MAXIMUM = 2048
}
}
Loading

0 comments on commit 1de3a42

Please sign in to comment.