Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
16 changes: 8 additions & 8 deletions packages/reown_walletkit/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PODS:
- MTBBarcodeScanner
- reown_yttrium_utils (0.0.1):
- Flutter
- YttriumUtilsWrapper (= 0.10.33)
- YttriumUtilsWrapper (= 0.10.37)
- Sentry/HybridSDK (8.56.2)
- sentry_flutter (9.12.0):
- Flutter
Expand All @@ -30,12 +30,12 @@ PODS:
- Flutter
- walletconnect_pay (0.0.1):
- Flutter
- YttriumWrapper (= 0.10.31)
- YttriumWrapper (= 0.10.37)
- webview_flutter_wkwebview (0.0.1):
- Flutter
- FlutterMacOS
- YttriumUtilsWrapper (0.10.33)
- YttriumWrapper (0.10.31)
- YttriumUtilsWrapper (0.10.37)
- YttriumWrapper (0.10.37)

DEPENDENCIES:
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
Expand Down Expand Up @@ -95,16 +95,16 @@ SPEC CHECKSUMS:
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
qr_bar_code_scanner_dialog: a4cb7ad7201cbf8b888f3e6e58972b611ac43b28
qr_code_scanner: d77f94ecc9abf96d9b9b8fc04ef13f611e5a147a
reown_yttrium_utils: f1eab97119ca83d2c4a13718019c94496060863e
reown_yttrium_utils: 9c407bda2e3db1638eed33598cf58fde08fb48e0
Sentry: b53951377b78e21a734f5dc8318e333dbfc682d7
sentry_flutter: 26f4615de8bdc741318397fdc78ba3e4e08df07f
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0
url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b
walletconnect_pay: df5449d1a7f9caf4f7f05e8c7da266c1fdebb1d1
walletconnect_pay: 8ea83ad692cc808414e82f6a6067769c4ab8f112
webview_flutter_wkwebview: 8ebf4fded22593026f7dbff1fbff31ea98573c8d
YttriumUtilsWrapper: 67c9e33159131d0625f86c5cb3cad83d45b045f1
YttriumWrapper: c951f1ef208f7fe876348c47f69827fd5e3da9f1
YttriumUtilsWrapper: 481d00fc2a203610525b5106ba23b8b2c63c96b8
YttriumWrapper: 2ae3722e8f07fde214725edd499679d03e7e86c9

