Skip to content

Commit 1783acc

Browse files
authored
FOSS flavor separation (#19)
* Separated lin implementation for FOSS / GPLAY - Patch 1 * Separated lin implementation for FOSS / GPLAY - Patch 2
1 parent 46e670a commit 1783acc

File tree

24 files changed

+379
-47
lines changed

24 files changed

+379
-47
lines changed

app/app.gradle

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@ plugins {
22
id 'com.android.application'
33
id 'org.jetbrains.kotlin.android'
44
id 'kotlin-kapt'
5+
id 'com.google.gms.google-services' apply false
6+
id 'com.google.firebase.crashlytics' apply false
7+
}
8+
9+
def taskRequests = getGradle().getStartParameter().getTaskRequests().toString()
10+
def isGooglePlay = !(taskRequests.contains("Foss") || taskRequests.contains("foss"))
11+
12+
if (isGooglePlay) {
13+
apply plugin: 'com.google.gms.google-services'
14+
apply plugin: 'com.google.firebase.crashlytics'
515
}
616

717
apply from: "$project.rootDir/gradle/common.gradle"
@@ -38,13 +48,19 @@ dependencies {
3848
implementation project(":network")
3949
implementation project(":storage")
4050
implementation project(":domain")
51+
implementation project(":feature:ads")
4152
implementation project(":data")
4253
implementation project(":demo")
4354
implementation di.koinCore
4455
implementation di.koinAndroid
4556
implementation di.koinCompose
4657
implementation reactive.rxkotlin
4758
implementation reactive.rxandroid
59+
60+
playstoreImplementation platform(proprietary.firebaseBom)
61+
playstoreImplementation proprietary.firebaseAnalytics
62+
playstoreImplementation proprietary.firebaseCrashlytics
63+
playstoreImplementation proprietary.playServicesAds
4864
}
4965

5066
kapt {

app/google-services.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"project_info": {
3+
"project_number": "457071394222",
4+
"project_id": "stable-diffusion-android",
5+
"storage_bucket": "stable-diffusion-android.appspot.com"
6+
},
7+
"client": [
8+
{
9+
"client_info": {
10+
"mobilesdk_app_id": "1:457071394222:android:df6ae3f3e640d255c39c3f",
11+
"android_client_info": {
12+
"package_name": "com.shifthackz.aisdv1.app"
13+
}
14+
},
15+
"oauth_client": [
16+
{
17+
"client_id": "457071394222-sre4vtc3rcsla98f22vqcpvui4rsg9a2.apps.googleusercontent.com",
18+
"client_type": 1,
19+
"android_info": {
20+
"package_name": "com.shifthackz.aisdv1.app",
21+
"certificate_hash": "c00bf2d57403fbf23efbe7b1de6fecd58bf4cffa"
22+
}
23+
},
24+
{
25+
"client_id": "457071394222-k0bu4kaj80h5jntcud5fjoppavt4atbt.apps.googleusercontent.com",
26+
"client_type": 3
27+
}
28+
],
29+
"api_key": [
30+
{
31+
"current_key": "AIzaSyAHdAfmzEBUyxaNk_xjz25Z9-TPm7bwfSQ"
32+
}
33+
],
34+
"services": {
35+
"appinvite_service": {
36+
"other_platform_oauth_client": [
37+
{
38+
"client_id": "457071394222-k0bu4kaj80h5jntcud5fjoppavt4atbt.apps.googleusercontent.com",
39+
"client_type": 3
40+
}
41+
]
42+
}
43+
}
44+
}
45+
],
46+
"configuration_version": "1"
47+
}

app/src/main/AndroidManifest.xml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
android:name=".AiStableDiffusionClientApp"
1010
android:icon="@mipmap/ic_launcher"
1111
android:label="@string/app_name"
12-
android:usesCleartextTraffic="true"
1312
android:requestLegacyExternalStorage="true"
14-
android:theme="@style/Theme.AiSdCompose">
13+
android:theme="@style/Theme.AiSdCompose"
14+
android:usesCleartextTraffic="true">
1515

1616
<activity
1717
android:name="com.shifthackz.aisdv1.presentation.activity.AiStableDiffusionActivity"
@@ -26,6 +26,19 @@
2626
</intent-filter>
2727
</activity>
2828

29+
<activity
30+
android:name="com.shifthackz.aisdv1.presentation.activity.TestCrashActivity"
31+
android:exported="true"
32+
android:launchMode="singleInstance"
33+
android:screenOrientation="portrait"
34+
android:taskAffinity=""
35+
android:windowSoftInputMode="adjustResize">
36+
<!-- <intent-filter>-->
37+
<!-- <action android:name="android.intent.action.MAIN" />-->
38+
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
39+
<!-- </intent-filter>-->
40+
</activity>
41+
2942
<provider
3043
android:name="androidx.core.content.FileProvider"
3144
android:authorities="${applicationId}.fileprovider"
@@ -35,5 +48,10 @@
3548
android:name="android.support.FILE_PROVIDER_PATHS"
3649
android:resource="@xml/file_provider_paths" />
3750
</provider>
51+
52+
<meta-data
53+
android:name="com.google.android.gms.ads.APPLICATION_ID"
54+
android:value="ca-app-pub-5994265132349884~9645142847" />
55+
3856
</application>
3957
</manifest>

app/src/main/java/com/shifthackz/aisdv1/app/AiStableDiffusionClientApp.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.shifthackz.aisdv1.app
22

33
import android.app.Application
4+
import com.shifthackz.aisdv1.app.di.featureModule
45
import com.shifthackz.aisdv1.app.di.preferenceModule
56
import com.shifthackz.aisdv1.app.di.providersModule
67
import com.shifthackz.aisdv1.core.imageprocessing.di.imageProcessingModule
@@ -25,6 +26,7 @@ class AiStableDiffusionClientApp : Application() {
2526
androidContext(this@AiStableDiffusionClientApp)
2627
modules(
2728
demoModule,
29+
featureModule,
2830
preferenceModule,
2931
providersModule,
3032
domainModule,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.shifthackz.aisdv1.app.di
2+
3+
import com.shifthackz.aisdv1.feature.ads.di.adFeatureModule
4+
5+
val featureModule = adFeatureModule
6+
// ).toTypedArray()

build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ buildscript {
44
minSdk = 24
55
targetSdk = 33
66
}
7+
dependencies {
8+
classpath 'com.google.gms:google-services:4.3.15'
9+
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.4'
10+
}
711
}
812

913
plugins {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.shifthackz.aisdv1.domain.feature
2+
3+
import android.app.Activity
4+
import android.content.Context
5+
import android.view.View
6+
7+
interface AdFeature {
8+
fun initialize(activity: Activity)
9+
fun getBannerAdView(context: Context): View?
10+
fun loadAd(view: View)
11+
}

feature/ads/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

feature/ads/build.gradle

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
plugins {
2+
id 'com.android.library'
3+
id 'org.jetbrains.kotlin.android'
4+
}
5+
6+
apply from: "$project.rootDir/gradle/common.gradle"
7+
8+
android {
9+
namespace 'com.shifthackz.aisdv1.feature.ads'
10+
buildTypes {
11+
release {
12+
buildConfigField "String", "BANNER_AD_UNIT_ID", "\"ca-app-pub-5994265132349884/9250961993\""
13+
}
14+
debug {
15+
buildConfigField "String", "BANNER_AD_UNIT_ID", "\"ca-app-pub-3940256099942544/6300978111\""
16+
}
17+
}
18+
flavorDimensions "type"
19+
productFlavors {
20+
foss {
21+
dimension "type"
22+
}
23+
playstore {
24+
dimension "type"
25+
}
26+
}
27+
}
28+
29+
dependencies {
30+
implementation project(":domain")
31+
implementation di.koinCore
32+
playstoreImplementation proprietary.playServicesAds
33+
}

feature/ads/consumer-rules.pro

Whitespace-only changes.

0 commit comments

Comments
 (0)