Skip to content

Commit 6459bb3

Browse files
Merge pull request #62 from ionic-team/feat/RMET-4216/add-gesture-navigation
feat(ios): add allowsBackForwardNavigationGestures
2 parents c7cebb6 + b251e9a commit 6459bb3

File tree

8 files changed

+40
-23
lines changed

8 files changed

+40
-23
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Unreleased
2+
3+
### Features
4+
5+
* Added support for back and forward swipe navigation gestures in `WKWebView` via the `allowsBackForwardNavigationGestures` option. (for openInWebView option only) ([35ab447](https://github.com/ionic-team/capacitor-os-inappbrowser/commit/35ab44790eb98b2d0d748c130642b321e9dc1156))
6+
17
# [2.1.0](https://github.com/ionic-team/capacitor-os-inappbrowser/compare/v2.0.1...v2.1.0) (2025-04-15)
28

39
### Features

CapacitorInappbrowser.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Pod::Spec.new do |s|
1212
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
1313
s.source_files = 'ios/Sources/InAppBrowserPlugin/*.{swift,h,m,c,cc,mm,cpp}'
1414
s.ios.deployment_target = '14.0'
15-
s.dependency 'OSInAppBrowserLib', spec='~> 2.0'
15+
s.dependency 'OSInAppBrowserLib', spec='~> 2.0.1'
1616
s.dependency 'Capacitor'
1717
s.swift_version = '5.1'
1818
end

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,15 @@ Defines the options for opening a URL in the web view.
242242

243243
#### iOSWebViewOptions
244244

245-
| Prop | Type | Description |
246-
| ---------------------------------- | ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
247-
| **`allowOverScroll`** | <code>boolean</code> | Turns on the Web View bounce property. |
248-
| **`enableViewportScale`** | <code>boolean</code> | Prevents viewport scaling through a meta tag. |
249-
| **`allowInLineMediaPlayback`** | <code>boolean</code> | Allows in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface. Note: The HTML's video element must also include the webkit-playsinline attribute. |
250-
| **`surpressIncrementalRendering`** | <code>boolean</code> | Waits until all new view content is received before being rendered. |
251-
| **`viewStyle`** | <code><a href="#iosviewstyle">iOSViewStyle</a></code> | Sets the presentation style of the Web View. |
252-
| **`animationEffect`** | <code><a href="#iosanimation">iOSAnimation</a></code> | Sets the transition style of the Web View. |
245+
| Prop | Type | Description |
246+
| ----------------------------------------- | ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
247+
| **`allowOverScroll`** | <code>boolean</code> | Turns on the Web View bounce property. |
248+
| **`enableViewportScale`** | <code>boolean</code> | Prevents viewport scaling through a meta tag. |
249+
| **`allowInLineMediaPlayback`** | <code>boolean</code> | Allows in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface. Note: The HTML's video element must also include the webkit-playsinline attribute. |
250+
| **`surpressIncrementalRendering`** | <code>boolean</code> | Waits until all new view content is received before being rendered. |
251+
| **`viewStyle`** | <code><a href="#iosviewstyle">iOSViewStyle</a></code> | Sets the presentation style of the Web View. |
252+
| **`animationEffect`** | <code><a href="#iosanimation">iOSAnimation</a></code> | Sets the transition style of the Web View. |
253+
| **`allowsBackForwardNavigationGestures`** | <code>boolean</code> | Enables back and forward swipe gestures in the Web View. |
253254

254255

255256
#### OpenInSystemBrowserParameterModel

example-app/package-lock.json

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example-app/src/pages/Home.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ const Home: React.FC = () => {
8686
allowInLineMediaPlayback: true,
8787
surpressIncrementalRendering: true,
8888
viewStyle: iOSViewStyle.PAGE_SHEET,
89-
animationEffect: iOSAnimation.CROSS_DISSOLVE
89+
animationEffect: iOSAnimation.CROSS_DISSOLVE,
90+
allowsBackForwardNavigationGestures: true
9091
}
9192
}
9293
});
@@ -116,7 +117,8 @@ const Home: React.FC = () => {
116117
allowInLineMediaPlayback: true,
117118
surpressIncrementalRendering: true,
118119
viewStyle: iOSViewStyle.PAGE_SHEET,
119-
animationEffect: iOSAnimation.CROSS_DISSOLVE
120+
animationEffect: iOSAnimation.CROSS_DISSOLVE,
121+
allowsBackForwardNavigationGestures: true
120122
}
121123
}
122124
});

ios/Sources/InAppBrowserPlugin/OSInAppBrowserWebViewModel.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ struct OSInAppBrowserWebViewModel: Decodable {
99
let surpressIncrementalRendering: Bool
1010
let viewStyle: OSIABViewStyle
1111
let animationEffect: OSIABAnimationEffect
12+
let allowsBackForwardNavigationGestures: Bool
1213

1314
enum CodingKeys: CodingKey {
1415
case allowOverScroll
@@ -17,6 +18,7 @@ struct OSInAppBrowserWebViewModel: Decodable {
1718
case surpressIncrementalRendering
1819
case viewStyle
1920
case animationEffect
21+
case allowsBackForwardNavigationGestures
2022
}
2123

2224
init(from decoder: Decoder) throws {
@@ -31,6 +33,7 @@ struct OSInAppBrowserWebViewModel: Decodable {
3133
self.surpressIncrementalRendering = try container.decode(Bool.self, forKey: .surpressIncrementalRendering)
3234
self.viewStyle = .init(viewStyleValue)
3335
self.animationEffect = .init(animationValue)
36+
self.allowsBackForwardNavigationGestures = try container.decode(Bool.self, forKey: .allowsBackForwardNavigationGestures)
3437
}
3538
}
3639

@@ -98,7 +101,8 @@ extension OSInAppBrowserWebViewModel {
98101
surpressIncrementalRendering: self.iOS.surpressIncrementalRendering,
99102
viewStyle: self.iOS.viewStyle,
100103
animationEffect: self.iOS.animationEffect,
101-
customUserAgent: self.customWebViewUserAgent
104+
customUserAgent: self.customWebViewUserAgent,
105+
allowsBackForwardNavigationGestures: self.iOS.allowsBackForwardNavigationGestures
102106
)
103107
}
104108
}

src/defaults.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export const DefaultiOSWebViewOptions: iOSWebViewOptions = {
2828

2929
viewStyle: iOSViewStyle.FULL_SCREEN,
3030
animationEffect: iOSAnimation.COVER_VERTICAL,
31+
allowsBackForwardNavigationGestures: true,
3132
};
3233

3334
export const DefaultWebViewOptions: WebViewOptions = {

src/definitions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ export interface iOSWebViewOptions {
7676
viewStyle: iOSViewStyle;
7777
/** Sets the transition style of the Web View. */
7878
animationEffect: iOSAnimation;
79+
80+
/** Enables back and forward swipe gestures in the Web View. */
81+
allowsBackForwardNavigationGestures: boolean;
7982
}
8083

8184
export interface AndroidWebViewOptions {

0 commit comments

Comments
 (0)