@capgo/capacitor-autofill-save-password 7.0.1 → 7.0.2

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.
@@ -20,8 +20,15 @@ public class SavePasswordPlugin: CAPPlugin, CAPBridgedPlugin {
20
20
  loginScreen.usernameTextField.text = call.getString("username") ?? ""
21
21
  loginScreen.passwordTextField.text = call.getString("password") ?? ""
22
22
  self.bridge?.webView?.addSubview(loginScreen.view)
23
- loginScreen.view.removeFromSuperview()
24
- call.resolve()
23
+
24
+ // Defer removal so the system registers the fields before they disappear
25
+ DispatchQueue.main.async {
26
+ loginScreen.view.removeFromSuperview()
27
+ // Clear fields *after* removal as required by Autofill heuristics
28
+ loginScreen.usernameTextField.text = ""
29
+ loginScreen.passwordTextField.text = ""
30
+ call.resolve()
31
+ }
25
32
  }
26
33
  }
27
34
  }
@@ -40,6 +47,7 @@ class LoginScreenViewController: UIViewController {
40
47
  textField.frame.size.width = 1
41
48
  textField.frame.size.height = 1
42
49
  textField.textContentType = .newPassword
50
+ // Fix for ios 18.3 : from https://stackoverflow.com/questions/76773166/password-autofill-wkwebview-doesnt-present-save-password-alert#comment140186929_76773167
43
51
  return textField
44
52
  }()
45
53
 
@@ -48,6 +56,7 @@ class LoginScreenViewController: UIViewController {
48
56
  view.frame = CGRect(x: 0, y: 0, width: 0, height: 0)
49
57
  view.addSubview(usernameTextField)
50
58
  view.addSubview(passwordTextField)
51
- usernameTextField.becomeFirstResponder()
59
+ // Make password the first responder so the strong-password prompt or save-password alert triggers reliably
60
+ passwordTextField.becomeFirstResponder()
52
61
  }
53
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-autofill-save-password",
3
- "version": "7.0.1",
3
+ "version": "7.0.2",
4
4
  "description": "Prompt to display dialog for saving password to keychain from webview app",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",