Skip to content
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

docs(stories): WebView in stories usage #176

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
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
31 changes: 31 additions & 0 deletions source/includes/_stories.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -449,3 +449,34 @@ No implementation yet
No implementation needed
```
Setting up the text for a message that the user will see after successfully copying the promocode can be done by changing the default text in the **data-promocode-copy-text** attribute.

## Open links in WebView


```kotlin
No implementation yet
```

```swift
let webmanager = RWebViewManager()
webmanager.openURL(link, needOpeningWebView: true, from: self){result in
switch result{
case .success:
print("URL successfully opened")
self.closeStory()
case .failure(let error):
print("Failed to open URL: \(error.localizedDescription)")
}
}
```
`RWebViewManager` abstracts the work with WebView and simplifies opening links for developers using the SDK.
How it works:
- The SDK provides an API for opening links within the application.
- The application calls the `openURL(...)` method, passing a link and the flag `needOpeningWebView: true` (to explicitly indicate that WebView should be used).
- Inside `RWebViewManager`, the SDK:
- Can create a `WKWebView` and load the page into it.
- Can use `SFSafariViewController` if WebView is not needed.
- Can handle redirects, cookies, authentication, and other web mechanisms.
- Completion handler:
- `.success` means that the WebView opened without any issues.
- `.failure(let error)` indicates a page loading error.