@capgo/capacitor-social-login 7.19.1 → 7.20.0-beta.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.
- package/CapgoCapacitorSocialLogin.podspec +2 -0
- package/README.md +79 -30
- package/android/build.gradle +60 -6
- package/android/gradle.properties +34 -0
- 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 +25 -0
- package/android/src/facebookStubs/java/com/facebook/login/LoginBehavior.java +14 -0
- package/android/src/facebookStubs/java/com/facebook/login/LoginManager.java +39 -0
- package/android/src/facebookStubs/java/com/facebook/login/LoginResult.java +27 -0
- package/android/src/main/AndroidManifest.xml +2 -6
- package/android/src/main/java/ee/forgr/capacitor/social/login/AppleProvider.java +54 -13
- package/android/src/main/java/ee/forgr/capacitor/social/login/SocialLoginPlugin.java +92 -6
- package/android/src/main/java/ee/forgr/capacitor/social/login/helpers/DependencyAvailabilityChecker.java +287 -0
- package/dist/esm/twitter-provider.js +1 -0
- package/dist/esm/twitter-provider.js.map +1 -1
- package/dist/plugin.cjs.js +1 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +1 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/SocialLoginPlugin/AppleProvider.swift +35 -0
- package/ios/Sources/SocialLoginPlugin/FacebookProvider.swift +43 -3
- package/ios/Sources/SocialLoginPlugin/GoogleProvider.swift +32 -0
- package/ios/Sources/SocialLoginPlugin/SocialLoginPlugin.swift +215 -22
- package/package.json +9 -4
- package/scripts/configure-dependencies.js +352 -0
|
@@ -14,6 +14,8 @@ Pod::Spec.new do |s|
|
|
|
14
14
|
s.exclude_files = '**/node_modules/**/*', '**/examples/**/*'
|
|
15
15
|
s.ios.deployment_target = '14.0'
|
|
16
16
|
s.dependency 'Capacitor'
|
|
17
|
+
# Provider dependencies (conditionally included via hook script)
|
|
18
|
+
# Hook script modifies these lines based on capacitor.config.ts
|
|
17
19
|
s.dependency 'FBSDKCoreKit', '18.0.0'
|
|
18
20
|
s.dependency 'FBSDKLoginKit', '18.0.0'
|
|
19
21
|
s.dependency 'GoogleSignIn', '~> 9.0.0'
|
package/README.md
CHANGED
|
@@ -37,6 +37,68 @@ npm install @capgo/capacitor-social-login
|
|
|
37
37
|
npx cap sync
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
## Dynamic Provider Dependencies
|
|
41
|
+
|
|
42
|
+
You can configure which providers to include to reduce app size. This is especially useful if you only need specific providers.
|
|
43
|
+
|
|
44
|
+
### Configuration
|
|
45
|
+
|
|
46
|
+
Add provider configuration to your `capacitor.config.ts`:
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import type { CapacitorConfig } from '@capacitor/cli';
|
|
50
|
+
|
|
51
|
+
const config: CapacitorConfig = {
|
|
52
|
+
appId: 'com.example.app',
|
|
53
|
+
appName: 'MyApp',
|
|
54
|
+
webDir: 'dist',
|
|
55
|
+
plugins: {
|
|
56
|
+
SocialLogin: {
|
|
57
|
+
providers: {
|
|
58
|
+
google: true, // true = enabled (bundled), false = disabled (not bundled)
|
|
59
|
+
facebook: true, // Use false to reduce app size
|
|
60
|
+
apple: true, // Apple uses system APIs, no external deps
|
|
61
|
+
twitter: false // false = disabled (not bundled)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default config;
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Provider Configuration
|
|
71
|
+
|
|
72
|
+
- **`true`** (default): Provider is enabled - dependencies are bundled in final APK/IPA
|
|
73
|
+
- **`false`**: Provider is disabled - dependencies are not bundled in final APK/IPA
|
|
74
|
+
|
|
75
|
+
### Notes
|
|
76
|
+
|
|
77
|
+
- Changes require running `npx cap sync` to take effect
|
|
78
|
+
- If configuration is not provided, all providers default to `true` (enabled, backward compatible)
|
|
79
|
+
- **Important**: Disabling a provider (`false`) will make it unavailable at runtime, regardless of whether it actually adds any dependencies. The provider will be disabled even if it uses only system APIs.
|
|
80
|
+
- This configuration only affects iOS and Android platforms; it does not affect the web platform.
|
|
81
|
+
- **Important**: Using `false` means the dependency won't be bundled, but the plugin code still compiles against it. Ensure the consuming app includes the dependency if needed.
|
|
82
|
+
- Apple Sign-In on Android uses OAuth flow without external SDK dependencies
|
|
83
|
+
- Twitter uses standard OAuth 2.0 flow without external SDK dependencies
|
|
84
|
+
|
|
85
|
+
### Example: Reduce App Size
|
|
86
|
+
|
|
87
|
+
To only include Google Sign-In and disable others:
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
plugins: {
|
|
91
|
+
SocialLogin: {
|
|
92
|
+
providers: {
|
|
93
|
+
google: true, // Enabled
|
|
94
|
+
facebook: false, // Disabled (not bundled)
|
|
95
|
+
apple: true, // Enabled
|
|
96
|
+
twitter: false // Disabled (not bundled)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
40
102
|
## Apple
|
|
41
103
|
|
|
42
104
|
[How to get the credentials](https://github.com/Cap-go/capacitor-social-login/blob/main/docs/setup_apple.md)
|
|
@@ -297,42 +359,29 @@ If you get this error on App Store Connect:
|
|
|
297
359
|
|
|
298
360
|
**Problem**: After submitting your app to Google Play, you receive this error:
|
|
299
361
|
```
|
|
300
|
-
Google Api Error: Invalid request - This release includes the com.google.android.gms.permission.AD_ID permission
|
|
301
|
-
but your declaration on Play Console says your app doesn't use advertising ID.
|
|
302
|
-
ID declaration.
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
**Root Cause**: The Facebook SDK automatically includes the `com.google.android.gms.permission.AD_ID` permission, even when you're only using Google and Apple sign-in.
|
|
306
|
-
|
|
307
|
-
**Solutions**:
|
|
308
|
-
|
|
309
|
-
#### Solution 1: Remove AD_ID Permission (Recommended)
|
|
310
|
-
If you're not using Facebook login, add this to your app's `android/app/src/main/AndroidManifest.xml`:
|
|
311
|
-
```xml
|
|
312
|
-
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove" />
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
Make sure you have the tools namespace declared:
|
|
316
|
-
```xml
|
|
317
|
-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
318
|
-
xmlns:tools="http://schemas.android.com/tools">
|
|
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.
|
|
319
364
|
```
|
|
320
365
|
|
|
321
|
-
|
|
322
|
-
In Google Play Console → App content → Data safety:
|
|
323
|
-
1. Select "Yes, my app collects or shares user data"
|
|
324
|
-
2. Under "Data types" → "Device or other IDs" → Select "Advertising ID"
|
|
325
|
-
3. Specify usage purpose (usually "App functionality" and/or "Analytics")
|
|
366
|
+
**Root Cause**: The Facebook SDK includes `AD_ID` and other advertising-related permissions.
|
|
326
367
|
|
|
327
|
-
|
|
328
|
-
For advanced users who want to completely exclude Facebook from builds, you can use Gradle's conditional dependencies, but this requires custom build configuration.
|
|
368
|
+
**Solution**: If you're not using Facebook login, set `facebook: false` in your `capacitor.config.ts`:
|
|
329
369
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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
|
+
};
|
|
333
382
|
```
|
|
334
383
|
|
|
335
|
-
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.
|
|
336
385
|
|
|
337
386
|
### Google Sign-In with Family Link Supervised Accounts
|
|
338
387
|
|
package/android/build.gradle
CHANGED
|
@@ -3,6 +3,10 @@ ext {
|
|
|
3
3
|
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
|
|
4
4
|
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
|
|
5
5
|
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
|
|
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 {
|
|
@@ -40,6 +44,15 @@ android {
|
|
|
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 {
|
|
@@ -49,19 +62,60 @@ repositories {
|
|
|
49
62
|
|
|
50
63
|
|
|
51
64
|
dependencies {
|
|
65
|
+
// Common dependencies (always included)
|
|
52
66
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
53
67
|
implementation project(':capacitor-android')
|
|
54
68
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
55
|
-
implementation 'com.facebook.android:facebook-login:18.1.3'
|
|
56
69
|
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
|
57
70
|
implementation 'com.auth0.android:jwtdecode:2.0.2'
|
|
58
71
|
implementation "androidx.credentials:credentials:1.5.0"
|
|
59
|
-
implementation '
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
72
|
+
implementation 'androidx.concurrent:concurrent-futures:1.3.0'
|
|
73
|
+
|
|
74
|
+
// Read provider configuration from gradle.properties (set by hook script)
|
|
75
|
+
def googleDependencyType = project.findProperty('socialLogin.google.dependencyType') ?: 'implementation'
|
|
76
|
+
def includeGoogle = project.findProperty('socialLogin.google.include') ?: 'true'
|
|
77
|
+
|
|
78
|
+
// Note: includeFacebook is defined in ext block at the top
|
|
79
|
+
|
|
80
|
+
def appleDependencyType = project.findProperty('socialLogin.apple.dependencyType') ?: 'implementation'
|
|
81
|
+
def includeApple = project.findProperty('socialLogin.apple.include') ?: 'true'
|
|
82
|
+
|
|
83
|
+
def twitterDependencyType = project.findProperty('socialLogin.twitter.dependencyType') ?: 'implementation'
|
|
84
|
+
def includeTwitter = project.findProperty('socialLogin.twitter.include') ?: 'true'
|
|
85
|
+
|
|
86
|
+
// Google dependencies
|
|
87
|
+
if (googleDependencyType == 'compileOnly') {
|
|
88
|
+
compileOnly 'com.google.android.gms:play-services-auth:21.4.0'
|
|
89
|
+
compileOnly "androidx.credentials:credentials-play-services-auth:1.5.0"
|
|
90
|
+
compileOnly "com.google.android.libraries.identity.googleid:googleid:1.1.1"
|
|
91
|
+
compileOnly 'com.google.androidbrowserhelper:androidbrowserhelper:2.5.0'
|
|
92
|
+
} else if (includeGoogle == 'true') {
|
|
93
|
+
implementation 'com.google.android.gms:play-services-auth:21.4.0'
|
|
94
|
+
implementation "androidx.credentials:credentials-play-services-auth:1.5.0"
|
|
95
|
+
implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1"
|
|
96
|
+
implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.5.0'
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Facebook dependencies
|
|
100
|
+
// When Facebook is disabled, stub classes from src/facebookStubs are used instead
|
|
101
|
+
if (includeFacebook == 'true') {
|
|
102
|
+
implementation 'com.facebook.android:facebook-login:18.1.3'
|
|
103
|
+
}
|
|
104
|
+
// When includeFacebook != 'true', no Facebook SDK is included
|
|
105
|
+
// and the stub classes provide the necessary API for compilation
|
|
106
|
+
|
|
107
|
+
// Apple dependencies
|
|
108
|
+
if (appleDependencyType == 'compileOnly') {
|
|
109
|
+
compileOnly "androidx.browser:browser:1.9.0"
|
|
110
|
+
} else if (includeApple == 'true') {
|
|
111
|
+
implementation "androidx.browser:browser:1.9.0"
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Twitter dependencies (uses OAuth flow, no external SDK)
|
|
115
|
+
// Twitter uses standard OAuth 2.0 flow without external dependencies
|
|
116
|
+
|
|
117
|
+
// Test dependencies (always included)
|
|
63
118
|
testImplementation "junit:junit:$junitVersion"
|
|
64
119
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
65
120
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
66
|
-
implementation 'androidx.concurrent:concurrent-futures:1.3.0'
|
|
67
121
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Project-wide Gradle settings.
|
|
2
|
+
|
|
3
|
+
# IDE (e.g. Android Studio) users:
|
|
4
|
+
# Gradle settings configured through the IDE *will override*
|
|
5
|
+
# any settings specified in this file.
|
|
6
|
+
|
|
7
|
+
# For more details on how to configure your build environment visit
|
|
8
|
+
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
|
9
|
+
|
|
10
|
+
# Specifies the JVM arguments used for the daemon process.
|
|
11
|
+
# The setting is particularly useful for tweaking memory settings.
|
|
12
|
+
org.gradle.jvmargs=-Xmx1536m
|
|
13
|
+
|
|
14
|
+
# When configured, Gradle will run in incubating parallel mode.
|
|
15
|
+
# This option should only be used with decoupled projects. More details, visit
|
|
16
|
+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
|
17
|
+
# org.gradle.parallel=true
|
|
18
|
+
|
|
19
|
+
# AndroidX package structure to make it clearer which packages are bundled with the
|
|
20
|
+
# Android operating system, and which are packaged with your app's APK
|
|
21
|
+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
|
22
|
+
android.useAndroidX=true
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# SocialLogin Provider Dependencies (auto-generated)
|
|
26
|
+
# Generated by SocialLogin hook script
|
|
27
|
+
socialLogin.google.include=true
|
|
28
|
+
socialLogin.google.dependencyType=implementation
|
|
29
|
+
socialLogin.facebook.include=true
|
|
30
|
+
socialLogin.facebook.dependencyType=implementation
|
|
31
|
+
socialLogin.apple.include=true
|
|
32
|
+
socialLogin.apple.dependencyType=implementation
|
|
33
|
+
socialLogin.twitter.include=true
|
|
34
|
+
socialLogin.twitter.dependencyType=implementation
|
|
@@ -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
|
+
|
|
11
|
+
boolean onActivityResult(int requestCode, int resultCode, Intent data);
|
|
12
|
+
|
|
13
|
+
class Factory {
|
|
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,25 @@
|
|
|
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
|
+
public String getErrorMessage() {
|
|
18
|
+
return "Facebook SDK is not available (stub)";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public Exception getException() {
|
|
22
|
+
return new FacebookException("Facebook SDK is not available (stub)");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -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,39 @@
|
|
|
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(ActivityResultRegistryOwner activityResultRegistryOwner, CallbackManager callbackManager, Collection<String> permissions) {
|
|
29
|
+
// Stub - no-op
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public void logIn(ActivityResultRegistryOwner activityResultRegistryOwner, CallbackManager callbackManager, Collection<String> permissions, String nonce) {
|
|
33
|
+
// Stub - no-op
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public void logOut() {
|
|
37
|
+
// Stub - no-op
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
public String getToken() {
|
|
24
|
+
return "";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -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"
|