-
Notifications
You must be signed in to change notification settings - Fork 787
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
feat(auth): use WebView for authentication #323
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice work 👍
Thanks! Although it still seems buggy on my device, I sometime find myself logged in with an empty events tab and nothing clickable. So still WIP. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First and foremost, this is such a great job @machour it's amazing 😍 You've made it feel like a separate window isn't even opening by rendering a WebView
with a section underneath:
I know this is a WIP progress but here's a few things I noticed. Noticing an issue on the simulator however with the navigator consistently firing and navigating to Main
and I'm not sure why 🤔
When I reload the app, I notice just like you mentioned: a logged in events tab with nothing clickable and showing.
Another thing is the Cancel
button you've included (which I think is just awesome :)). Unfortunately if I try to cancel while the loading step is firing it doesn't necessarily stop the call.
Notice how the original Welcome
screen remains in the back as well? I love the new Preparing GitPoint
screen you have so we'll have to:
- Make sure the cancel button isn't there (or disabled) when the call is being fired since the user can't necessarily cancel the call
- Remove the Welcome Screen entirely since we have this new intermediate step
OR you can just make sure that clicking sign in will navigate directly to the Welcome Screen and not rely on the webview anymore (happy to have it restyled to match your intermediate Preparing GitPoint
screen.
src/auth/screens/login.screen.js
Outdated
height: '100%', | ||
width: '100%', | ||
textAlign: 'center', | ||
backgroundColor: '#1f2327', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's put #1f2327
in the colors
file. Can call it whatever you think sounds reasonable (githubDark
or something if you like).
@housseindjirdeh I think I fixed the problem with iOS by using Linking only for Android. |
src/auth/screens/login.screen.js
Outdated
onLoadEnd = e => { | ||
const url = e.nativeEvent.url; | ||
|
||
if (url === 'https://github.com/session') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just thinking out loud: can made a separate method, because this code line two times is used, then the meaning of this check will be more clear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great advice, thanks! Refactored here: c2c4d56
I went ahead and fixed #182 in this same PR by resetting the WebView's cookie as per @andrewda recommendation. The logout is now instantaneous (maybe even too quick 💭 ) I used https://github.com/joeferraro/react-native-cookies to clear the cookies, which needs some extra step in XCode and Android build, documented in their README. I didn't commit the |
src/locale/languages/en.js
Outdated
@@ -4,6 +4,9 @@ | |||
export const en = { | |||
auth: { | |||
login: { | |||
connectingToGitHub: 'Connecting to GitHub..', | |||
preparingGitPoint: 'Preparing GitPoint..', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add another period to these: Connecting to GitHub...
and Preparing GitPoint...
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@machour and more you need to add new keys to other languages, otherwise there will be errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@machour yes, you need to add English sentences to all languages, just so that there are no such errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lex111 done buddy! I think I'll tackle down i18n right after auth & markdown 😄
@@ -2,6 +2,9 @@ | |||
export const fr = { | |||
auth: { | |||
login: { | |||
connectingToGitHub: 'Connexion à GitHub..', | |||
preparingGitPoint: 'Configuration de GitPoint..', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing dot 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not in french ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, I did not know 😃
src/auth/screens/login.screen.js
Outdated
@@ -236,6 +236,7 @@ class Login extends Component { | |||
<View style={styles.container}> | |||
<Modal | |||
animationType="slide" | |||
onRequestClose={() => null} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -623,6 +642,7 @@ | |||
isa = PBXGroup; | |||
children = ( | |||
273F19201F1E1AD5004B4410 /* libCodePush.a */, | |||
48F9DE9B1F6DB8C60064194C /* libCodePush.a */, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@housseindjirdeh not sure why Xcode added this line, you may want to have a closer look
@@ -1148,6 +1181,20 @@ | |||
remoteRef = 48F49F661F19026D0012FAD6 /* PBXContainerItemProxy */; | |||
sourceTree = BUILT_PRODUCTS_DIR; | |||
}; | |||
48F9DE9B1F6DB8C60064194C /* libCodePush.a */ = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here @housseindjirdeh
@housseindjirdeh @andrewda @lex111 I'd love to see this merged soon in order for it to be fully tested by everyone before making it to the next release 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closes #109 and #221
Rather than using another library to handle Android, I went ahead and used the WebView component from ReactNative. This seems to be working fine for me on iOS Simulator and my Android Device.
I would really love to have a thorough review of my code, as I feel I've kinda abused the view system here. (and it's the app entry point, so it's a really critical change 😆 )