Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Refactor/ad config UI role based #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
fulleni merged 13 commits into main from refactor/ad-config-ui-role-based
Sep 23, 2025
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit Hold shift + click to select a range
965c0ef
chore(deps): update core.git to d7d9afa3
fulleni Sep 23, 2025
eabfc06
refactor(ad_config_form): simplify AdConfigForm widget
fulleni Sep 23, 2025
904c0bb
feat(app_configuration): implement role-based in-article ad slot visi...
fulleni Sep 23, 2025
f9f9cd9
refactor(app_configuration): update feed ad settings form logic
fulleni Sep 23, 2025
f0893b0
refactor(ad): improve interstitial ad config management
fulleni Sep 23, 2025
0ecbf73
feat(localization): add translations for in-article ads settings
fulleni Sep 23, 2025
1f8048b
refactor(app_configuration): improve in-article ad settings UI consis...
fulleni Sep 23, 2025
ffc0c65
refactor(app_configuration): improve ad settings UI and functionality
fulleni Sep 23, 2025
7413d25
refactor(ad): improve UI consistency and code formatting in interstit...
fulleni Sep 23, 2025
d32724b
refactor(ad): revert in-article ad settings UI changes
fulleni Sep 23, 2025
36aa7b6
feat(ad-settings): remove automatic ad disabling for premium users
fulleni Sep 23, 2025
b0514b1
feat(ad-config): remove auto-disable ads for premium users
fulleni Sep 23, 2025
fdfe26f
style: format
fulleni Sep 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor(app_configuration): improve in-article ad settings UI consis...
...tency
- Replace CheckboxListTile with SwitchListTile for better alignment with existing design
- Restructure the widget layout to improve usability
- Enhance the logic for enabling/disabling in-article ads for different user roles
  • Loading branch information
fulleni committed Sep 23, 2025
commit 1f8048be59f608ead35a10f2eeb88f8a7910fa10
96 changes: 68 additions & 28 deletions lib/app_configuration/widgets/article_ad_settings_form.dart
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -202,38 +202,78 @@ class _ArticleAdSettingsFormState extends State<ArticleAdSettingsForm>

return Column(
children: [
// Checkbox for each InArticleAdSlotType
for (final slotType in InArticleAdSlotType.values)
CheckboxListTile(
title: Text(slotType.l10n(context)),
value: (roleSlots != null && roleSlots[slotType] == true) &&
isEnabled,
onChanged: isEnabled
? (value) {
final newRoleSlots =
Map<InArticleAdSlotType, bool>.from(roleSlots ?? {});
if (value ?? false) {
newRoleSlots[slotType] = true;
} else {
newRoleSlots.remove(slotType);
}
SwitchListTile(
// Changed from CheckboxListTile to SwitchListTile for consistency
title: Text(l10n.enableInArticleAdsForRoleLabel(role.l10n(context))),
value: roleSlots != null && isEnabled,
onChanged: isEnabled
? (value) {
final newVisibleTo =
Map<AppUserRole, Map<InArticleAdSlotType, bool>>.from(
config.visibleTo,
);
if (value) {
// Default values when enabling for a role
newVisibleTo[role] = {
InArticleAdSlotType.aboveArticleContinueReadingButton: true,
InArticleAdSlotType.belowArticleContinueReadingButton: true,
};
} else {
newVisibleTo.remove(role);
}

widget.onConfigChanged(
widget.remoteConfig.copyWith(
adConfig: widget.remoteConfig.adConfig.copyWith(
articleAdConfiguration: config.copyWith(
visibleTo: newVisibleTo,
),
),
),
);
}
: null,
),
if (roleSlots != null)
Padding(
padding: const EdgeInsets.symmetric(
horizontal: AppSpacing.lg,
vertical: AppSpacing.sm,
),
child: Column(
children: [
// SwitchListTile for each InArticleAdSlotType
for (final slotType in InArticleAdSlotType.values)
SwitchListTile(
title: Text(slotType.l10n(context)),
value: roleSlots[slotType] == true,
onChanged: (value) {
final newRoleSlots =
Map<InArticleAdSlotType, bool>.from(roleSlots);
if (value) {
newRoleSlots[slotType] = true;
} else {
newRoleSlots.remove(slotType);
}

final newVisibleTo =
Map<AppUserRole, Map<InArticleAdSlotType, bool>>.from(
config.visibleTo,
)..[role] = newRoleSlots;
final newVisibleTo =
Map<AppUserRole, Map<InArticleAdSlotType, bool>>.from(
config.visibleTo,
)..[role] = newRoleSlots;

widget.onConfigChanged(
widget.remoteConfig.copyWith(
adConfig: widget.remoteConfig.adConfig.copyWith(
articleAdConfiguration: config.copyWith(
visibleTo: newVisibleTo,
widget.onConfigChanged(
widget.remoteConfig.copyWith(
adConfig: widget.remoteConfig.adConfig.copyWith(
articleAdConfiguration: config.copyWith(
visibleTo: newVisibleTo,
),
),
),
),
);
}
: null,
);
},
),
],
),
),
],
);
Expand Down

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /