Skip to content

Commit

Permalink
Merge pull request #49 from trustedshops-public/develop
Browse files Browse the repository at this point in the history
Prepare release 0.1.756
  • Loading branch information
superus8r authored Oct 9, 2023
2 parents 806f171 + 92ba343 commit ac00801
Show file tree
Hide file tree
Showing 109 changed files with 3,314 additions and 173 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ app/config.json
fastlane/report.xml
app-dist-key.json
.scannerwork
docs/.DS_Store
61 changes: 30 additions & 31 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ GEM
specs:
CFPropertyList (3.0.6)
rexml
addressable (2.8.4)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.754.0)
aws-sdk-core (3.171.0)
aws-partitions (1.833.0)
aws-sdk-core (3.185.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.63.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-kms (1.72.0)
aws-sdk-core (~> 3, >= 3.184.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.121.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-s3 (1.136.0)
aws-sdk-core (~> 3, >= 3.181.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
aws-sigv4 (1.5.2)
aws-sigv4 (~> 1.6)
aws-sigv4 (1.6.0)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
claide (1.1.0)
Expand All @@ -30,13 +30,13 @@ GEM
commander (4.6.0)
highline (~> 2.0.0)
declarative (0.0.20)
digest-crc (0.6.4)
digest-crc (0.6.5)
rake (>= 12.0.0, < 14.0.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.8.1)
emoji_regex (3.2.3)
excon (0.99.0)
excon (0.104.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand Down Expand Up @@ -65,8 +65,8 @@ GEM
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.6)
fastlane (2.212.2)
fastimage (2.2.7)
fastlane (2.216.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand All @@ -87,29 +87,30 @@ GEM
google-apis-playcustomapp_v1 (~> 0.1)
google-cloud-storage (~> 1.31)
highline (~> 2.0)
http-cookie (~> 1.0.5)
json (< 3.0.0)
jwt (>= 2.1.0, < 3)
mini_magick (>= 4.9.4, < 5.0.0)
multipart-post (~> 2.0.0)
multipart-post (>= 2.0.0, < 3.0.0)
naturally (~> 2.2)
optparse (~> 0.1.1)
plist (>= 3.1.0, < 4.0.0)
rubyzip (>= 2.0.0, < 3.0.0)
security (= 0.1.3)
simctl (~> 1.6.3)
terminal-notifier (>= 2.0.0, < 3.0.0)
terminal-table (>= 1.4.5, < 2.0.0)
terminal-table (~> 3)
tty-screen (>= 0.6.3, < 1.0.0)
tty-spinner (>= 0.8.0, < 1.0.0)
word_wrap (~> 1.0.0)
xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
fastlane-plugin-firebase_app_distribution (0.5.0)
fastlane-plugin-firebase_app_distribution (0.6.1)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.40.0)
google-apis-androidpublisher_v3 (0.50.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.0)
google-apis-core (0.11.1)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.a)
Expand Down Expand Up @@ -138,10 +139,9 @@ GEM
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
googleauth (1.5.2)
googleauth (1.8.1)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
Expand All @@ -151,30 +151,29 @@ GEM
httpclient (2.8.3)
jmespath (1.6.2)
json (2.6.3)
jwt (2.7.0)
memoist (0.16.2)
jwt (2.7.1)
mini_magick (4.12.0)
mini_mime (1.1.2)
mini_mime (1.1.5)
multi_json (1.15.0)
multipart-post (2.0.0)
multipart-post (2.3.0)
nanaimo (0.3.0)
naturally (2.2.1)
optparse (0.1.1)
os (1.1.4)
plist (3.7.0)
public_suffix (5.0.1)
public_suffix (5.0.3)
rake (13.0.6)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.5)
rexml (3.2.6)
rouge (2.0.7)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
security (0.1.3)
signet (0.17.0)
signet (0.18.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
Expand All @@ -183,8 +182,8 @@ GEM
CFPropertyList
naturally
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
trailblazer-option (0.1.2)
tty-cursor (0.7.1)
tty-screen (0.8.1)
Expand All @@ -194,10 +193,10 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (1.8.0)
unicode-display_width (2.5.0)
webrick (1.8.1)
word_wrap (1.0.0)
xcodeproj (1.22.0)
xcodeproj (1.23.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
Expand Down
39 changes: 30 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ You can add the Trustbadge widget to your Android project in 2 steps:

### 1. 🐘 Implement the dependency
- In your `app` module's `build.gradle` file, add the following line in your dependencies block:
```
```kotlin
dependencies {
implementation("com.etrusted.android.trustbadge.library:(version))")
}
Expand All @@ -65,7 +65,7 @@ We recommend using Jetpack Compose to show the widget in your app.

Use the Trustbadge Compose function anywhere in your composables:
Example of showing the `ShopGrade` widget:
```
```kotlin
Trustbadge(
badgeContext = TrustbadgeContext.ShopGrade,
tsid = "X330A2E7D449E31E467D2F53A55DDD070",
Expand All @@ -77,7 +77,7 @@ Trustbadge(
<br />

For `ProductGrade`, it is required to provide the product `sku` as well, that way the widget shows the rating for a product with given `sku`:
```
```kotlin
Trustbadge(
badgeContext = TrustbadgeContext.ProductGrade(sku = "1234-Ti-Bl"),
tsid = "X330A2E7D449E31E467D2F53A55DDD070",
Expand All @@ -89,7 +89,7 @@ Trustbadge(
<br />

Showing `BuyerProtection` widget, is also similar to the `ShopGrade`:
```
```kotlin
Trustbadge(
badgeContext = TrustbadgeContext.BuyerProtection,
tsid = "X330A2E7D449E31E467D2F53A55DDD070",
Expand All @@ -101,7 +101,7 @@ Trustbadge(
<br />

Align the badge anywhere in its parent using a standard `Modifier`. For example:
```
```kotlin
Trustbadge(
modifier = Modifier.align(Alignment.BottomStart),
badgeContext = TrustbadgeContext.ShopGrade,
Expand All @@ -113,7 +113,7 @@ Trustbadge(
<br />

Control hiding or showing the badge using the `TrustbadgeState`:
```
```kotlin
val badgeState = rememberTrustbadgeState()

Trustbadge(
Expand All @@ -135,7 +135,7 @@ LaunchedEffect(null) {
```

For example, hide the badge when the user scrolls using the badge state and scroll state of a column:
```
```kotlin
@Composable
internal fun HideBadgeOnScroll(
scrollState: ScrollState,
Expand All @@ -162,7 +162,7 @@ For full example of hiding the badge when the user scrolls, see [`HomeScreen.kt`
Using the Legacy UI system requires more steps to show the widget:

First, add a `ComposeView` tag in your layout's XML file, for example:
```
```xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
Expand All @@ -180,7 +180,7 @@ First, add a `ComposeView` tag in your layout's XML file, for example:

Then in your source file, inflate the layout and get the `ComposeView` using the XML ID, set a composition strategy that works best for you and call the `setContent()` to use Compose.
Example of loading the Trustbadge in a fragment:
```
```kotlin
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
Expand All @@ -206,6 +206,27 @@ override fun onCreateView(
```
For more information about Compose interoperability with the legacy system, please refer to [Android official docs for Interoperability APIs](https://developer.android.com/jetpack/compose/interop/interop-apis).

<br />

### Dark Mode
The Trustbadge Widget now supports Dark Mode on Android.
By default, the widget will follow the system theme.

<img src="docs/img/screenshot-trustbadge-uncertified-dark.png" height="400" />

To override the system theme, you can force the widget to use Dark Mode by wrapping the `Trustbadge` composable in a `TrustbadgeTheme` and setting the `darkTheme` parameter to `true` in the `TrustbadgeTheme`.

Example of overriding the system theme to Dark Mode:
```kotlin
TrustbadgeTheme(darkTheme = true) {
Trustbadge(...)
}
```

For more information about forcing Dark Mode, please refer to [Android official docs for Force Dark](https://developer.android.com/develop/ui/views/theming/darktheme#force-dark).

<br />

---
Your eTrusted `account` might contain more than one `channel`. The `Trustbadge` function requires a `channelId` to determine which channel it should choose to load the information from your `account`.
Please read the section [Getting `channelId` and `TSID`]() for more information about how to get that information.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ internal fun ExampleApp() {
ProductScreen(env)
}
composable(Screens.Profile.route) {
ProfileScreen()
ProfileScreen(env)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ internal fun CheckoutScreen(
Trustbadge(
modifier = Modifier.align(Alignment.BottomStart),
state = badgeState,
badgeContext = TrustbadgeContext.BuyerProtection,
badgeContext = TrustbadgeContext.BuyerProtection(),
tsid = "X2AB6FF7BFF70A04D1D323E039D676EDB",
channelId = "chl-7e52920a-2722-4881-9908-ecec98c716e4"
)
Expand All @@ -74,7 +74,7 @@ internal fun CheckoutScreen(
Trustbadge(
modifier = Modifier.align(Alignment.BottomStart),
state = badgeState,
badgeContext = TrustbadgeContext.BuyerProtection,
badgeContext = TrustbadgeContext.BuyerProtection(),
tsid = "X079198F3BC11FA13F8980EB6879E2677",
channelId = "chl-b38b62ee-1e62-4a9f-9381-0ece0909b038"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,76 @@

package com.etrusted.android.trustbadgeexample.ui.profile

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.etrusted.android.trustbadge.library.common.internal.EnvironmentKey
import com.etrusted.android.trustbadge.library.model.CurrencyCode
import com.etrusted.android.trustbadge.library.model.OrderDetails
import com.etrusted.android.trustbadge.library.ui.badge.Trustbadge
import com.etrusted.android.trustbadge.library.ui.badge.TrustbadgeContext
import com.etrusted.android.trustbadge.library.ui.badge.rememberTrustbadgeState

@Composable
internal fun ProfileScreen() {
Text(text = "Profile Screen")
internal fun ProfileScreen(
env: EnvironmentKey,
) {

val badgeState = rememberTrustbadgeState()

Box(modifier = Modifier.fillMaxSize()) {

Column(
Modifier
.align(Alignment.Center)
) {
Button(onClick = {
badgeState.showAsCard()
}) {
Text(text = "Show Trustcard")
}
}

when(env) {
EnvironmentKey.DEBUG -> {
Trustbadge(
modifier = Modifier.align(Alignment.BottomStart),
state = badgeState,
badgeContext = TrustbadgeContext.BuyerProtection(
orderDetails = OrderDetails(
number = "123456789",
amount = "129.00",
currency = CurrencyCode.EUR,
paymentType = "PayPal",
estimatedDeliveryDate = "2022-11-30",
buyerEmail = "[email protected]"
),
),
tsid = "X2AB6FF7BFF70A04D1D323E039D676EDB",
channelId = "chl-7e52920a-2722-4881-9908-ecec98c716e4"
)
}
else -> {
Trustbadge(
modifier = Modifier.align(Alignment.BottomStart),
state = badgeState,
badgeContext = TrustbadgeContext.BuyerProtection(),
tsid = "X079198F3BC11FA13F8980EB6879E2677",
channelId = "chl-b38b62ee-1e62-4a9f-9381-0ece0909b038"
)
}
}
}
}

@Composable
@Preview
internal fun PreviewProfileScreen() {
ProfileScreen()
ProfileScreen(EnvironmentKey.DEBUG)
}
Loading

0 comments on commit ac00801

Please sign in to comment.