Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add options to dismiss the drop in #249

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
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
19 changes: 18 additions & 1 deletion packages/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PODS:
- ReactCommon/turbomodule/core (= 0.72.0)
- fmt (6.2.1)
- glog (0.3.5)
- primer-io-react-native (2.27.2):
- primer-io-react-native (2.28.0):
- PrimerSDK (= 2.33.1)
- React-Core
- Primer3DS (2.4.1)
Expand Down Expand Up @@ -567,6 +567,7 @@ SPEC CHECKSUMS:
PrimerSDK: 181f7b12d3d436916bfea9a2c58d49a694aa8186
PrimerStripeSDK: c37d4e7c1b5256d67d4890c4cc4b38ddc9427489
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
RCTRequired: 656ef0536dd60a9740961ade6a64ba0cb0572d2b
RCTTypeSafety: 82bd23b63f043d1a6b8e80e72fd15c08e04528a4
React: 4f2c0b59d1a1c0ae02771deb69e5ee78999fee79
Expand All @@ -575,19 +576,30 @@ SPEC CHECKSUMS:
React-Core: fce0e8a04de16c69e766f26b652e7ca9927eda9b
React-CoreModules: b02ca7a4fb869bcbe4c0ed2c939d433f13a120c5
React-cxxreact: 9738d95069cfbe030d5f44319c9b44028f442d82
React-Codegen: 7dcfe258f856ac8381a905f0669435736bcfb5b9
React-Core: fce0e8a04de16c69e766f26b652e7ca9927eda9b
React-CoreModules: b02ca7a4fb869bcbe4c0ed2c939d433f13a120c5
React-cxxreact: 9738d95069cfbe030d5f44319c9b44028f442d82
React-debug: 77ab539975d81d27153e2998bc1214a2473cde01
React-jsc: 3c0b9256529613da65281effc9ddf1067a2e075f
React-jsi: 26276762f73bf53c33c3d5252664c32ba4509f8b
React-jsiexecutor: de4e98ab0f2661affeb54931806a79a93a34d1ea
React-jsi: 26276762f73bf53c33c3d5252664c32ba4509f8b
React-jsiexecutor: de4e98ab0f2661affeb54931806a79a93a34d1ea
React-jsinspector: 8d754fc957255a29d93e52fc67a895045cdc8703
React-logger: 454ffb01980778a43b0153ee98721d0275b56616
react-native-safe-area-context: dcab599c527c2d7de2d76507a523d20a0b83823d
react-native-segmented-control: d88b35fcd06c0c8e1f1f7ed1eb066c2b02570fdd
React-NativeModulesApple: 1d81d927ef1a67a3545a01e14c2e98500bf9b199
React-logger: 454ffb01980778a43b0153ee98721d0275b56616
react-native-safe-area-context: dcab599c527c2d7de2d76507a523d20a0b83823d
react-native-segmented-control: d88b35fcd06c0c8e1f1f7ed1eb066c2b02570fdd
React-NativeModulesApple: 1d81d927ef1a67a3545a01e14c2e98500bf9b199
React-perflogger: 684a11499a0589cc42135d6d5cc04d0e4e0e261a
React-RCTActionSheet: 00b0a4c382a13b834124fa3f541a7d8d1d56efb9
React-RCTAnimation: 10c24c66fb504f2faa53f4ec0666c4568255cff9
React-RCTAppDelegate: 0402b094e4f630aee6831570731759a43a69a28c
React-RCTAppDelegate: 0402b094e4f630aee6831570731759a43a69a28c
React-RCTBlob: 48aaf595ea4f209faa8a80f26c23a4b9c271248f
React-RCTImage: 2f609dd1c80c4aec8edf2ca235cba476fdd442ec
React-RCTLinking: d7f20b7d51246bf34790ce1362d124cc1b42671b
Expand All @@ -601,9 +613,14 @@ SPEC CHECKSUMS:
React-utils: c12d2e75c8bbc727939ddc4319ed95493395ed5a
ReactCommon: b9547f82aed45eccc1aa59034dc6c72809e37000
RNScreens: 93ae3be2f119d955620f9bbb39ad372adb53b7a9
React-runtimescheduler: 4a36521cc1ec1bc3997ae2462b6779dadaae376b
React-utils: c12d2e75c8bbc727939ddc4319ed95493395ed5a
ReactCommon: b9547f82aed45eccc1aa59034dc6c72809e37000
RNScreens: 93ae3be2f119d955620f9bbb39ad372adb53b7a9
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
Yoga: 1d6727ed193122f6adaf435c3de1a768326ff83b

