Skip to content

Commit 17a7c50

Browse files
committed
Merge branch 'ADP-5877-NEW' into develop
2 parents 333fbd5 + 8464483 commit 17a7c50

8 files changed

Lines changed: 208 additions & 96 deletions

File tree

src/components/TableOfContents.astro

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,27 +83,30 @@ const tocHeadings = headings.filter(h => h.depth >= 2 && h.depth <= 3);
8383
const scrollY = window.scrollY;
8484
const windowHeight = window.innerHeight;
8585
const documentHeight = document.documentElement.scrollHeight;
86-
86+
87+
const currentHeadings = visibleHeadings();
88+
if (currentHeadings.length === 0) return;
89+
8790
// Check if we're at the bottom of the page
8891
// If the user has scrolled to near the bottom, always highlight the last item
8992
// This handles cases where the last section is too short to reach the top offset
9093
if (scrollY + windowHeight >= documentHeight - 50) {
91-
const lastHeading = headings[headings.length - 1];
94+
const lastHeading = currentHeadings[currentHeadings.length - 1];
9295
const id = lastHeading?.getAttribute('id');
9396
if (id) {
9497
setActiveLink(id);
9598
return;
9699
}
97100
}
98-
101+
99102
// Find the last heading that is above or at the headerOffset
100103
// This mimics standard "scroll spy" behavior: the section you are reading
101104
// is the one whose header you most recently passed.
102-
let activeHeading = headings[0];
103-
104-
for (const heading of headings) {
105+
let activeHeading = currentHeadings[0];
106+
107+
for (const heading of currentHeadings) {
105108
const rect = heading.getBoundingClientRect();
106-
109+
107110
if (rect.top <= headerOffset) {
108111
activeHeading = heading;
109112
} else {
@@ -122,7 +125,13 @@ const tocHeadings = headings.filter(h => h.depth >= 2 && h.depth <= 3);
122125
// Update on scroll with throttling
123126
let ticking = false;
124127
let scrollEndTimer;
125-
128+
129+
// SDK-version blocks hide their content via `display: none` on the
130+
// wrapping `[data-sdk-version]` div. Headings inside a hidden block
131+
// have offsetParent === null — skip them so scrollspy never lands on
132+
// a heading the user can't see.
133+
const visibleHeadings = () => headings.filter(h => h.offsetParent !== null);
134+
126135
const handleScroll = () => {
127136
// If we are in "click mode", we purely want to detect when scrolling STOPS
128137
// We don't want to run the expensive/noisy update logic during the smooth scroll

src/content/docs/ios/ios-paywalls.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ metadataTitle: "Paywall and Onboarding Flows - iOS | Adapty Docs"
66

77
import CustomDocCardList from '@site/src/components/CustomDocCardList';
88

9-
## Display paywalls
9+
## Display paywalls
1010

11-
### Adapty Paywall Builder
11+
### Adapty Paywall Builder/Flow Builder
1212

1313
<CustomDocCardList ids={['get-pb-paywalls', 'ios-present-paywalls', 'ios-handling-events', 'handle-paywall-actions', 'ios-handle-permissions']} />
1414

@@ -24,4 +24,4 @@ For more guides on implementing paywalls and handling purchases manually, see th
2424

2525
## Useful features
2626

27-
<CustomDocCardList ids={['ios-use-fallback-paywalls', 'localizations-and-locale-codes', 'ios-web-paywall']} />
27+
<CustomDocCardList ids={['ios-use-fallback-paywalls', 'localizations-and-locale-codes', 'ios-web-paywall']} />

src/content/docs/ios/ios-present-paywalls.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Display flows & paywalls - iOS"
3-
description: "Present paywall and onboarding flows to users in your iOS app."
4-
metadataTitle: "Display Flows - iOS | Adapty Docs"
3+
description: "Present paywall and flows to users in your iOS app."
4+
metadataTitle: "Display Paywalls & Flows - iOS | Adapty Docs"
55
---
66

77
import SampleApp from '@site/src/components/reusable/SampleApp.md';
@@ -245,7 +245,7 @@ In order to display the visual paywall on the device screen, do the following:
245245
```swift showLineNumbers title="Swift"
246246
import Adapty
247247
import AdaptyUI
248-
248+
249249
let visualPaywall = AdaptyUI.paywallController(
250250
with: <paywall configuration object>,
251251
delegate: <AdaptyPaywallControllerDelegate>
@@ -265,7 +265,7 @@ In order to display the visual paywall on the device screen, do the following:
265265
| :---------------------- | :--------------------------------------------------- |
266266
| **AdaptyPaywallController** | An object, representing the requested paywall screen |
267267

268-
2. After the object has been successfully created, you can display it on the screen of the device:
268+
2. After the object has been successfully created, you can display it on the screen of the device:
269269

270270
```swift showLineNumbers title="Swift"
271271
present(visualPaywall, animated: true)

0 commit comments

Comments
 (0)