1
0
This commit is contained in:
2025-11-18 15:39:58 +09:00
parent b6281d2847
commit f87a909674

View File

@@ -100,21 +100,28 @@
return; return;
} }
// Universal Links用: 現在のHTTPS URLがそのままアプリに渡される // カスタムスキームのDeep Linkを生成
// iOSがUniversal Linkを認識すれば自動的にアプリが開く const deepLink = `aicard://oauth/callback?code=${encodeURIComponent(code)}&state=${encodeURIComponent(state)}`;
console.log('Waiting for Universal Link to trigger...');
// 3秒後にフォールバックメッセージを表示 console.log('OAuth callback received, attempting app launch...');
console.log('Universal Link should trigger automatically if configured correctly');
// 即座にカスタムスキームへのリダイレクトを試行(フォールバック)
// Universal Linksが動作すればこのコードに到達する前にアプリが開く
// 動作しない場合はカスタムスキームで開く
setTimeout(() => { setTimeout(() => {
// カスタムスキームのDeep Linkを生成フォールバック用 console.log('Attempting fallback custom scheme redirect');
const deepLink = `aicard://oauth/callback?code=${encodeURIComponent(code)}&state=${encodeURIComponent(state)}`; window.location.href = deepLink;
}, 500);
// 2秒後に手動ボタンを表示念のため
setTimeout(() => {
content.innerHTML = ` content.innerHTML = `
<div class="message">認証が完了しました</div> <div class="message">認証が完了しました</div>
<p style="font-size: 14px; opacity: 0.9;">アプリが自動的に開かない場合は、<br>下のボタンをタップしてください</p> <p style="font-size: 14px; opacity: 0.9;">アプリが自動的に開かない場合は、<br>下のボタンをタップしてください</p>
<a href="${deepLink}" class="button">アプリを開く</a> <a href="${deepLink}" class="button">アプリを開く</a>
`; `;
}, 3000); }, 2000);
} catch (err) { } catch (err) {
console.error('Callback error:', err); console.error('Callback error:', err);