Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into dependabot/pub/flutte…
Browse files Browse the repository at this point in the history
…r_news_example/packages/news_blocks_ui/google_mobile_ads-5.0.0
  • Loading branch information
matiasleyba committed May 6, 2024
2 parents 0a4942c + 9299699 commit 77a5d94
Show file tree
Hide file tree
Showing 71 changed files with 3,099 additions and 3,778 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
run: npm run build

- name: ☁️ Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/flutter_news_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,15 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: subosito/flutter-action@v2.13.0
- uses: subosito/flutter-action@v2.16.0
with:
channel: ${{matrix.channel}}
flutter-version: "3.10.2"
flutter-version: "3.13.9"
cache: false

- name: Install Dependencies
run: |
flutter pub global activate very_good_cli
very_good --analytics false
very_good packages get --recursive
- name: Format
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate_flutter_news_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
run: git stash pop

- name: Create Pull Request With Required Changes
uses: peter-evans/[email protected].2
uses: peter-evans/[email protected].5
with:
branch: chore/generate-flutter-news-template
commit-message: "chore: generate flutter_news_template"
Expand Down
6,132 changes: 2,518 additions & 3,614 deletions docs/package-lock.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint ."
},
"dependencies": {
"@docusaurus/core": "3.1.1",
"@docusaurus/preset-classic": "3.1.1",
"@docusaurus/core": "3.3.2",
"@docusaurus/preset-classic": "3.3.2",
"@mdx-js/react": "^3.0.1",
"clsx": "^2.1.0",
"clsx": "^2.1.1",
"prism-react-renderer": "^2.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@babel/eslint-parser": "^7.23.10",
"@docusaurus/eslint-plugin": "^3.1.1",
"@docusaurus/module-type-aliases": "3.1.1",
"@tsconfig/docusaurus": "^2.0.2",
"@babel/eslint-parser": "^7.24.5",
"@docusaurus/eslint-plugin": "^3.3.2",
"@docusaurus/module-type-aliases": "3.3.2",
"@tsconfig/docusaurus": "^2.0.3",
"eslint": "^8.57.0",
"prettier": "^3.2.4",
"typescript": "^5.4.2"
"typescript": "^5.4.5"
},
"browserslist": {
"production": [
Expand Down
10 changes: 5 additions & 5 deletions flutter_news_example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 33
compileSdkVersion 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
}

sourceSets {
Expand All @@ -54,7 +54,7 @@ android {

defaultConfig {
applicationId "com.flutter.news.example"
minSdkVersion 23
minSdkVersion 24
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
1 change: 1 addition & 0 deletions flutter_news_example/api/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ include: package:very_good_analysis/analysis_options.5.1.0.yaml
analyzer:
exclude:
- build/**
- lib/**/*.g.dart
linter:
rules:
file_names: false
6 changes: 3 additions & 3 deletions flutter_news_example/api/lib/src/data/static_news_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ final popularArticles = <NewsItem>[
url: Uri.parse(
'https://nbc-2.com/news/2022/05/19/boeing-makes-third-attempt-to-launch-its-starliner-capsule-to-the-iss',
),
)
),
];

/// List of relevant search articles.
Expand Down Expand Up @@ -116,7 +116,7 @@ final relevantArticles = <NewsItem>[
url: Uri.parse(
'https://www.cnn.com/2022/05/24/health/what-is-monkeypox-virus-explainer-update-wellness',
),
)
),
];

/// Technology news items.
Expand Down Expand Up @@ -1232,7 +1232,7 @@ final scienceVideoItems = <NewsItem>[
url: Uri.parse(
'https://www.cbsnews.com/news/black-hole-audio-perseus-galaxy-cluster',
),
)
),
];

/// Top news feed blocks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ enum BlockActionType {
unknown
}

/// {@macro block_action}
/// {@template block_action}
/// A class which represents an action that can occur
/// when interacting with a block.
/// {@endtemplate}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void main() {

const actions = <BlockAction>[
NavigateToArticleAction(articleId: 'articleId'),
NavigateToFeedCategoryAction(category: Category.top)
NavigateToFeedCategoryAction(category: Category.top),
];

for (final action in actions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void main() {
publishedAt: DateTime(2022, 3, 12),
imageUrl: 'imageUrl',
title: 'title',
)
),
],
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void main() {
publishedAt: DateTime(2022, 3, 12),
imageUrl: 'imageUrl',
title: 'title',
)
),
],
);

