mirror of
https://github.com/zhigang1992/devhub.git
synced 2026-06-12 16:18:49 +08:00
Move link about private support from LoginScreen to AddColumnModal
This commit is contained in:
@@ -21,7 +21,9 @@ import { SpringAnimatedText } from '../animated/spring/SpringAnimatedText'
|
||||
import { SpringAnimatedTouchableOpacity } from '../animated/spring/SpringAnimatedTouchableOpacity'
|
||||
import { ColumnHeaderItem } from '../columns/ColumnHeaderItem'
|
||||
import { ModalColumn } from '../columns/ModalColumn'
|
||||
import { Link } from '../common/Link'
|
||||
import { separatorTickSize } from '../common/Separator'
|
||||
import { Spacer } from '../common/Spacer'
|
||||
import { SubHeader } from '../common/SubHeader'
|
||||
import { useColumnWidth } from '../context/ColumnWidthContext'
|
||||
import { useTheme } from '../context/ThemeContext'
|
||||
@@ -310,6 +312,7 @@ export function AddColumnModal(props: AddColumnModalProps) {
|
||||
<SpringAnimatedText
|
||||
style={{
|
||||
marginTop: contentPadding,
|
||||
paddingHorizontal: contentPadding,
|
||||
lineHeight: 20,
|
||||
fontSize: 14,
|
||||
color: springAnimatedTheme.foregroundColorMuted50,
|
||||
@@ -321,6 +324,29 @@ export function AddColumnModal(props: AddColumnModalProps) {
|
||||
} columns. This is to maintain a healthy usage of the GitHub API.`}
|
||||
</SpringAnimatedText>
|
||||
)}
|
||||
|
||||
<Spacer flex={1} minHeight={contentPadding} />
|
||||
|
||||
<Link
|
||||
analyticsLabel="about-private-access"
|
||||
href="https://github.com/devhubapp/devhub/issues/32"
|
||||
openOnNewTab
|
||||
>
|
||||
<SpringAnimatedText
|
||||
style={{
|
||||
paddingHorizontal: contentPadding,
|
||||
lineHeight: 20,
|
||||
fontSize: 12,
|
||||
color: springAnimatedTheme.foregroundColorMuted50,
|
||||
textAlign: 'center',
|
||||
}}
|
||||
>
|
||||
Support for private repositories is coming soon! Subscribe to this
|
||||
issue if you want to be notified.
|
||||
</SpringAnimatedText>
|
||||
</Link>
|
||||
|
||||
<Spacer height={contentPadding} />
|
||||
</View>
|
||||
</ModalColumn>
|
||||
)
|
||||
|
||||
@@ -5,7 +5,6 @@ import { Image, StyleSheet, View } from 'react-native'
|
||||
import { SpringAnimatedText } from '../components/animated/spring/SpringAnimatedText'
|
||||
import { GitHubLoginButton } from '../components/buttons/GitHubLoginButton'
|
||||
import { AppVersion } from '../components/common/AppVersion'
|
||||
import { Link } from '../components/common/Link'
|
||||
import { Screen } from '../components/common/Screen'
|
||||
import { Spacer } from '../components/common/Spacer'
|
||||
import { useCSSVariablesOrSpringAnimatedTheme } from '../hooks/use-css-variables-or-spring--animated-theme'
|
||||
@@ -79,12 +78,7 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
})
|
||||
|
||||
type LoginMethod = 'github.public' | 'github.private'
|
||||
|
||||
export const LoginScreen = React.memo(() => {
|
||||
const [loggingInMethod, setLoggingInMethod] = useState<LoginMethod | null>(
|
||||
null,
|
||||
)
|
||||
const [isExecutingOAuth, setIsExecutingOAuth] = useState(false)
|
||||
|
||||
const isLoggingIn = useReduxState(selectors.isLoggingInSelector)
|
||||
@@ -144,14 +138,6 @@ export const LoginScreen = React.memo(() => {
|
||||
? params.github_scope
|
||||
: _githubScope
|
||||
|
||||
if (!loggingInMethod) {
|
||||
setLoggingInMethod(
|
||||
(githubScope || []).includes('repo')
|
||||
? 'github.private'
|
||||
: 'github.public',
|
||||
)
|
||||
}
|
||||
|
||||
await loginRequest({
|
||||
appToken,
|
||||
githubScope,
|
||||
@@ -193,17 +179,13 @@ export const LoginScreen = React.memo(() => {
|
||||
}
|
||||
}
|
||||
|
||||
const loginWithGitHub = async (method: LoginMethod) => {
|
||||
setLoggingInMethod(method)
|
||||
const loginWithGitHub = async () => {
|
||||
setIsExecutingOAuth(true)
|
||||
|
||||
const githubScope =
|
||||
method === 'github.private'
|
||||
? ['read:user', 'user:email', 'repo', 'notifications', 'read:org']
|
||||
: ['read:user', 'user:email', 'notifications', 'read:org']
|
||||
const githubScope = ['read:user', 'user:email', 'notifications', 'read:org']
|
||||
|
||||
try {
|
||||
analytics.trackEvent('engagement', 'login', method, 1, { method })
|
||||
analytics.trackEvent('engagement', 'login')
|
||||
|
||||
const params = await executeOAuth(githubScope)
|
||||
handleOAuth(params, githubScope)
|
||||
@@ -231,60 +213,13 @@ export const LoginScreen = React.memo(() => {
|
||||
|
||||
<GitHubLoginButton
|
||||
analyticsLabel="github_login_public"
|
||||
loading={
|
||||
(isLoggingIn || isExecutingOAuth) &&
|
||||
loggingInMethod === 'github.public'
|
||||
}
|
||||
onPress={() => loginWithGitHub('github.public')}
|
||||
// rightIcon="globe"
|
||||
loading={isLoggingIn || isExecutingOAuth}
|
||||
onPress={() => loginWithGitHub()}
|
||||
style={styles.button}
|
||||
subtitle="Public access only"
|
||||
title="Sign in with GitHub"
|
||||
/>
|
||||
|
||||
{/* <GitHubLoginButton
|
||||
analyticsLabel="github_login_private"
|
||||
loading={
|
||||
(isLoggingIn || isExecutingOAuth) &&
|
||||
loggingInMethod === 'github.private'
|
||||
}
|
||||
onPress={() => loginWithGitHub('github.private')}
|
||||
// rightIcon="lock"
|
||||
style={styles.button}
|
||||
subtitle="Private access"
|
||||
title="Sign in with GitHub"
|
||||
/> */}
|
||||
|
||||
<Spacer height={contentPadding} />
|
||||
|
||||
<Link
|
||||
analyticsLabel="about-private-access"
|
||||
href="https://github.com/devhubapp/devhub/issues/32"
|
||||
openOnNewTab
|
||||
>
|
||||
<SpringAnimatedText
|
||||
style={{
|
||||
fontSize: 12,
|
||||
color: springAnimatedTheme.foregroundColorMuted50,
|
||||
}}
|
||||
>
|
||||
What about private repositories?
|
||||
</SpringAnimatedText>
|
||||
</Link>
|
||||
|
||||
{/* <Spacer height={contentPadding} />
|
||||
|
||||
<Link
|
||||
analyticsLabel="why-permission"
|
||||
href="https://github.com/dear-github/dear-github/issues/113"
|
||||
openOnNewTab
|
||||
>
|
||||
<SpringAnimatedText
|
||||
style={{ fontSize: 12, color: springAnimatedTheme.foregroundColorMuted50 }}
|
||||
>
|
||||
Why all these permissions?
|
||||
</SpringAnimatedText>
|
||||
</Link> */}
|
||||
</View>
|
||||
|
||||
<View style={styles.footer}>
|
||||
|
||||
Reference in New Issue
Block a user