Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add customization config to project to load remote assets (Apps-1771) #211

Merged
merged 32 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
21d1297
fix bug in PurchasesRepository
Fabtron Sep 10, 2024
e0588c3
replace old primary button with new on to keep colors for states like…
Fabtron Sep 10, 2024
8ace083
remove logs
Fabtron Sep 10, 2024
5452798
remove obsolete styles
Fabtron Sep 10, 2024
773a2aa
change to cast to primary button
Fabtron Sep 10, 2024
491fa07
change to cast to primary button
Fabtron Sep 10, 2024
d2a73eb
adjust floating action buttons and deletion dialog
Fabtron Sep 10, 2024
bd76f9b
change to cast to primary button
Fabtron Sep 10, 2024
c45e879
revert external billing subject dialog changes since it is not needed
Fabtron Sep 10, 2024
5684ab1
change to cast to primary button
Fabtron Sep 10, 2024
27eb064
change to cast to primary button
Fabtron Sep 10, 2024
8afad11
roll back to use default button
Fabtron Sep 10, 2024
1b0a8fc
change to cast to snabble primary button
Fabtron Sep 10, 2024
3b99acd
change to cast to snabble primary button
Fabtron Sep 11, 2024
241ec1f
set dispose strategy
Fabtron Sep 11, 2024
6201731
switch to use primary color
Fabtron Sep 11, 2024
da16595
rename
Fabtron Sep 11, 2024
3609ff0
remove obsolete declaration
Fabtron Sep 11, 2024
65e0d1d
override onclickListener to ensure that it is actually called
Fabtron Sep 11, 2024
3861398
adjust button to use layout height and fontsize set via xml
Fabtron Sep 11, 2024
b1fe2ba
convert to lambda ref
Fabtron Sep 11, 2024
e902114
change button style
Fabtron Sep 11, 2024
41726fa
WIP: Add style to customize the snabble primary button
Fabtron Sep 12, 2024
23136a2
WIP: add snabble primary button style
Fabtron Sep 12, 2024
ed03e81
WIP: add snabble primary button style if needed
Fabtron Sep 12, 2024
9ed2a93
WIP: add method to apply project theme
Fabtron Sep 12, 2024
4aea64d
provide customization config
Fabtron Sep 12, 2024
b8a7096
Merge branch 'refs/heads/main' into apps-1771-remote-assets
Fabtron Sep 13, 2024
7881fa8
make setter private
Fabtron Sep 13, 2024
536c7f9
revert obsolete changes
Fabtron Sep 13, 2024
da6d5cc
revert obsolete changes
Fabtron Sep 13, 2024
29001fc
revert obsolete changes
Fabtron Sep 13, 2024
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
7 changes: 5 additions & 2 deletions core/src/main/java/io/snabble/sdk/Project.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.google.gson.Gson
import com.google.gson.JsonElement
import com.google.gson.JsonObject
import com.google.gson.JsonSyntaxException
import com.google.gson.annotations.SerializedName
import com.google.gson.reflect.TypeToken
import io.snabble.sdk.auth.SnabbleAuthorizationInterceptor
import io.snabble.sdk.checkout.Checkout
Expand Down Expand Up @@ -351,6 +350,10 @@ class Project internal constructor(
private set

var appTheme: AppTheme? = null
private set

var customizationConfig: JsonElement? = null
private set

init {
parse(jsonObject)
Expand All @@ -368,7 +371,7 @@ class Project internal constructor(
brand = Snabble.brands[brandId]
}

val customizationConfig: JsonElement? = jsonObject["appCustomizationConfig"]
customizationConfig = jsonObject["appCustomizationConfig"]
try {
val lightModeColors: LightModeColors? = gson.fromJson(customizationConfig, LightModeColors::class.java)
val darkModeColors: DarkModeColors? = gson.fromJson(customizationConfig, DarkModeColors::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ internal class PurchasesRepositoryImpl(
}

private fun Array<ReceiptInfo>.mapToPurchases(count: Int): List<Purchase> {
val purchases = filter { it.pdfUrl != null }
if (purchases.isEmpty()) return emptyList()
return purchases
.slice(0 until size.coerceAtMost(count))
.map { it.toPurchase(timeFormatter) }
val receipts = filter { it.pdfUrl != null }
return when {
receipts.isEmpty() -> emptyList()
else -> receipts.slice(0 until size.coerceAtMost(count))
.map { it.toPurchase(timeFormatter) }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ public void setHelperImage(Bitmap bitmap) {
helperText.setVisibility(View.VISIBLE);
}
}
}
}
Loading