Skip to content

Commit 229aef6

Browse files
authored
Merge pull request #20 from SiroDevs/develop
Develop
2 parents 6255e33 + a6f26d2 commit 229aef6

20 files changed

Lines changed: 477 additions & 113 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#name: Deploy to Play Store
2+
#
3+
#on:
4+
# push:
5+
# branches: [ main ]
6+
#
7+
#jobs:
8+
# build-and-deploy:
9+
# runs-on: ubuntu-latest
10+
#
11+
# steps:
12+
# - name: Checkout code
13+
# uses: actions/checkout@v4
14+
#
15+
# - name: Set up JDK
16+
# uses: actions/setup-java@v3
17+
# with:
18+
# java-version: '17'
19+
# distribution: 'temurin'
20+
#
21+
# - name: Setup Android SDK
22+
# uses: android-actions/setup-android@v3
23+
#
24+
# - name: Build APK/AAB
25+
# run: |
26+
# chmod +x gradlew
27+
# ./gradlew assembleRelease
28+
#
29+
# - name: Build App Bundle
30+
# run: ./gradlew bundleRelease
31+
#
32+
# - name: Upload artifacts
33+
# uses: actions/upload-artifact@v3
34+
# with:
35+
# name: app-bundle
36+
# path: app/build/outputs/
37+
#
38+
# - name: Deploy to Play Store
39+
# uses: r0adkll/upload-google-play@v1
40+
# with:
41+
# serviceAccountJsonPlainText: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
42+
# packageName: com.yourcompany.yourapp
43+
# releaseFiles: app/build/outputs/bundle/release/app-release.aab
44+
# track: internal
45+
# status: completed

.kotlin/sessions/kotlin-compiler-18110105652542382796.salive

Whitespace-only changes.

