Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/deploy-to-playstore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#name: Deploy to Play Store
#
#on:
# push:
# branches: [ main ]
#
#jobs:
# build-and-deploy:
# runs-on: ubuntu-latest
#
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: Set up JDK
# uses: actions/setup-java@v3
# with:
# java-version: '17'
# distribution: 'temurin'
#
# - name: Setup Android SDK
# uses: android-actions/setup-android@v3
#
# - name: Build APK/AAB
# run: |
# chmod +x gradlew
# ./gradlew assembleRelease
#
# - name: Build App Bundle
# run: ./gradlew bundleRelease
#
# - name: Upload artifacts
# uses: actions/upload-artifact@v3
# with:
# name: app-bundle
# path: app/build/outputs/
#
# - name: Deploy to Play Store
# uses: r0adkll/upload-google-play@v1
# with:
# serviceAccountJsonPlainText: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
# packageName: com.yourcompany.yourapp
# releaseFiles: app/build/outputs/bundle/release/app-release.aab
# track: internal
# status: completed
Empty file.
1 change: 0 additions & 1 deletion app/src/main/java/com/songlib/core/utils/AppConstants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ object PrefConstants {
const val DATA_LOADED = "dataLoaded"
const val SELECT_AFRESH = "selectAfresh"
const val IS_PRO_USER = "isProUser"
const val CAN_SHOW_PAYWALL = "canShowPaywall"
const val INSTALL_DATE = "install_date"
const val REVIEW_REQUESTED = "review_requested"
const val IS_USER_A_KID = "is_user_a_kid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.songlib.domain.repository
import android.content.Context
import android.content.SharedPreferences
import com.songlib.core.utils.PrefConstants
import androidx.core.content.edit
import dagger.hilt.android.qualifiers.ApplicationContext
import javax.inject.*

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

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

var canShowPaywall: Boolean
get() = prefs.getBoolean(PrefConstants.CAN_SHOW_PAYWALL, false)
set(value) = prefs.edit { putBoolean(PrefConstants.CAN_SHOW_PAYWALL, value) }

var isDataLoaded: Boolean
get() = prefs.getBoolean(PrefConstants.DATA_LOADED, false)
set(value) = prefs.edit { putBoolean(PrefConstants.DATA_LOADED, value) }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.songlib.presentation.components.action

import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable

@Composable
fun ProLimitDialog(
onDismiss: () -> Unit,
onUpgrade: () -> Unit,
title: String = "Support us by upgrading",
message: String = "Please purchase a subscription if you want to continue using this feature and all other Pro features.",
upgradeButtonText: String = "Upgrade",
dismissButtonText: String = "Not Now"
) {
AlertDialog(
onDismissRequest = onDismiss,
title = { Text(title) },
text = { Text(message) },
confirmButton = {
TextButton(onClick = onUpgrade) {
Text(upgradeButtonText)
}
},
dismissButton = {
TextButton(onClick = onDismiss) {
Text(dismissButtonText)
}
}
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.songlib.presentation.components.action

import androidx.compose.foundation.layout.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Star
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.*
import androidx.compose.ui.unit.dp

@Composable
fun UpgradeBanner(onUpgradeClick: () -> Unit) {
Card(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 8.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.primaryContainer
),
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp)
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 12.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically
) {
Icon(
imageVector = Icons.Filled.Star,
contentDescription = "Pro feature",
tint = MaterialTheme.colorScheme.primary,
modifier = Modifier.size(20.dp)
)

Spacer(modifier = Modifier.width(8.dp))

Text(
text = "You are currently limited to only 1 listing",
style = MaterialTheme.typography.bodySmall,
modifier = Modifier.weight(1f)
)

Spacer(modifier = Modifier.width(8.dp))

TextButton(
onClick = onUpgradeClick,
modifier = Modifier.height(32.dp)
) {
Text(
text = "Upgrade to PRO",
style = MaterialTheme.typography.labelSmall
)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.songlib.presentation.components.indicators

import android.graphics.Bitmap
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
Expand All @@ -13,7 +12,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import com.songlib.R
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ import com.songlib.core.utils.refineTitle
import com.songlib.data.models.Book
import com.songlib.data.sample.SampleBooks
import com.songlib.domain.entity.Selectable

@Composable
fun SongBook(
item: Selectable<Book>,
onClick: (Selectable<Book>) -> Unit
onClick: (Selectable<Book>) -> Unit,
modifier: Modifier = Modifier
) {
val bgColor =
if (item.isSelected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.inversePrimary
val txtColor =
if (item.isSelected) MaterialTheme.colorScheme.onPrimary else MaterialTheme.colorScheme.scrim

ElevatedCard(
modifier = Modifier
modifier = modifier
.fillMaxWidth()
.padding(2.dp)
.clickable { onClick(item) },
Expand All @@ -41,16 +41,10 @@ fun SongBook(
) {
Row(
modifier = Modifier
.fillMaxWidth()
.fillMaxSize()
.padding(5.dp),
verticalAlignment = Alignment.CenterVertically
) {
Icon(
imageVector = if (item.isSelected) Icons.Filled.CheckBox else Icons.Filled.CheckBoxOutlineBlank,
contentDescription = null,
tint = txtColor,
modifier = Modifier.padding(end = 12.dp)
)
Text(
text = buildAnnotatedString {
withStyle(style = SpanStyle(fontSize = 16.sp, color = txtColor)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,8 @@ fun HomeScreen(
val selectedTab by viewModel.selectedTab.collectAsState()
val songs by viewModel.songs.collectAsState(initial = emptyList())

val canShowPaywall by viewModel.canShowPaywall.collectAsState()
var showPaywall by remember { mutableStateOf(false) }

LaunchedEffect(Unit) {
viewModel.fetchData()
showPaywall = canShowPaywall
}

if (showPaywall) {
Dialog(
onDismissRequest = { showPaywall = false },
properties = DialogProperties(usePlatformDefaultWidth = false)
) {
val paywallOptions = remember {
PaywallOptions.Builder(dismissRequest = { showPaywall = false })
.setShouldDisplayDismissButton(true)
.build()
}
Box() {
if (canShowPaywall) {
Paywall(paywallOptions)
} else {
CustomerCenter(onDismiss = { showPaywall = false })
}
}
}
}

when (uiState) {
Expand All @@ -82,10 +58,13 @@ fun HomeScreen(
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!",
messageIcon = Icons.Default.EditNote,
onAction = {
viewModel.clearData()
navController.navigate(Routes.SPLASH) {
popUpTo(0) { inclusive = true }
launchSingleTop = true
viewModel.clearData { success ->
if (success) {
navController.navigate(Routes.SPLASH) {
popUpTo(0) { inclusive = true }
launchSingleTop = true
}
}
}
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import com.songlib.data.models.ListingUi
@Composable
fun ChoosingListingSheet(
listings: List<ListingUi>,
isProUser: Boolean,
onDismiss: () -> Unit,
onNewListClick: () -> Unit,
onListingClick: (ListingUi) -> Unit,
Expand All @@ -39,16 +40,51 @@ fun ChoosingListingSheet(
.padding(bottom = 12.dp)
)

// Upgrade banner for free users with existing listings
if (!isProUser && listings.isNotEmpty()) {
Card(
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 16.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.primaryContainer
),
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp)
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 12.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically
) {
Icon(
imageVector = Icons.Filled.Star,
contentDescription = "Pro feature",
tint = MaterialTheme.colorScheme.primary,
modifier = Modifier.size(20.dp)
)

Spacer(modifier = Modifier.width(8.dp))

Text(
text = "Free users can only have 1 listing",
style = MaterialTheme.typography.bodySmall,
modifier = Modifier.weight(1f)
)
}
}
}

LazyColumn(
modifier = Modifier
.weight(1f, fill = false)
.padding(bottom = 16.dp)
) {
item() {
item {
Row(
modifier = Modifier
.fillMaxWidth()
.clickable { onNewListClick }
.clickable { onNewListClick() }
.padding(vertical = 12.dp),
verticalAlignment = Alignment.CenterVertically
) {
Expand Down Expand Up @@ -76,7 +112,7 @@ fun ChoosingListingSheet(
Row(
modifier = Modifier
.fillMaxWidth()
.clickable { onListingClick }
.clickable { onListingClick(listing) }
.padding(vertical = 12.dp),
verticalAlignment = Alignment.CenterVertically
) {
Expand Down Expand Up @@ -109,4 +145,3 @@ fun ChoosingListingSheet(
}
}
}

Loading