6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit e228f805

AuthorMikkel Thygesen<mth@dwarf.dk>
Date2025-01-17 00:27:59 +0100
481: Implemented adding payment method in prereg flow

Changed files

.../android/app/src/main/AndroidManifest.xml       | 15 ++++---
 .../kotlin/com/comwell/phoenix/MainActivity.kt     |  4 +-
 comwell_key_app/lib/home/home_page.dart            | 51 +++++++++++++++-------
 .../pregistration/pages/prereg_payment_page.dart   |  9 ++--
 .../lib/pregistration/preregistration_flow.dart    |  1 +
 comwell_key_app/lib/routing/app_router.dart        |  8 ++++
 comwell_key_app/lib/routing/app_routes.dart        |  1 +
 comwell_key_app/lib/services/api.dart              |  5 +--
 8 files changed, 64 insertions(+), 30 deletions(-)

Diff

diff --git a/comwell_key_app/android/app/src/main/AndroidManifest.xml b/comwell_key_app/android/app/src/main/AndroidManifest.xml
index fb917310..070ce3f9 100644
--- a/comwell_key_app/android/app/src/main/AndroidManifest.xml
+++ b/comwell_key_app/android/app/src/main/AndroidManifest.xml
@@ -3,7 +3,7 @@
<uses-feature
android:name="android.hardware.nfc.hce"
android:required="false"/>
-
+
<application
android:label="@string/app_name"
android:name="${applicationName}"
@@ -21,9 +21,9 @@
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
- android:name="io.flutter.embedding.android.NormalTheme"
- android:resource="@style/NormalTheme"
- />
+ android:name="io.flutter.embedding.android.NormalTheme"
+ android:resource="@style/AppTheme" />
+
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
@@ -33,8 +33,13 @@
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
- <!-- <data android:scheme="https" android:host="comwellservicesdev.b2clogin.com" android:path="/oauthredirect" /> -->
+ <!-- <data android:scheme="https" android:host="comwellservicesdev.b2clogin.com" android:path="/oauthredirect" /> -->
<!-- <data android:scheme="msal40304e05-f354-49b2-9934-1b42f311751a" android:host="/auth" /> -->
+
+ <data
+ android:host="${applicationId}"
+ android:path="/adyenPayment"
+ android:scheme="adyencheckout" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
diff --git a/comwell_key_app/android/app/src/main/kotlin/com/comwell/phoenix/MainActivity.kt b/comwell_key_app/android/app/src/main/kotlin/com/comwell/phoenix/MainActivity.kt
index 3c976e41..7698d9e0 100644
--- a/comwell_key_app/android/app/src/main/kotlin/com/comwell/phoenix/MainActivity.kt
+++ b/comwell_key_app/android/app/src/main/kotlin/com/comwell/phoenix/MainActivity.kt
@@ -1,5 +1,5 @@
package com.comwell.phoenix
-import io.flutter.embedding.android.FlutterActivity
+import io.flutter.embedding.android.FlutterFragmentActivity
-class MainActivity: FlutterActivity()
+class MainActivity: FlutterFragmentActivity()
diff --git a/comwell_key_app/lib/home/home_page.dart b/comwell_key_app/lib/home/home_page.dart
index b0a99bf5..1e7ad546 100644
--- a/comwell_key_app/lib/home/home_page.dart
+++ b/comwell_key_app/lib/home/home_page.dart
@@ -42,7 +42,6 @@ class _HomeWidget extends State<HomeWidget> {
if (state == const HomeState.keyProvisioned()) {
context.read<HomeBloc>().add(const SearchForKeysEvent());
}
-
},
builder: (context, state) {
if (state == const HomeState.unknown()) {
@@ -70,22 +69,24 @@ class _HomeWidget extends State<HomeWidget> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Spacer(),
- if (state.status == HomeStatus.invalidOrNoKey )
+ if (state.status == HomeStatus.invalidOrNoKey )
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
- child: ElevatedButton(onPressed: () {
- context.read<HomeBloc>().add(const SearchForKeysEvent(endpointNeedsUpdate: true));
- }
-
- , child: const Text('Get Key')),
+ child: ElevatedButton(
+ onPressed: () {
+ context.read<HomeBloc>().add(
+ const SearchForKeysEvent(
+ endpointNeedsUpdate: true));
+ },
+ child: const Text('Get Key')),
),
- if(state.status == HomeStatus.validKey || state.status == HomeStatus.multipleKeys)
+ if(state.status == HomeStatus.validKey ||
+ state.status == HomeStatus.multipleKeys)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: SliderButton(
backgroundColor: sandColor,
width: 300,
-
icon: Center(
child: SvgPicture.asset(
'assets/icons/Union.svg',
@@ -110,17 +111,35 @@ class _HomeWidget extends State<HomeWidget> {
),
],
),
-
- const BottomSheetWidget(
+ BottomSheetWidget(
widgetChildren: [
- SizedBox(
+ const SizedBox(
height: 10,
width: double.infinity,
),
- Text('Rooms'),
- SizedBox(height: 400),
- Text('Keys'),
- SizedBox(height: 400),
+ const Text('Rooms'),
+ const SizedBox(height: 400),
+ ElevatedButton(
+ onPressed: () {
+ context.push("/prereg");
+ },
+ style: ButtonStyle(
+ backgroundColor:
+ WidgetStateProperty.resolveWith((states) {
+ if (states.contains(WidgetState.disabled)) {
+ return Colors.grey;
+ }
+ return const Color(0xffAA8D65);
+ }),
+ foregroundColor:
+ const WidgetStatePropertyAll(Colors.white)),
+ child: const Padding(
+ padding: EdgeInsets.symmetric(vertical: 16.0),
+ child: Text("Klargør dit værelse"),
+ ),
+ ),
+ const Text('Keys'),
+ const SizedBox(height: 400),
],
)
],
diff --git a/comwell_key_app/lib/pregistration/pages/prereg_payment_page.dart b/comwell_key_app/lib/pregistration/pages/prereg_payment_page.dart
index 76840e22..4aa80ac1 100644
--- a/comwell_key_app/lib/pregistration/pages/prereg_payment_page.dart
+++ b/comwell_key_app/lib/pregistration/pages/prereg_payment_page.dart
@@ -18,8 +18,8 @@ class PreregPaymentPage extends StatelessWidget {
final isTermsAndConditionsAccepted = cubit.state.termsAndConditionsAccepted;
final paymentMethods = cubit.state.storedPaymentMethods;
final selectedPaymentMethod = cubit.state.selectedPaymentMethod;
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
+ return ListView(
+ key: const PageStorageKey("prereg_payment"),
children: [
const SizedBox(height: 40),
Text("preregistration_payment_title".tr(),
@@ -35,7 +35,7 @@ class PreregPaymentPage extends StatelessWidget {
isSelected: pm.id == selectedPaymentMethod?.id,
),
)),
- AddCard(onClick: () {}),
+ const AddCard(),
Row(
children: [
Checkbox(
@@ -49,7 +49,8 @@ class PreregPaymentPage extends StatelessWidget {
}),
const Text("Jeg acceptere betingelserne")
],
- )
+ ),
+ const SizedBox(height: 40)
],
);
}
diff --git a/comwell_key_app/lib/pregistration/preregistration_flow.dart b/comwell_key_app/lib/pregistration/preregistration_flow.dart
index ade74604..1cfa01df 100644
--- a/comwell_key_app/lib/pregistration/preregistration_flow.dart
+++ b/comwell_key_app/lib/pregistration/preregistration_flow.dart
@@ -112,6 +112,7 @@ class _PreregistrationFlowState extends State<PreregistrationFlow> {
return const Center(child: CircularProgressIndicator());
}
return PageView(
+ key: const PageStorageKey("prereg_flow"),
physics: const NeverScrollableScrollPhysics(),
controller: cubit.pageController,
children: PreregistrationPage.getPages(ValueKey(state))
diff --git a/comwell_key_app/lib/routing/app_router.dart b/comwell_key_app/lib/routing/app_router.dart
index b985f7fb..6ce7c4d0 100644
--- a/comwell_key_app/lib/routing/app_router.dart
+++ b/comwell_key_app/lib/routing/app_router.dart
@@ -10,6 +10,7 @@ import 'package:comwell_key_app/login/login_page.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/overview/overview_page.dart';
import 'package:comwell_key_app/overview/past_cancelled_booking_detail_page.dart';
+import 'package:comwell_key_app/pregistration/preregistration_flow.dart';
import 'package:comwell_key_app/profile/profile_page.dart';
import 'package:comwell_key_app/profile_settings/components/change_password_modal.dart';
import 'package:comwell_key_app/profile_settings/profile_settings_page.dart';
@@ -134,6 +135,13 @@ GoRouter goRouter(AuthenticationBloc authBloc) {
name: AppRoutes.redeem.name,
builder: (context, state) => const RedeemPage(),
),
+ GoRoute(path: "/prereg",
+ name: AppRoutes.preregistration.name,
+ builder: (context,
+ state) {
+ return PreregistrationFlow();
+ }),
+
/* GoRoute(
path: "/keys",
name: AppRoutes.keys.name,
diff --git a/comwell_key_app/lib/routing/app_routes.dart b/comwell_key_app/lib/routing/app_routes.dart
index a6b0cfa5..1e36a91d 100644
--- a/comwell_key_app/lib/routing/app_routes.dart
+++ b/comwell_key_app/lib/routing/app_routes.dart
@@ -16,4 +16,5 @@ enum AppRoutes {
loadingPage,
changePassword,
checkIn,
+ preregistration,
}
diff --git a/comwell_key_app/lib/services/api.dart b/comwell_key_app/lib/services/api.dart
index 253677a0..5816115e 100644
--- a/comwell_key_app/lib/services/api.dart
+++ b/comwell_key_app/lib/services/api.dart
@@ -27,9 +27,8 @@ class Api {
return await dio.get('/booking/v1/GetCurrentBookingsFunction/$userId');
}
- Future<Response<PaymentMethods>> getPaymentMethods(
- String shopperReference) async {
- return await dio.get('/paymentMethods?shopperReference=$shopperReference');
+ Future<Response<PaymentMethods>> getPaymentMethods() async {
+ return await dio.get('/paymentMethods');
}
Future<Json> postPaymentsDetails(Json body) async {