Skip to content

Commit

Permalink
feat: migrate news to hashnode (#1291)
Browse files Browse the repository at this point in the history
* chore: install graphql packages

* feat: basic news API service

* feat: fetch posts from hashnode

* feat: paginated news feed

* feat: post view

* feat: author view and author feed view

* feat: tags feed view

* chore: remove log statements

* chore: temp disable search post feed view

* chore: update radio articles IDs

* fix: update breaking tests

* fix: add error widget when 404 on CDN side

* fix: put blockquoutes through separate parser

* fix: add error widget when 404 on CDN side (author page)

* chore: update pod lockfile

* chore: future work comments

* fix: ci/cd hashnode env key

---------

Co-authored-by: sembauke <[email protected]>
  • Loading branch information
Nirajn2311 and Sembauke authored Sep 7, 2024
1 parent cfe8ace commit 7489e1e
Show file tree
Hide file tree
Showing 30 changed files with 795 additions and 468 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/flutter-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,13 @@ jobs:

- name: Create .env file
run: |
echo "NEWSURL=https://www.freecodecamp.org/news/ghost/api/v3/content/" > .env
echo "NEWSKEY=$GHOST_NEWSKEY" >> .env
echo "HASHNODE_PUBLICATION_ID=$HASHNODE_PUBLICATION_ID" > .env
echo "ALGOLIAAPPID=$ALGOLIA_APP_ID" >> .env
echo "ALGOLIAKEY=$ALGOLIA_KEY" >> .env
echo "AUTH0_DOMAIN=$AUTH0_DOMAIN" >> .env
echo "AUTH0_CLIENT_ID=$AUTH0_CLIENT_ID" >> .env
env:
GHOST_NEWSKEY: ${{ secrets.GHOST_NEWSKEY }}
HASHNODE_PUBLICATION_ID: ${{ secrets.HASHNODE_PUBLICATION_ID }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_KEY: ${{ secrets.ALGOLIA_KEY }}
AUTH0_DOMAIN: ${{ secrets.AUTH0_DOMAIN }}
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/flutter-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,13 @@ jobs:

- name: Create .env file
run: |
echo "NEWSURL=https://www.freecodecamp.org/news/ghost/api/v3/content/" > .env
echo "NEWSKEY=$GHOST_NEWSKEY" >> .env
echo "HASHNODE_PUBLICATION_ID=$HASHNODE_PUBLICATION_ID" > .env
echo "ALGOLIAAPPID=$ALGOLIA_APP_ID" >> .env
echo "ALGOLIAKEY=$ALGOLIA_KEY" >> .env
echo "AUTH0_DOMAIN=$AUTH0_DOMAIN" >> .env
echo "AUTH0_CLIENT_ID=$AUTH0_CLIENT_ID" >> .env
env:
GHOST_NEWSKEY: ${{ secrets.GHOST_NEWSKEY }}
HASHNODE_PUBLICATION_ID: ${{ secrets.HASHNODE_PUBLICATION_ID }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_KEY: ${{ secrets.ALGOLIA_KEY }}
AUTH0_DOMAIN: ${{ secrets.AUTH0_DOMAIN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mobile-curriculum-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
run: |
cd mobile/mobile-app
echo "DEVELOPMENTMODE=true" > .env
echo "NEWSURL=https://www.freecodecamp.org/news/ghost/api/v3/content/" >> .env
echo "HASHNODE_PUBLICATION_ID=$HASHNODE_PUBLICATION_ID" > .env
flutter pub get
flutter test test/widget_test.dart
Expand Down
6 changes: 2 additions & 4 deletions codemagic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ workflows:
scripts:
- name: Create .env file
script: |
echo "NEWSURL=$NEWSURL" > .env
echo "NEWSKEY=$NEWSKEY" >> .env
echo "HASHNODE_PUBLICATION_ID=$HASHNODE_PUBLICATION_ID" > .env
echo "ALGOLIAAPPID=$ALGOLIAAPPID" >> .env
echo "ALGOLIAKEY=$ALGOLIAKEY" >> .env
echo "AUTH0_DOMAIN=$AUTH0_DOMAIN" >> .env
Expand Down Expand Up @@ -109,8 +108,7 @@ workflows:
scripts:
- name: Create .env file
script: |
echo "NEWSURL=$NEWSURL" > .env
echo "NEWSKEY=$NEWSKEY" >> .env
echo "HASHNODE_PUBLICATION_ID=$HASHNODE_PUBLICATION_ID" > .env
echo "ALGOLIAAPPID=$ALGOLIAAPPID" >> .env
echo "ALGOLIAKEY=$ALGOLIAKEY" >> .env
echo "AUTH0_DOMAIN=$AUTH0_DOMAIN" >> .env
Expand Down
10 changes: 7 additions & 3 deletions mobile-app/integration_test/news/bookmark_test.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:freecodecamp/main.dart' as app;
import 'package:freecodecamp/ui/views/news/news-feed/news_feed_viewmodel.dart';
import 'package:freecodecamp/ui/views/news/news-tutorial/news_tutorial_view.dart';
import 'package:integration_test/integration_test.dart';
import 'package:path/path.dart' as path;
Expand Down Expand Up @@ -29,15 +28,20 @@ void main() {
await binding.takeScreenshot('news/news-feed');

// Tap on the first tutorial
final Finder firstTutorial = find.byType(NewsFeedLazyLoading).first;
final Finder firstTutorial = find
.descendant(
of: find.byKey(const Key('news-tutorial-0')),
matching: find.byType(InkWell),
)
.first;
final Finder firstTutorialImage = find
.descendant(
of: firstTutorial,
matching: find.byType(AspectRatio),
)
.first;
final ValueKey firstTutorialKey =
tester.firstWidget<NewsFeedLazyLoading>(firstTutorial).key! as ValueKey;
tester.firstWidget<InkWell>(firstTutorial).key! as ValueKey;

expect(firstTutorial, findsOneWidget);
expect(firstTutorialImage, findsOneWidget);
Expand Down
10 changes: 10 additions & 0 deletions mobile-app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ PODS:
- Flutter
- JWTDecode (= 3.0.1)
- SimpleKeychain (= 1.0.1)
- connectivity_plus (0.0.1):
- Flutter
- ReachabilitySwift
- device_info_plus (0.0.1):
- Flutter
- Firebase/Analytics (10.24.0):
Expand Down Expand Up @@ -188,6 +191,7 @@ PODS:
- PromisesObjC (= 2.4.0)
- quick_actions_ios (0.0.1):
- Flutter
- ReachabilitySwift (5.2.3)
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
Expand All @@ -208,6 +212,7 @@ DEPENDENCIES:
- audio_service (from `.symlinks/plugins/audio_service/ios`)
- audio_session (from `.symlinks/plugins/audio_session/ios`)
- auth0_flutter (from `.symlinks/plugins/auth0_flutter/ios`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
Expand Down Expand Up @@ -253,6 +258,7 @@ SPEC REPOS:
- OrderedSet
- PromisesObjC
- PromisesSwift
- ReachabilitySwift
- SimpleKeychain

EXTERNAL SOURCES:
Expand All @@ -262,6 +268,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/audio_session/ios"
auth0_flutter:
:path: ".symlinks/plugins/auth0_flutter/ios"
connectivity_plus:
:path: ".symlinks/plugins/connectivity_plus/ios"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
firebase_analytics:
Expand Down Expand Up @@ -310,6 +318,7 @@ SPEC CHECKSUMS:
audio_session: 088d2483ebd1dc43f51d253d4a1c517d9a2e7207
Auth0: 64da28fdc5cd499aa516dc4bfd0ace8efae2c1da
auth0_flutter: cc9689234a67336292f576a070da32ab7dffe42a
connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
Firebase: 91fefd38712feb9186ea8996af6cbdef41473442
firebase_analytics: 573fd0677abf22d32e2820865fc5190b6cdbfa1b
Expand Down Expand Up @@ -345,6 +354,7 @@ SPEC CHECKSUMS:
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
quick_actions_ios: d24571db7345d2e48d094db8d077a015a568002d
ReachabilitySwift: 7f151ff156cea1481a8411701195ac6a984f4979
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
SimpleKeychain: 130211269f88f038d7dc5254cf0b1b9ce978c398
Expand Down
2 changes: 2 additions & 0 deletions mobile-app/lib/app/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:freecodecamp/service/podcast/download_service.dart';
import 'package:freecodecamp/service/podcast/notification_service.dart';
import 'package:freecodecamp/service/podcast/podcasts_service.dart';
import 'package:freecodecamp/service/dio_service.dart';
import 'package:freecodecamp/service/news/api_service.dart';

import 'package:freecodecamp/ui/views/code_radio/code_radio_view.dart';
import 'package:freecodecamp/ui/views/learn/challenge/challenge_view.dart';
Expand Down Expand Up @@ -75,6 +76,7 @@ import 'package:stacked_services/stacked_services.dart';
LazySingleton(classType: BookmarksDatabaseService),
LazySingleton(classType: LocaleService),
LazySingleton(classType: DioService),
LazySingleton(classType: NewsApiServive),
],
logger: StackedLogger(),
)
Expand Down
2 changes: 2 additions & 0 deletions mobile-app/lib/app/app.locator.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 19 additions & 19 deletions mobile-app/lib/app/app.router.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions mobile-app/lib/constants/radio_articles.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
List<String> radioArticles = [
'622c7bf563ded806bb9e8a20',
'5f9ca12d740569d1a4ca4d23',
'5f9ca15f740569d1a4ca4e36',
'5f9ca198740569d1a4ca4f89',
'5f9ca587740569d1a4ca6a0b',
'5f9ca99d740569d1a4ca85c3',
'5f9cafb9740569d1a4caaf5b'
'66bb9216add24ba427325101',
'66b90438941d2f900bad52b1',
'66b8d2d40c9c1d363b7c4213',
'66b8d5cfd482a18d3e02825a',
'66b8d2d957c651c38343a959',
'66b8d2d7064c610cf26d29ae',
'66b8d46af8e5d39507c4c100',
];
2 changes: 2 additions & 0 deletions mobile-app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:freecodecamp/service/firebase/analytics_service.dart';
import 'package:freecodecamp/service/firebase/remote_config_service.dart';
import 'package:freecodecamp/service/locale_service.dart';
import 'package:freecodecamp/service/navigation/quick_actions_service.dart';
import 'package:freecodecamp/service/news/api_service.dart';
import 'package:freecodecamp/service/podcast/notification_service.dart';
import 'package:freecodecamp/ui/theme/fcc_theme.dart';
import 'package:freecodecamp/utils/upgrade_controller.dart';
Expand All @@ -31,6 +32,7 @@ Future<void> main({bool testing = false}) async {
await DioService().init();
await AppAudioService().init();
await AuthenticationService().init();
await NewsApiServive().init();
var fbApp = await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
Expand Down
1 change: 1 addition & 0 deletions mobile-app/lib/models/learn/challenge_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Challenge {
final List<ChallengeFile> files;

// Challenge Type 11 - Video
// TODO: Renamed to questions and its an array of questions
Question? question;

// Challenge Type 15 - Odin
Expand Down
Loading

0 comments on commit 7489e1e

Please sign in to comment.