Skip to content

Commit f0503b0

Browse files
authored
Merge pull request #62 from flutter-news-app-full-source-code/refactor_rename_package
Refactor rename package
2 parents c8621dc + 2389a64 commit f0503b0

File tree

75 files changed

+831
-810
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+831
-810
lines changed

.github/dependabot.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,16 @@ updates:
99
schedule:
1010
interval: "daily"
1111
ignore:
12-
- dependency-name: "ht_*"
12+
- dependency-name: "auth_api"
13+
- dependency-name: "auth_client"
14+
- dependency-name: "auth_inmemory"
15+
- dependency-name: "auth_repository"
16+
- dependency-name: "data_api"
17+
- dependency-name: "data_client"
18+
- dependency-name: "data_inmemory"
19+
- dependency-name: "data_repository"
20+
- dependency-name: "http_client"
21+
- dependency-name: "kv_storage_service"
22+
- dependency-name: "kv_storage_shared_preferences"
23+
- dependency-name: "core"
24+
- dependency-name: "ui_kit"

.github/workflows/deploy.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: deploy
1+
name: cd
22

33
# Run this workflow when a new release is published
44
on:
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
# 1. Checkout the repository code
1313
- name: Checkout
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515

1616
# 2. Setup Flutter SDK
1717
- name: Setup Flutter
@@ -25,11 +25,11 @@ jobs:
2525

2626
# 4. Build the Flutter web app
2727
- name: Build Web App
28-
run: flutter build web --release --base-href /ht-main/
28+
run: flutter build web --release --base-href /flutter-news-app-mobile-client-full-source-code/
2929

3030
# 5. Deploy the built app to GitHub Pages
3131
- name: Deploy
32-
uses: peaceiris/actions-gh-pages@v3
32+
uses: peaceiris/actions-gh-pages@v4
3333
with:
3434
github_token: ${{ secrets.GITHUB_TOKEN }}
3535
publish_dir: ./build/web

.github/workflows/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: ht_main
1+
name: ci
22

33
concurrency:
44
group: $-$

README.md

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,106 @@
1-
# 📱✨ ht_main
1+
# The Complete Flutter News App - Full Source Code
22

33
![coverage: percentage](https://img.shields.io/badge/coverage-XX-green)
4-
[![Demo: Live](https://img.shields.io/badge/Demo-Live-orange)](https://headlines-toolkit.github.io/ht-main/)
4+
[![Demo: Live](https://img.shields.io/badge/Demo-Live-orange)](https://flutter-news-app-full-source-code.github.io/flutter-news-app-mobile-client-full-source-code/)
55
[![style: very good analysis](https://img.shields.io/badge/style-very_good_analysis-B22C89.svg)](https://pub.dev/packages/very_good_analysis)
66
[![License: PolyForm Free Trial](https://img.shields.io/badge/License-PolyForm%20Free%20Trial-blue)](https://polyformproject.org/licenses/free-trial/1.0.0)
77

8-
`ht_main` is a flutter mobile application that serves as both a powerful, fully functional news application ready for deployment, and an exceptionally robust starter kit, architected for easy extension and customization. It is a key component of the [Headlines Toolkit](https://github.com/headlines-toolkit), an ecosystem that also includes a [Dart Frog backend API](https://github.com/headlines-toolkit/ht-api) and a [web-based content dashboard](https://github.com/headlines-toolkit/ht-dashboard).
8+
This is a complete and fully-functional Flutter news application. It gives you everything you need to launch your own news app on the App Store and Google Play, right out of the box. It is a key component of the [**Flutter News App - Full Source Code Toolkit**](https://github.com/flutter-news-app-full-source-code), an ecosystem that also includes a [Dart Frog backend API](https://github.com/flutter-news-app-full-source-code/flutter-news-app-api-server-full-source-code) and a [web-based content dashboard](https://github.com/flutter-news-app-full-source-code/flutter-news-app-web-dashboard-full-source-code).
99

10-
## Features & Benefits
10+
## Everything You Get, Ready to Go
1111

12-
`ht_main` comes packed with features to accelerate your development and delight your users:
12+
This app comes packed with all the features you need to launch a professional news application.
1313

1414
#### 📰 **Dynamic & Engaging Headlines Feed**
15-
Experience a beautifully crafted, infinitely scrolling news feed. It's highly performant and ready for your content.
16-
* **Benefit for you:** Save months of UI/UX development and complex state management. Get a production-quality feed system instantly! ⏱️
15+
* Display news in a beautiful, performant, infinitely scrolling feed.
16+
* Strategically display in-feed messages to drive user actions. Show calls-to-action like 'Create an Account' to anonymous users or 'Upgrade to Premium' to authenticated users, all based on configurable rules.
17+
> **Your Advantage:** You get a production-quality feed system instantly. Skip the months of complex UI work and state management. ⏱️
1718
1819
#### 🔍 **Advanced Content Filtering & Search**
19-
Empower users with intuitive filtering for headlines by categories, sources, and countries. A dedicated search page helps users find exactly what they're looking for.
20-
* **Benefit for you:** Offer powerful content discovery tools that significantly enhance user engagement and satisfaction. 🎯
20+
* Let users filter headlines by categories, sources, and countries.
21+
* Includes a dedicated search page to help users find specific content quickly.
22+
> **Your Advantage:** Give your users powerful content discovery tools that keep them engaged and coming back for more. 🎯
2123
2224
#### 🔐 **Robust User Authentication**
2325
Secure and flexible authentication flows are built-in:
2426
* 📧 **Email + Code (Passwordless) Sign-In:** Modern and secure.
2527
* 👤 **Anonymous Sign-In:** Allow users to explore before committing.
2628
* 🔗 **Account Linking:** Seamlessly convert anonymous users to registered accounts, preserving all their personalized settings, content preferences, and saved headlines.
27-
* **Benefit for you:** Complex security and user management handled, including data migration during account linking, letting you focus on features. ✅
29+
> **Your Advantage:** All the complex security and user management is already done for you, including data migration when users link their accounts. ✅
2830
2931
#### 🧑‍🎨 **Personalized User Accounts & Preferences**
3032
Users can tailor their experience:
3133
* **Content Preferences:** Follow/unfollow categories, sources, and countries.
3234
* **Saved Headlines:** Bookmark articles for easy access later.
33-
* **Benefit for you:** A strong foundation for personalization, driving user retention and creating a sticky app experience. ❤️
35+
> **Your Advantage:** Built-in personalization features that drive user retention and create a sticky app experience. ❤️
3436
3537
#### ⚙️ **Customizable App Settings**
3638
Offer users control over their app experience:
3739
* **Appearance:** Light/Dark/System themes, accent colors (via FlexColorScheme), font choices, and text scaling.
3840
* **Feed Display:** Customize how headlines are presented.
39-
* **Benefit for you:** Provide a premium, adaptable user experience that caters to individual needs. 🔧
41+
> **Your Advantage:** Deliver a premium, adaptable user experience that caters to individual needs without writing any code. 🔧
4042
4143
#### 📱 **Adaptive UI for All Screens**
42-
Built with `flutter_adaptive_scaffold`, `ht_main` offers responsive navigation and layouts that look great on both phones and tablets.
43-
* **Benefit for you:** Deliver a consistent and optimized UX across a wide range of devices effortlessly. ↔️
44+
Built with `flutter_adaptive_scaffold`, the app offers responsive navigation and layouts that look great on both phones and tablets.
45+
> **Your Advantage:** Deliver a consistent and optimized UX across a wide range of devices effortlessly. ↔️
4446
4547
#### 🏗️ **Clean & Modern Architecture**
4648
Developed with best practices for a maintainable and scalable codebase:
4749
* **Flutter & Dart:** Cutting-edge mobile development.
4850
* **BLoC Pattern:** Predictable and robust state management.
4951
* **GoRouter:** Well-structured and powerful navigation.
50-
* **Benefit for you:** An easy-to-understand, extendable, and testable foundation for your project. 📈
52+
> **Your Advantage:** The app is built on a clean, modern architecture that's easy to understand and maintain. It's solid and built to last. 📈
5153
5254
#### ⚙️ **Flexible Environment Configuration**
5355
Easily switch between development (in-memory data or local API) and production environments with a simple code change. This empowers rapid prototyping, robust testing, and seamless deployment.
54-
* **Benefit for you:** Accelerate your development cycle and ensure your app is always ready for any deployment scenario. 🚀
56+
> **Your Advantage:** A flexible setup that speeds up your development cycle and makes deployment simple. 🚀
5557
5658
#### 🌍 **Localization Ready**
5759
Fully internationalized with working English and Arabic localizations (`.arb` files). Adding more languages is straightforward.
58-
* **Benefit for you:** Easily adapt your application for a global audience. 🌐
60+
> **Your Advantage:** Easily adapt your application for a global audience and tap into new markets. 🌐
5961
6062
---
6163

62-
## 🔑 Access and Licensing
64+
## 🔑 Licensing
6365

64-
`ht-main` is source-available as part of the Headlines Toolkit ecosystem.
66+
This app is source-available and licensed under the [PolyForm Free Trial 1.0.0](LICENSE). This lets you try out the full source code before you buy.
67+
68+
For a commercial license to build and distribute your app, please visit the main [**Flutter News App - Full Source Code Toolkit**](https://github.com/flutter-news-app-full-source-code) organization.
6569

66-
To acquire a commercial license for building unlimited news applications, please visit
67-
the [Headlines Toolkit GitHub organization page](https://github.com/headlines-toolkit)
68-
for more details.
6970

7071
---
7172

72-
## 🚀 Getting Started
73+
## 🚀 Getting Started & Running Locally
7374

7475
1. **Ensure Flutter is installed.** (See [Flutter documentation](https://flutter.dev/docs/get-started/install))
7576
2. **Clone the repository:**
7677
```bash
77-
git clone https://github.com/headlines-toolkit/ht-main.git
78-
cd ht-main
78+
git clone https://github.com/flutter-news-app-full-source-code/flutter-news-app-mobile-client-full-source-code.git
79+
cd flutter-news-app-mobile-client-full-source-code
7980
```
8081
3. **Get dependencies:**
8182
```bash
8283
flutter pub get
8384
```
8485
4. **Run the app:**
85-
```bash
86-
flutter run
87-
```
88-
*(Note: For full functionality, ensure the `ht-api` backend service is running and accessible.)*
86+
87+
### Running the App
88+
89+
To run the app, first select your desired environment in `lib/main.dart`:
90+
91+
```dart
92+
// lib/main.dart
93+
94+
// Use `AppEnvironment.demo` to run with in-memory data (no API needed).
95+
// Use `AppEnvironment.development` to connect to a local backend API.
96+
const appEnvironment = AppEnvironment.demo;
97+
```
98+
99+
Then, run the app from your terminal:
100+
```bash
101+
flutter run
102+
```
103+
*(Note: For `development` environment, ensure the [backend service](https://github.com/flutter-news-app-full-source-code/flutter-news-app-api-server-full-source-code) is running.)*
89104

90105
---
91106

@@ -96,4 +111,3 @@ This project aims for high test coverage to ensure quality and reliability.
96111
* Run tests with:
97112
```bash
98113
flutter test
99-
```

android/app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
}
1010

1111
android {
12-
namespace = "com.example.ht_main"
12+
namespace = "com.example.flutter_news_app_mobile_client_full_source_code"
1313
compileSdk = flutter.compileSdkVersion
1414
ndkVersion = "29.0.13113456"
1515

@@ -24,7 +24,7 @@ android {
2424

2525
defaultConfig {
2626
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
27-
applicationId = "com.example.ht_main"
27+
applicationId = "com.example.flutter_news_app_mobile_client_full_source_code"
2828
// You can update the following values to match your application needs.
2929
// For more information, see: https://flutter.dev/to/review-gradle-config.
3030
minSdk = 24

android/app/google-services.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"project_info": {
33
"project_number": "420644261437",
4-
"project_id": "headlines-toolkit",
5-
"storage_bucket": "headlines-toolkit.firebasestorage.app"
4+
"project_id": "flutter-news-app-full-source-code",
5+
"storage_bucket": "flutter-news-app-full-source-code.firebasestorage.app"
66
},
77
"client": [
88
{
99
"client_info": {
1010
"mobilesdk_app_id": "1:420644261437:android:3fa3052f883bf86958a454",
1111
"android_client_info": {
12-
"package_name": "com.example.ht_main"
12+
"package_name": "com.example.flutter_news_app_mobile_client_full_source_code"
1313
}
1414
},
1515
"oauth_client": [],

android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
22
<application
3-
android:label="ht_main"
3+
android:label="flutter_news_app_mobile_client_full_source_code"
44
android:name="${applicationName}"
55
android:icon="@mipmap/launcher_icon">
66
<activity
@@ -30,7 +30,7 @@
3030
<category android:name="android.intent.category.DEFAULT"/>
3131
<category android:name="android.intent.category.BROWSABLE"/>
3232
<!-- Accepts URIs that begin with your dynamic link domain -->
33-
<data android:scheme="https" android:host="htmain.page.link" />
33+
<data android:scheme="https" android:host="flutter-news-app-full-source-code.page.link" />
3434
</intent-filter>
3535
</activity>
3636
<!-- Don't delete the meta-data below.

android/app/src/main/kotlin/com/example/ht_main/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example.ht_main
1+
package com.example.flutter_news_app_mobile_client_full_source_code
22

33
import io.flutter.embedding.android.FlutterActivity
44

lib/account/bloc/account_bloc.dart

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
import 'dart:async';
22

3+
import 'package:auth_repository/auth_repository.dart';
34
import 'package:bloc/bloc.dart';
5+
import 'package:core/core.dart';
6+
import 'package:data_repository/data_repository.dart';
47
import 'package:equatable/equatable.dart';
5-
import 'package:ht_auth_repository/ht_auth_repository.dart';
6-
import 'package:ht_data_repository/ht_data_repository.dart';
7-
import 'package:ht_main/app/config/config.dart' as local_config;
8-
import 'package:ht_shared/ht_shared.dart';
8+
import 'package:flutter_news_app_mobile_client_full_source_code/app/config/config.dart'
9+
as local_config;
910
import 'package:logging/logging.dart';
1011

1112
part 'account_event.dart';
1213
part 'account_state.dart';
1314

1415
class AccountBloc extends Bloc<AccountEvent, AccountState> {
1516
AccountBloc({
16-
required HtAuthRepository authenticationRepository,
17-
required HtDataRepository<UserContentPreferences>
17+
required AuthRepository authenticationRepository,
18+
required DataRepository<UserContentPreferences>
1819
userContentPreferencesRepository,
1920
required local_config.AppEnvironment environment,
2021
Logger? logger,
@@ -23,7 +24,7 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
2324
_environment = environment,
2425
_logger = logger ?? Logger('AccountBloc'),
2526
super(const AccountState()) {
26-
// Listen to user changes from HtAuthRepository
27+
// Listen to user changes from AuthRepository
2728
_userSubscription = _authenticationRepository.authStateChanges.listen((
2829
user,
2930
) {
@@ -39,8 +40,8 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
3940
on<AccountClearUserPreferences>(_onAccountClearUserPreferences);
4041
}
4142

42-
final HtAuthRepository _authenticationRepository;
43-
final HtDataRepository<UserContentPreferences>
43+
final AuthRepository _authenticationRepository;
44+
final DataRepository<UserContentPreferences>
4445
_userContentPreferencesRepository;
4546
final local_config.AppEnvironment _environment;
4647
final Logger _logger;
@@ -149,9 +150,9 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
149150
clearError: true,
150151
),
151152
);
152-
} on HtHttpException catch (e) {
153+
} on HttpException catch (e) {
153154
_logger.severe(
154-
'Failed to create default preferences with HtHttpException: $e',
155+
'Failed to create default preferences with HttpException: $e',
155156
);
156157
emit(state.copyWith(status: AccountStatus.failure, error: e));
157158
} catch (e, st) {
@@ -169,9 +170,9 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
169170
),
170171
);
171172
}
172-
} on HtHttpException catch (e) {
173+
} on HttpException catch (e) {
173174
_logger.severe(
174-
'AccountLoadUserPreferences failed with HtHttpException: $e',
175+
'AccountLoadUserPreferences failed with HttpException: $e',
175176
);
176177
emit(state.copyWith(status: AccountStatus.failure, error: e));
177178
} catch (e, st) {
@@ -227,9 +228,9 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
227228
clearError: true,
228229
),
229230
);
230-
} on HtHttpException catch (e) {
231+
} on HttpException catch (e) {
231232
_logger.severe(
232-
'AccountSaveHeadlineToggled failed with HtHttpException: $e',
233+
'AccountSaveHeadlineToggled failed with HttpException: $e',
233234
);
234235
emit(state.copyWith(status: AccountStatus.failure, error: e));
235236
} catch (e, st) {
@@ -284,10 +285,8 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
284285
clearError: true,
285286
),
286287
);
287-
} on HtHttpException catch (e) {
288-
_logger.severe(
289-
'AccountFollowTopicToggled failed with HtHttpException: $e',
290-
);
288+
} on HttpException catch (e) {
289+
_logger.severe('AccountFollowTopicToggled failed with HttpException: $e');
291290
emit(state.copyWith(status: AccountStatus.failure, error: e));
292291
} catch (e, st) {
293292
_logger.severe(
@@ -344,9 +343,9 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
344343
clearError: true,
345344
),
346345
);
347-
} on HtHttpException catch (e) {
346+
} on HttpException catch (e) {
348347
_logger.severe(
349-
'AccountFollowSourceToggled failed with HtHttpException: $e',
348+
'AccountFollowSourceToggled failed with HttpException: $e',
350349
);
351350
emit(state.copyWith(status: AccountStatus.failure, error: e));
352351
} catch (e, st) {
@@ -392,9 +391,9 @@ class AccountBloc extends Bloc<AccountEvent, AccountState> {
392391
clearError: true,
393392
),
394393
);
395-
} on HtHttpException catch (e) {
394+
} on HttpException catch (e) {
396395
_logger.severe(
397-
'AccountClearUserPreferences failed with HtHttpException: $e',
396+
'AccountClearUserPreferences failed with HttpException: $e',
398397
);
399398
emit(state.copyWith(status: AccountStatus.failure, error: e));
400399
} catch (e, st) {

lib/account/bloc/account_state.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ class AccountState extends Equatable {
1313
final AccountStatus status;
1414
final User? user;
1515
final UserContentPreferences? preferences;
16-
final HtHttpException? error;
16+
final HttpException? error;
1717

1818
AccountState copyWith({
1919
AccountStatus? status,
2020
User? user,
2121
UserContentPreferences? preferences,
22-
HtHttpException? error,
22+
HttpException? error,
2323
bool clearUser = false,
2424
bool clearPreferences = false,
2525
bool clearError = false,

0 commit comments

Comments
 (0)