PODFILE CHECKSUM: 4505e915c8982e98dcb8297a1c627233ce3a067f

COCOAPODS: 1.16.2
COCOAPODS: 1.16.2
2 changes: 1 addition & 1 deletion packages/example/src/screens/CheckoutScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import * as React from 'react';
import { View, Text, useColorScheme, TouchableOpacity } from 'react-native';
import { Colors } from 'react-native/Libraries/NewAppScreen';
Expand Down Expand Up @@ -277,6 +276,7 @@ const CheckoutScreen = (props: any) => {
isInitScreenEnabled: true,
isSuccessScreenEnabled: true,
isErrorScreenEnabled: true,
dismissalMechanism: ['gestures', 'closeButton'],
theme: {
// 👇 Uncomment to try theming drop-in checkout

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ data class PrimerUIOptionsRN(
var isInitScreenEnabled: Boolean = true,
var isSuccessScreenEnabled: Boolean = true,
var isErrorScreenEnabled: Boolean = true,
var dismissalMechanism: List<String>? = listOf("gestures"),
var theme: PrimerThemeRN = PrimerThemeRN()
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@ package com.primerioreactnative.extensions

import com.primerioreactnative.datamodels.PrimerUIOptionsRN
import io.primer.android.ui.settings.PrimerUIOptions
import io.primer.android.data.settings.DismissalMechanism

@OptIn(kotlin.ExperimentalStdlibApi::class)
internal fun PrimerUIOptionsRN.toPrimerUIOptions() =
PrimerUIOptions(
isInitScreenEnabled,
isSuccessScreenEnabled,
isErrorScreenEnabled,
buildSet {
for (it in dismissalMechanism.orEmpty()) {
when (it) {
"gestures" -> add(DismissalMechanism.GESTURES)
"closeButton" -> add(DismissalMechanism.CLOSE_BUTTON)
else -> { /* no-op */ }
}
}
}.toList().takeIf { it.isNotEmpty() } ?: listOf(DismissalMechanism.GESTURES),
theme.toPrimerTheme()
)
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,23 @@ extension PrimerSettings {
isInitScreenEnabled: rnUIOptions["isInitScreenEnabled"] as? Bool,
isSuccessScreenEnabled: rnUIOptions["isSuccessScreenEnabled"] as? Bool,
isErrorScreenEnabled: rnUIOptions["isErrorScreenEnabled"] as? Bool,
dismissalMechanism: {
if let mechanisms = rnUIOptions["dismissalMechanism"] as? [String] {
var dismissalMechanisms: [DismissalMechanism] = []
for mechanism in mechanisms {
switch mechanism {
case "gestures":
dismissalMechanisms.append(.gestures)
case "closeButton":
dismissalMechanisms.append(.closeButton)
default:
break
}
}
return dismissalMechanisms.isEmpty ? nil : dismissalMechanisms
}
return nil
}(),
theme: theme)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/ios/Sources/version.swift
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// swiftlint:disable:next identifier_name
public let PrimerReactNativeSDKVersion = "2.27.2"
public let PrimerReactNativeSDKVersion = "2.28.0"
3 changes: 3 additions & 0 deletions packages/sdk/src/models/PrimerSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,12 @@ interface IPrimerUIOptions {
isInitScreenEnabled?: boolean;
isSuccessScreenEnabled?: boolean;
isErrorScreenEnabled?: boolean;
dismissalMechanism?: DismissalMechanism[];
theme?: IPrimerTheme;
}

export type DismissalMechanism = 'gestures' | 'closeButton';

//----------------------------------------

interface IPrimerDebugOptions {
Expand Down
Loading