Skip to content

Commit 04a59dc

Browse files
authored
fix: Keep compatible with app_links 6.0.0 and 5.0.0 (#918)
* fix: keep compatible with app_links 6.0.0 and 5.0.0 * ci: test supabase_flutter with downgraded packages * ci: downgrade only app_links * style: undo formatting
1 parent 3b823cc commit 04a59dc

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

.github/workflows/supabase_flutter.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,8 @@ jobs:
7171

7272
- name: Run tests
7373
run: flutter test --concurrency=1
74+
75+
- name: Run tests with downgraded app_links
76+
run: |
77+
flutter pub downgrade app_links
78+
flutter test --concurrency=1

packages/supabase_flutter/lib/src/supabase_auth.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,16 @@ class SupabaseAuth with WidgetsBindingObserver {
189189
_initialDeeplinkIsHandled = true;
190190

191191
try {
192-
final uri = await _appLinks.getInitialAppLink();
192+
Uri? uri;
193+
try {
194+
// before app_links 6.0.0
195+
uri = await (_appLinks as dynamic).getInitialAppLink();
196+
} on NoSuchMethodError catch (_) {
197+
// Needed to keep compatible with 5.0.0 and 6.0.0
198+
// https://pub.dev/packages/app_links/changelog
199+
// after app_links 6.0.0
200+
uri = await (_appLinks as dynamic).getInitialLink();
201+
}
193202
if (uri != null) {
194203
await _handleDeeplink(uri);
195204
}

packages/supabase_flutter/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ environment:
1010
flutter: '>=3.0.0'
1111

1212
dependencies:
13-
app_links: '>=3.5.0 <6.0.0'
13+
app_links: '>=3.5.0 <7.0.0'
1414
async: ^2.11.0
1515
crypto: ^3.0.2
1616
flutter:

0 commit comments

Comments
 (0)