Skip to content

Commit 6d7b0a1

Browse files
authored
Ads view supporting dark mode now. #58 (#60)
1 parent a26db9e commit 6d7b0a1

File tree

4 files changed

+19
-20
lines changed

4 files changed

+19
-20
lines changed

Surcharges/PresentationLayer/UIs/CommonUI/Sources/Text+extension/blurBackground.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,11 @@ import Resources
1313
public extension View {
1414
func blurBackground() -> some View {
1515
self
16-
.padding([.top, .bottom], 10)
17-
.padding([.leading, .trailing], 20)
18-
.frame(maxWidth: .infinity, alignment: .leading)
1916
.background(.ultraThinMaterial, in: Rectangle())
2017
}
2118

2219
func blurRoundedBackground(cornerRadius: CGFloat) -> some View {
2320
self
24-
.padding([.top, .bottom], 10)
25-
.padding([.leading, .trailing], 20)
26-
.frame(maxWidth: .infinity, alignment: .leading)
2721
.background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: cornerRadius))
2822
}
2923
}

Surcharges/PresentationLayer/UIs/Main/Sources/MainView.swift

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ public struct MainView<VM: MainViewModelProtocol, Router: MainRouterProtocol, Ad
7474

7575
if _viewModel.noResults {
7676

77-
if _adsService.isShowingAds {
78-
ListAdsView(unitId: _adsService.listBannerUnitId)
79-
}
80-
8177
NoResultView(searchedText: _viewModel.searchedText)
8278
.padding(.top, 40)
8379
.padding([.leading, .trailing], 20)
@@ -86,10 +82,6 @@ public struct MainView<VM: MainViewModelProtocol, Router: MainRouterProtocol, Ad
8682

8783
if !_viewModel.mainModel.places.isEmpty {
8884

89-
if _adsService.isShowingAds {
90-
ListAdsView(unitId: _adsService.listBannerUnitId)
91-
}
92-
9385
Section {
9486
PlacesView(
9587
mainModel: $_viewModel.mainModel,
@@ -104,8 +96,22 @@ public struct MainView<VM: MainViewModelProtocol, Router: MainRouterProtocol, Ad
10496
)
10597

10698
} header: {
107-
Text("🔎\(R.string.localizable.searchFor(_viewModel.searchedText))")
108-
.blurBackground()
99+
100+
VStack(spacing: 0) {
101+
102+
if _adsService.isShowingAds {
103+
ListAdsView(unitId: _adsService.listBannerUnitId)
104+
}
105+
106+
Text("🔎\(R.string.localizable.searchFor(_viewModel.searchedText))")
107+
.frame(maxWidth: .infinity, alignment: .leading)
108+
.padding([.leading, .trailing], 20)
109+
.padding(.top, 10)
110+
.padding(.bottom, 10)
111+
112+
}
113+
.blurBackground()
114+
109115
}
110116

111117
} else {
@@ -115,9 +121,10 @@ public struct MainView<VM: MainViewModelProtocol, Router: MainRouterProtocol, Ad
115121
.padding([.leading, .trailing], 20)
116122

117123
FixedAdsView(isAdShowing: $_adsService.isShowingAds, unitId: _adsService.fixedBannerUnitId)
118-
.padding(.top, 20)
124+
.blurRoundedBackground(cornerRadius: 20)
125+
.padding([.top, .bottom], 10)
119126
.padding([.leading, .trailing], 20)
120-
127+
121128
}
122129
}
123130
}

Surcharges/PresentationLayer/UIs/MobileAds/Sources/FixedAdsView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ public struct FixedAdsView: View {
9595

9696
}
9797
}
98-
.background(R.color.gray100.color)
9998
.frame(minHeight: _adSize.size.width, maxHeight: _adSize.size.width)
10099
.cornerRadius(20)
101100
.readSize { size in

Surcharges/PresentationLayer/UIs/MobileAds/Sources/ListAdsView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public struct ListAdsView: View {
3030
.frame(height: _adSize.size.height)
3131
}
3232
.background(R.color.gray100.color)
33-
.cornerRadius(20)
3433
.readSize { size in
3534
_adSize = GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(size.width)
3635
}

0 commit comments

Comments
 (0)