Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions pay_ios/ios/pay_ios/Sources/pay_ios/ApplePayButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ extension PKPaymentButtonType {
return .contribute
case "tip":
return .tip
case "continue":
guard #available(iOS 15.0, *) else { return nil }
return .continue
default:
return nil
}
Expand Down
4 changes: 3 additions & 1 deletion pay_ios/lib/src/widgets/apple_pay_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ enum ApplePayButtonType {
rent,
support,
contribute,
tip
tip,
continue_
}

/// The button styles supported on Apple Pay.
Expand Down Expand Up @@ -198,6 +199,7 @@ extension on ApplePayButtonType {
ApplePayButtonType.support: 'support',
ApplePayButtonType.contribute: 'contribute',
ApplePayButtonType.tip: 'tip',
ApplePayButtonType.continue_: 'continue',
}[this]!;
}

Expand Down
19 changes: 19 additions & 0 deletions pay_ios/test/pay_button_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,24 @@ void main() {
);
debugDefaultTargetPlatformOverride = null;
});

testWidgets('maps ApplePayButtonType.continue_ to "continue"',
(WidgetTester tester) async {
await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: RawApplePayButton(
type: ApplePayButtonType.continue_,
onPressed: () {},
),
));

expect(
find.byWidgetPredicate((widget) =>
widget is UiKitView &&
widget.creationParams['type'] == 'continue'),
findsOneWidget);

debugDefaultTargetPlatformOverride = null;
});
});
}