From 44e39dd5f88c4f69537dea8873978a23f5f194b0 Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Mon, 6 May 2024 07:50:59 +0530 Subject: [PATCH 1/5] [chore] added attribution --- petcare-sample/b2c/mobile-app/petcare-with-sdk/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/petcare-sample/b2c/mobile-app/petcare-with-sdk/README.md b/petcare-sample/b2c/mobile-app/petcare-with-sdk/README.md index cefe11a7d..8664e426a 100644 --- a/petcare-sample/b2c/mobile-app/petcare-with-sdk/README.md +++ b/petcare-sample/b2c/mobile-app/petcare-with-sdk/README.md @@ -262,3 +262,6 @@ The application you created requires 2 properties to perform android attestation ![image](https://github.com/wso2/samples-is/assets/46097917/5a31af56-b3ae-4b37-992d-aae42046ab31) ![image](https://github.com/wso2/samples-is/assets/46097917/cc67d9da-2f47-408b-8b75-77499f03802f) ![image](https://github.com/wso2/samples-is/assets/46097917/65f04443-e43a-4c28-a68a-436f890deb7e) + +###### Credits +- Images used in the application are taken from [Freepik](https://www.freepik.com/), [Unsplash](https://unsplash.com/), and [Flaticon](https://www.flaticon.com/). From c4d54cb85eabd100217ae420f719b479ec120222 Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Mon, 6 May 2024 07:53:09 +0530 Subject: [PATCH 2/5] Update README.md --- petcare-sample/b2c/mobile-app/petcare-with-sdk/README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/petcare-sample/b2c/mobile-app/petcare-with-sdk/README.md b/petcare-sample/b2c/mobile-app/petcare-with-sdk/README.md index 7b9dd6a0f..04f00209e 100644 --- a/petcare-sample/b2c/mobile-app/petcare-with-sdk/README.md +++ b/petcare-sample/b2c/mobile-app/petcare-with-sdk/README.md @@ -246,12 +246,9 @@ The application you created requires 2 properties to perform android attestation > When you have released multiple versions of the application, you may face a problem that the application you download from the link are still giving the old version, to mitigate this you can change the device and open the link or wait a few minutes. ###### App Screens -![image](https://github.com/wso2/samples-is/assets/46097917/5a31af56-b3ae-4b37-992d-aae42046ab31) -![image](https://github.com/wso2/samples-is/assets/46097917/cc67d9da-2f47-408b-8b75-77499f03802f) -![image](https://github.com/wso2/samples-is/assets/46097917/65f04443-e43a-4c28-a68a-436f890deb7e) - -###### Credits -- Images used in the application are taken from [Freepik](https://www.freepik.com/), [Unsplash](https://unsplash.com/), and [Flaticon](https://www.flaticon.com/). ![Screenshot_20240411_223503](https://github.com/wso2/samples-is/assets/46097917/e2aabd05-4450-4dff-a93d-587bd37360b8) ![Screenshot_20240411_223521](https://github.com/wso2/samples-is/assets/46097917/34bd711c-aa69-418a-a5a9-6e517d15ba1a) ![Screenshot_20240411_223607](https://github.com/wso2/samples-is/assets/46097917/6c6a6d25-4be3-454b-930d-9fd4332c1e4c) + +###### Credits +- Images used in the application are taken from [Freepik](https://www.freepik.com/), [Unsplash](https://unsplash.com/), and [Flaticon](https://www.flaticon.com/). From 82a08188a6447bbcc227775c0247f1808587beae Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Mon, 6 May 2024 09:24:39 +0530 Subject: [PATCH 3/5] [improvement] improve home and profile screen --- .../screens/profile/ProfileScreen.kt | 10 ++++++---- .../presentation/util/pets_list/PetsList.kt | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/petcare-sample/b2c/mobile-app/petcare-with-sdk/app/src/main/java/com/wso2_sample/api_auth_sample/features/home/presentation/screens/profile/ProfileScreen.kt b/petcare-sample/b2c/mobile-app/petcare-with-sdk/app/src/main/java/com/wso2_sample/api_auth_sample/features/home/presentation/screens/profile/ProfileScreen.kt index fbcf009c9..dd7f027c7 100644 --- a/petcare-sample/b2c/mobile-app/petcare-with-sdk/app/src/main/java/com/wso2_sample/api_auth_sample/features/home/presentation/screens/profile/ProfileScreen.kt +++ b/petcare-sample/b2c/mobile-app/petcare-with-sdk/app/src/main/java/com/wso2_sample/api_auth_sample/features/home/presentation/screens/profile/ProfileScreen.kt @@ -94,10 +94,12 @@ fun ProfileScreenContent( verticalArrangement = Arrangement.spacedBy(8.dp) ) { ProfileImage(imageUrl = state.user?.imageUrl ?: "") - NameSection( - firstName = state.user?.firstName, - lastName = state.user?.lastName - ) + if (state.user?.firstName != null || state.user?.lastName != null) { + NameSection( + firstName = state.user.firstName, + lastName = state.user.lastName + ) + } } Spacer(modifier = Modifier.height(32.dp)) Column( diff --git a/petcare-sample/b2c/mobile-app/petcare-with-sdk/app/src/main/java/com/wso2_sample/api_auth_sample/features/home/presentation/util/pets_list/PetsList.kt b/petcare-sample/b2c/mobile-app/petcare-with-sdk/app/src/main/java/com/wso2_sample/api_auth_sample/features/home/presentation/util/pets_list/PetsList.kt index 59fae8ce2..6aa6f0a84 100644 --- a/petcare-sample/b2c/mobile-app/petcare-with-sdk/app/src/main/java/com/wso2_sample/api_auth_sample/features/home/presentation/util/pets_list/PetsList.kt +++ b/petcare-sample/b2c/mobile-app/petcare-with-sdk/app/src/main/java/com/wso2_sample/api_auth_sample/features/home/presentation/util/pets_list/PetsList.kt @@ -25,7 +25,9 @@ import androidx.compose.foundation.layout.padding import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import com.wso2_sample.api_auth_sample.features.home.domain.models.pet.Pet @@ -42,9 +44,20 @@ fun PetsList(pets: List) { Column( modifier = Modifier .padding(top = 16.dp) - .fillMaxWidth(), - verticalArrangement = Arrangement.spacedBy(16.dp) + .fillMaxWidth() + .align(Alignment.CenterHorizontally), + verticalArrangement = Arrangement.spacedBy(16.dp), ) { + + if (pets.isEmpty()) { + Text( + text = "You don't have any pets yet", + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.tertiaryContainer, + textAlign = TextAlign.Center + ) + } + pets.forEach { pet -> PetCard(pet = pet) } From c0ae354705e8807a5023414e3bd0c7d6391bd45e Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Mon, 6 May 2024 10:35:36 +0530 Subject: [PATCH 4/5] [improvement] go to home page if add pets is successful --- .../b2c/mobile-app/petcare-with-sdk/app/build.gradle.kts | 4 ++-- .../presentation/screens/add_pet/AddPetScreenViewModel.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/petcare-sample/b2c/mobile-app/petcare-with-sdk/app/build.gradle.kts b/petcare-sample/b2c/mobile-app/petcare-with-sdk/app/build.gradle.kts index ab216a568..c265e493e 100644 --- a/petcare-sample/b2c/mobile-app/petcare-with-sdk/app/build.gradle.kts +++ b/petcare-sample/b2c/mobile-app/petcare-with-sdk/app/build.gradle.kts @@ -32,8 +32,8 @@ android { applicationId = "com.wso2_sample.api_auth_sample" minSdk = 26 targetSdk = 34 - versionCode = 1 - versionName = "1.0" + versionCode = 17 + versionName = "0.0.17" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" diff --git a/petcare-sample/b2c/mobile-app/petcare-with-sdk/app/src/main/java/com/wso2_sample/api_auth_sample/features/home/presentation/screens/add_pet/AddPetScreenViewModel.kt b/petcare-sample/b2c/mobile-app/petcare-with-sdk/app/src/main/java/com/wso2_sample/api_auth_sample/features/home/presentation/screens/add_pet/AddPetScreenViewModel.kt index 6f0ce0be1..2b92c200b 100644 --- a/petcare-sample/b2c/mobile-app/petcare-with-sdk/app/src/main/java/com/wso2_sample/api_auth_sample/features/home/presentation/screens/add_pet/AddPetScreenViewModel.kt +++ b/petcare-sample/b2c/mobile-app/petcare-with-sdk/app/src/main/java/com/wso2_sample/api_auth_sample/features/home/presentation/screens/add_pet/AddPetScreenViewModel.kt @@ -87,6 +87,7 @@ class AddPetScreenViewModel @Inject constructor( _state.update { it.copy(isLoading = false) } + navigateToHome() }.onFailure { e -> _state.update { it.copy(error = e.message!!, isLoading = false) @@ -94,7 +95,6 @@ class AddPetScreenViewModel @Inject constructor( } } } - } } } From 0e99416dcac557fa91b7901763e6908420229cbf Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Mon, 6 May 2024 11:35:22 +0530 Subject: [PATCH 5/5] [chore] added orgin_finder.py This will be used to find the origin to add as a trusted origin when using the passkey authenticator --- .../petcare-with-sdk/origin_finder.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 petcare-sample/b2c/mobile-app/petcare-with-sdk/origin_finder.py diff --git a/petcare-sample/b2c/mobile-app/petcare-with-sdk/origin_finder.py b/petcare-sample/b2c/mobile-app/petcare-with-sdk/origin_finder.py new file mode 100644 index 000000000..a574dc082 --- /dev/null +++ b/petcare-sample/b2c/mobile-app/petcare-with-sdk/origin_finder.py @@ -0,0 +1,25 @@ +# ------------------------------------------------------------------------------------- +# +# Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). +# +# WSO2 LLC. licenses this file to you under the Apache License, +# Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# -------------------------------------------------------------------------------------- + +import binascii +import base64 +fingerprint = + +print("android:apk-key-hash:" + base64.urlsafe_b64encode(binascii.a2b_hex(fingerprint.replace(':', ''))).decode('utf8').replace('=', ''))