PODFILE CHECKSUM: f15d300013bf3f49206576bb82c1d46cc60fd0fe

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ class DeepLinkHandler {
static final _errorStream = StreamController<String>();
static Stream<String> get errorStream => _errorStream.stream;

/// Temporary interceptor for deep links. When set, incoming links are
/// checked against this callback first. If it returns true the link is
/// considered handled and normal processing is skipped.
static bool Function(Uri uri)? oneShotInterceptor;

static void initListener() {
if (kIsWeb) return;
_eventChannel.receiveBroadcastStream().listen(_onLink, onError: _onError);
Expand Down Expand Up @@ -46,6 +51,16 @@ class DeepLinkHandler {

static void _onLink(dynamic link) async {
debugPrint('[WalletKit] [DeepLinkHandler] _onLink $link');

// Check one-shot interceptor first (used by in-app browser callback).
if (oneShotInterceptor != null) {
final uri = Uri.tryParse('$link');
if (uri != null && oneShotInterceptor!(uri)) {
oneShotInterceptor = null;
return;
}
}

try {
final serviceRegistered = GetIt.I.isRegistered<IWalletKitService>();
if (serviceRegistered) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import 'package:reown_walletkit_wallet/utils/eth_utils.dart';
import 'package:reown_walletkit_wallet/utils/methods_utils.dart';
import 'package:reown_walletkit_wallet/walletconnect_pay/wcp_modals/wcp_confirming_payment.dart';
import 'package:reown_walletkit_wallet/walletconnect_pay/wcp_modals/wcp_get_payment_options.dart';
import 'package:reown_walletkit_wallet/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_collect_data_browser.dart';
import 'package:reown_walletkit_wallet/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_collect_data_webview.dart';
import 'package:reown_walletkit_wallet/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_information_capture_start.dart';
import 'package:reown_walletkit_wallet/walletconnect_pay/wcp_modals/wcp_payment_details.dart';
import 'package:reown_walletkit_wallet/walletconnect_pay/wcp_modals/wcp_payment_result.dart';
import 'package:reown_walletkit_wallet/widgets/wc_connection_request/wc_connection_request_widget.dart';
Expand Down Expand Up @@ -782,19 +782,16 @@ class WalletKitService implements IWalletKitService {

// WalletConnectPay related UX

/// Initiates the data collection flow by showing the start modal and webview.
/// Initiates the data collection flow by showing the browser directly.
Future<dynamic> _startDataCollection(
PaymentOptionsResponse response,
String collectDataUrl,
) async {
final startResult = await _bottomSheetHandler.queueBottomSheet(
widget: WCPInformationCaptureStartWidget(paymentInfo: response.info!),
);
if (startResult != WCBottomSheetResult.next.name) {
return startResult;
}
return _showCollectDataBrowser(collectDataUrl);
}

return _showCollectDataWebView(collectDataUrl);
Future<dynamic> _showCollectDataBrowser(String collectDataUrl) async {
return WCPCollectDataBrowser.show(collectDataUrl);
}

Future<dynamic> _showCollectDataWebView(String collectDataUrl) async {
Expand All @@ -810,7 +807,6 @@ class WalletKitService implements IWalletKitService {
MaterialPageRoute(
builder: (_) => WCPCollectDataWebView(
collectDataUrl: collectDataUrl,
stepper: (1, 2),
),
),
);
Expand Down Expand Up @@ -850,18 +846,12 @@ class WalletKitService implements IWalletKitService {
Future<ConfirmPaymentRequest> _showPaymentDetails(
PaymentOptionsResponse response,
) async {
(int, int) stepper = (0, 0);
final hasCollectDataUrl = response.collectData?.url?.isNotEmpty ?? false;
if (hasCollectDataUrl) {
stepper = (2, 2);
}
final result = await _bottomSheetHandler.queueBottomSheet(
widget: WCPPaymentDetailsWidget(
paymentOptionsResponse: response,
paymentRequest: _pendingPaymentRequest!,
),
showBackButton: true,
stepper: stepper,
);

if (result is ConfirmPaymentRequest) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Identity Check</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #fff;
color: #141414;
padding: 24px 16px;
min-height: 100vh;
}
h1 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.subtitle { font-size: 14px; color: #787878; margin-bottom: 24px; }
.field { margin-bottom: 16px; }
.field label {
display: block;
font-size: 13px;
color: #787878;
margin-bottom: 6px;
}
.field input, .field select {
width: 100%;
height: 52px;
border: 1px solid #e0e0e0;
border-radius: 16px;
padding: 0 16px;
font-size: 16px;
color: #141414;
background: #fafafa;
outline: none;
-webkit-appearance: none;
}
.field input:focus, .field select:focus {
border-color: #3396ff;
border-width: 2px;
background: #fff;
}
.field select { padding-right: 32px; }
.actions { margin-top: 32px; }
.btn-primary {
width: 100%;
height: 52px;
background: #3396ff;
color: #fff;
border: none;
border-radius: 16px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
}
.btn-primary:active { background: #2b80d9; }
.btn-cancel {
display: block;
width: 100%;
text-align: center;
margin-top: 16px;
color: #787878;
font-size: 14px;
text-decoration: none;
cursor: pointer;
}
</style>
</head>
<body>
<h1>One-time identity check</h1>
<p class="subtitle">We need to collect a few details to meet legal requirements.</p>

<form id="form">
<div class="field">
<label for="dob">Date of Birth</label>
<input type="text" id="dob" name="dob" placeholder="DD/MM/YYYY" inputmode="numeric" maxlength="10" required>
</div>
<div class="field">
<label for="fullName">Full Name</label>
<input type="text" id="fullName" name="fullName" placeholder="John Doe" required>
</div>
<div class="field">
<label for="address">Place of Birth Address</label>
<input type="text" id="address" name="address" placeholder="123 Main St">
</div>
<div class="field">
<label for="city">Place of Birth City</label>
<input type="text" id="city" name="city" placeholder="New York">
</div>
<div class="field">
<label for="country">Place of Birth Country</label>
<select id="country" name="country">
<option value="">Select country...</option>
<option value="US">United States</option>
<option value="GB">United Kingdom</option>
<option value="DE">Germany</option>
<option value="FR">France</option>
<option value="ES">Spain</option>
<option value="IT">Italy</option>
<option value="JP">Japan</option>
<option value="KR">South Korea</option>
<option value="BR">Brazil</option>
<option value="AR">Argentina</option>
<option value="MX">Mexico</option>
<option value="CA">Canada</option>
<option value="AU">Australia</option>
<option value="IN">India</option>
<option value="CN">China</option>
<option value="NG">Nigeria</option>
<option value="ZA">South Africa</option>
<option value="CH">Switzerland</option>
<option value="SG">Singapore</option>
<option value="AE">United Arab Emirates</option>
</select>
</div>

<div class="actions">
<button type="submit" class="btn-primary">Continue</button>
<a id="cancel" class="btn-cancel">Cancel</a>
</div>
</form>

<script>
// Auto-format DOB field as DD/MM/YYYY
document.getElementById('dob').addEventListener('input', function(e) {
var v = this.value.replace(/\D/g, '');
if (v.length > 8) v = v.slice(0, 8);
if (v.length >= 5) {
this.value = v.slice(0, 2) + '/' + v.slice(2, 4) + '/' + v.slice(4);
} else if (v.length >= 3) {
this.value = v.slice(0, 2) + '/' + v.slice(2);
} else {
this.value = v;
}
});

var params = new URLSearchParams(window.location.search);
var fallback = 'https://appkit-lab.reown.com/flutter_walletkit_internal';
var successUrl = params.get('successUrl') || fallback;
var errorUrl = params.get('errorUrl') || fallback;

document.getElementById('form').addEventListener('submit', function(e) {
e.preventDefault();
window.location.href = successUrl + '?status=success';
});

document.getElementById('cancel').addEventListener('click', function(e) {
e.preventDefault();
window.location.href = errorUrl + '?status=cancelled';
});
</script>
</body>
</html>
Loading