Facebook login app frontend
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -18,8 +18,41 @@
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>fb677857427521030</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>FacebookAppID</key>
|
||||
<string>677857427521030</string>
|
||||
<key>FacebookClientToken</key>
|
||||
<string>a6fb48571d9dd9fe5f3454b1ae2401e2</string>
|
||||
<key>FacebookDisplayName</key>
|
||||
<string>wrenchboard.com - development</string>
|
||||
<key>LSApplicationQueriesSchemes</key>
|
||||
<array>
|
||||
<string>fbapi</string>
|
||||
<string>fbapi20130214</string>
|
||||
<string>fbapi20130410</string>
|
||||
<string>fbapi20130702</string>
|
||||
<string>fbapi20131010</string>
|
||||
<string>fbapi20131219</string>
|
||||
<string>fbapi20140410</string>
|
||||
<string>fbapi20140116</string>
|
||||
<string>fbapi20150313</string>
|
||||
<string>fbapi20150629</string>
|
||||
<string>fbapi20160328</string>
|
||||
<string>fbauth</string>
|
||||
<string>fb-messenger-share-api</string>
|
||||
<string>fbauth2</string>
|
||||
<string>fbshareextension</string>
|
||||
</array>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
||||
|
||||
@@ -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
|
||||
|
||||
+27
-1
@@ -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
|
||||
|
||||
Generated
+20
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<ion-label class="or">Or Continue With</ion-label>
|
||||
<div class="button">
|
||||
<ion-buttons>
|
||||
<ion-button>
|
||||
<ion-button (click) ="onLoginFacebook()">
|
||||
<ion-icon name="logo-facebook"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user