@capgo/capacitor-social-login 8.4.1 → 8.4.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.
@@ -124,6 +124,7 @@ dependencies {
124
124
 
125
125
  // Test dependencies (always included)
126
126
  testImplementation "junit:junit:$junitVersion"
127
+ testImplementation "org.json:json:20240303"
127
128
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
128
129
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
129
130
  }
@@ -24,7 +24,7 @@ import org.json.JSONObject;
24
24
  @CapacitorPlugin(name = "SocialLogin")
25
25
  public class SocialLoginPlugin extends Plugin {
26
26
 
27
- private final String pluginVersion = "8.4.1";
27
+ private final String pluginVersion = "8.4.2";
28
28
 
29
29
  public static String LOG_TAG = "CapgoSocialLogin";
30
30
  public HashMap<String, SocialProvider> socialProviderHashMap = new HashMap<>();
@@ -532,9 +532,22 @@ public class SocialLoginPlugin extends Plugin {
532
532
  }
533
533
  }
534
534
 
535
+ // Capacitor's PluginCall.getLong() only reads Java Long values. JS numbers that
536
+ // fit in 32 bits cross the bridge as Integer, so Number coercion is required.
537
+ static Long longOptionFromCall(PluginCall call, String key) {
538
+ if (!call.getData().has(key)) {
539
+ return null;
540
+ }
541
+ Object value = call.getData().opt(key);
542
+ if (value == null || !(value instanceof Number)) {
543
+ return null;
544
+ }
545
+ return ((Number) value).longValue();
546
+ }
547
+
535
548
  @PluginMethod
536
549
  public void getAccessTokenExpirationDate(final PluginCall call) {
537
- Long expiresAt = call.getLong("accessTokenExpirationDate");
550
+ Long expiresAt = longOptionFromCall(call, "accessTokenExpirationDate");
538
551
  if (expiresAt == null) {
539
552
  call.reject("accessTokenExpirationDate is required");
540
553
  return;
@@ -552,7 +565,7 @@ public class SocialLoginPlugin extends Plugin {
552
565
 
553
566
  @PluginMethod
554
567
  public void isAccessTokenExpired(final PluginCall call) {
555
- Long expiresAt = call.getLong("accessTokenExpirationDate");
568
+ Long expiresAt = longOptionFromCall(call, "accessTokenExpirationDate");
556
569
  if (expiresAt == null) {
557
570
  call.reject("accessTokenExpirationDate is required");
558
571
  return;
@@ -16,7 +16,7 @@ import GoogleSignIn
16
16
  */
17
17
  @objc(SocialLoginPlugin)
18
18
  public class SocialLoginPlugin: CAPPlugin, CAPBridgedPlugin {
19
- private let pluginVersion: String = "8.4.1"
19
+ private let pluginVersion: String = "8.4.2"
20
20
  public let identifier = "SocialLoginPlugin"
21
21
  public let jsName = "SocialLogin"
22
22
  private static let userCancelledCode = "USER_CANCELLED"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-social-login",
3
- "version": "8.4.1",
3
+ "version": "8.4.2",
4
4
  "description": "All social logins in one plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",