@@ -4,9 +4,19 @@ import SwiftUI
44///
55struct CouponCreationSuccess : View {
66 let couponCode : String
7+ let shareMessage : String
8+ let onDismiss : ( ) -> Void
9+ @State private var showingShareSheet : Bool = false
10+
711
812 var body : some View {
913 VStack ( alignment: . center, spacing: 0 ) {
14+ // Anchor the action sheet at the top to be able to show the popover on iPad in the most appropriate position
15+ Divider ( )
16+ . shareSheet ( isPresented: $showingShareSheet) {
17+ ShareSheet ( activityItems: [ shareMessage] )
18+ }
19+
1020 Spacer ( )
1121
1222 VStack ( alignment: . leading, spacing: 0 ) {
@@ -24,12 +34,13 @@ struct CouponCreationSuccess: View {
2434
2535 VStack ( alignment: . center, spacing: Constants . contentPadding) {
2636 Button ( Localization . shareCoupon) {
27- // TODO
37+ showingShareSheet = true
38+ // TODO: add analytics
2839 }
2940 . buttonStyle ( PrimaryButtonStyle ( ) )
3041
3142 Button ( Localization . close) {
32- // TODO
43+ onDismiss ( )
3344 }
3445 . buttonStyle ( SecondaryButtonStyle ( ) )
3546 }
@@ -53,6 +64,6 @@ private extension CouponCreationSuccess {
5364
5465struct CouponCreationSuccess_Previews : PreviewProvider {
5566 static var previews : some View {
56- CouponCreationSuccess ( couponCode: " 34sdfg " )
67+ CouponCreationSuccess ( couponCode: " 34sdfg " , shareMessage : " Use this coupon to get 10% off all products " ) { }
5768 }
5869}
0 commit comments