Skip to content

Commit deab505

Browse files
chore: generate flutter_news_template (#1311)
1 parent 2124be4 commit deab505

File tree

26 files changed

+335
-212
lines changed

26 files changed

+335
-212
lines changed

flutter_news_template/__brick__/{{project_name.snakeCase()}}/.github/workflows/deep_link_client.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ concurrency:
77
on:
88
pull_request:
99
paths:
10-
- "packages/deep_link_client/**"
10+
- "packages/deep_link_client/deep_link_client/**"
1111
- ".github/workflows/deep_link_client.yaml"
1212
branches:
1313
- main
1414

1515
jobs:
1616
build:
17-
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
17+
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/dart_package.yml@v1
1818
with:
19-
flutter_version: {{flutter_version}}
20-
working_directory: packages/deep_link_client
19+
dart_sdk: 3.4.3
20+
working_directory: packages/deep_link_client/deep_link_client
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: firebase_deep_link_client
2+
3+
concurrency:
4+
group: ${{#mustacheCase}}github.workflow{{/mustacheCase}}-${{#mustacheCase}}github.ref{{/mustacheCase}}
5+
cancel-in-progress: true
6+
7+
on:
8+
pull_request:
9+
paths:
10+
- "packages/deep_link_client/firebase_deep_link_client/**"
11+
- ".github/workflows/firebase_deep_link_client.yaml"
12+
branches:
13+
- main
14+
15+
jobs:
16+
build:
17+
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
18+
with:
19+
flutter_version: {{flutter_version}}
20+
working_directory: packages/deep_link_client/firebase_deep_link_client

flutter_news_template/__brick__/{{project_name.snakeCase()}}/.github/workflows/{{#snakeCase}}{{project_name}}{{/snakeCase}}.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
steps:
3131
- uses: actions/checkout@v4
3232

33-
- uses: subosito/flutter-action@v2.16.0
33+
- uses: subosito/flutter-action@v2.18.0
3434
with:
3535
channel: ${{#mustacheCase}}matrix.channel{{/mustacheCase}}
3636
flutter-version: {{flutter_version}}

flutter_news_template/__brick__/{{project_name.snakeCase()}}/api/pubspec.lock

+31-18
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,23 @@ packages:
55
dependency: transitive
66
description:
77
name: _fe_analyzer_shared
8-
sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051
8+
sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834
99
url: "https://pub.dev"
1010
source: hosted
11-
version: "64.0.0"
11+
version: "72.0.0"
12+
_macros:
13+
dependency: transitive
14+
description: dart
15+
source: sdk
16+
version: "0.3.2"
1217
analyzer:
1318
dependency: transitive
1419
description:
1520
name: analyzer
16-
sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893"
21+
sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139
1722
url: "https://pub.dev"
1823
source: hosted
19-
version: "6.2.0"
24+
version: "6.7.0"
2025
args:
2126
dependency: transitive
2227
description:
@@ -173,10 +178,10 @@ packages:
173178
dependency: "direct main"
174179
description:
175180
name: equatable
176-
sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2
181+
sha256: "567c64b3cb4cf82397aac55f4f0cbd3ca20d77c6c03bedbc4ceaddc08904aef7"
177182
url: "https://pub.dev"
178183
source: hosted
179-
version: "2.0.5"
184+
version: "2.0.7"
180185
file:
181186
dependency: transitive
182187
description:
@@ -285,10 +290,10 @@ packages:
285290
dependency: "direct dev"
286291
description:
287292
name: json_serializable
288-
sha256: ea1432d167339ea9b5bb153f0571d0039607a873d6e04e0117af043f14a1fd4b
293+
sha256: c2fcb3920cf2b6ae6845954186420fca40bc0a8abcc84903b7801f17d7050d7c
289294
url: "https://pub.dev"
290295
source: hosted
291-
version: "6.8.0"
296+
version: "6.9.0"
292297
logging:
293298
dependency: transitive
294299
description:
@@ -297,6 +302,14 @@ packages:
297302
url: "https://pub.dev"
298303
source: hosted
299304
version: "1.2.0"
305+
macros:
306+
dependency: transitive
307+
description:
308+
name: macros
309+
sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536"
310+
url: "https://pub.dev"
311+
source: hosted
312+
version: "0.1.2-main.4"
300313
matcher:
301314
dependency: transitive
302315
description:
@@ -309,10 +322,10 @@ packages:
309322
dependency: transitive
310323
description:
311324
name: meta
312-
sha256: "25dfcaf170a0190f47ca6355bdd4552cb8924b430512ff0cafb8db9bd41fe33b"
325+
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
313326
url: "https://pub.dev"
314327
source: hosted
315-
version: "1.14.0"
328+
version: "1.16.0"
316329
mime:
317330
dependency: transitive
318331
description:
@@ -356,10 +369,10 @@ packages:
356369
dependency: transitive
357370
description:
358371
name: path
359-
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
372+
sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
360373
url: "https://pub.dev"
361374
source: hosted
362-
version: "1.8.3"
375+
version: "1.9.1"
363376
pool:
364377
dependency: transitive
365378
description:
@@ -508,26 +521,26 @@ packages:
508521
dependency: "direct dev"
509522
description:
510523
name: test
511-
sha256: "713a8789d62f3233c46b4a90b174737b2c04cb6ae4500f2aa8b1be8f03f5e67f"
524+
sha256: "22eb7769bee38c7e032d532e8daa2e1cc901b799f603550a4db8f3a5f5173ea2"
512525
url: "https://pub.dev"
513526
source: hosted
514-
version: "1.25.8"
527+
version: "1.25.12"
515528
test_api:
516529
dependency: transitive
517530
description:
518531
name: test_api
519-
sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
532+
sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
520533
url: "https://pub.dev"
521534
source: hosted
522-
version: "0.7.3"
535+
version: "0.7.4"
523536
test_core:
524537
dependency: transitive
525538
description:
526539
name: test_core
527-
sha256: "12391302411737c176b0b5d6491f466b0dd56d4763e347b6714efbaa74d7953d"
540+
sha256: "84d17c3486c8dfdbe5e12a50c8ae176d15e2a771b96909a9442b40173649ccaa"
528541
url: "https://pub.dev"
529542
source: hosted
530-
version: "0.6.5"
543+
version: "0.6.8"
531544
timing:
532545
dependency: transitive
533546
description:

flutter_news_template/__brick__/{{project_name.snakeCase()}}/api/pubspec.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ environment:
99
dependencies:
1010
collection: ^1.16.0
1111
dart_frog: ^1.1.0
12-
equatable: ^2.0.5
12+
equatable: ^2.0.7
1313
http: ^1.2.2
1414
json_annotation: ^4.9.0
1515
news_blocks:
1616
path: packages/news_blocks
1717

1818
dev_dependencies:
1919
build_runner: ^2.4.9
20-
json_serializable: ^6.8.0
20+
json_serializable: ^6.9.0
2121
mocktail: ^1.0.4
22-
test: ^1.25.8
22+
test: ^1.25.12
2323
very_good_analysis: ^6.0.0
2424

2525
dependency_overrides:

flutter_news_template/__brick__/{{project_name.snakeCase()}}/lib/main/{{#flavors}}main_{{{name}}}.dart{{/flavors}}

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:ads_consent_client/ads_consent_client.dart';
22
import 'package:article_repository/article_repository.dart';
33
import 'package:deep_link_client/deep_link_client.dart';
44
import 'package:firebase_authentication_client/firebase_authentication_client.dart';
5+
import 'package:firebase_deep_link_client/firebase_deep_link_client.dart';
56
import 'package:firebase_notifications_client/firebase_notifications_client.dart';
67
import 'package:{{project_name.snakeCase()}}/app/app.dart';
78
import 'package:{{project_name.snakeCase()}}/main/bootstrap/bootstrap.dart';
@@ -43,8 +44,10 @@ void main() {
4344
packageVersion: packageVersion,
4445
);
4546

46-
final deepLinkClient = DeepLinkClient(
47-
firebaseDynamicLinks: firebaseDynamicLinks,
47+
final deepLinkService = DeepLinkService(
48+
deepLinkClient: FirebaseDeepLinkClient(
49+
firebaseDynamicLinks: firebaseDynamicLinks,
50+
),
4851
);
4952

5053
final userStorage = UserStorage(storage: persistentStorage);
@@ -61,7 +64,7 @@ void main() {
6164
apiClient: apiClient,
6265
authenticationClient: authenticationClient,
6366
packageInfoClient: packageInfoClient,
64-
deepLinkClient: deepLinkClient,
67+
deepLinkService: deepLinkService,
6568
storage: userStorage,
6669
);
6770

flutter_news_template/__brick__/{{project_name.snakeCase()}}/packages/app_ui/pubspec.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ dependencies:
99
flutter:
1010
sdk: flutter
1111
flutter_svg: ^2.0.5
12-
intl: ^0.19.0
13-
mockingjay: ^0.5.0
12+
intl: ^0.20.0
13+
mockingjay: ^0.6.0
1414

1515
dev_dependencies:
1616
build_runner: ^2.0.3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include: package:very_good_analysis/analysis_options.5.1.0.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export 'src/deep_link_client.dart';
2+
export 'src/deep_link_service.dart';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/// {@template deep_link_client}
2+
/// A generic DeepLinkClient interface.
3+
/// {@endtemplate}
4+
abstract class DeepLinkClient {
5+
/// Provides a stream of URIs intercepted by the app. Will emit the latest
6+
/// received value (if any) as first.
7+
Stream<Uri> get deepLinkStream;
8+
9+
/// Retrieves the initial deep link if present.
10+
Future<Uri?> getInitialLink();
11+
}

flutter_news_template/__brick__/{{project_name.snakeCase()}}/packages/deep_link_client/lib/src/deep_link_client.dart flutter_news_template/__brick__/{{project_name.snakeCase()}}/packages/deep_link_client/deep_link_client/lib/src/deep_link_service.dart

+14-16
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
import 'dart:async';
44

5+
import 'package:deep_link_client/deep_link_client.dart';
56
import 'package:equatable/equatable.dart';
6-
import 'package:firebase_dynamic_links/firebase_dynamic_links.dart';
7-
87
import 'package:rxdart/rxdart.dart';
98

109
/// {@template deep_link_client_failure}
@@ -21,21 +20,20 @@ class DeepLinkClientFailure with EquatableMixin implements Exception {
2120
List<Object> get props => [error];
2221
}
2322

24-
/// {@template deep_link_client}
25-
/// A client that exposes a stream of deep link URIs redirected to the app.
23+
/// {@template deep_link_service}
24+
/// A DeepLinkService that provides access to deep links intercepted by the app.
2625
/// {@endtemplate}
27-
class DeepLinkClient {
28-
/// {@macro deep_link_client}
29-
DeepLinkClient({FirebaseDynamicLinks? firebaseDynamicLinks})
30-
: _deepLinkSubject = BehaviorSubject<Uri>() {
31-
_firebaseDynamicLinks =
32-
firebaseDynamicLinks ?? FirebaseDynamicLinks.instance;
33-
26+
class DeepLinkService {
27+
/// {@macro deep_link_service}
28+
DeepLinkService({
29+
required DeepLinkClient deepLinkClient,
30+
}) : _deepLinkClient = deepLinkClient,
31+
_deepLinkSubject = BehaviorSubject<Uri>() {
3432
unawaited(_getInitialLink());
35-
_firebaseDynamicLinks.onLink.listen(_onAppLink).onError(_handleError);
33+
_deepLinkClient.deepLinkStream.listen(_onAppLink).onError(_handleError);
3634
}
3735

38-
late final FirebaseDynamicLinks _firebaseDynamicLinks;
36+
final DeepLinkClient _deepLinkClient;
3937
final BehaviorSubject<Uri> _deepLinkSubject;
4038

4139
/// Provides a stream of URIs intercepted by the app. Will emit the latest
@@ -44,7 +42,7 @@ class DeepLinkClient {
4442

4543
Future<void> _getInitialLink() async {
4644
try {
47-
final deepLink = await _firebaseDynamicLinks.getInitialLink();
45+
final deepLink = await _deepLinkClient.getInitialLink();
4846
if (deepLink != null) {
4947
_onAppLink(deepLink);
5048
}
@@ -53,8 +51,8 @@ class DeepLinkClient {
5351
}
5452
}
5553

56-
void _onAppLink(PendingDynamicLinkData dynamicLinkData) {
57-
_deepLinkSubject.add(dynamicLinkData.link);
54+
void _onAppLink(Uri deepLink) {
55+
_deepLinkSubject.add(deepLink);
5856
}
5957

6058
void _handleError(Object error, StackTrace stackTrace) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: deep_link_client
2+
description: A deep link client interface
3+
publish_to: none
4+
5+
environment:
6+
sdk: ">=3.0.0 <4.0.0"
7+
8+
dependencies:
9+
equatable: ^2.0.5
10+
rxdart: ^0.27.5
11+
12+
dev_dependencies:
13+
mocktail: ^1.0.4
14+
test: ^1.25.8
15+
very_good_analysis: ^6.0.0

0 commit comments

Comments
 (0)