From 0f9ffa6452a5558a1daedb151d3577dce5ab052a Mon Sep 17 00:00:00 2001 From: "Ng Wing Tat, David" Date: Wed, 15 Jan 2020 14:18:24 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=94=96=20Bump=20version=20to=200.13.1?= =?UTF-8?q?(156)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 4 ++-- android/app/build.gradle | 4 ++-- ios/LikeCoinApp.xcodeproj/project.pbxproj | 8 ++++---- package.json | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.env b/.env index 3ff8ca822..9c78cc69b 100644 --- a/.env +++ b/.env @@ -5,10 +5,10 @@ # import { API_URL } from 'react-native-dotenv' # Same as MARKETING_VERSION in iOS / version in Android -APP_MARKETING_VERSION=0.13.0 +APP_MARKETING_VERSION=0.13.1 # Same as CURRENT_PROJECT_VERSION in iOS / version code in Android -APP_VERSION=155 +APP_VERSION=156 # APP_VERSION must be greater or equal to the this value # without forcing user to update the app diff --git a/android/app/build.gradle b/android/app/build.gradle index dea85d813..a0d4a8036 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,8 +138,8 @@ android { applicationId "com.oice" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 155 - versionName "0.13.0" + versionCode 156 + versionName "0.13.1" missingDimensionStrategy 'react-native-camera', 'general' } splits { diff --git a/ios/LikeCoinApp.xcodeproj/project.pbxproj b/ios/LikeCoinApp.xcodeproj/project.pbxproj index a406aeb22..bd3cbf6f8 100644 --- a/ios/LikeCoinApp.xcodeproj/project.pbxproj +++ b/ios/LikeCoinApp.xcodeproj/project.pbxproj @@ -703,12 +703,12 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = LikeCoinApp/LikeCoinApp.entitlements; - CURRENT_PROJECT_VERSION = 155; + CURRENT_PROJECT_VERSION = 156; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = 76UMR894HH; INFOPLIST_FILE = LikeCoinApp/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 0.13.0; + MARKETING_VERSION = 0.13.1; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -727,11 +727,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = LikeCoinApp/LikeCoinApp.entitlements; - CURRENT_PROJECT_VERSION = 155; + CURRENT_PROJECT_VERSION = 156; DEVELOPMENT_TEAM = 76UMR894HH; INFOPLIST_FILE = LikeCoinApp/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 0.13.0; + MARKETING_VERSION = 0.13.1; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", diff --git a/package.json b/package.json index 979d71ab3..7e35f4065 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "likecoin-app", - "version": "0.13.0", + "version": "0.13.1", "private": true, "scripts": { "start": "react-native start", From bc8c159785c8686df2c470fffdbd83fd58aed806 Mon Sep 17 00:00:00 2001 From: "Ng Wing Tat, David" Date: Wed, 15 Jan 2020 14:15:28 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=A4=96=20Fix=20liker.land=20sign=20in?= =?UTF-8?q?=20not=20redirect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../likerland-oauth-screen.tsx | 41 +++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/app/screens/likerland-oauth-screen/likerland-oauth-screen.tsx b/app/screens/likerland-oauth-screen/likerland-oauth-screen.tsx index ce8e0ca28..6bfe2fd75 100644 --- a/app/screens/likerland-oauth-screen/likerland-oauth-screen.tsx +++ b/app/screens/likerland-oauth-screen/likerland-oauth-screen.tsx @@ -1,6 +1,7 @@ import * as React from "react" import { Alert, + Platform, View, } from "react-native" import { NavigationScreenProps } from "react-navigation" @@ -25,28 +26,36 @@ export interface LikerLandOAuthScreenProps extends NavigationScreenProps<{}> { } @inject("rootStore") -export class LikerLandOAuthScreen extends React.Component { - private onNavigationStateChange = async (navState: WebViewNavigation) => { - const { url } = navState - const { rootStore } = this.props - if (url.includes("/following")) { - await Promise.all([ - this.props.rootStore.userStore.fetchUserInfo(), - this.props.rootStore.userStore.fetchLikerLandUserInfo(), - ]) - this.props.navigation.navigate("App") +export class LikerLandOAuthScreen extends React.Component { + private handleError = async () => { + await this.props.rootStore.userStore.logout() + this.props.rootStore.userStore.setIsSigningIn(false) + this.props.navigation.goBack() + } + + private handlePostSignIn = async () => { + await Promise.all([ + this.props.rootStore.userStore.fetchUserInfo(), + this.props.rootStore.userStore.fetchLikerLandUserInfo(), + ]) + this.props.navigation.navigate("App") - // Try to open the deferred deep link URL after sign in - rootStore.openDeepLink() + // Try to open the deferred deep link URL after sign in + this.props.rootStore.openDeepLink() + } + + private handleURLChange = (url: string) => { + if (url.includes("/following")) { + this.handlePostSignIn() + } else if (Platform.OS === "android" && url.includes("/oauth/redirect")) { + setTimeout(this.handlePostSignIn, 2000) } else if (url.includes("/in/register")) { this.handleError() } } - private handleError = async () => { - await this.props.rootStore.userStore.logout() - this.props.rootStore.userStore.setIsSigningIn(false) - this.props.navigation.goBack() + private onNavigationStateChange = ({ url }: WebViewNavigation) => { + this.handleURLChange(url) } private onWebviewError = () => { From f591e894ff213c787824af9ae6dcd83af2c3c4eb Mon Sep 17 00:00:00 2001 From: "Ng Wing Tat, David" Date: Wed, 15 Jan 2020 14:16:32 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=94=8A=20Add=20logs=20for=20liker.lan?= =?UTF-8?q?d=20OAuth=20screen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../likerland-oauth-screen.tsx | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/app/screens/likerland-oauth-screen/likerland-oauth-screen.tsx b/app/screens/likerland-oauth-screen/likerland-oauth-screen.tsx index 6bfe2fd75..728944db7 100644 --- a/app/screens/likerland-oauth-screen/likerland-oauth-screen.tsx +++ b/app/screens/likerland-oauth-screen/likerland-oauth-screen.tsx @@ -6,6 +6,10 @@ import { } from "react-native" import { NavigationScreenProps } from "react-navigation" import { WebViewNavigation } from 'react-native-webview' +import { + WebViewErrorEvent, + WebViewHttpErrorEvent, +} from "react-native-webview/lib/WebViewTypes" import { inject } from "mobx-react" import { Style } from "./likerland-oauth-screen.style" @@ -20,6 +24,7 @@ import { RootStore } from "../../models/root-store" import { translate } from "../../i18n" import { COMMON_API_CONFIG } from "../../services/api/api-config" +import { logError } from "../../utils/error" export interface LikerLandOAuthScreenProps extends NavigationScreenProps<{}> { rootStore: RootStore, @@ -51,6 +56,7 @@ export class LikerLandOAuthScreen extends React.Component { + this.onWebviewError() + const { code, description, url } = event.nativeEvent + logError(`Error occurs inside webview when signing in to liker.land ${JSON.stringify({ code, description, url })}`) + } + + private onHttpError = (event: WebViewHttpErrorEvent) => { + this.onWebviewError() + const { description, statusCode, url } = event.nativeEvent + logError(`HTTP error occurs inside webview when signing in to liker.land ${JSON.stringify({ description, statusCode, url })}`) + } + render () { const { signInURL, @@ -90,8 +108,8 @@ export class LikerLandOAuthScreen extends React.Component {this.renderLoadingOverlay()} From 3dd0d598710c949aa26081bbc009078953c7e48d Mon Sep 17 00:00:00 2001 From: "Ng Wing Tat, David" Date: Wed, 15 Jan 2020 14:40:44 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=A5=85=20Add=20redirect=20fallback=20?= =?UTF-8?q?case=20liker.land=20OAuth=20screen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../likerland-oauth-screen.tsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/screens/likerland-oauth-screen/likerland-oauth-screen.tsx b/app/screens/likerland-oauth-screen/likerland-oauth-screen.tsx index 728944db7..b97f5ea86 100644 --- a/app/screens/likerland-oauth-screen/likerland-oauth-screen.tsx +++ b/app/screens/likerland-oauth-screen/likerland-oauth-screen.tsx @@ -1,7 +1,6 @@ import * as React from "react" import { Alert, - Platform, View, } from "react-native" import { NavigationScreenProps } from "react-navigation" @@ -32,6 +31,12 @@ export interface LikerLandOAuthScreenProps extends NavigationScreenProps<{}> { @inject("rootStore") export class LikerLandOAuthScreen extends React.Component { + redirectTimer?: NodeJS.Timeout + + state = { + hasHandledRedirect: false, + } + private handleError = async () => { await this.props.rootStore.userStore.logout() this.props.rootStore.userStore.setIsSigningIn(false) @@ -39,6 +44,12 @@ export class LikerLandOAuthScreen extends React.Component { + if (this.state.hasHandledRedirect) return + this.setState({ hasHandledRedirect: true }) + if (this.redirectTimer) { + clearTimeout(this.redirectTimer) + this.redirectTimer = undefined + } await Promise.all([ this.props.rootStore.userStore.fetchUserInfo(), this.props.rootStore.userStore.fetchLikerLandUserInfo(), @@ -52,8 +63,9 @@ export class LikerLandOAuthScreen extends React.Component { if (url.includes("/following")) { this.handlePostSignIn() - } else if (Platform.OS === "android" && url.includes("/oauth/redirect")) { - setTimeout(this.handlePostSignIn, 2000) + } else if (url.includes("/oauth/redirect")) { + // Fallback to use timer if the above case not working + this.redirectTimer = setTimeout(this.handlePostSignIn, 2000) } else if (url.includes("/in/register")) { this.handleError() logError("Error when signing in to liker.land, like.co shows register page")