@capacitor/ios 7.0.0-alpha.2 → 7.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59,10 +59,17 @@ import Cordova
59
59
 
60
60
  override open func viewDidLoad() {
61
61
  super.viewDidLoad()
62
- self.becomeFirstResponder()
63
62
  loadWebView()
64
63
  }
65
64
 
65
+ override open func viewDidAppear(_ animated: Bool) {
66
+ super.viewDidAppear(animated)
67
+
68
+ if bridge?.config.hasInitialFocus ?? true {
69
+ self.webView?.becomeFirstResponder()
70
+ }
71
+ }
72
+
66
73
  override open func canPerformUnwindSegueAction(_ action: Selector, from fromViewController: UIViewController, withSender sender: Any) -> Bool {
67
74
  return false
68
75
  }
@@ -21,6 +21,7 @@ NS_SWIFT_NAME(InstanceConfiguration)
21
21
  @property (nonatomic, readonly) BOOL allowLinkPreviews;
22
22
  @property (nonatomic, readonly) BOOL handleApplicationNotifications;
23
23
  @property (nonatomic, readonly) BOOL isWebDebuggable;
24
+ @property (nonatomic, readonly) BOOL hasInitialFocus;
24
25
  @property (nonatomic, readonly) BOOL cordovaDeployDisabled;
25
26
  @property (nonatomic, readonly) UIScrollViewContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior;
26
27
  @property (nonatomic, readonly, nonnull) NSURL *appLocation;
@@ -39,6 +39,7 @@
39
39
  _preferredContentMode = descriptor.preferredContentMode;
40
40
  _pluginConfigurations = descriptor.pluginConfigurations;
41
41
  _isWebDebuggable = descriptor.isWebDebuggable;
42
+ _hasInitialFocus = descriptor.hasInitialFocus;
42
43
  _legacyConfig = descriptor.legacyConfig;
43
44
  // construct the necessary URLs
44
45
  _localURL = [[NSURL alloc] initWithString:[NSString stringWithFormat:@"%@://%@", descriptor.urlScheme, descriptor.urlHostname]];
@@ -71,6 +72,7 @@
71
72
  _allowLinkPreviews = configuration.allowLinkPreviews;
72
73
  _handleApplicationNotifications = configuration.handleApplicationNotifications;
73
74
  _isWebDebuggable = configuration.isWebDebuggable;
75
+ _hasInitialFocus = configuration.hasInitialFocus;
74
76
  _cordovaDeployDisabled = configuration.cordovaDeployDisabled;
75
77
  _contentInsetAdjustmentBehavior = configuration.contentInsetAdjustmentBehavior;
76
78
  // we don't care about internal usage of deprecated APIs and the framework should build cleanly
@@ -103,6 +103,12 @@ NS_SWIFT_NAME(InstanceDescriptor)
103
103
  @discussion Defaults to true in debug mode and false in production
104
104
  */
105
105
  @property (nonatomic, assign) BOOL isWebDebuggable;
106
+ /**
107
+ @brief Whether or not the webview will have focus.
108
+ @discussion Defaults to @c true. Set by @c ios.initialFocus in the configuration file.
109
+ */
110
+ @property (nonatomic, assign) BOOL hasInitialFocus;
111
+
106
112
  /**
107
113
  @brief How the web view will inset its content
108
114
  @discussion Set by @c ios.contentInset in the configuration file. Corresponds to @c contentInsetAdjustmentBehavior on WKWebView.
@@ -41,6 +41,7 @@ NSString* const CAPInstanceDescriptorDefaultHostname = @"localhost";
41
41
  _allowLinkPreviews = YES;
42
42
  _handleApplicationNotifications = YES;
43
43
  _isWebDebuggable = NO;
44
+ _hasInitialFocus = YES;
44
45
  _contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
45
46
  _appLocation = location;
46
47
  _limitsNavigationsToAppBoundDomains = FALSE;
@@ -141,6 +141,9 @@ internal extension InstanceDescriptor {
141
141
  isWebDebuggable = true
142
142
  #endif
143
143
  }
144
+ if let initialFocus = (config[keyPath: "ios.initialFocus"] as? Bool) ?? (config[keyPath: "initialFocus"] as? Bool) {
145
+ hasInitialFocus = initialFocus
146
+ }
144
147
  }
145
148
  }
146
149
  // swiftlint:enable cyclomatic_complexity
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/ios",
3
- "version": "7.0.0-alpha.2",
3
+ "version": "7.0.0-beta.0",
4
4
  "description": "Capacitor: Cross-platform apps with JavaScript and the web",
5
5
  "homepage": "https://capacitorjs.com",
6
6
  "author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
@@ -26,7 +26,7 @@
26
26
  "xc:build:xcframework": "scripts/build.sh xcframework"
27
27
  },
28
28
  "peerDependencies": {
29
- "@capacitor/core": "^7.0.0-alpha.2"
29
+ "@capacitor/core": "^7.0.0-beta.0"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"