diff --git a/ios/App/App/AppDelegate.swift b/ios/App/App/AppDelegate.swift
index fe66f70..58010c3 100644
--- a/ios/App/App/AppDelegate.swift
+++ b/ios/App/App/AppDelegate.swift
@@ -1,6 +1,7 @@
import UIKit
import Capacitor
import OneSignalFramework
+import FBSDKCoreKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -12,6 +13,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Remove this method to stop OneSignal Debugging
//OneSignal.Debug.setLogLevel(.LL_VERBOSE)
+ // Override point for customization after application launch.
+ FBSDKCoreKit.ApplicationDelegate.shared.application(
+ application,
+ didFinishLaunchingWithOptions: launchOptions
+ )
+
return true
}
@@ -38,9 +45,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}
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
- return ApplicationDelegateProxy.shared.application(app, open: url, options: options)
+ if (FBSDKCoreKit.ApplicationDelegate.shared.application(
+ app,
+ open: url,
+ sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
+ annotation: options[UIApplication.OpenURLOptionsKey.annotation]
+ )) {
+ return true;
+ } else {
+ return ApplicationDelegateProxy.shared.application(app, open: url, options: options)
+ }
}
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
diff --git a/ios/App/App/Info.plist b/ios/App/App/Info.plist
index 09839de..69f396b 100644
--- a/ios/App/App/Info.plist
+++ b/ios/App/App/Info.plist
@@ -18,8 +18,41 @@
APPL
CFBundleShortVersionString
$(MARKETING_VERSION)
+ CFBundleURLTypes
+
+
+ CFBundleURLSchemes
+
+ fb677857427521030
+
+
+
CFBundleVersion
$(CURRENT_PROJECT_VERSION)
+ FacebookAppID
+ 677857427521030
+ FacebookClientToken
+ a6fb48571d9dd9fe5f3454b1ae2401e2
+ FacebookDisplayName
+ wrenchboard.com - development
+ LSApplicationQueriesSchemes
+
+ fbapi
+ fbapi20130214
+ fbapi20130410
+ fbapi20130702
+ fbapi20131010
+ fbapi20131219
+ fbapi20140410
+ fbapi20140116
+ fbapi20150313
+ fbapi20150629
+ fbapi20160328
+ fbauth
+ fb-messenger-share-api
+ fbauth2
+ fbshareextension
+
LSRequiresIPhoneOS
NSLocationAlwaysAndWhenInUseUsageDescription
diff --git a/ios/App/Podfile b/ios/App/Podfile
index 6dea08b..d7eeb90 100644
--- a/ios/App/Podfile
+++ b/ios/App/Podfile
@@ -13,6 +13,7 @@ def capacitor_pods
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCommunityAppleSignIn', :path => '../../node_modules/@capacitor-community/apple-sign-in'
pod 'CapacitorCommunityBarcodeScanner', :path => '../../node_modules/@capacitor-community/barcode-scanner'
+ pod 'CapacitorCommunityFacebookLogin', :path => '../../node_modules/@capacitor-community/facebook-login'
pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'
pod 'CapacitorHaptics', :path => '../../node_modules/@capacitor/haptics'
pod 'CapacitorKeyboard', :path => '../../node_modules/@capacitor/keyboard'
@@ -24,6 +25,8 @@ end
target 'App' do
capacitor_pods
# Add your Pods here
+ pod 'FBSDKCoreKit', '16.1.3'
+ pod 'FBSDKLoginKit', '16.1.3'
end
target 'OneSignalNotificationServiceExtension' do
diff --git a/ios/App/Podfile.lock b/ios/App/Podfile.lock
index 8af9253..ff71fd4 100644
--- a/ios/App/Podfile.lock
+++ b/ios/App/Podfile.lock
@@ -7,6 +7,10 @@ PODS:
- Capacitor
- CapacitorCommunityBarcodeScanner (4.0.1):
- Capacitor
+ - CapacitorCommunityFacebookLogin (5.0.3):
+ - Capacitor
+ - FBSDKCoreKit (= 16.1.3)
+ - FBSDKLoginKit (= 16.1.3)
- CapacitorCordova (5.0.5)
- CapacitorHaptics (5.0.4):
- Capacitor
@@ -19,6 +23,14 @@ PODS:
- CordovaPluginsStatic (5.0.5):
- CapacitorCordova
- OneSignalXCFramework (= 5.0.0-beta-04)
+ - FBAEMKit (16.1.3):
+ - FBSDKCoreKit_Basics (= 16.1.3)
+ - FBSDKCoreKit (16.1.3):
+ - FBAEMKit (= 16.1.3)
+ - FBSDKCoreKit_Basics (= 16.1.3)
+ - FBSDKCoreKit_Basics (16.1.3)
+ - FBSDKLoginKit (16.1.3):
+ - FBSDKCoreKit (= 16.1.3)
- OneSignalXCFramework (5.0.0-beta-04):
- OneSignalXCFramework/OneSignalCore (= 5.0.0-beta-04)
- OneSignalXCFramework/OneSignalExtension (= 5.0.0-beta-04)
@@ -49,16 +61,23 @@ DEPENDENCIES:
- "CapacitorApp (from `../../node_modules/@capacitor/app`)"
- "CapacitorCommunityAppleSignIn (from `../../node_modules/@capacitor-community/apple-sign-in`)"
- "CapacitorCommunityBarcodeScanner (from `../../node_modules/@capacitor-community/barcode-scanner`)"
+ - "CapacitorCommunityFacebookLogin (from `../../node_modules/@capacitor-community/facebook-login`)"
- "CapacitorCordova (from `../../node_modules/@capacitor/ios`)"
- "CapacitorHaptics (from `../../node_modules/@capacitor/haptics`)"
- "CapacitorKeyboard (from `../../node_modules/@capacitor/keyboard`)"
- "CapacitorPreferences (from `../../node_modules/@capacitor/preferences`)"
- "CapacitorStatusBar (from `../../node_modules/@capacitor/status-bar`)"
- CordovaPluginsStatic (from `../capacitor-cordova-ios-plugins`)
+ - FBSDKCoreKit (= 16.1.3)
+ - FBSDKLoginKit (= 16.1.3)
- OneSignalXCFramework (= 5.0.0-beta-04)
SPEC REPOS:
trunk:
+ - FBAEMKit
+ - FBSDKCoreKit
+ - FBSDKCoreKit_Basics
+ - FBSDKLoginKit
- OneSignalXCFramework
EXTERNAL SOURCES:
@@ -70,6 +89,8 @@ EXTERNAL SOURCES:
:path: "../../node_modules/@capacitor-community/apple-sign-in"
CapacitorCommunityBarcodeScanner:
:path: "../../node_modules/@capacitor-community/barcode-scanner"
+ CapacitorCommunityFacebookLogin:
+ :path: "../../node_modules/@capacitor-community/facebook-login"
CapacitorCordova:
:path: "../../node_modules/@capacitor/ios"
CapacitorHaptics:
@@ -88,14 +109,19 @@ SPEC CHECKSUMS:
CapacitorApp: 7a5dec8b33573707164b293475d5c89ba684364a
CapacitorCommunityAppleSignIn: eafdd59b18b38161fa5cceee7b0e31312b122958
CapacitorCommunityBarcodeScanner: 7feb206489c8555a8ca0c74c57ddf49ead774eb8
+ CapacitorCommunityFacebookLogin: c0e2bb54cb567d90443a80ae20569fdac0df3f89
CapacitorCordova: f8c06b897c74ee8f7701fe10e6443b40822bc83a
CapacitorHaptics: e36653b37326d71bb35ae42b944124037dbc3d97
CapacitorKeyboard: d1b25fde6f19744ad09c890862aefc6e2a7ded3d
CapacitorPreferences: f03954bcb0ff09c792909e46bff88e3183c16b10
CapacitorStatusBar: 190e0321b8734f4244d0c81baa183a00d5806ddf
CordovaPluginsStatic: c1b87170d7e6c70c473250768081e07414af3879
+ FBAEMKit: af2972f39bb0f3f7c45998f435b007833c32ffb2
+ FBSDKCoreKit: 19e2e18b3be578d7a51fed8fdd8c152bef0b9511
+ FBSDKCoreKit_Basics: dd9826ce3c9fd9f8cdf8dbbd0ef0a53e6c0c9e7e
+ FBSDKLoginKit: c395c63a1a6cf4a8a1e6103fd94b8c46329ee81c
OneSignalXCFramework: 0225dc78b9c611be84733e5adc9b68638632c1e8
-PODFILE CHECKSUM: b015864ddbe3c1ce5a660117a38ed722ba66c918
+PODFILE CHECKSUM: 7d6a1b0dbd7cb987c2121b75ec46088af01da740
COCOAPODS: 1.12.1
diff --git a/package-lock.json b/package-lock.json
index 949d3b6..11cd058 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -16,6 +16,7 @@
"@angular/router": "^14.0.0",
"@capacitor-community/apple-sign-in": "^5.0.0",
"@capacitor-community/barcode-scanner": "^4.0.1",
+ "@capacitor-community/facebook-login": "^5.0.3",
"@capacitor/android": "5.0.5",
"@capacitor/app": "^5.0.0",
"@capacitor/core": "^5.0.0",
@@ -2334,6 +2335,17 @@
"@capacitor/core": "^5.0.0"
}
},
+ "node_modules/@capacitor-community/facebook-login": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/@capacitor-community/facebook-login/-/facebook-login-5.0.3.tgz",
+ "integrity": "sha512-MdVBkPHbtAqiVgj5YJdIzO+2DG5kBakvjkTPpnxkxEwOVCPNmshyhR5YzPqkkbG00rpgU2SArM/Ml2riceSi/A==",
+ "dependencies": {
+ "@capacitor/core": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=16.0.0"
+ }
+ },
"node_modules/@capacitor/android": {
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/@capacitor/android/-/android-5.0.5.tgz",
@@ -21431,6 +21443,14 @@
"@zxing/library": "^0.20.0"
}
},
+ "@capacitor-community/facebook-login": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/@capacitor-community/facebook-login/-/facebook-login-5.0.3.tgz",
+ "integrity": "sha512-MdVBkPHbtAqiVgj5YJdIzO+2DG5kBakvjkTPpnxkxEwOVCPNmshyhR5YzPqkkbG00rpgU2SArM/Ml2riceSi/A==",
+ "requires": {
+ "@capacitor/core": "^5.0.0"
+ }
+ },
"@capacitor/android": {
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/@capacitor/android/-/android-5.0.5.tgz",
diff --git a/package.json b/package.json
index 725fb4f..0678fa5 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
"@angular/router": "^14.0.0",
"@capacitor-community/apple-sign-in": "^5.0.0",
"@capacitor-community/barcode-scanner": "^4.0.1",
+ "@capacitor-community/facebook-login": "^5.0.3",
"@capacitor/android": "5.0.5",
"@capacitor/app": "^5.0.0",
"@capacitor/core": "^5.0.0",
diff --git a/src/app/pages/login/login.page.html b/src/app/pages/login/login.page.html
index e4a42bb..52ace49 100644
--- a/src/app/pages/login/login.page.html
+++ b/src/app/pages/login/login.page.html
@@ -66,7 +66,7 @@
Or Continue With
-
+
diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts
index e89edc2..9868667 100644
--- a/src/app/pages/login/login.page.ts
+++ b/src/app/pages/login/login.page.ts
@@ -13,6 +13,10 @@ import {
SignInWithAppleResponse,
SignInWithAppleOptions,
} from '@capacitor-community/apple-sign-in';
+import {
+ FacebookLogin,
+ FacebookLoginResponse,
+} from '@capacitor-community/facebook-login';
@Component({
selector: 'app-login',
@@ -52,6 +56,8 @@ export class LoginPage implements OnInit {
//console.log(`Hello ${value}!`);
};
+ // use hook after platform dom ready
+ FacebookLogin.initialize({ appId: environment.facebookAppId });
}
getBlogData(){
@@ -109,6 +115,70 @@ getBlogData(){
this.router.navigate(['startscan']);
}
+ onLoginFacebook() {
+ const FACEBOOK_PERMISSIONS = [
+ 'email',
+ 'user_birthday',
+ 'user_photos',
+ 'user_gender',
+ ];
+
+ FacebookLogin.login({
+ permissions: FACEBOOK_PERMISSIONS
+ }).then((result: FacebookLoginResponse) => {
+ if (result.accessToken) {
+ // Login successful.
+ console.log(result);
+ console.log(`Facebook access token is ${result.accessToken.token}`);
+
+ /*
+ var reqData = {
+ auth_type: "FACEBOOK",
+ code: codeResponse,
+ redirect_uri: process.env.REACT_APP_FACEBOOK_REDIRECT_URL,
+ };
+ */
+ const oauth2Data = {
+ "auth_type": "FACEBOOK",
+ "access_token": result.accessToken.token,
+ "user":result.accessToken.userId,
+ "application_id":result.accessToken.applicationId,
+ };
+ console.log(oauth2Data);
+ // Validate token with server and create new session
+ this.wrenchService.authStart(oauth2Data).subscribe(
+ loginResult => {
+ console.log(loginResult);
+ this.loginResult = loginResult;
+ console.log("INTERNAL RETURN->" + this.loginResult.internal_return);
+
+ if (loginResult != null && loginResult.internal_return == 100 && this.sessionDataProviderService.ConstructGlobalSessionData(this.loginResult) == true) {
+ const setName = async () => {
+ await Preferences.set({
+ key: 'username',
+ value: this.username,
+ });
+ };
+
+ this.getBlogData();
+ this.router.navigate(['tabs/tab1']);
+ }
+ else{
+ this.showAlert("Error","Invalid username/password");
+ }
+ }
+ );
+
+ } else {
+ console.log(result);
+ this.showAlert("Error", "Login failed!");
+ }
+ }).catch((error: any) => {
+ this.showAlert("Error", error);
+ console.log(error);
+ });
+ }
+
onLoginApple() {
// -> 'web', 'ios' or 'android'
diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts
index 43d1c69..d64b737 100644
--- a/src/environments/environment.prod.ts
+++ b/src/environments/environment.prod.ts
@@ -1,8 +1,9 @@
export const environment = {
production: true,
apiKey: '', // <-- Enter your own key here!' PROD
- baseUrl: 'https://apigate.nebula.g1.wrenchboard.com/svs/user',
- images: 'https://apigate.nebula.g1.wrenchboard.com/svs/user',
- appleRedirectUri: '',
+ baseUrl: 'https://apigate.lotus.g1.wrenchboard.com/svs/user',
+ images: 'https://apigate.lotus.g1.wrenchboard.com/svs/user',
+ appleRedirectUri: 'https://users.wrenchboard.com/loginWithApple',
+ facebookAppId: '390204307987009',
loginSocial: false
};
diff --git a/src/environments/environment.ts b/src/environments/environment.ts
index cc397fa..cdf7160 100644
--- a/src/environments/environment.ts
+++ b/src/environments/environment.ts
@@ -1,9 +1,10 @@
export const environment = {
production: false,
apiKey: '', // <-- Enter your own key here!' TEST
- baseUrl: 'https://apigate.nebula.g1.wrenchboard.com/en/wrench/api/v1',
- images: 'https://apigate.nebula.g1.wrenchboard.com/en/wrench/api/v1/',
+ baseUrl: 'https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1',
+ images: 'https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1/',
appleRedirectUri: 'https://dev-users.wrenchboard.com/loginWithApple',
+ facebookAppId: '677857427521030',
loginSocial: true
};