Expand Down
20 changes: 10 additions & 10 deletions flutter_news_example/api/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ packages:
dependency: "direct dev"
description:
name: build_runner
sha256: "581bacf68f89ec8792f5e5a0b2c4decd1c948e97ce659dc783688c8a88fbec21"
sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22"
url: "https://pub.dev"
source: hosted
version: "2.4.8"
version: "2.4.9"
build_runner_core:
dependency: transitive
description:
Expand Down Expand Up @@ -309,10 +309,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
sha256: "25dfcaf170a0190f47ca6355bdd4552cb8924b430512ff0cafb8db9bd41fe33b"
url: "https://pub.dev"
source: hosted
version: "1.10.0"
version: "1.14.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -508,26 +508,26 @@ packages:
dependency: "direct dev"
description:
name: test
sha256: "7ee446762c2c50b3bd4ea96fe13ffac69919352bd3b4b17bac3f3465edc58073"
sha256: d72b538180efcf8413cd2e4e6fcc7ae99c7712e0909eb9223f9da6e6d0ef715f
url: "https://pub.dev"
source: hosted
version: "1.25.2"
version: "1.25.4"
test_api:
dependency: transitive
description:
name: test_api
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
sha256: "2419f20b0c8677b2d67c8ac4d1ac7372d862dc6c460cdbb052b40155408cd794"
url: "https://pub.dev"
source: hosted
version: "0.7.0"
version: "0.7.1"
test_core:
dependency: transitive
description:
name: test_core
sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4"
sha256: "4d070a6bc36c1c4e89f20d353bfd71dc30cdf2bd0e14349090af360a029ab292"
url: "https://pub.dev"
source: hosted
version: "0.6.0"
version: "0.6.2"
timing:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions flutter_news_example/api/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ dependencies:
path: packages/news_blocks

dev_dependencies:
build_runner: ^2.4.8
build_runner: ^2.4.9
json_serializable: ^6.7.1
mocktail: ^1.0.2
test: ^1.25.2
test: ^1.25.4
very_good_analysis: ^5.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ void main() {
name: SubscriptionPlan.premium,
cost: SubscriptionCost(annual: 4200, monthly: 42),
benefits: ['benefit'],
)
),
],
);
when(() => httpClient.get(any())).thenAnswer(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
import 'package:dart_frog/dart_frog.dart';
import 'package:flutter_news_example_api/api.dart';
import 'package:mocktail/mocktail.dart';
import 'package:test/test.dart';

class _MockRequestContext extends Mock implements RequestContext {}
import 'test_request_context.dart';

void main() {
group('newsDataSourceProvider', () {
test('provides a NewsDataSource instance', () async {
NewsDataSource? value;
final context = _MockRequestContext();
final context = TestRequestContext(
path: 'http://localhost/',
);

final handler = newsDataSourceProvider()(
(_) {
value = context.read<NewsDataSource>();
return Response(body: '');
},
);
final request = Request.get(Uri.parse('http://localhost/'));
when(() => context.request).thenReturn(request);

when(() => context.read<NewsDataSource>())
.thenReturn(InMemoryNewsDataSource());

when(() => context.provide<NewsDataSource>(any())).thenReturn(context);
when(() => context.provide<RequestUser>(any())).thenReturn(context);
context.mockProvide<NewsDataSource>(InMemoryNewsDataSource());

await handler(context);
expect(value, isNotNull);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Taken from https://github.com/VeryGoodOpenSource/dart_frog/issues/1101

import 'package:dart_frog/dart_frog.dart';

class TestRequestContext implements RequestContext {
TestRequestContext({
this.path = '/',
this.method = HttpMethod.get,
this.headers,
});

String path;
HttpMethod method;
Map<String, String>? headers;

final Map<String, dynamic> _dependencies = {};

@override
RequestContext provide<T extends Object?>(T Function() create) {
final dependency = create();
_dependencies[dependency.runtimeType.toString()] = dependency;
return this;
}

void mockProvide<T>(T dependency) => _dependencies[T.toString()] = dependency;

@override
T read<T>() {
final dependency = _dependencies[T.toString()];
if (dependency is! T) {
throw Error();
}
return dependency;
}

@override
Request get request => Request(
method.name.toUpperCase(),
Uri.parse(path),
headers: headers,
);

@override
Map<String, String> get mountedParams => {};
}
Loading

0 comments on commit 77a5d94

Please sign in to comment.