-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
open an external browser when the server config for MobileExternalBro…
…wse is set to true (#8220) (#8223) (cherry picked from commit f04838d) Co-authored-by: Elias Nahum <[email protected]>
- Loading branch information
1 parent
1900990
commit d91023d
Showing
8 changed files
with
395 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
import {Button} from '@rneui/base'; | ||
import React from 'react'; | ||
import {Text, View} from 'react-native'; | ||
|
||
import FormattedText from '@components/formatted_text'; | ||
import {buttonBackgroundStyle, buttonTextStyle} from '@utils/buttonStyles'; | ||
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme'; | ||
import {typography} from '@utils/typography'; | ||
|
||
interface AuthErrorProps { | ||
error: string; | ||
retry: () => void; | ||
theme: Theme; | ||
} | ||
|
||
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => { | ||
return { | ||
button: { | ||
marginTop: 25, | ||
}, | ||
errorText: { | ||
color: changeOpacity(theme.centerChannelColor, 0.72), | ||
textAlign: 'center', | ||
...typography('Body', 200, 'Regular'), | ||
}, | ||
infoContainer: { | ||
alignItems: 'center', | ||
flex: 1, | ||
justifyContent: 'center', | ||
}, | ||
infoText: { | ||
color: changeOpacity(theme.centerChannelColor, 0.72), | ||
...typography('Body', 100, 'Regular'), | ||
}, | ||
infoTitle: { | ||
color: theme.centerChannelColor, | ||
marginBottom: 4, | ||
...typography('Heading', 700), | ||
}, | ||
}; | ||
}); | ||
|
||
const AuthError = ({error, retry, theme}: AuthErrorProps) => { | ||
const style = getStyleSheet(theme); | ||
|
||
return ( | ||
<View style={style.infoContainer}> | ||
<FormattedText | ||
id='mobile.oauth.switch_to_browser.error_title' | ||
testID='mobile.oauth.switch_to_browser.error_title' | ||
defaultMessage='Sign in error' | ||
style={style.infoTitle} | ||
/> | ||
<Text style={style.errorText}> | ||
{`${error}.`} | ||
</Text> | ||
<Button | ||
buttonStyle={[style.button, buttonBackgroundStyle(theme, 'lg', 'primary', 'default')]} | ||
testID='mobile.oauth.try_again' | ||
onPress={retry} | ||
> | ||
<FormattedText | ||
id='mobile.oauth.try_again' | ||
defaultMessage='Try again' | ||
style={buttonTextStyle(theme, 'lg', 'primary', 'default')} | ||
/> | ||
</Button> | ||
</View> | ||
); | ||
}; | ||
|
||
export default AuthError; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
|
||
import FormattedText from '@components/formatted_text'; | ||
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme'; | ||
import {typography} from '@utils/typography'; | ||
|
||
interface AuthRedirectProps { | ||
theme: Theme; | ||
} | ||
|
||
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => { | ||
return { | ||
infoContainer: { | ||
alignItems: 'center', | ||
flex: 1, | ||
justifyContent: 'center', | ||
}, | ||
infoText: { | ||
color: changeOpacity(theme.centerChannelColor, 0.72), | ||
...typography('Body', 100, 'Regular'), | ||
}, | ||
infoTitle: { | ||
color: theme.centerChannelColor, | ||
marginBottom: 4, | ||
...typography('Heading', 700), | ||
}, | ||
}; | ||
}); | ||
|
||
const AuthRedirect = ({theme}: AuthRedirectProps) => { | ||
const style = getStyleSheet(theme); | ||
|
||
return ( | ||
<View style={style.infoContainer}> | ||
<FormattedText | ||
id='mobile.oauth.switch_to_browser.title' | ||
testID='mobile.oauth.switch_to_browser.title' | ||
defaultMessage='Redirecting...' | ||
style={style.infoTitle} | ||
/> | ||
<FormattedText | ||
id='mobile.oauth.switch_to_browser' | ||
testID='mobile.oauth.switch_to_browser' | ||
defaultMessage='You are being redirected to your login provider' | ||
style={style.infoText} | ||
/> | ||
</View> | ||
); | ||
}; | ||
|
||
export default AuthRedirect; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
|
||
import FormattedText from '@components/formatted_text'; | ||
import Loading from '@components/loading'; | ||
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme'; | ||
import {typography} from '@utils/typography'; | ||
|
||
interface AuthSuccessProps { | ||
theme: Theme; | ||
} | ||
|
||
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => { | ||
return { | ||
infoContainer: { | ||
alignItems: 'center', | ||
flex: 1, | ||
justifyContent: 'center', | ||
}, | ||
infoText: { | ||
color: changeOpacity(theme.centerChannelColor, 0.72), | ||
...typography('Body', 100, 'Regular'), | ||
}, | ||
infoTitle: { | ||
color: theme.centerChannelColor, | ||
marginBottom: 4, | ||
...typography('Heading', 700), | ||
}, | ||
}; | ||
}); | ||
|
||
const AuthSuccess = ({theme}: AuthSuccessProps) => { | ||
const style = getStyleSheet(theme); | ||
|
||
return ( | ||
<View style={style.infoContainer}> | ||
<Loading/> | ||
<FormattedText | ||
id='mobile.oauth.success.title' | ||
testID='mobile.oauth.success.title' | ||
defaultMessage='Authentication successful' | ||
style={style.infoTitle} | ||
/> | ||
<FormattedText | ||
id='mobile.oauth.success.description' | ||
testID='mobile.oauth.success.description' | ||
defaultMessage='Signing in now, just a moment...' | ||
style={style.infoText} | ||
/> | ||
</View> | ||
); | ||
}; | ||
|
||
export default AuthSuccess; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.