app/src/main/java/com/songlib/core/utils/AppConstants.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ object PrefConstants {
2828
const val DATA_LOADED = "dataLoaded"
2929
const val SELECT_AFRESH = "selectAfresh"
3030
const val IS_PRO_USER = "isProUser"
31-
const val CAN_SHOW_PAYWALL = "canShowPaywall"
3231
const val INSTALL_DATE = "install_date"
3332
const val REVIEW_REQUESTED = "review_requested"
3433
const val IS_USER_A_KID = "is_user_a_kid"

app/src/main/java/com/songlib/domain/repository/PreferencesRepository.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package com.songlib.domain.repository
33
import android.content.Context
44
import android.content.SharedPreferences
55
import com.songlib.core.utils.PrefConstants
6-
import androidx.core.content.edit
76
import dagger.hilt.android.qualifiers.ApplicationContext
87
import javax.inject.*
98

@@ -14,7 +13,6 @@ class PreferencesRepository @Inject constructor(
1413
private val prefs =
1514
context.getSharedPreferences(PrefConstants.PREFERENCE_FILE, Context.MODE_PRIVATE)
1615

17-
// Existing properties
1816
var initialBooks: String
1917
get() = prefs.getString(PrefConstants.INITIAL_BOOKS, "") ?: ""
2018
set(value) = prefs.edit { putString(PrefConstants.INITIAL_BOOKS, value) }
@@ -35,10 +33,6 @@ class PreferencesRepository @Inject constructor(
3533
get() = prefs.getBoolean(PrefConstants.IS_PRO_USER, false)
3634
set(value) = prefs.edit { putBoolean(PrefConstants.IS_PRO_USER, value) }
3735

38-
var canShowPaywall: Boolean
39-
get() = prefs.getBoolean(PrefConstants.CAN_SHOW_PAYWALL, false)
40-
set(value) = prefs.edit { putBoolean(PrefConstants.CAN_SHOW_PAYWALL, value) }
41-
4236
var isDataLoaded: Boolean
4337
get() = prefs.getBoolean(PrefConstants.DATA_LOADED, false)
4438
set(value) = prefs.edit { putBoolean(PrefConstants.DATA_LOADED, value) }
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.songlib.presentation.components.action
2+
3+
import androidx.compose.material3.AlertDialog
4+
import androidx.compose.material3.Text
5+
import androidx.compose.material3.TextButton
6+
import androidx.compose.runtime.Composable
7+
8+
@Composable
9+
fun ProLimitDialog(
10+
onDismiss: () -> Unit,
11+
onUpgrade: () -> Unit,
12+
title: String = "Support us by upgrading",
13+
message: String = "Please purchase a subscription if you want to continue using this feature and all other Pro features.",
14+
upgradeButtonText: String = "Upgrade",
15+
dismissButtonText: String = "Not Now"
16+
) {
17+
AlertDialog(
18+
onDismissRequest = onDismiss,
19+
title = { Text(title) },
20+
text = { Text(message) },
21+
confirmButton = {
22+
TextButton(onClick = onUpgrade) {
23+
Text(upgradeButtonText)
24+
}
25+
},
26+
dismissButton = {
27+
TextButton(onClick = onDismiss) {
28+
Text(dismissButtonText)
29+
}
30+
}
31+
)
32+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package com.songlib.presentation.components.action
2+
3+
import androidx.compose.foundation.layout.*
4+
import androidx.compose.material.icons.Icons
5+
import androidx.compose.material.icons.filled.Star
6+
import androidx.compose.material3.*
7+
import androidx.compose.runtime.Composable
8+
import androidx.compose.ui.*
9+
import androidx.compose.ui.unit.dp
10+
11+
@Composable
12+
fun UpgradeBanner(onUpgradeClick: () -> Unit) {
13+
Card(
14+
modifier = Modifier
15+
.fillMaxWidth()
16+
.padding(horizontal = 16.dp, vertical = 8.dp),
17+
colors = CardDefaults.cardColors(
18+
containerColor = MaterialTheme.colorScheme.primaryContainer
19+
),
20+
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp)
21+
) {
22+
Row(
23+
modifier = Modifier
24+
.fillMaxWidth()
25+
.padding(horizontal = 12.dp, vertical = 8.dp),
26+
verticalAlignment = Alignment.CenterVertically
27+
) {
28+
Icon(
29+
imageVector = Icons.Filled.Star,
30+
contentDescription = "Pro feature",
31+
tint = MaterialTheme.colorScheme.primary,
32+
modifier = Modifier.size(20.dp)
33+
)
34+
35+
Spacer(modifier = Modifier.width(8.dp))
36+
37+
Text(
38+
text = "You are currently limited to only 1 listing",
39+
style = MaterialTheme.typography.bodySmall,
40+
modifier = Modifier.weight(1f)
41+
)
42+
43+
Spacer(modifier = Modifier.width(8.dp))
44+
45+
TextButton(
46+
onClick = onUpgradeClick,
47+
modifier = Modifier.height(32.dp)
48+
) {
49+
Text(
50+
text = "Upgrade to PRO",
51+
style = MaterialTheme.typography.labelSmall
52+
)
53+
}
54+
}
55+
}
56+
}

app/src/main/java/com/songlib/presentation/components/indicators/EmptyState.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.songlib.presentation.components.indicators
22

3-
import android.graphics.Bitmap
43
import androidx.compose.foundation.Image
54
import androidx.compose.foundation.layout.*
65
import androidx.compose.material3.*
@@ -13,7 +12,6 @@ import androidx.compose.ui.Modifier
1312
import androidx.compose.ui.graphics.vector.ImageVector
1413
import androidx.compose.ui.layout.ContentScale
1514
import androidx.compose.ui.res.painterResource
16-
import androidx.compose.ui.text.font.FontWeight
1715
import androidx.compose.ui.text.style.TextAlign
1816
import androidx.compose.ui.tooling.preview.Preview
1917
import com.songlib.R

app/src/main/java/com/songlib/presentation/components/listitems/SongBook.kt

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ import com.songlib.core.utils.refineTitle
1717
import com.songlib.data.models.Book
1818
import com.songlib.data.sample.SampleBooks
1919
import com.songlib.domain.entity.Selectable
20-
2120
@Composable
2221
fun SongBook(
2322
item: Selectable<Book>,
24-
onClick: (Selectable<Book>) -> Unit
23+
onClick: (Selectable<Book>) -> Unit,
24+
modifier: Modifier = Modifier
2525
) {
2626
val bgColor =
2727
if (item.isSelected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.inversePrimary
2828
val txtColor =
2929
if (item.isSelected) MaterialTheme.colorScheme.onPrimary else MaterialTheme.colorScheme.scrim
3030

3131
ElevatedCard(
32-
modifier = Modifier
32+
modifier = modifier
3333
.fillMaxWidth()
3434
.padding(2.dp)
3535
.clickable { onClick(item) },
@@ -41,16 +41,10 @@ fun SongBook(
4141
) {
4242
Row(
4343
modifier = Modifier
44-
.fillMaxWidth()
44+
.fillMaxSize()
4545
.padding(5.dp),
4646
verticalAlignment = Alignment.CenterVertically
4747
) {
48-
Icon(
49-
imageVector = if (item.isSelected) Icons.Filled.CheckBox else Icons.Filled.CheckBoxOutlineBlank,
50-
contentDescription = null,
51-
tint = txtColor,
52-
modifier = Modifier.padding(end = 12.dp)
53-
)
5448
Text(
5549
text = buildAnnotatedString {
5650
withStyle(style = SpanStyle(fontSize = 16.sp, color = txtColor)) {

app/src/main/java/com/songlib/presentation/screens/home/HomeScreen.kt

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,8 @@ fun HomeScreen(
3030
val selectedTab by viewModel.selectedTab.collectAsState()
3131
val songs by viewModel.songs.collectAsState(initial = emptyList())
3232

33-
val canShowPaywall by viewModel.canShowPaywall.collectAsState()
34-
var showPaywall by remember { mutableStateOf(false) }
35-
3633
LaunchedEffect(Unit) {
3734
viewModel.fetchData()
38-
showPaywall = canShowPaywall
39-
}
40-
41-
if (showPaywall) {
42-
Dialog(
43-
onDismissRequest = { showPaywall = false },
44-
properties = DialogProperties(usePlatformDefaultWidth = false)
45-
) {
46-
val paywallOptions = remember {
47-
PaywallOptions.Builder(dismissRequest = { showPaywall = false })
48-
.setShouldDisplayDismissButton(true)
49-
.build()
50-
}
51-
Box() {
52-
if (canShowPaywall) {
53-
Paywall(paywallOptions)
54-
} else {
55-
CustomerCenter(onDismiss = { showPaywall = false })
56-
}
57-
}
58-
}
5935
}
6036

6137
when (uiState) {
@@ -82,10 +58,13 @@ fun HomeScreen(
8258
message = "It appears you didn't finish your songbook selection, that's why it's empty here at the moment.\n\nLet's fix that asap!",
8359
messageIcon = Icons.Default.EditNote,
8460
onAction = {
85-
viewModel.clearData()
86-
navController.navigate(Routes.SPLASH) {
87-
popUpTo(0) { inclusive = true }
88-
launchSingleTop = true
61+
viewModel.clearData { success ->
62+
if (success) {
63+
navController.navigate(Routes.SPLASH) {
64+
popUpTo(0) { inclusive = true }
65+
launchSingleTop = true
66+
}
67+
}
8968
}
9069
}
9170
)

app/src/main/java/com/songlib/presentation/screens/home/components/ChooseListingSheet.kt

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import com.songlib.data.models.ListingUi
1717
@Composable
1818
fun ChoosingListingSheet(
1919
listings: List<ListingUi>,
20+
isProUser: Boolean,
2021
onDismiss: () -> Unit,
2122
onNewListClick: () -> Unit,
2223
onListingClick: (ListingUi) -> Unit,
@@ -39,16 +40,51 @@ fun ChoosingListingSheet(
3940
.padding(bottom = 12.dp)
4041
)
4142

43+
// Upgrade banner for free users with existing listings
44+
if (!isProUser && listings.isNotEmpty()) {
45+
Card(
46+
modifier = Modifier
47+
.fillMaxWidth()
48+
.padding(bottom = 16.dp),
49+
colors = CardDefaults.cardColors(
50+
containerColor = MaterialTheme.colorScheme.primaryContainer
51+
),
52+
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp)
53+
) {
54+
Row(
55+
modifier = Modifier
56+
.fillMaxWidth()
57+
.padding(horizontal = 12.dp, vertical = 8.dp),
58+
verticalAlignment = Alignment.CenterVertically
59+
) {
60+
Icon(
61+
imageVector = Icons.Filled.Star,
62+
contentDescription = "Pro feature",
63+
tint = MaterialTheme.colorScheme.primary,
64+
modifier = Modifier.size(20.dp)
65+
)
66+
67+
Spacer(modifier = Modifier.width(8.dp))
68+
69+
Text(
70+
text = "Free users can only have 1 listing",
71+
style = MaterialTheme.typography.bodySmall,
72+
modifier = Modifier.weight(1f)
73+
)
74+
}
75+
}
76+
}
77+
4278
LazyColumn(
4379
modifier = Modifier
4480
.weight(1f, fill = false)
4581
.padding(bottom = 16.dp)
4682
) {
47-
item() {
83+
item {
4884
Row(
4985
modifier = Modifier
5086
.fillMaxWidth()
51-
.clickable { onNewListClick }
87+
.clickable { onNewListClick() }
5288
.padding(vertical = 12.dp),
5389
verticalAlignment = Alignment.CenterVertically
5490
) {
@@ -76,7 +112,7 @@ fun ChoosingListingSheet(
76112
Row(
77113
modifier = Modifier
78114
.fillMaxWidth()
79-
.clickable { onListingClick }
115+
.clickable { onListingClick(listing) }
80116
.padding(vertical = 12.dp),
81117
verticalAlignment = Alignment.CenterVertically
82118
) {
@@ -109,4 +145,3 @@ fun ChoosingListingSheet(
109145
}
110146
}
111147
}
112-

0 commit comments

Comments
 (0)