Skip to content

Commit

Permalink
Merge pull request #155 from MZ-OFFISSU/fix/oauth-improve
Browse files Browse the repository at this point in the history
Fix/oauth improve
  • Loading branch information
Jun99uu authored Nov 15, 2023
2 parents 7291cbe + b4c2048 commit 35011ae
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
3 changes: 2 additions & 1 deletion TERMTERM/src/components/terms/WordCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Animated, {
useSharedValue,
} from "react-native-reanimated";
import Carousel from "react-native-reanimated-carousel";
import { screenWidth } from "@style/dimensions";
import { screenHeight, screenWidth } from "@style/dimensions";
import { WordProps } from "@interfaces/word";
import WordCard from "./WordCard";
import { useThemeStyle } from "@hooks/useThemeStyle";
Expand Down Expand Up @@ -62,6 +62,7 @@ const WordCarousel = ({
{...baseOptions}
style={{
width: screenWidth,
height: 370,
}}
loop={words.length > 1}
pagingEnabled={true}
Expand Down
20 changes: 19 additions & 1 deletion TERMTERM/src/screens/Webview/KakaoLogin.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { View } from "react-native";
import { WebView } from "react-native-webview";
import { WebView, WebViewNavigation } from "react-native-webview";
import { StackScreenProps } from "@react-navigation/stack";
import { RootStackParamList } from "@interfaces/RootStackParamList";
import { KAKAO_CLIENT_ID, KAKAO_REDIRECT_URI } from "@api/secret";
Expand All @@ -8,6 +8,7 @@ import { setAccessToken, setRefreshToken } from "@utils/tokenHandler";
import MemberApi from "@api/MemberApi";
import { MemberInfo } from "Member";
import { loginFailed, loginSucceed, needRegister } from "@utils/showToast";
import { Linking, Platform } from "react-native";

export type HomeScreenProps = StackScreenProps<RootStackParamList, "Kakao">;

Expand All @@ -17,6 +18,21 @@ const KakaoLogin = ({ navigation }: HomeScreenProps) => {
const authApi = new AuthApi();
const memberApi = new MemberApi();

// Mozilla/5.0 (Linux; Android 8.0.0; SM-G935S Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Mobile Safari/537.36
const customUserAgent =
"Mozilla/5.0 (Linux; Android 8.0.0; SM-G935S Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Mobile Safari/537.36";

const onShouldStartLoadWithRequest = (
request: WebViewNavigation
): boolean => {
console.log(request);
if (request.url.startsWith("kakaotalk://")) {
Linking.openURL(request.url);
return false;
}
return true;
};

const logInProgress = (data: any) => {
const exp = "code=";

Expand Down Expand Up @@ -69,6 +85,8 @@ const KakaoLogin = ({ navigation }: HomeScreenProps) => {
onMessage={(event) => {
logInProgress(event.nativeEvent.url);
}}
userAgent={customUserAgent}
onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
/>
</View>
);
Expand Down

0 comments on commit 35011ae

Please sign in to comment.