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

FR-17568 - Fix Direct login action #33

Merged
merged 1 commit into from
Aug 22, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class FronteggRNModule(val reactContext: ReactApplicationContext) :
}

@ReactMethod
fun directLoginAction(type: String, data: String, promise: Promise) {
fun directLoginAction(type: String, data: String, ephemeralSession:Boolean, promise: Promise) {
frontegg-david marked this conversation as resolved.
Show resolved Hide resolved
val activity = currentActivity
FronteggAuth.instance.directLoginAction(activity!!, type, data)
promise.resolve(true)
Expand Down
11 changes: 6 additions & 5 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PODS:
- React-jsi (= 0.72.1)
- ReactCommon/turbomodule/core (= 0.72.1)
- fmt (6.2.1)
- FronteggRN (1.2.3):
- FronteggRN (1.2.4):
- FronteggSwift (= 1.2.16)
- RCT-Folly (= 2021.07.22.00)
- React-Core
Expand Down Expand Up @@ -431,7 +431,8 @@ PODS:
- React-jsi (= 0.72.1)
- React-logger (= 0.72.1)
- React-perflogger (= 0.72.1)
- RNScreens (3.22.1):
- RNScreens (3.32.0):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- React-RCTImage
- SocketRocket (0.6.1)
Expand Down Expand Up @@ -578,12 +579,12 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
boost: 7dcd2de282d72e344012f7d6564d024930a6a440
boost: 57d2868c099736d80fcd648bf211b4431e51a558
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: 55cd4593d570bd9e5e227488d637ce6a9581ce51
FBReactNativeSpec: 799b0e1a1561699cd0e424e24fe5624da38402f0
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
FronteggRN: 01a1df999ee3b58c3b4ab881da1bbc60a00117b8
FronteggRN: 4529b26513ca97509a34dbd59c1ff41ddcd56fba
FronteggSwift: 7041ff82d1924e9be39a7c4db02cb2e8a1eb229a
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
hermes-engine: 9df83855a0fd15ef8eb61694652bae636b0c466e
Expand Down Expand Up @@ -621,7 +622,7 @@ SPEC CHECKSUMS:
React-runtimescheduler: 67707a955b9ecc628cc38bdc721fbc498910f0fd
React-utils: 0a70ea97d4e2749f336b450c082905be1d389435
ReactCommon: e593d19c9e271a6da4d0bd7f13b28cfeae5d164b
RNScreens: 50ffe2fa2342eabb2d0afbe19f7c1af286bc7fb3
RNScreens: 0bd9eec783bed1032e02a4db9976dae1664a5c7b
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Yoga: 65286bb6a07edce5e4fe8c90774da977ae8fc009

Expand Down
6 changes: 6 additions & 0 deletions example/ios/ReactNativeExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,8 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = ReactNativeExample/ReactNativeExample.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 3R2X6557U2;
ENABLE_BITCODE = NO;
Expand All @@ -527,6 +529,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.frontegg.demo;
PRODUCT_NAME = ReactNativeExample;
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -540,6 +543,8 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = ReactNativeExample/ReactNativeExample.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 3R2X6557U2;
INFOPLIST_FILE = ReactNativeExample/Info.plist;
Expand All @@ -556,6 +561,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.frontegg.demo;
PRODUCT_NAME = ReactNativeExample;
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
Expand Down
11 changes: 11 additions & 0 deletions example/src/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
logout,
refreshToken,
useAuth,
directLoginAction,
} from '@frontegg/react-native';
import { useState } from 'react';
import type { ITenantsResponse } from '@frontegg/rest-api';
Expand Down Expand Up @@ -41,6 +42,16 @@ export default function HomeScreen() {
/>
</View>

{state.isAuthenticated ? null : (
<Button
color={'#000000'}
title={'Login with google'}
onPress={() => {
directLoginAction('social-login', 'google');
}}
/>
)}

<View style={styles.listenerButton}>
<Button
title={'Refresh Token'}
Expand Down
1 change: 1 addition & 0 deletions ios/FronteggRN.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ @interface RCT_EXTERN_MODULE(FronteggRN, RCTEventEmitter)
RCT_EXTERN_METHOD(
directLoginAction: (NSString *)type
data: (NSString *)data
ephemeralSession: (BOOL)ephemeralSession
resolver: (RCTPromiseResolveBlock)resolve
rejecter: (RCTPromiseRejectBlock)reject
)
Expand Down
5 changes: 3 additions & 2 deletions ios/FronteggRN.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ class FronteggRN: RCTEventEmitter {
func directLoginAction(
_ type: String,
data: String,
ephemeralSession: Bool,
resolver: @escaping RCTPromiseResolveBlock,
rejecter: RCTPromiseRejectBlock
) -> Void {
fronteggApp.auth.directLoginAction(window: nil, type: type, data: data) { _ in

fronteggApp.auth.directLoginAction(window: nil, type: type, data: data, ephemeralSesion: ephemeralSession) { _ in
resolver("ok")
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/FronteggNative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ export async function refreshToken() {

export async function directLoginAction(
type: string,
data: string
data: string,
ephemeralSession: boolean = true
): Promise<void> {
return FronteggRN.directLoginAction({ type, data });
return FronteggRN.directLoginAction(type, data, ephemeralSession);
}

function debounce<T extends (...args: any[]) => any>(func: T, waitFor: number) {
Expand Down
Loading