Skip to content

Commit

Permalink
Merge branch 'main' of github.com:bluesky-social/social-app into main
Browse files Browse the repository at this point in the history
  • Loading branch information
pfrazee committed Oct 26, 2023
2 parents 01e25c9 + 927cee1 commit a1a61ef
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 83 deletions.
6 changes: 3 additions & 3 deletions src/lib/analytics/analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ export function init(store: RootStoreModel) {
store.onSessionLoaded(() => {
const sess = store.session.currentSession
if (sess) {
if (sess.email) {
if (sess.did) {
const did_hashed = sha256(sess.did)
segmentClient.identify(did_hashed, {did_hashed})
store.log.debug('Ping w/hash')
const email_hashed = sha256(sess.email)
segmentClient.identify(email_hashed, {email_hashed})
} else {
store.log.debug('Ping w/o hash')
segmentClient.identify()
Expand Down
6 changes: 3 additions & 3 deletions src/lib/analytics/analytics.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ export function init(store: RootStoreModel) {
store.onSessionLoaded(() => {
const sess = store.session.currentSession
if (sess) {
if (sess.email) {
if (sess.did) {
const did_hashed = sha256(sess.did)
segmentClient.identify(did_hashed, {did_hashed})
store.log.debug('Ping w/hash')
const email_hashed = sha256(sess.email)
segmentClient.identify(email_hashed, {email_hashed})
} else {
store.log.debug('Ping w/o hash')
segmentClient.identify()
Expand Down
14 changes: 8 additions & 6 deletions src/state/models/feeds/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export class PostsFeedItemModel {
},
() => this.rootStore.agent.deleteLike(url),
)
track('Post:Unlike')
} else {
// like
await updateDataOptimistically(
Expand All @@ -129,18 +130,18 @@ export class PostsFeedItemModel {
this.post.viewer!.like = res.uri
},
)
track('Post:Like')
}
} catch (error) {
this.rootStore.log.error('Failed to toggle like', error)
} finally {
track(this.post.viewer.like ? 'Post:Unlike' : 'Post:Like')
}
}

async toggleRepost() {
this.post.viewer = this.post.viewer || {}
try {
if (this.post.viewer?.repost) {
// unrepost
const url = this.post.viewer.repost
await updateDataOptimistically(
this.post,
Expand All @@ -150,7 +151,9 @@ export class PostsFeedItemModel {
},
() => this.rootStore.agent.deleteRepost(url),
)
track('Post:Unrepost')
} else {
// repost
await updateDataOptimistically(
this.post,
() => {
Expand All @@ -162,25 +165,24 @@ export class PostsFeedItemModel {
this.post.viewer!.repost = res.uri
},
)
track('Post:Repost')
}
} catch (error) {
this.rootStore.log.error('Failed to toggle repost', error)
} finally {
track(this.post.viewer.repost ? 'Post:Unrepost' : 'Post:Repost')
}
}

async toggleThreadMute() {
try {
if (this.isThreadMuted) {
this.rootStore.mutedThreads.uris.delete(this.rootUri)
track('Post:ThreadUnmute')
} else {
this.rootStore.mutedThreads.uris.add(this.rootUri)
track('Post:ThreadMute')
}
} catch (error) {
this.rootStore.log.error('Failed to toggle thread mute', error)
} finally {
track(this.isThreadMuted ? 'Post:ThreadUnmute' : 'Post:ThreadMute')
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/view/com/modals/CreateOrEditMuteList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {ListModel} from 'state/models/content/list'
import {s, colors, gradients} from 'lib/styles'
import {enforceLen} from 'lib/strings/helpers'
import {compressIfNeeded} from 'lib/media/manip'
import {UserAvatar} from '../util/UserAvatar'
import {EditableUserAvatar} from '../util/UserAvatar'
import {usePalette} from 'lib/hooks/usePalette'
import {useTheme} from 'lib/ThemeContext'
import {useAnalytics} from 'lib/analytics/analytics'
Expand Down Expand Up @@ -148,7 +148,7 @@ export function Component({
)}
<Text style={[styles.label, pal.text]}>List Avatar</Text>
<View style={[styles.avi, {borderColor: pal.colors.background}]}>
<UserAvatar
<EditableUserAvatar
type="list"
size={80}
avatar={avatar}
Expand Down
4 changes: 2 additions & 2 deletions src/view/com/modals/EditProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {enforceLen} from 'lib/strings/helpers'
import {MAX_DISPLAY_NAME, MAX_DESCRIPTION} from 'lib/constants'
import {compressIfNeeded} from 'lib/media/manip'
import {UserBanner} from '../util/UserBanner'
import {UserAvatar} from '../util/UserAvatar'
import {EditableUserAvatar} from '../util/UserAvatar'
import {usePalette} from 'lib/hooks/usePalette'
import {useTheme} from 'lib/ThemeContext'
import {useAnalytics} from 'lib/analytics/analytics'
Expand Down Expand Up @@ -153,7 +153,7 @@ export function Component({
onSelectNewBanner={onSelectNewBanner}
/>
<View style={[styles.avi, {borderColor: pal.colors.background}]}>
<UserAvatar
<EditableUserAvatar
size={80}
avatar={userAvatar}
onSelectNewAvatar={onSelectNewAvatar}
Expand Down
2 changes: 2 additions & 0 deletions src/view/com/modals/Waitlist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ export function Component({}: {}) {
keyboardAppearance={theme.colorScheme}
value={email}
onChangeText={setEmail}
onSubmitEditing={onPressSignup}
enterKeyHint="done"
accessible={true}
accessibilityLabel="Email"
accessibilityHint="Input your email to get on the Bluesky waitlist"
Expand Down
6 changes: 3 additions & 3 deletions src/view/com/modals/crop-image/CropImage.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function Component({
accessibilityHint="Sets image aspect ratio to wide">
<RectWideIcon
size={24}
style={as === AspectRatio.Wide ? s.blue3 : undefined}
style={as === AspectRatio.Wide ? s.blue3 : pal.text}
/>
</TouchableOpacity>
<TouchableOpacity
Expand All @@ -110,7 +110,7 @@ export function Component({
accessibilityHint="Sets image aspect ratio to tall">
<RectTallIcon
size={24}
style={as === AspectRatio.Tall ? s.blue3 : undefined}
style={as === AspectRatio.Tall ? s.blue3 : pal.text}
/>
</TouchableOpacity>
<TouchableOpacity
Expand All @@ -120,7 +120,7 @@ export function Component({
accessibilityHint="Sets image aspect ratio to square">
<SquareIcon
size={24}
style={as === AspectRatio.Square ? s.blue3 : undefined}
style={as === AspectRatio.Square ? s.blue3 : pal.text}
/>
</TouchableOpacity>
</View>
Expand Down
11 changes: 5 additions & 6 deletions src/view/com/profile/ProfileHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,20 +132,19 @@ const ProfileHeaderLoaded = observer(function ProfileHeaderLoadedImpl({
}, [store, view])

const onPressToggleFollow = React.useCallback(() => {
track(
view.viewer.following
? 'ProfileHeader:FollowButtonClicked'
: 'ProfileHeader:UnfollowButtonClicked',
)
view?.toggleFollowing().then(
() => {
setShowSuggestedFollows(Boolean(view.viewer.following))

Toast.show(
`${
view.viewer.following ? 'Following' : 'No longer following'
} ${sanitizeDisplayName(view.displayName || view.handle)}`,
)
track(
view.viewer.following
? 'ProfileHeader:FollowButtonClicked'
: 'ProfileHeader:UnfollowButtonClicked',
)
},
err => store.log.error('Failed to toggle follow', err),
)
Expand Down
12 changes: 8 additions & 4 deletions src/view/com/profile/ProfileHeaderSuggestedFollows.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import {View, StyleSheet, ScrollView, Pressable} from 'react-native'
import {View, StyleSheet, Pressable, ScrollView} from 'react-native'
import Animated, {
useSharedValue,
withTiming,
Expand All @@ -26,6 +26,7 @@ import {sanitizeHandle} from 'lib/strings/handles'
import {makeProfileLink} from 'lib/routes/links'
import {Link} from 'view/com/util/Link'
import {useAnalytics} from 'lib/analytics/analytics'
import {isWeb} from 'platform/detection'

const OUTER_PADDING = 10
const INNER_PADDING = 14
Expand Down Expand Up @@ -100,7 +101,6 @@ export function ProfileHeaderSuggestedFollows({
backgroundColor: pal.viewLight.backgroundColor,
height: '100%',
paddingTop: INNER_PADDING / 2,
paddingBottom: INNER_PADDING,
}}>
<View
style={{
Expand Down Expand Up @@ -130,11 +130,15 @@ export function ProfileHeaderSuggestedFollows({
</View>

<ScrollView
horizontal
showsHorizontalScrollIndicator={false}
horizontal={true}
showsHorizontalScrollIndicator={isWeb}
persistentScrollbar={true}
scrollIndicatorInsets={{bottom: 0}}
scrollEnabled={true}
contentContainerStyle={{
alignItems: 'flex-start',
paddingLeft: INNER_PADDING / 2,
paddingBottom: INNER_PADDING,
}}>
{isLoading ? (
<>
Expand Down
9 changes: 4 additions & 5 deletions src/view/com/util/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, {ComponentProps, useMemo} from 'react'
import {observer} from 'mobx-react-lite'
import React, {ComponentProps, memo, useMemo} from 'react'
import {
Linking,
GestureResponderEvent,
Expand Down Expand Up @@ -50,7 +49,7 @@ interface Props extends ComponentProps<typeof TouchableOpacity> {
anchorNoUnderline?: boolean
}

export const Link = observer(function Link({
export const Link = memo(function Link({
testID,
style,
href,
Expand Down Expand Up @@ -136,7 +135,7 @@ export const Link = observer(function Link({
)
})

export const TextLink = observer(function TextLink({
export const TextLink = memo(function TextLink({
testID,
type = 'md',
style,
Expand Down Expand Up @@ -236,7 +235,7 @@ interface DesktopWebTextLinkProps extends TextProps {
accessibilityHint?: string
title?: string
}
export const DesktopWebTextLink = observer(function DesktopWebTextLink({
export const DesktopWebTextLink = memo(function DesktopWebTextLink({
testID,
type = 'md',
style,
Expand Down
Loading

0 comments on commit a1a61ef

Please sign in to comment.