Skip to content
Merged
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
21 changes: 21 additions & 0 deletions lib/src/ui/sec_modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class SecModalBuilder extends StatelessWidget {
this.disconnectOnClose = true,
this.turnOffOnClose = true,
this.canDismiss = true,
this.storageAdapter,
this.readerConnectorMode = ReaderConnectorMode.preferLastConnected,
this.tokenAmount,
super.key,
});
Expand All @@ -33,6 +35,13 @@ class SecModalBuilder extends StatelessWidget {
/// Whether the reader should be turned off when the sheet is closed.
final bool turnOffOnClose;

/// The StorageAdapter to use for persisting the last connected and paired
/// devices.
final StorageAdapter? storageAdapter;

/// The mode to use when connecting to a device.
final ReaderConnectorMode readerConnectorMode;

/// Strategy to use for the connection.
final ConnectionStrategy strategy;

Expand Down Expand Up @@ -106,6 +115,8 @@ class SecModalBuilder extends StatelessWidget {
useSafeArea: useSafeArea,
strategy: strategy,
payload: payload,
storageAdapter: storageAdapter,
readerConnectorMode: readerConnectorMode,
tokenAmount: tokenAmount,
),
);
Expand Down Expand Up @@ -153,6 +164,14 @@ LdModal secModal({
/// Whether to use safe area inside the modal
required bool useSafeArea,

/// The StorageAdapter to use for persisting the last connected and paired
/// devices.
StorageAdapter? storageAdapter,

/// The mode to use when connecting to a device.
ReaderConnectorMode readerConnectorMode =
ReaderConnectorMode.preferLastConnected,

/// Amount of token to be requested on token refresh
int? tokenAmount,
}) {
Expand Down Expand Up @@ -181,6 +200,8 @@ LdModal secModal({
onVerificationFailed: () async {
Navigator.of(context).pop(SecResultFailed());
},
storageAdapter: storageAdapter,
readerConnectorMode: readerConnectorMode,
tokenAmount: tokenAmount,
),
),
Expand Down
5 changes: 5 additions & 0 deletions lib/src/ui/sec_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class SecWidget extends StatelessWidget {
required this.onVerificationDone,
required this.onVerificationFailed,
this.storageAdapter,
this.readerConnectorMode = ReaderConnectorMode.preferLastConnected,
this.tokenAmount,
super.key,
});
Expand All @@ -23,6 +24,9 @@ class SecWidget extends StatelessWidget {
/// devices.
final StorageAdapter? storageAdapter;

/// The mode to use when connecting to a device.
final ReaderConnectorMode readerConnectorMode;

/// The strategy to use for the connection.
final ConnectionStrategy strategy;

Expand Down Expand Up @@ -51,6 +55,7 @@ class SecWidget extends StatelessWidget {
child: DeviceConnector(
connectionStrategy: strategy,
storageAdapter: storageAdapter,
mode: readerConnectorMode,
connectedBuilder: (BuildContext context) {
return LdSubmit<UrpSecPrimeResponse?>(
config: LdSubmitConfig<UrpSecPrimeResponse?>(
Expand Down