Skip to content

fix: Keep compatible with app_links 6.0.0 and 5.0.0 #918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 7, 2024
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
5 changes: 5 additions & 0 deletions .github/workflows/supabase_flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,8 @@ jobs:

- name: Run tests
run: flutter test --concurrency=1

- name: Run tests with downgraded app_links
run: |
flutter pub downgrade app_links
flutter test --concurrency=1
11 changes: 10 additions & 1 deletion packages/supabase_flutter/lib/src/supabase_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,16 @@ class SupabaseAuth with WidgetsBindingObserver {
_initialDeeplinkIsHandled = true;

try {
final uri = await _appLinks.getInitialAppLink();
Uri? uri;
try {
// before app_links 6.0.0
uri = await (_appLinks as dynamic).getInitialAppLink();
} on NoSuchMethodError catch (_) {
// Needed to keep compatible with 5.0.0 and 6.0.0
// https://pub.dev/packages/app_links/changelog
// after app_links 6.0.0
uri = await (_appLinks as dynamic).getInitialLink();
}
if (uri != null) {
await _handleDeeplink(uri);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/supabase_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ environment:
flutter: '>=3.0.0'

dependencies:
app_links: '>=3.5.0 <6.0.0'
app_links: '>=3.5.0 <7.0.0'
async: ^2.11.0
crypto: ^3.0.2
flutter:
Expand Down
Loading