# iOS Deep Link Setup for Onairos

## 📱 Simple iOS Configuration

### Step 1: Update Info.plist

Add this configuration to your `ios/Runner/Info.plist` file:

```xml
<!-- Add these keys to your Info.plist -->
<key>CFBundleURLTypes</key>
<array>
    <!-- Onairos OAuth callback -->
    <dict>
        <key>CFBundleURLName</key>
        <string>OnairosOAuth</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>onairos</string>
        </array>
    </dict>
</array>

<!-- Allow querying for OAuth apps -->
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>onairos</string>
</array>
```

### Step 2: Update AppDelegate.swift

Create or update `ios/Runner/AppDelegate.swift`:

```swift
import UIKit
import Flutter

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
  
  // Handle deep links
  override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    return super.application(app, open: url, options: options)
  }
}
```

### Step 3: Test Your Setup

**Test in Xcode Simulator:**
1. Open Safari in simulator
2. Type: `onairos://test`
3. Your app should open

**Test on Device:**
1. Use Shortcuts app
2. Create new shortcut with "Open URLs"
3. Enter: `onairos://test`

## ✅ What You Need to Do

1. **Copy the XML code** above into your `ios/Runner/Info.plist`
2. **Copy the Swift code** above into your `ios/Runner/AppDelegate.swift`
3. **Test the deep link** using the methods above
4. **Use `returnLink: 'onairos'`** in your OnairosButton widget

## 🔧 Flutter Code Example

```dart
OnairosButton(
  requestData: {'basicProfile': true},
  returnLink: 'onairos', // This must match your URL scheme
  logoAssetPath: 'assets/logo.png',
  onResolved: (apiUrl, token, userData) {
    print('Success!');
  },
)
```

That's it! Your iOS app will now handle Onairos deep links.
