-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from afterpay/feature/modal-theme
Feature: modal theme and id
- Loading branch information
Showing
5 changed files
with
88 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
afterpay/src/main/kotlin/com/afterpay/android/view/AfterpayModalTheme.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.afterpay.android.view | ||
|
||
enum class AfterpayModalTheme(val slug: String) { | ||
MINT(""), | ||
WHITE("-theme-white"); | ||
} |
47 changes: 47 additions & 0 deletions
47
afterpay/src/main/kotlin/com/afterpay/android/view/AfterpayMoreInfoOptions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.afterpay.android.view | ||
|
||
import com.afterpay.android.Afterpay | ||
|
||
class AfterpayMoreInfoOptions { | ||
private var modalId: String? = null | ||
private var modalTheme: AfterpayModalTheme = AfterpayModalTheme.MINT | ||
private var isCbtEnabled: Boolean = false | ||
|
||
/** | ||
* Set up options for the more info link in AfterpayPriceBreakdown | ||
* | ||
* @param modalId the filename of a modal hosted on Afterpay static | ||
*/ | ||
constructor(modalId: String) { | ||
this.modalId = modalId | ||
} | ||
|
||
/** | ||
* Set up options for the more info link in AfterpayPriceBreakdown | ||
* | ||
* **Notes:** | ||
* - Not all combinations of Locales and CBT are available. | ||
* | ||
* @param modalTheme the color theme used when displaying the modal | ||
* @param isCbtEnabled whether to show the Cross Border Trade details in the modal | ||
*/ | ||
constructor( | ||
modalTheme: AfterpayModalTheme = AfterpayModalTheme.MINT, | ||
isCbtEnabled: Boolean = false | ||
) { | ||
this.modalTheme = modalTheme | ||
this.isCbtEnabled = isCbtEnabled | ||
} | ||
|
||
internal fun modalFile(): String { | ||
modalId?.let { | ||
return "$it.html" | ||
} | ||
|
||
val locale = "${Afterpay.locale.language}_${Afterpay.locale.country}" | ||
val cbt = if (isCbtEnabled) "-cbt" else "" | ||
val theme = modalTheme.slug | ||
|
||
return "$locale$theme$cbt.html" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters