Skip to content

Commit b345cf8

Browse files
authored
Merge pull request #121 from flutter-news-app-full-source-code/refactor/remove-local-ads-feature
chore: cleaning up
2 parents 29312ac + ca82103 commit b345cf8

File tree

61 files changed

+6
-7847
lines changed

Some content is hidden

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

61 files changed

+6
-7847
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,9 @@ Effortlessly manage your entire user base with a dedicated user management syste
5151

5252
### 💸 Centralized Monetization Engine
5353
Take direct control of your mobile app's revenue strategy. This integrated system allows you to manage your ad inventory and fine-tune display rules without ever touching the mobile app's code.
54-
- **Flexible Ad Provider Strategy:** Instantly switch the mobile app's primary ad source between industry-standard networks like Google AdMob or your own self-hosted ad server for maximum control.
55-
- **Custom Ad Inventory Management:** When using the local provider, you have full creative control to upload and manage a wide variety of ad formats, from native and banner to full-screen interstitial ads.
54+
- **Flexible Ad Provider Strategy:** Instantly switch the mobile app's primary ad source between industry-standard networks like Google AdMob for maximum control.
5655
- **Granular, Role-Based Rules:** Define precisely how and when ads are shown based on user subscription tiers (e.g., guest, standard, premium), optimizing both revenue and user experience.
57-
> **Your Advantage:** Deploy a powerful, backend-driven monetization strategy. A/B test ad providers, launch direct-sold campaigns, and adjust revenue models on the fly to respond to market demands in real-time.
56+
> **Your Advantage:** Deploy a powerful, backend-driven monetization strategy. A/B test ad providers and adjust revenue models on the fly to respond to market demands in real-time.
5857
5958
---
6059

lib/app/view/app.dart

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import 'package:flutter_news_app_web_dashboard_full_source_code/content_manageme
1616
import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/sources_filter/sources_filter_bloc.dart';
1717
import 'package:flutter_news_app_web_dashboard_full_source_code/content_management/bloc/topics_filter/topics_filter_bloc.dart';
1818
import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/app_localizations.dart';
19-
import 'package:flutter_news_app_web_dashboard_full_source_code/local_ads_management/bloc/filter_local_ads/filter_local_ads_bloc.dart';
20-
import 'package:flutter_news_app_web_dashboard_full_source_code/local_ads_management/bloc/local_ads_management_bloc.dart';
2119
import 'package:flutter_news_app_web_dashboard_full_source_code/overview/bloc/overview_bloc.dart';
2220
import 'package:flutter_news_app_web_dashboard_full_source_code/router/router.dart';
2321
import 'package:flutter_news_app_web_dashboard_full_source_code/shared/services/pending_deletions_service.dart';
@@ -42,7 +40,6 @@ class App extends StatelessWidget {
4240
required DataRepository<DashboardSummary> dashboardSummaryRepository,
4341
required DataRepository<Country> countriesRepository,
4442
required DataRepository<Language> languagesRepository,
45-
required DataRepository<LocalAd> localAdsRepository,
4643
required DataRepository<User> usersRepository,
4744
required KVStorageService storageService,
4845
required AppEnvironment environment,
@@ -59,7 +56,6 @@ class App extends StatelessWidget {
5956
_dashboardSummaryRepository = dashboardSummaryRepository,
6057
_countriesRepository = countriesRepository,
6158
_languagesRepository = languagesRepository,
62-
_localAdsRepository = localAdsRepository,
6359
_usersRepository = usersRepository,
6460
_environment = environment,
6561
_pendingDeletionsService = pendingDeletionsService;
@@ -75,7 +71,6 @@ class App extends StatelessWidget {
7571
final DataRepository<DashboardSummary> _dashboardSummaryRepository;
7672
final DataRepository<Country> _countriesRepository;
7773
final DataRepository<Language> _languagesRepository;
78-
final DataRepository<LocalAd> _localAdsRepository;
7974
final DataRepository<User> _usersRepository;
8075
final KVStorageService _kvStorageService;
8176
final AppEnvironment _environment;
@@ -97,7 +92,6 @@ class App extends StatelessWidget {
9792
RepositoryProvider.value(value: _dashboardSummaryRepository),
9893
RepositoryProvider.value(value: _countriesRepository),
9994
RepositoryProvider.value(value: _languagesRepository),
100-
RepositoryProvider.value(value: _localAdsRepository),
10195
RepositoryProvider.value(value: _usersRepository),
10296
RepositoryProvider.value(value: _kvStorageService),
10397
RepositoryProvider(
@@ -139,9 +133,7 @@ class App extends StatelessWidget {
139133
BlocProvider(
140134
create: (context) => SourcesFilterBloc(),
141135
),
142-
BlocProvider(
143-
create: (context) => FilterLocalAdsBloc(),
144-
),
136+
145137
BlocProvider(
146138
create: (context) => ContentManagementBloc(
147139
headlinesRepository: context.read<DataRepository<Headline>>(),
@@ -153,13 +145,6 @@ class App extends StatelessWidget {
153145
pendingDeletionsService: context.read<PendingDeletionsService>(),
154146
),
155147
),
156-
BlocProvider(
157-
create: (context) => LocalAdsManagementBloc(
158-
localAdsRepository: context.read<DataRepository<LocalAd>>(),
159-
filterLocalAdsBloc: context.read<FilterLocalAdsBloc>(),
160-
pendingDeletionsService: context.read<PendingDeletionsService>(),
161-
),
162-
),
163148
BlocProvider(
164149
create: (context) => OverviewBloc(
165150
dashboardSummaryRepository: context

lib/app_configuration/widgets/ad_platform_config_form.dart

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import 'package:flutter/material.dart';
33
import 'package:flutter_news_app_web_dashboard_full_source_code/app_configuration/widgets/app_config_form_fields.dart';
44
import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/app_localizations.dart';
55
import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart';
6-
import 'package:flutter_news_app_web_dashboard_full_source_code/router/routes.dart';
76
import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/ad_platform_type_l10n.dart';
8-
import 'package:go_router/go_router.dart';
97
import 'package:ui_kit/ui_kit.dart';
108

119
/// {@template ad_platform_config_form}
@@ -301,38 +299,7 @@ class _AdPlatformConfigFormState extends State<AdPlatformConfigForm> {
301299
),
302300
],
303301
),
304-
const SizedBox(height: AppSpacing.lg),
305-
306-
// Local Ad Management
307-
if (_selectedPlatform == AdPlatformType.local)
308-
ExpansionTile(
309-
title: Text(l10n.localAdManagementTitle),
310-
childrenPadding: const EdgeInsetsDirectional.only(
311-
start: AppSpacing.lg,
312-
top: AppSpacing.md,
313-
bottom: AppSpacing.md,
314-
),
315-
expandedCrossAxisAlignment: CrossAxisAlignment.start,
316-
children: [
317-
Text(
318-
l10n.localAdManagementDescription,
319-
style: Theme.of(context).textTheme.bodySmall?.copyWith(
320-
color: Theme.of(
321-
context,
322-
).colorScheme.onSurface.withOpacity(0.7),
323-
),
324-
textAlign: TextAlign.start,
325-
),
326-
const SizedBox(height: AppSpacing.lg),
327-
Center(
328-
child: ElevatedButton(
329-
onPressed: () =>
330-
context.goNamed(Routes.localAdsManagementName),
331-
child: Text(l10n.manageLocalAdsButton),
332-
),
333-
),
334-
],
335-
),
302+
const SizedBox(height: AppSpacing.lg),
336303
],
337304
);
338305
}

lib/bootstrap.dart

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ Future<Widget> bootstrap(
6464
DataClient<DashboardSummary> dashboardSummaryClient;
6565
DataClient<Country> countriesClient;
6666
DataClient<Language> languagesClient;
67-
DataClient<LocalAd> localAdsClient;
6867
DataClient<User> usersClient;
6968

7069
if (appConfig.environment == app_config.AppEnvironment.demo) {
@@ -120,12 +119,7 @@ Future<Widget> bootstrap(
120119
initialData: languagesFixturesData,
121120
logger: Logger('DataInMemory<Language>'),
122121
);
123-
localAdsClient = DataInMemory<LocalAd>(
124-
toJson: FeedItem.toJson,
125-
getId: (i) => i.id,
126-
initialData: localAdsFixturesData,
127-
logger: Logger('DataInMemory<LocalAd>'),
128-
);
122+
129123
usersClient = DataInMemory<User>(
130124
toJson: (i) => i.toJson(),
131125
getId: (i) => i.id,
@@ -196,13 +190,7 @@ Future<Widget> bootstrap(
196190
toJson: (language) => language.toJson(),
197191
logger: Logger('DataApi<Language>'),
198192
);
199-
localAdsClient = DataApi<LocalAd>(
200-
httpClient: httpClient,
201-
modelName: 'local_ad',
202-
fromJson: LocalAd.fromJson,
203-
toJson: FeedItem.toJson,
204-
logger: Logger('DataApi<LocalAd>'),
205-
);
193+
206194
usersClient = DataApi<User>(
207195
httpClient: httpClient,
208196
modelName: 'user',
@@ -240,9 +228,6 @@ Future<Widget> bootstrap(
240228
final languagesRepository = DataRepository<Language>(
241229
dataClient: languagesClient,
242230
);
243-
final localAdsRepository = DataRepository<LocalAd>(
244-
dataClient: localAdsClient,
245-
);
246231
final usersRepository = DataRepository<User>(dataClient: usersClient);
247232

248233
return App(
@@ -256,7 +241,6 @@ Future<Widget> bootstrap(
256241
dashboardSummaryRepository: dashboardSummaryRepository,
257242
countriesRepository: countriesRepository,
258243
languagesRepository: languagesRepository,
259-
localAdsRepository: localAdsRepository,
260244
usersRepository: usersRepository,
261245
storageService: kvStorage,
262246
environment: environment,

0 commit comments

Comments
 (0)