Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #196 configuration not loaded on Android #197

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CapacitorFirebaseAuth.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Pod::Spec.new do |s|
s.name = 'CapacitorFirebaseAuth'
s.version = '3.0.0-rc.0'
s.version = '3.1.2-rc.3'
s.summary = 'Capacitor plugin for Firebase Authentication'
s.license = 'MIT'
s.homepage = 'https://github.com/baumblatt/capacitor-firebase-auth.git'
Expand Down
13 changes: 13 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,19 @@ Since that Apple using Push Notification service (APNs). You need to have `.p8`

...

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

ApplicationDelegate.shared.application(
application,
didFinishLaunchingWithOptions: launchOptions
)

return true
}

...

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
// Called when the app was launched with a url. Feel free to add additional processing here,
// but if you want the App API to support tracking app url opens, make sure to keep this call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class CapacitorFirebaseAuth extends Plugin {
private CapConfig config;

public PluginConfig getConfig() {
return this.config.getPluginConfiguration("plugins.CapacitorFirebaseAuth");
return this.config.getPluginConfiguration("CapacitorFirebaseAuth");
}

public void load() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class AppleProviderHandler implements ProviderHandler, OnSuccessListener<
public void init(CapacitorFirebaseAuth plugin) {
this.plugin = plugin;

String languageCode = this.plugin.getConfig().getString(CapacitorFirebaseAuth.CONFIG_KEY_PREFIX +"languageCode", "en");
String languageCode = this.plugin.getConfig().getString("languageCode", "en");

this.provider = OAuthProvider.newBuilder("apple.com");
this.provider.addCustomParameter("lang", languageCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

import com.auth0.android.jwt.JWT;

import static com.baumblatt.capacitor.firebase.auth.CapacitorFirebaseAuth.CONFIG_KEY_PREFIX;

public class GoogleProviderHandler implements ProviderHandler {
public static final int RC_GOOGLE_SIGN_IN = 9001;
private static final String GOOGLE_TAG = "GoogleProviderHandler";
Expand All @@ -38,7 +36,7 @@ public class GoogleProviderHandler implements ProviderHandler {
public void init(CapacitorFirebaseAuth plugin) {
this.plugin = plugin;

String[] permissions = this.plugin.getConfig().getArray(CONFIG_KEY_PREFIX + "permissions.google", new String[0]);
String[] permissions = this.plugin.getConfig().getArray("permissions.google", new String[0]);

GoogleApiAvailability googleAPI = GoogleApiAvailability.getInstance();
int result = googleAPI.isGooglePlayServicesAvailable(this.plugin.getContext());
Expand All @@ -60,7 +58,7 @@ public void init(CapacitorFirebaseAuth plugin) {
}
}

String hostedDomain = this.plugin.getConfig().getString(CONFIG_KEY_PREFIX + "properties.google.hostedDomain");
String hostedDomain = this.plugin.getConfig().getString("properties.google.hostedDomain");

if (hostedDomain != null) {
gsBuilder.setHostedDomain(hostedDomain);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class TwitterProviderHandler implements ProviderHandler, OnSuccessListene
public void init(CapacitorFirebaseAuth plugin) {
this.plugin = plugin;

String languageCode = this.plugin.getConfig().getString(CapacitorFirebaseAuth.CONFIG_KEY_PREFIX +"languageCode", "en");
String languageCode = this.plugin.getConfig().getString("languageCode", "en");

this.provider = OAuthProvider.newBuilder("twitter.com");
this.provider.addCustomParameter("lang", languageCode);
Expand Down
78 changes: 26 additions & 52 deletions ios/Plugin.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
DA34D39B22328D9400326C50 /* ProviderHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA34D39A22328D9400326C50 /* ProviderHandler.swift */; };
DA34D39D22328E4900326C50 /* GoogleProviderHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA34D39C22328E4900326C50 /* GoogleProviderHandler.swift */; };
DA8E24E4223977D60030886C /* TwitterProviderHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA8E24E3223977D60030886C /* TwitterProviderHandler.swift */; };
DACBFA2626C755CF001496FB /* AppleProviderHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DACBFA2526C755CF001496FB /* AppleProviderHandler.swift */; };
DAF56119224A506B00751B26 /* PhoneNumberProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAF56118224A506B00751B26 /* PhoneNumberProvider.swift */; };
DAFD89D6223ED7D20082332B /* FacebookProviderHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAFD89D5223ED7D20082332B /* FacebookProviderHandler.swift */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -51,6 +52,7 @@
DA5BC0DB22338541006F86D1 /* Plugin-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Plugin-Bridging-Header.h"; sourceTree = "<group>"; };
DA5BC0DE2236BDDB006F86D1 /* FirebaseCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = FirebaseCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DA8E24E3223977D60030886C /* TwitterProviderHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwitterProviderHandler.swift; sourceTree = "<group>"; };
DACBFA2526C755CF001496FB /* AppleProviderHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppleProviderHandler.swift; sourceTree = "<group>"; };
DAF56118224A506B00751B26 /* PhoneNumberProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhoneNumberProvider.swift; sourceTree = "<group>"; };
DAFD89D5223ED7D20082332B /* FacebookProviderHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FacebookProviderHandler.swift; sourceTree = "<group>"; };
F65BB2953ECE002E1EF3E424 /* Pods-PluginTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PluginTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.release.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -146,6 +148,7 @@
DA34D39922328C8000326C50 /* Handlers */ = {
isa = PBXGroup;
children = (
DACBFA2526C755CF001496FB /* AppleProviderHandler.swift */,
DAFD89D5223ED7D20082332B /* FacebookProviderHandler.swift */,
DA34D39A22328D9400326C50 /* ProviderHandler.swift */,
DA34D39C22328E4900326C50 /* GoogleProviderHandler.swift */,
Expand Down Expand Up @@ -178,7 +181,6 @@
50ADFF84201F53D600D50D53 /* Frameworks */,
50ADFF85201F53D600D50D53 /* Headers */,
50ADFF86201F53D600D50D53 /* Resources */,
AE646EB3107D841B880D174A /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -198,7 +200,6 @@
50ADFF8E201F53D600D50D53 /* Frameworks */,
50ADFF8F201F53D600D50D53 /* Resources */,
CCA81D3B7E26D0D727D24C84 /* [CP] Embed Pods Frameworks */,
32BFB60F8ADE8D433EDE204C /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -285,26 +286,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
32BFB60F8ADE8D433EDE204C /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-PluginTests/Pods-PluginTests-resources.sh",
"${PODS_ROOT}/GoogleSignIn/Resources/GoogleSignIn.bundle",
"${PODS_ROOT}/TwitterKit/iOS/TwitterKit.framework/TwitterKitResources.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleSignIn.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/TwitterKitResources.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-PluginTests/Pods-PluginTests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
AB5B3E54B4E897F32C2279DA /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -323,59 +304,51 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
AE646EB3107D841B880D174A /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Plugin/Pods-Plugin-resources.sh",
"${PODS_ROOT}/GoogleSignIn/Resources/GoogleSignIn.bundle",
"${PODS_ROOT}/TwitterKit/iOS/TwitterKit.framework/TwitterKitResources.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleSignIn.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/TwitterKitResources.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Plugin/Pods-Plugin-resources.sh\"\n";
showEnvVarsInLog = 0;
};
CCA81D3B7E26D0D727D24C84 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-PluginTests/Pods-PluginTests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Bolts/Bolts.framework",
"${BUILT_PRODUCTS_DIR}/Capacitor/Capacitor.framework",
"${BUILT_PRODUCTS_DIR}/CapacitorCordova/Cordova.framework",
"${BUILT_PRODUCTS_DIR}/AppAuth/AppAuth.framework",
"${BUILT_PRODUCTS_DIR}/FBAEMKit/FBAEMKit.framework",
"${BUILT_PRODUCTS_DIR}/FBSDKCoreKit/FBSDKCoreKit.framework",
"${BUILT_PRODUCTS_DIR}/FBSDKCoreKit_Basics/FBSDKCoreKit_Basics.framework",
"${BUILT_PRODUCTS_DIR}/FBSDKLoginKit/FBSDKLoginKit.framework",
"${BUILT_PRODUCTS_DIR}/GCDWebServer/GCDWebServer.framework",
"${BUILT_PRODUCTS_DIR}/FirebaseAuth/FirebaseAuth.framework",
"${BUILT_PRODUCTS_DIR}/FirebaseCore/FirebaseCore.framework",
"${BUILT_PRODUCTS_DIR}/FirebaseCoreDiagnostics/FirebaseCoreDiagnostics.framework",
"${BUILT_PRODUCTS_DIR}/FirebaseInstallations/FirebaseInstallations.framework",
"${BUILT_PRODUCTS_DIR}/GTMAppAuth/GTMAppAuth.framework",
"${BUILT_PRODUCTS_DIR}/GTMSessionFetcher/GTMSessionFetcher.framework",
"${BUILT_PRODUCTS_DIR}/GoogleToolboxForMac/GoogleToolboxForMac.framework",
"${BUILT_PRODUCTS_DIR}/GoogleDataTransport/GoogleDataTransport.framework",
"${BUILT_PRODUCTS_DIR}/GoogleSignIn/GoogleSignIn.framework",
"${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework",
"${PODS_ROOT}/TwitterCore/iOS/TwitterCore.framework",
"${PODS_ROOT}/TwitterKit/iOS/TwitterKit.framework",
"${BUILT_PRODUCTS_DIR}/PromisesObjC/FBLPromises.framework",
"${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Bolts.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Capacitor.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cordova.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AppAuth.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBAEMKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBSDKCoreKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBSDKCoreKit_Basics.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBSDKLoginKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GCDWebServer.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseAuth.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseCore.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseCoreDiagnostics.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseInstallations.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMAppAuth.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMSessionFetcher.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleToolboxForMac.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleDataTransport.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleSignIn.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TwitterCore.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TwitterKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBLPromises.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework",
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -390,6 +363,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
DACBFA2626C755CF001496FB /* AppleProviderHandler.swift in Sources */,
DA8E24E4223977D60030886C /* TwitterProviderHandler.swift in Sources */,
DA34D39D22328E4900326C50 /* GoogleProviderHandler.swift in Sources */,
DAF56119224A506B00751B26 /* PhoneNumberProvider.swift in Sources */,
Expand Down
8 changes: 4 additions & 4 deletions ios/Plugin/Handlers/AppleProviderHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ class AppleProviderHandler: NSObject, ProviderHandler {

func signOut() {
// there is nothing to do here
print("AppleProviderHandler.signOut called.");
print("AppleProviderHandler.signOut called.")
}

func fillResult(credential: AuthCredential?, data: PluginResultData) -> PluginResultData {
var jsResult: PluginResultData = [:]
func fillResult(credential: AuthCredential?, data: PluginCallResultData) -> PluginCallResultData {
var jsResult: PluginCallResultData = [:]

data.forEach { (key, value) in
jsResult[key] = value
Expand Down Expand Up @@ -93,7 +93,7 @@ extension AppleProviderHandler: ASAuthorizationControllerDelegate, ASAuthorizati
let credential = OAuthProvider.credential(withProviderID: "apple.com", idToken: idTokenString, rawNonce: nonce)

// Sign in with Firebase.
self.plugin?.handleAuthCredentials(credential: credential);
self.plugin?.handleAuthCredentials(credential: credential)
}
}

Expand Down
4 changes: 2 additions & 2 deletions ios/Plugin/Handlers/FacebookProviderHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ class FacebookProviderHandler: NSObject, ProviderHandler {
return AccessToken.current != nil
}

func fillResult(credential: AuthCredential?, data: PluginResultData) -> PluginResultData {
func fillResult(credential: AuthCredential?, data: PluginCallResultData) -> PluginCallResultData {
guard let accessToken = AccessToken.current else {
return data
}

var jsResult: PluginResultData = [:]
var jsResult: PluginCallResultData = [:]
data.forEach { (key, value) in
jsResult[key] = value
}
Expand Down
Loading