@capgo/capacitor-social-login 7.20.0 → 8.1.1
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.
- package/CapgoCapacitorSocialLogin.podspec +1 -1
- package/Package.swift +2 -2
- package/README.md +26 -30
- package/android/build.gradle +27 -14
- package/android/src/facebookStubs/java/com/facebook/AccessToken.java +65 -0
- package/android/src/facebookStubs/java/com/facebook/CallbackManager.java +23 -0
- package/android/src/facebookStubs/java/com/facebook/FacebookCallback.java +11 -0
- package/android/src/facebookStubs/java/com/facebook/FacebookException.java +24 -0
- package/android/src/facebookStubs/java/com/facebook/FacebookSdk.java +22 -0
- package/android/src/facebookStubs/java/com/facebook/GraphRequest.java +56 -0
- package/android/src/facebookStubs/java/com/facebook/GraphResponse.java +26 -0
- package/android/src/facebookStubs/java/com/facebook/login/LoginBehavior.java +14 -0
- package/android/src/facebookStubs/java/com/facebook/login/LoginManager.java +48 -0
- package/android/src/facebookStubs/java/com/facebook/login/LoginResult.java +28 -0
- package/android/src/main/AndroidManifest.xml +2 -6
- package/android/src/main/java/ee/forgr/capacitor/social/login/SocialLoginPlugin.java +1 -1
- package/ios/Sources/SocialLoginPlugin/SocialLoginPlugin.swift +6 -2
- package/package.json +13 -12
|
@@ -12,7 +12,7 @@ Pod::Spec.new do |s|
|
|
|
12
12
|
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
13
|
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
14
|
s.exclude_files = '**/node_modules/**/*', '**/examples/**/*'
|
|
15
|
-
s.ios.deployment_target = '
|
|
15
|
+
s.ios.deployment_target = '15.0'
|
|
16
16
|
s.dependency 'Capacitor'
|
|
17
17
|
# Provider dependencies (conditionally included via hook script)
|
|
18
18
|
# Hook script modifies these lines based on capacitor.config.ts
|
package/Package.swift
CHANGED
|
@@ -3,14 +3,14 @@ import PackageDescription
|
|
|
3
3
|
|
|
4
4
|
let package = Package(
|
|
5
5
|
name: "CapgoCapacitorSocialLogin",
|
|
6
|
-
platforms: [.iOS(.
|
|
6
|
+
platforms: [.iOS(.v15)],
|
|
7
7
|
products: [
|
|
8
8
|
.library(
|
|
9
9
|
name: "CapgoCapacitorSocialLogin",
|
|
10
10
|
targets: ["SocialLoginPlugin"])
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
13
|
-
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
|
|
14
14
|
// FBSDKCoreKit and FBSDKLoginKit
|
|
15
15
|
.package(url: "https://github.com/facebook/facebook-ios-sdk.git", .upToNextMajor(from: "18.0.0")),
|
|
16
16
|
// Add Google Sign-In dependency
|
package/README.md
CHANGED
|
@@ -359,42 +359,29 @@ If you get this error on App Store Connect:
|
|
|
359
359
|
|
|
360
360
|
**Problem**: After submitting your app to Google Play, you receive this error:
|
|
361
361
|
```
|
|
362
|
-
Google Api Error: Invalid request - This release includes the com.google.android.gms.permission.AD_ID permission
|
|
363
|
-
but your declaration on Play Console says your app doesn't use advertising ID.
|
|
364
|
-
ID declaration.
|
|
362
|
+
Google Api Error: Invalid request - This release includes the com.google.android.gms.permission.AD_ID permission
|
|
363
|
+
but your declaration on Play Console says your app doesn't use advertising ID.
|
|
365
364
|
```
|
|
366
365
|
|
|
367
|
-
**Root Cause**: The Facebook SDK
|
|
366
|
+
**Root Cause**: The Facebook SDK includes `AD_ID` and other advertising-related permissions.
|
|
368
367
|
|
|
369
|
-
**
|
|
368
|
+
**Solution**: If you're not using Facebook login, set `facebook: false` in your `capacitor.config.ts`:
|
|
370
369
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
#### Solution 2: Update Google Play Console Declaration
|
|
384
|
-
In Google Play Console → App content → Data safety:
|
|
385
|
-
1. Select "Yes, my app collects or shares user data"
|
|
386
|
-
2. Under "Data types" → "Device or other IDs" → Select "Advertising ID"
|
|
387
|
-
3. Specify usage purpose (usually "App functionality" and/or "Analytics")
|
|
388
|
-
|
|
389
|
-
#### Solution 3: Conditional Facebook Dependencies (Advanced)
|
|
390
|
-
For advanced users who want to completely exclude Facebook from builds, you can use Gradle's conditional dependencies, but this requires custom build configuration.
|
|
391
|
-
|
|
392
|
-
**Verification**: After implementing Solution 1, run:
|
|
393
|
-
```bash
|
|
394
|
-
./gradlew :app:dependencies --configuration debugRuntimeClasspath | grep facebook
|
|
370
|
+
```typescript
|
|
371
|
+
const config: CapacitorConfig = {
|
|
372
|
+
plugins: {
|
|
373
|
+
SocialLogin: {
|
|
374
|
+
providers: {
|
|
375
|
+
google: true,
|
|
376
|
+
facebook: false, // Completely excludes Facebook SDK and its permissions
|
|
377
|
+
apple: true,
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
};
|
|
395
382
|
```
|
|
396
383
|
|
|
397
|
-
The
|
|
384
|
+
Then run `npx cap sync`. The plugin uses stub classes instead of the real Facebook SDK, so no Facebook dependencies or permissions are included in your build.
|
|
398
385
|
|
|
399
386
|
### Google Sign-In with Family Link Supervised Accounts
|
|
400
387
|
|
|
@@ -430,6 +417,15 @@ await SocialLogin.login({
|
|
|
430
417
|
|
|
431
418
|
**Note**: Other apps like Listonic work with Family Link accounts because they use similar configurations. The default settings may be too restrictive for supervised accounts.
|
|
432
419
|
|
|
420
|
+
## Where to store access tokens?
|
|
421
|
+
|
|
422
|
+
You can use the [@capgo/capacitor-persistent-account](https://github.com/Cap-go/capacitor-persistent-account) plugin for this.
|
|
423
|
+
|
|
424
|
+
This plugin stores data in secure locations for native devices.
|
|
425
|
+
|
|
426
|
+
For Android, it will store data in Android's Account Manager, which provides system-level account management.
|
|
427
|
+
For iOS, it will store data in the Keychain, which is Apple's secure credential storage.
|
|
428
|
+
|
|
433
429
|
## API
|
|
434
430
|
|
|
435
431
|
<docgen-index>
|
package/android/build.gradle
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
ext {
|
|
2
2
|
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.
|
|
4
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.
|
|
5
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
|
|
6
|
+
|
|
7
|
+
// Read provider configuration from gradle.properties (set by hook script)
|
|
8
|
+
// These need to be at ext level so they can be used in sourceSets
|
|
9
|
+
includeFacebook = project.findProperty('socialLogin.facebook.include') ?: 'true'
|
|
6
10
|
}
|
|
7
11
|
|
|
8
12
|
buildscript {
|
|
@@ -11,18 +15,18 @@ buildscript {
|
|
|
11
15
|
mavenCentral()
|
|
12
16
|
}
|
|
13
17
|
dependencies {
|
|
14
|
-
classpath 'com.android.tools.build:gradle:8.
|
|
18
|
+
classpath 'com.android.tools.build:gradle:8.13.0'
|
|
15
19
|
}
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
apply plugin: 'com.android.library'
|
|
19
23
|
|
|
20
24
|
android {
|
|
21
|
-
namespace "ee.forgr.capacitor.social.login"
|
|
22
|
-
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
25
|
+
namespace = "ee.forgr.capacitor.social.login"
|
|
26
|
+
compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
|
|
23
27
|
defaultConfig {
|
|
24
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
25
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
28
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
|
|
29
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
|
|
26
30
|
versionCode 1
|
|
27
31
|
versionName "1.0"
|
|
28
32
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -34,12 +38,21 @@ android {
|
|
|
34
38
|
}
|
|
35
39
|
}
|
|
36
40
|
lintOptions {
|
|
37
|
-
abortOnError false
|
|
41
|
+
abortOnError = false
|
|
38
42
|
}
|
|
39
43
|
compileOptions {
|
|
40
44
|
sourceCompatibility JavaVersion.VERSION_21
|
|
41
45
|
targetCompatibility JavaVersion.VERSION_21
|
|
42
46
|
}
|
|
47
|
+
|
|
48
|
+
// Conditionally include Facebook stub classes when Facebook is disabled
|
|
49
|
+
sourceSets {
|
|
50
|
+
main {
|
|
51
|
+
if (includeFacebook != 'true') {
|
|
52
|
+
java.srcDirs += 'src/facebookStubs/java'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
43
56
|
}
|
|
44
57
|
|
|
45
58
|
repositories {
|
|
@@ -62,8 +75,7 @@ dependencies {
|
|
|
62
75
|
def googleDependencyType = project.findProperty('socialLogin.google.dependencyType') ?: 'implementation'
|
|
63
76
|
def includeGoogle = project.findProperty('socialLogin.google.include') ?: 'true'
|
|
64
77
|
|
|
65
|
-
|
|
66
|
-
def includeFacebook = project.findProperty('socialLogin.facebook.include') ?: 'true'
|
|
78
|
+
// Note: includeFacebook is defined in ext block at the top
|
|
67
79
|
|
|
68
80
|
def appleDependencyType = project.findProperty('socialLogin.apple.dependencyType') ?: 'implementation'
|
|
69
81
|
def includeApple = project.findProperty('socialLogin.apple.include') ?: 'true'
|
|
@@ -85,11 +97,12 @@ dependencies {
|
|
|
85
97
|
}
|
|
86
98
|
|
|
87
99
|
// Facebook dependencies
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
} else if (includeFacebook == 'true') {
|
|
100
|
+
// When Facebook is disabled, stub classes from src/facebookStubs are used instead
|
|
101
|
+
if (includeFacebook == 'true') {
|
|
91
102
|
implementation 'com.facebook.android:facebook-login:18.1.3'
|
|
92
103
|
}
|
|
104
|
+
// When includeFacebook != 'true', no Facebook SDK is included
|
|
105
|
+
// and the stub classes provide the necessary API for compilation
|
|
93
106
|
|
|
94
107
|
// Apple dependencies
|
|
95
108
|
if (appleDependencyType == 'compileOnly') {
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
package com.facebook;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import java.util.Collection;
|
|
5
|
+
import java.util.Collections;
|
|
6
|
+
import java.util.Date;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Stub class for Facebook AccessToken.
|
|
10
|
+
* This is used when Facebook login is disabled to allow compilation without the Facebook SDK.
|
|
11
|
+
*/
|
|
12
|
+
public class AccessToken {
|
|
13
|
+
|
|
14
|
+
@Nullable
|
|
15
|
+
public static AccessToken getCurrentAccessToken() {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public static void refreshCurrentAccessTokenAsync(AccessTokenRefreshCallback callback) {
|
|
20
|
+
if (callback != null) {
|
|
21
|
+
callback.OnTokenRefreshFailed(null);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public String getToken() {
|
|
26
|
+
return "";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public String getApplicationId() {
|
|
30
|
+
return "";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public String getUserId() {
|
|
34
|
+
return "";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public Date getExpires() {
|
|
38
|
+
return new Date();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public Date getLastRefresh() {
|
|
42
|
+
return new Date();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public boolean isExpired() {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public boolean isDataAccessExpired() {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public Collection<String> getPermissions() {
|
|
54
|
+
return Collections.emptyList();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public Collection<String> getDeclinedPermissions() {
|
|
58
|
+
return Collections.emptyList();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public interface AccessTokenRefreshCallback {
|
|
62
|
+
void OnTokenRefreshed(@Nullable AccessToken accessToken);
|
|
63
|
+
void OnTokenRefreshFailed(@Nullable FacebookException e);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
package com.facebook;
|
|
2
|
+
|
|
3
|
+
import android.content.Intent;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Stub class for Facebook CallbackManager.
|
|
7
|
+
* This is used when Facebook login is disabled to allow compilation without the Facebook SDK.
|
|
8
|
+
*/
|
|
9
|
+
public interface CallbackManager {
|
|
10
|
+
boolean onActivityResult(int requestCode, int resultCode, Intent data);
|
|
11
|
+
|
|
12
|
+
class Factory {
|
|
13
|
+
|
|
14
|
+
public static CallbackManager create() {
|
|
15
|
+
return new CallbackManager() {
|
|
16
|
+
@Override
|
|
17
|
+
public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
package com.facebook;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Stub interface for Facebook FacebookCallback.
|
|
5
|
+
* This is used when Facebook login is disabled to allow compilation without the Facebook SDK.
|
|
6
|
+
*/
|
|
7
|
+
public interface FacebookCallback<RESULT> {
|
|
8
|
+
void onSuccess(RESULT result);
|
|
9
|
+
void onCancel();
|
|
10
|
+
void onError(FacebookException error);
|
|
11
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
package com.facebook;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Stub class for Facebook FacebookException.
|
|
5
|
+
* This is used when Facebook login is disabled to allow compilation without the Facebook SDK.
|
|
6
|
+
*/
|
|
7
|
+
public class FacebookException extends RuntimeException {
|
|
8
|
+
|
|
9
|
+
public FacebookException() {
|
|
10
|
+
super();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public FacebookException(String message) {
|
|
14
|
+
super(message);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public FacebookException(String message, Throwable cause) {
|
|
18
|
+
super(message, cause);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public FacebookException(Throwable cause) {
|
|
22
|
+
super(cause);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.facebook;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Stub class for Facebook FacebookSdk.
|
|
7
|
+
* This is used when Facebook login is disabled to allow compilation without the Facebook SDK.
|
|
8
|
+
*/
|
|
9
|
+
public class FacebookSdk {
|
|
10
|
+
|
|
11
|
+
public static void setApplicationId(String applicationId) {
|
|
12
|
+
// Stub - no-op
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public static void setClientToken(String clientToken) {
|
|
16
|
+
// Stub - no-op
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public static void sdkInitialize(Context context) {
|
|
20
|
+
// Stub - no-op
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
package com.facebook;
|
|
2
|
+
|
|
3
|
+
import android.os.Bundle;
|
|
4
|
+
import androidx.annotation.Nullable;
|
|
5
|
+
import org.json.JSONObject;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Stub class for Facebook GraphRequest.
|
|
9
|
+
* This is used when Facebook login is disabled to allow compilation without the Facebook SDK.
|
|
10
|
+
*/
|
|
11
|
+
public class GraphRequest {
|
|
12
|
+
|
|
13
|
+
private Bundle parameters;
|
|
14
|
+
private Callback callback;
|
|
15
|
+
|
|
16
|
+
public static GraphRequest newMeRequest(AccessToken accessToken, GraphJSONObjectCallback callback) {
|
|
17
|
+
GraphRequest request = new GraphRequest();
|
|
18
|
+
request.callback = new Callback() {
|
|
19
|
+
@Override
|
|
20
|
+
public void onCompleted(GraphResponse response) {
|
|
21
|
+
if (callback != null) {
|
|
22
|
+
callback.onCompleted(null, response);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return request;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public void setParameters(Bundle parameters) {
|
|
30
|
+
this.parameters = parameters;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public void executeAsync() {
|
|
34
|
+
// Stub - no-op, just call callback with empty response
|
|
35
|
+
if (callback != null) {
|
|
36
|
+
GraphResponse response = new GraphResponse();
|
|
37
|
+
callback.onCompleted(response);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public void executeAndWait() {
|
|
42
|
+
// Stub - no-op, just call callback with empty response
|
|
43
|
+
if (callback != null) {
|
|
44
|
+
GraphResponse response = new GraphResponse();
|
|
45
|
+
callback.onCompleted(response);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public interface Callback {
|
|
50
|
+
void onCompleted(GraphResponse response);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public interface GraphJSONObjectCallback {
|
|
54
|
+
void onCompleted(@Nullable JSONObject object, @Nullable GraphResponse response);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
package com.facebook;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Stub class for Facebook GraphResponse.
|
|
7
|
+
* This is used when Facebook login is disabled to allow compilation without the Facebook SDK.
|
|
8
|
+
*/
|
|
9
|
+
public class GraphResponse {
|
|
10
|
+
|
|
11
|
+
@Nullable
|
|
12
|
+
public FacebookRequestError getError() {
|
|
13
|
+
return new FacebookRequestError();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public static class FacebookRequestError {
|
|
17
|
+
|
|
18
|
+
public String getErrorMessage() {
|
|
19
|
+
return "Facebook SDK is not available (stub)";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public Exception getException() {
|
|
23
|
+
return new FacebookException("Facebook SDK is not available (stub)");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
package com.facebook.login;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Stub enum for Facebook LoginBehavior.
|
|
5
|
+
* This is used when Facebook login is disabled to allow compilation without the Facebook SDK.
|
|
6
|
+
*/
|
|
7
|
+
public enum LoginBehavior {
|
|
8
|
+
NATIVE_WITH_FALLBACK,
|
|
9
|
+
NATIVE_ONLY,
|
|
10
|
+
KATANA_ONLY,
|
|
11
|
+
WEB_ONLY,
|
|
12
|
+
WEB_VIEW_ONLY,
|
|
13
|
+
DEVICE_AUTH
|
|
14
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
package com.facebook.login;
|
|
2
|
+
|
|
3
|
+
import androidx.activity.result.ActivityResultRegistryOwner;
|
|
4
|
+
import com.facebook.CallbackManager;
|
|
5
|
+
import com.facebook.FacebookCallback;
|
|
6
|
+
import java.util.Collection;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Stub class for Facebook LoginManager.
|
|
10
|
+
* This is used when Facebook login is disabled to allow compilation without the Facebook SDK.
|
|
11
|
+
*/
|
|
12
|
+
public class LoginManager {
|
|
13
|
+
|
|
14
|
+
private static final LoginManager instance = new LoginManager();
|
|
15
|
+
|
|
16
|
+
public static LoginManager getInstance() {
|
|
17
|
+
return instance;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public void registerCallback(CallbackManager callbackManager, FacebookCallback<LoginResult> callback) {
|
|
21
|
+
// Stub - no-op
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public void setLoginBehavior(LoginBehavior loginBehavior) {
|
|
25
|
+
// Stub - no-op
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public void logIn(
|
|
29
|
+
ActivityResultRegistryOwner activityResultRegistryOwner,
|
|
30
|
+
CallbackManager callbackManager,
|
|
31
|
+
Collection<String> permissions
|
|
32
|
+
) {
|
|
33
|
+
// Stub - no-op
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public void logIn(
|
|
37
|
+
ActivityResultRegistryOwner activityResultRegistryOwner,
|
|
38
|
+
CallbackManager callbackManager,
|
|
39
|
+
Collection<String> permissions,
|
|
40
|
+
String nonce
|
|
41
|
+
) {
|
|
42
|
+
// Stub - no-op
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public void logOut() {
|
|
46
|
+
// Stub - no-op
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package com.facebook.login;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
import com.facebook.AccessToken;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Stub class for Facebook LoginResult.
|
|
8
|
+
* This is used when Facebook login is disabled to allow compilation without the Facebook SDK.
|
|
9
|
+
*/
|
|
10
|
+
public class LoginResult {
|
|
11
|
+
|
|
12
|
+
@Nullable
|
|
13
|
+
public AccessToken getAccessToken() {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@Nullable
|
|
18
|
+
public AuthenticationToken getAuthenticationToken() {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public static class AuthenticationToken {
|
|
23
|
+
|
|
24
|
+
public String getToken() {
|
|
25
|
+
return "";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
xmlns:tools="http://schemas.android.com/tools">
|
|
3
3
|
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
|
|
4
4
|
<uses-permission android:name="android.permission.INTERNET"/>
|
|
5
|
-
|
|
6
|
-
<!-- Remove AD_ID permission if you're not using Facebook login to avoid Google Play Console errors -->
|
|
7
|
-
<!-- Uncomment the line below if you're only using Google/Apple login and getting AD_ID permission errors -->
|
|
8
|
-
<!-- <uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove" /> -->
|
|
9
|
-
|
|
5
|
+
|
|
10
6
|
<application>
|
|
11
|
-
<provider
|
|
7
|
+
<provider
|
|
12
8
|
android:name="com.facebook.internal.FacebookInitProvider"
|
|
13
9
|
android:authorities="${applicationId}.FacebookInitProvider"
|
|
14
10
|
android:exported="false"
|
|
@@ -19,7 +19,7 @@ import org.json.JSONObject;
|
|
|
19
19
|
@CapacitorPlugin(name = "SocialLogin")
|
|
20
20
|
public class SocialLoginPlugin extends Plugin {
|
|
21
21
|
|
|
22
|
-
private final String pluginVersion = "
|
|
22
|
+
private final String pluginVersion = "8.1.1";
|
|
23
23
|
|
|
24
24
|
public static String LOG_TAG = "CapgoSocialLogin";
|
|
25
25
|
|
|
@@ -15,7 +15,7 @@ import GoogleSignIn
|
|
|
15
15
|
*/
|
|
16
16
|
@objc(SocialLoginPlugin)
|
|
17
17
|
public class SocialLoginPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
18
|
-
private let pluginVersion: String = "
|
|
18
|
+
private let pluginVersion: String = "8.1.1"
|
|
19
19
|
public let identifier = "SocialLoginPlugin"
|
|
20
20
|
public let jsName = "SocialLogin"
|
|
21
21
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
@@ -599,12 +599,16 @@ public class SocialLoginPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
599
599
|
"familyName": appleResponse.profile.familyName ?? ""
|
|
600
600
|
]
|
|
601
601
|
|
|
602
|
-
|
|
602
|
+
var appleResult: [String: Any] = [
|
|
603
603
|
"accessToken": accessTokenObject ?? NSNull(),
|
|
604
604
|
"profile": profileObject,
|
|
605
605
|
"idToken": appleResponse.idToken ?? ""
|
|
606
606
|
]
|
|
607
607
|
|
|
608
|
+
if let authorizationCode = appleResponse.authorizationCode {
|
|
609
|
+
appleResult["authorizationCode"] = authorizationCode
|
|
610
|
+
}
|
|
611
|
+
|
|
608
612
|
call.resolve([
|
|
609
613
|
"provider": "apple",
|
|
610
614
|
"result": appleResult
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/capacitor-social-login",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.1.1",
|
|
4
4
|
"description": "All social logins in one plugin",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"unpkg": "dist/plugin.js",
|
|
9
9
|
"files": [
|
|
10
10
|
"android/src/main/",
|
|
11
|
+
"android/src/facebookStubs/",
|
|
11
12
|
"android/build.gradle",
|
|
12
13
|
"dist/",
|
|
13
14
|
"ios/Sources",
|
|
@@ -58,25 +59,25 @@
|
|
|
58
59
|
"prepublishOnly": "npm run build"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
|
-
"@capacitor/android": "^
|
|
62
|
-
"@capacitor/docgen": "^0.3.
|
|
63
|
-
"@capacitor/ios": "^
|
|
62
|
+
"@capacitor/android": "^8.0.0",
|
|
63
|
+
"@capacitor/docgen": "^0.3.1",
|
|
64
|
+
"@capacitor/ios": "^8.0.0",
|
|
64
65
|
"@ionic/eslint-config": "^0.4.0",
|
|
65
66
|
"@ionic/prettier-config": "^4.0.0",
|
|
66
67
|
"@ionic/swiftlint-config": "^2.0.0",
|
|
67
68
|
"@types/google.accounts": "^0.0.18",
|
|
68
|
-
"@types/node": "^
|
|
69
|
-
"eslint": "^8.57.
|
|
69
|
+
"@types/node": "^24.10.1",
|
|
70
|
+
"eslint": "^8.57.1",
|
|
70
71
|
"eslint-plugin-import": "^2.31.0",
|
|
71
|
-
"prettier": "^3.
|
|
72
|
-
"prettier-plugin-java": "^2.
|
|
73
|
-
"rimraf": "^6.0
|
|
74
|
-
"rollup": "^4.
|
|
72
|
+
"prettier": "^3.6.2",
|
|
73
|
+
"prettier-plugin-java": "^2.7.7",
|
|
74
|
+
"rimraf": "^6.1.0",
|
|
75
|
+
"rollup": "^4.53.2",
|
|
75
76
|
"swiftlint": "^2.0.0",
|
|
76
|
-
"typescript": "5.9.3"
|
|
77
|
+
"typescript": "^5.9.3"
|
|
77
78
|
},
|
|
78
79
|
"peerDependencies": {
|
|
79
|
-
"@capacitor/core": ">=
|
|
80
|
+
"@capacitor/core": ">=8.0.0"
|
|
80
81
|
},
|
|
81
82
|
"prettier": "@ionic/prettier-config",
|
|
82
83
|
"swiftlint": "@ionic/swiftlint-config",
|