testDeeplink function
Implementation
Future<void> testDeeplink({
String? url,
bool testAndroid = false,
bool testIos = false,
String? scheme,
}) async {
print(
'${ColorsText.cyan}═══════════════════════════════════════════════════════════${ColorsText.reset}');
print('${ColorsText.cyan} Deep Link Testing${ColorsText.reset}');
print(
'${ColorsText.cyan}═══════════════════════════════════════════════════════════${ColorsText.reset}\n');
// If no specific platform is selected, show both
final testBoth = !testAndroid && !testIos;
if (url == null && scheme == null) {
print(
'${ColorsText.red}Error: You must specify either --url or --scheme${ColorsText.reset}');
print('\nUsage: flyer deeplink test --url <url>');
print(' or: flyer deeplink test --scheme <scheme> --url <path>');
return;
}
// Build test URL
String testUrl;
if (scheme != null) {
testUrl = '$scheme://${url ?? ''}';
} else {
testUrl = url!;
}
print(
'${ColorsText.blue}🧪 Test URL: ${ColorsText.cyan}$testUrl${ColorsText.reset}\n');
// Extract project info for package names
final projectInfo = await extractProjectInfo();
// Test Android
if (testAndroid || testBoth) {
await _testAndroid(testUrl, projectInfo.androidPackageName);
}
// Test iOS
if (testIos || testBoth) {
_showIosTestInstructions(testUrl);
}
// Show verification commands
if (testBoth || testAndroid) {
_showAndroidVerification(projectInfo.androidPackageName);
}
}