Merge branch 'main' into ja-translation-17
This commit is contained in:
@@ -54,21 +54,6 @@ jest.mock('expo-image-manipulator', () => ({
|
|||||||
SaveFormat: jest.requireActual('expo-image-manipulator').SaveFormat,
|
SaveFormat: jest.requireActual('expo-image-manipulator').SaveFormat,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
jest.mock('@segment/analytics-react-native', () => ({
|
|
||||||
createClient: () => ({
|
|
||||||
add: jest.fn(),
|
|
||||||
}),
|
|
||||||
useAnalytics: () => ({
|
|
||||||
track: jest.fn(),
|
|
||||||
identify: jest.fn(),
|
|
||||||
reset: jest.fn(),
|
|
||||||
group: jest.fn(),
|
|
||||||
screen: jest.fn(),
|
|
||||||
alias: jest.fn(),
|
|
||||||
flush: jest.fn(),
|
|
||||||
}),
|
|
||||||
}))
|
|
||||||
|
|
||||||
jest.mock('expo-camera', () => ({
|
jest.mock('expo-camera', () => ({
|
||||||
Camera: {
|
Camera: {
|
||||||
useCameraPermissions: jest.fn(() => [true]),
|
useCameraPermissions: jest.fn(() => [true]),
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
let IMAGE_EXTENSIONS: [String] = ["png", "jpg", "jpeg", "gif", "heic"]
|
||||||
|
let MOVIE_EXTENSIONS: [String] = ["mov", "mp4", "m4v"]
|
||||||
|
|
||||||
|
enum URLType: String, CaseIterable {
|
||||||
|
case image
|
||||||
|
case movie
|
||||||
|
case other
|
||||||
|
}
|
||||||
|
|
||||||
class ShareViewController: UIViewController {
|
class ShareViewController: UIViewController {
|
||||||
// This allows other forks to use this extension while also changing their
|
// This allows other forks to use this extension while also changing their
|
||||||
// scheme.
|
// scheme.
|
||||||
@@ -43,9 +52,18 @@ class ShareViewController: UIViewController {
|
|||||||
|
|
||||||
private func handleUrl(item: NSItemProvider) async {
|
private func handleUrl(item: NSItemProvider) async {
|
||||||
if let data = try? await item.loadItem(forTypeIdentifier: "public.url") as? URL {
|
if let data = try? await item.loadItem(forTypeIdentifier: "public.url") as? URL {
|
||||||
if let encoded = data.absoluteString.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed),
|
switch data.type {
|
||||||
let url = URL(string: "\(self.appScheme)://intent/compose?text=\(encoded)") {
|
case .image:
|
||||||
_ = self.openURL(url)
|
await handleImages(items: [item])
|
||||||
|
return
|
||||||
|
case .movie:
|
||||||
|
await handleVideos(items: [item])
|
||||||
|
return
|
||||||
|
case .other:
|
||||||
|
if let encoded = data.absoluteString.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed),
|
||||||
|
let url = URL(string: "\(self.appScheme)://intent/compose?text=\(encoded)") {
|
||||||
|
_ = self.openURL(url)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.completeRequest()
|
self.completeRequest()
|
||||||
@@ -158,3 +176,21 @@ class ShareViewController: UIViewController {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension URL {
|
||||||
|
var type: URLType {
|
||||||
|
get {
|
||||||
|
guard self.absoluteString.starts(with: "file://"),
|
||||||
|
let ext = self.pathComponents.last?.split(separator: ".").last?.lowercased() else {
|
||||||
|
return .other
|
||||||
|
}
|
||||||
|
|
||||||
|
if IMAGE_EXTENSIONS.contains(ext) {
|
||||||
|
return .image
|
||||||
|
} else if MOVIE_EXTENSIONS.contains(ext) {
|
||||||
|
return .movie
|
||||||
|
}
|
||||||
|
return .other
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+79
-21
@@ -12,6 +12,11 @@ import java.io.File
|
|||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
import java.net.URLEncoder
|
import java.net.URLEncoder
|
||||||
|
|
||||||
|
enum class AttachmentType {
|
||||||
|
IMAGE,
|
||||||
|
VIDEO,
|
||||||
|
}
|
||||||
|
|
||||||
class ExpoReceiveAndroidIntentsModule : Module() {
|
class ExpoReceiveAndroidIntentsModule : Module() {
|
||||||
override fun definition() =
|
override fun definition() =
|
||||||
ModuleDefinition {
|
ModuleDefinition {
|
||||||
@@ -23,17 +28,26 @@ class ExpoReceiveAndroidIntentsModule : Module() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun handleIntent(intent: Intent?) {
|
private fun handleIntent(intent: Intent?) {
|
||||||
if (appContext.currentActivity == null || intent == null) return
|
if (appContext.currentActivity == null) return
|
||||||
|
intent?.let {
|
||||||
if (intent.action == Intent.ACTION_SEND) {
|
if (it.action == Intent.ACTION_SEND && it.type == "text/plain") {
|
||||||
if (intent.type == "text/plain") {
|
handleTextIntent(it)
|
||||||
handleTextIntent(intent)
|
return
|
||||||
} else if (intent.type.toString().startsWith("image/")) {
|
|
||||||
handleImageIntent(intent)
|
|
||||||
}
|
}
|
||||||
} else if (intent.action == Intent.ACTION_SEND_MULTIPLE) {
|
|
||||||
if (intent.type.toString().startsWith("image/")) {
|
val type =
|
||||||
handleImagesIntent(intent)
|
if (it.type.toString().startsWith("image/")) {
|
||||||
|
AttachmentType.IMAGE
|
||||||
|
} else if (it.type.toString().startsWith("video/")) {
|
||||||
|
AttachmentType.VIDEO
|
||||||
|
} else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (it.action == Intent.ACTION_SEND) {
|
||||||
|
handleAttachmentIntent(it, type)
|
||||||
|
} else if (it.action == Intent.ACTION_SEND_MULTIPLE) {
|
||||||
|
handleAttachmentsIntent(it, type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,26 +62,46 @@ class ExpoReceiveAndroidIntentsModule : Module() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleImageIntent(intent: Intent) {
|
private fun handleAttachmentIntent(
|
||||||
|
intent: Intent,
|
||||||
|
type: AttachmentType,
|
||||||
|
) {
|
||||||
val uri =
|
val uri =
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
intent.getParcelableExtra(Intent.EXTRA_STREAM, Uri::class.java)
|
intent.getParcelableExtra(Intent.EXTRA_STREAM, Uri::class.java)
|
||||||
} else {
|
} else {
|
||||||
intent.getParcelableExtra(Intent.EXTRA_STREAM)
|
intent.getParcelableExtra(Intent.EXTRA_STREAM)
|
||||||
}
|
}
|
||||||
if (uri == null) return
|
|
||||||
|
|
||||||
handleImageIntents(listOf(uri))
|
uri?.let {
|
||||||
|
when (type) {
|
||||||
|
AttachmentType.IMAGE -> handleImageIntents(listOf(it))
|
||||||
|
AttachmentType.VIDEO -> handleVideoIntents(listOf(it))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleImagesIntent(intent: Intent) {
|
private fun handleAttachmentsIntent(
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
intent: Intent,
|
||||||
intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM, Uri::class.java)?.let {
|
type: AttachmentType,
|
||||||
handleImageIntents(it.filterIsInstance<Uri>().take(4))
|
) {
|
||||||
|
val uris =
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
|
intent
|
||||||
|
.getParcelableArrayListExtra(Intent.EXTRA_STREAM, Uri::class.java)
|
||||||
|
?.filterIsInstance<Uri>()
|
||||||
|
?.take(4)
|
||||||
|
} else {
|
||||||
|
intent
|
||||||
|
.getParcelableArrayListExtra<Uri>(Intent.EXTRA_STREAM)
|
||||||
|
?.filterIsInstance<Uri>()
|
||||||
|
?.take(4)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
intent.getParcelableArrayListExtra<Uri>(Intent.EXTRA_STREAM)?.let {
|
uris?.let {
|
||||||
handleImageIntents(it.filterIsInstance<Uri>().take(4))
|
when (type) {
|
||||||
|
AttachmentType.IMAGE -> handleImageIntents(it)
|
||||||
|
else -> return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,11 +127,33 @@ class ExpoReceiveAndroidIntentsModule : Module() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun handleVideoIntents(uris: List<Uri>) {
|
||||||
|
val uri = uris[0]
|
||||||
|
// If there is no extension for the file, substringAfterLast returns the original string - not
|
||||||
|
// null, so we check for that below
|
||||||
|
// It doesn't actually matter what the extension is, so defaulting to mp4 is fine, even if the
|
||||||
|
// video isn't actually an mp4
|
||||||
|
var extension = uri.path?.substringAfterLast(".")
|
||||||
|
if (extension == null || extension == uri.path) {
|
||||||
|
extension = "mp4"
|
||||||
|
}
|
||||||
|
val file = createFile(extension)
|
||||||
|
|
||||||
|
val out = FileOutputStream(file)
|
||||||
|
appContext.currentActivity?.contentResolver?.openInputStream(uri)?.use {
|
||||||
|
it.copyTo(out)
|
||||||
|
}
|
||||||
|
"bluesky://intent/compose?videoUri=${URLEncoder.encode(file.path, "UTF-8")}".toUri().let {
|
||||||
|
val newIntent = Intent(Intent.ACTION_VIEW, it)
|
||||||
|
appContext.currentActivity?.startActivity(newIntent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun getImageInfo(uri: Uri): Map<String, Any> {
|
private fun getImageInfo(uri: Uri): Map<String, Any> {
|
||||||
val bitmap = MediaStore.Images.Media.getBitmap(appContext.currentActivity?.contentResolver, uri)
|
val bitmap = MediaStore.Images.Media.getBitmap(appContext.currentActivity?.contentResolver, uri)
|
||||||
// We have to save this so that we can access it later when uploading the image.
|
// We have to save this so that we can access it later when uploading the image.
|
||||||
// createTempFile will automatically place a unique string between "img" and "temp.jpeg"
|
// createTempFile will automatically place a unique string between "img" and "temp.jpeg"
|
||||||
val file = File.createTempFile("img", "temp.jpeg", appContext.currentActivity?.cacheDir)
|
val file = createFile("jpeg")
|
||||||
val out = FileOutputStream(file)
|
val out = FileOutputStream(file)
|
||||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out)
|
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out)
|
||||||
out.flush()
|
out.flush()
|
||||||
@@ -110,6 +166,8 @@ class ExpoReceiveAndroidIntentsModule : Module() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun createFile(extension: String): File = File.createTempFile(extension, "temp.$extension", appContext.currentActivity?.cacheDir)
|
||||||
|
|
||||||
// We will pas the width and height to the app here, since getting measurements
|
// We will pas the width and height to the app here, since getting measurements
|
||||||
// on the RN side is a bit more involved, and we already have them here anyway.
|
// on the RN side is a bit more involved, and we already have them here anyway.
|
||||||
private fun buildUriData(info: Map<String, Any>): String {
|
private fun buildUriData(info: Map<String, Any>): String {
|
||||||
|
|||||||
+1
-5
@@ -53,7 +53,7 @@
|
|||||||
"icons:optimize": "svgo -f ./assets/icons"
|
"icons:optimize": "svgo -f ./assets/icons"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@atproto/api": "^0.13.7",
|
"@atproto/api": "^0.13.8",
|
||||||
"@braintree/sanitize-url": "^6.0.2",
|
"@braintree/sanitize-url": "^6.0.2",
|
||||||
"@discord/bottom-sheet": "bluesky-social/react-native-bottom-sheet",
|
"@discord/bottom-sheet": "bluesky-social/react-native-bottom-sheet",
|
||||||
"@emoji-mart/react": "^1.1.1",
|
"@emoji-mart/react": "^1.1.1",
|
||||||
@@ -81,10 +81,6 @@
|
|||||||
"@react-navigation/drawer": "^6.6.15",
|
"@react-navigation/drawer": "^6.6.15",
|
||||||
"@react-navigation/native": "^6.1.17",
|
"@react-navigation/native": "^6.1.17",
|
||||||
"@react-navigation/native-stack": "^6.9.26",
|
"@react-navigation/native-stack": "^6.9.26",
|
||||||
"@segment/analytics-next": "^1.51.3",
|
|
||||||
"@segment/analytics-react": "^1.0.0-rc1",
|
|
||||||
"@segment/analytics-react-native": "^2.10.1",
|
|
||||||
"@segment/sovran-react-native": "^0.4.5",
|
|
||||||
"@sentry/react-native": "5.32.0",
|
"@sentry/react-native": "5.32.0",
|
||||||
"@tamagui/focus-scope": "^1.84.1",
|
"@tamagui/focus-scope": "^1.84.1",
|
||||||
"@tanstack/query-async-storage-persister": "^5.25.0",
|
"@tanstack/query-async-storage-persister": "^5.25.0",
|
||||||
|
|||||||
@@ -27,6 +27,29 @@ const withIntentFilters = config => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
action: [
|
||||||
|
{
|
||||||
|
$: {
|
||||||
|
'android:name': 'android.intent.action.SEND',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
category: [
|
||||||
|
{
|
||||||
|
$: {
|
||||||
|
'android:name': 'android.intent.category.DEFAULT',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
$: {
|
||||||
|
'android:mimeType': 'video/*',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
action: [
|
action: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import {
|
|||||||
StackActions,
|
StackActions,
|
||||||
} from '@react-navigation/native'
|
} from '@react-navigation/native'
|
||||||
|
|
||||||
import {init as initAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {timeout} from '#/lib/async/timeout'
|
import {timeout} from '#/lib/async/timeout'
|
||||||
import {useColorSchemeStyle} from '#/lib/hooks/useColorSchemeStyle'
|
import {useColorSchemeStyle} from '#/lib/hooks/useColorSchemeStyle'
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
@@ -647,8 +646,6 @@ function RoutesContainer({children}: React.PropsWithChildren<{}>) {
|
|||||||
|
|
||||||
function onReady() {
|
function onReady() {
|
||||||
prevLoggedRouteName.current = getCurrentRouteName()
|
prevLoggedRouteName.current = getCurrentRouteName()
|
||||||
initAnalytics(currentAccount)
|
|
||||||
|
|
||||||
if (currentAccount && shouldRequestEmailConfirmation(currentAccount)) {
|
if (currentAccount && shouldRequestEmailConfirmation(currentAccount)) {
|
||||||
openModal({name: 'verify-email', showReminder: true})
|
openModal({name: 'verify-email', showReminder: true})
|
||||||
snoozeEmailConfirmationPrompt()
|
snoozeEmailConfirmationPrompt()
|
||||||
|
|||||||
@@ -1,18 +1,23 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import QRCode from 'react-native-qrcode-styled'
|
import QRCode from 'react-native-qrcode-styled'
|
||||||
import ViewShot from 'react-native-view-shot'
|
import type ViewShot from 'react-native-view-shot'
|
||||||
import {AppBskyGraphDefs, AppBskyGraphStarterpack} from '@atproto/api'
|
import {AppBskyGraphDefs, AppBskyGraphStarterpack} from '@atproto/api'
|
||||||
import {Trans} from '@lingui/macro'
|
import {Trans} from '@lingui/macro'
|
||||||
|
|
||||||
import {isWeb} from 'platform/detection'
|
import {isWeb} from '#/platform/detection'
|
||||||
import {Logo} from 'view/icons/Logo'
|
import {Logo} from '#/view/icons/Logo'
|
||||||
import {Logotype} from 'view/icons/Logotype'
|
import {Logotype} from '#/view/icons/Logotype'
|
||||||
import {useTheme} from '#/alf'
|
import {useTheme} from '#/alf'
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
import {LinearGradientBackground} from '#/components/LinearGradientBackground'
|
import {LinearGradientBackground} from '#/components/LinearGradientBackground'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
|
|
||||||
|
const LazyViewShot = React.lazy(
|
||||||
|
// @ts-expect-error dynamic import
|
||||||
|
() => import('react-native-view-shot/src/index'),
|
||||||
|
)
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
starterPack: AppBskyGraphDefs.StarterPackView
|
starterPack: AppBskyGraphDefs.StarterPackView
|
||||||
link: string
|
link: string
|
||||||
@@ -29,7 +34,7 @@ export const QrCode = React.forwardRef<ViewShot, Props>(function QrCode(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ViewShot ref={ref}>
|
<LazyViewShot ref={ref}>
|
||||||
<LinearGradientBackground
|
<LinearGradientBackground
|
||||||
style={[
|
style={[
|
||||||
{width: 300, minHeight: 390},
|
{width: 300, minHeight: 390},
|
||||||
@@ -79,7 +84,7 @@ export const QrCode = React.forwardRef<ViewShot, Props>(function QrCode(
|
|||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</LinearGradientBackground>
|
</LinearGradientBackground>
|
||||||
</ViewShot>
|
</LazyViewShot>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import ViewShot from 'react-native-view-shot'
|
import type ViewShot from 'react-native-view-shot'
|
||||||
import {requestMediaLibraryPermissionsAsync} from 'expo-image-picker'
|
import {requestMediaLibraryPermissionsAsync} from 'expo-image-picker'
|
||||||
import {createAssetAsync} from 'expo-media-library'
|
import {createAssetAsync} from 'expo-media-library'
|
||||||
import * as Sharing from 'expo-sharing'
|
import * as Sharing from 'expo-sharing'
|
||||||
@@ -8,9 +8,9 @@ import {AppBskyGraphDefs, AppBskyGraphStarterpack} from '@atproto/api'
|
|||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {logEvent} from 'lib/statsig/statsig'
|
import {isNative, isWeb} from '#/platform/detection'
|
||||||
import {isNative, isWeb} from 'platform/detection'
|
|
||||||
import * as Toast from '#/view/com/util/Toast'
|
import * as Toast from '#/view/com/util/Toast'
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
import {Button, ButtonText} from '#/components/Button'
|
import {Button, ButtonText} from '#/components/Button'
|
||||||
@@ -153,46 +153,54 @@ export function QrCodeDialog({
|
|||||||
<Dialog.ScrollableInner
|
<Dialog.ScrollableInner
|
||||||
label={_(msg`Create a QR code for a starter pack`)}>
|
label={_(msg`Create a QR code for a starter pack`)}>
|
||||||
<View style={[a.flex_1, a.align_center, a.gap_5xl]}>
|
<View style={[a.flex_1, a.align_center, a.gap_5xl]}>
|
||||||
{!link ? (
|
<React.Suspense fallback={<Loading />}>
|
||||||
<View style={[a.align_center, a.p_xl]}>
|
{!link ? (
|
||||||
<Loader size="xl" />
|
<Loading />
|
||||||
</View>
|
) : (
|
||||||
) : (
|
<>
|
||||||
<>
|
<QrCode starterPack={starterPack} link={link} ref={ref} />
|
||||||
<QrCode starterPack={starterPack} link={link} ref={ref} />
|
{isProcessing ? (
|
||||||
{isProcessing ? (
|
<View>
|
||||||
<View>
|
<Loader size="xl" />
|
||||||
<Loader size="xl" />
|
</View>
|
||||||
</View>
|
) : (
|
||||||
) : (
|
<View
|
||||||
<View
|
style={[a.w_full, a.gap_md, isWeb && [a.flex_row_reverse]]}>
|
||||||
style={[a.w_full, a.gap_md, isWeb && [a.flex_row_reverse]]}>
|
<Button
|
||||||
<Button
|
label={_(msg`Copy QR code`)}
|
||||||
label={_(msg`Copy QR code`)}
|
variant="solid"
|
||||||
variant="solid"
|
color="secondary"
|
||||||
color="secondary"
|
size="small"
|
||||||
size="small"
|
onPress={isWeb ? onCopyPress : onSharePress}>
|
||||||
onPress={isWeb ? onCopyPress : onSharePress}>
|
<ButtonText>
|
||||||
<ButtonText>
|
{isWeb ? <Trans>Copy</Trans> : <Trans>Share</Trans>}
|
||||||
{isWeb ? <Trans>Copy</Trans> : <Trans>Share</Trans>}
|
</ButtonText>
|
||||||
</ButtonText>
|
</Button>
|
||||||
</Button>
|
<Button
|
||||||
<Button
|
label={_(msg`Save QR code`)}
|
||||||
label={_(msg`Save QR code`)}
|
variant="solid"
|
||||||
variant="solid"
|
color="secondary"
|
||||||
color="secondary"
|
size="small"
|
||||||
size="small"
|
onPress={onSavePress}>
|
||||||
onPress={onSavePress}>
|
<ButtonText>
|
||||||
<ButtonText>
|
<Trans>Save</Trans>
|
||||||
<Trans>Save</Trans>
|
</ButtonText>
|
||||||
</ButtonText>
|
</Button>
|
||||||
</Button>
|
</View>
|
||||||
</View>
|
)}
|
||||||
)}
|
</>
|
||||||
</>
|
)}
|
||||||
)}
|
</React.Suspense>
|
||||||
</View>
|
</View>
|
||||||
</Dialog.ScrollableInner>
|
</Dialog.ScrollableInner>
|
||||||
</Dialog.Outer>
|
</Dialog.Outer>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Loading() {
|
||||||
|
return (
|
||||||
|
<View style={[a.align_center, a.p_xl]}>
|
||||||
|
<Loader size="xl" />
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,158 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import {AppState, AppStateStatus} from 'react-native'
|
|
||||||
import AsyncStorage from '@react-native-async-storage/async-storage'
|
|
||||||
import {createClient, SegmentClient} from '@segment/analytics-react-native'
|
|
||||||
import * as Sentry from '@sentry/react-native'
|
|
||||||
import {sha256} from 'js-sha256'
|
|
||||||
|
|
||||||
import {logger} from '#/logger'
|
|
||||||
import {SessionAccount, useSession} from '#/state/session'
|
|
||||||
import {ScreenPropertiesMap, TrackPropertiesMap} from './types'
|
|
||||||
|
|
||||||
type AppInfo = {
|
|
||||||
build?: string | undefined
|
|
||||||
name?: string | undefined
|
|
||||||
namespace?: string | undefined
|
|
||||||
version?: string | undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delay creating until first actual use.
|
|
||||||
let segmentClient: SegmentClient | null = null
|
|
||||||
function getClient(): SegmentClient {
|
|
||||||
if (!segmentClient) {
|
|
||||||
segmentClient = createClient({
|
|
||||||
writeKey: '8I6DsgfiSLuoONyaunGoiQM7A6y2ybdI',
|
|
||||||
trackAppLifecycleEvents: false,
|
|
||||||
proxy: 'https://api.events.bsky.app/v1',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return segmentClient
|
|
||||||
}
|
|
||||||
|
|
||||||
export const track = async <E extends keyof TrackPropertiesMap>(
|
|
||||||
event: E,
|
|
||||||
properties?: TrackPropertiesMap[E],
|
|
||||||
) => {
|
|
||||||
await getClient().track(event, properties)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function useAnalytics() {
|
|
||||||
const {hasSession} = useSession()
|
|
||||||
|
|
||||||
return React.useMemo(() => {
|
|
||||||
if (hasSession) {
|
|
||||||
return {
|
|
||||||
async screen<E extends keyof ScreenPropertiesMap>(
|
|
||||||
event: E,
|
|
||||||
properties?: ScreenPropertiesMap[E],
|
|
||||||
) {
|
|
||||||
await getClient().screen(event, properties)
|
|
||||||
},
|
|
||||||
async track<E extends keyof TrackPropertiesMap>(
|
|
||||||
event: E,
|
|
||||||
properties?: TrackPropertiesMap[E],
|
|
||||||
) {
|
|
||||||
await getClient().track(event, properties)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// dont send analytics pings for anonymous users
|
|
||||||
return {
|
|
||||||
screen: async () => {},
|
|
||||||
track: async () => {},
|
|
||||||
}
|
|
||||||
}, [hasSession])
|
|
||||||
}
|
|
||||||
|
|
||||||
export function init(account: SessionAccount | undefined) {
|
|
||||||
setupListenersOnce()
|
|
||||||
|
|
||||||
if (account) {
|
|
||||||
const client = getClient()
|
|
||||||
if (account.did) {
|
|
||||||
const did_hashed = sha256(account.did)
|
|
||||||
client.identify(did_hashed, {did_hashed})
|
|
||||||
Sentry.setUser({id: did_hashed})
|
|
||||||
logger.debug('Ping w/hash')
|
|
||||||
} else {
|
|
||||||
logger.debug('Ping w/o hash')
|
|
||||||
client.identify()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let didSetupListeners = false
|
|
||||||
function setupListenersOnce() {
|
|
||||||
if (didSetupListeners) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
didSetupListeners = true
|
|
||||||
// NOTE
|
|
||||||
// this is a copy of segment's own lifecycle event tracking
|
|
||||||
// we handle it manually to ensure that it never fires while the app is backgrounded
|
|
||||||
// -prf
|
|
||||||
const client = getClient()
|
|
||||||
client.isReady.onChange(async () => {
|
|
||||||
if (AppState.currentState !== 'active') {
|
|
||||||
logger.debug('Prevented a metrics ping while the app was backgrounded')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const context = client.context.get()
|
|
||||||
if (typeof context?.app === 'undefined') {
|
|
||||||
logger.debug('Aborted metrics ping due to unavailable context')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const oldAppInfo = await readAppInfo()
|
|
||||||
const newAppInfo = context.app as AppInfo
|
|
||||||
writeAppInfo(newAppInfo)
|
|
||||||
logger.debug('Recording app info', {new: newAppInfo, old: oldAppInfo})
|
|
||||||
|
|
||||||
if (typeof oldAppInfo === 'undefined') {
|
|
||||||
client.track('Application Installed', {
|
|
||||||
version: newAppInfo.version,
|
|
||||||
build: newAppInfo.build,
|
|
||||||
})
|
|
||||||
} else if (newAppInfo.version !== oldAppInfo.version) {
|
|
||||||
client.track('Application Updated', {
|
|
||||||
version: newAppInfo.version,
|
|
||||||
build: newAppInfo.build,
|
|
||||||
previous_version: oldAppInfo.version,
|
|
||||||
previous_build: oldAppInfo.build,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
client.track('Application Opened', {
|
|
||||||
from_background: false,
|
|
||||||
version: newAppInfo.version,
|
|
||||||
build: newAppInfo.build,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
let lastState: AppStateStatus = AppState.currentState
|
|
||||||
AppState.addEventListener('change', (state: AppStateStatus) => {
|
|
||||||
if (state === 'active' && lastState !== 'active') {
|
|
||||||
const context = client.context.get()
|
|
||||||
client.track('Application Opened', {
|
|
||||||
from_background: true,
|
|
||||||
version: context?.app?.version,
|
|
||||||
build: context?.app?.build,
|
|
||||||
})
|
|
||||||
} else if (state !== 'active' && lastState === 'active') {
|
|
||||||
client.track('Application Backgrounded')
|
|
||||||
}
|
|
||||||
lastState = state
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function writeAppInfo(value: AppInfo) {
|
|
||||||
await AsyncStorage.setItem('BSKY_APP_INFO', JSON.stringify(value))
|
|
||||||
}
|
|
||||||
|
|
||||||
async function readAppInfo(): Promise<AppInfo | undefined> {
|
|
||||||
const rawData = await AsyncStorage.getItem('BSKY_APP_INFO')
|
|
||||||
const obj = rawData ? JSON.parse(rawData) : undefined
|
|
||||||
if (!obj || typeof obj !== 'object') {
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
return obj
|
|
||||||
}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import {createClient} from '@segment/analytics-react'
|
|
||||||
import * as Sentry from '@sentry/react-native'
|
|
||||||
import {sha256} from 'js-sha256'
|
|
||||||
|
|
||||||
import {logger} from '#/logger'
|
|
||||||
import {SessionAccount, useSession} from '#/state/session'
|
|
||||||
import {ScreenPropertiesMap, TrackPropertiesMap} from './types'
|
|
||||||
|
|
||||||
type SegmentClient = ReturnType<typeof createClient>
|
|
||||||
|
|
||||||
// Delay creating until first actual use.
|
|
||||||
let segmentClient: SegmentClient | null = null
|
|
||||||
function getClient(): SegmentClient {
|
|
||||||
if (!segmentClient) {
|
|
||||||
segmentClient = createClient(
|
|
||||||
{
|
|
||||||
writeKey: '8I6DsgfiSLuoONyaunGoiQM7A6y2ybdI',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
integrations: {
|
|
||||||
'Segment.io': {
|
|
||||||
apiHost: 'api.events.bsky.app/v1',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return segmentClient
|
|
||||||
}
|
|
||||||
|
|
||||||
export const track = async <E extends keyof TrackPropertiesMap>(
|
|
||||||
event: E,
|
|
||||||
properties?: TrackPropertiesMap[E],
|
|
||||||
) => {
|
|
||||||
await getClient().track(event, properties)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function useAnalytics() {
|
|
||||||
const {hasSession} = useSession()
|
|
||||||
|
|
||||||
return React.useMemo(() => {
|
|
||||||
if (hasSession) {
|
|
||||||
return {
|
|
||||||
async screen<E extends keyof ScreenPropertiesMap>(
|
|
||||||
event: E,
|
|
||||||
properties?: ScreenPropertiesMap[E],
|
|
||||||
) {
|
|
||||||
await getClient().screen(event, properties)
|
|
||||||
},
|
|
||||||
async track<E extends keyof TrackPropertiesMap>(
|
|
||||||
event: E,
|
|
||||||
properties?: TrackPropertiesMap[E],
|
|
||||||
) {
|
|
||||||
await getClient().track(event, properties)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// dont send analytics pings for anonymous users
|
|
||||||
return {
|
|
||||||
screen: async () => {},
|
|
||||||
track: async () => {},
|
|
||||||
}
|
|
||||||
}, [hasSession])
|
|
||||||
}
|
|
||||||
|
|
||||||
export function init(account: SessionAccount | undefined) {
|
|
||||||
if (account) {
|
|
||||||
const client = getClient()
|
|
||||||
if (account.did) {
|
|
||||||
const did_hashed = sha256(account.did)
|
|
||||||
client.identify(did_hashed, {did_hashed})
|
|
||||||
Sentry.setUser({id: did_hashed})
|
|
||||||
logger.debug('Ping w/hash')
|
|
||||||
} else {
|
|
||||||
logger.debug('Ping w/o hash')
|
|
||||||
client.identify()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,181 +0,0 @@
|
|||||||
export type TrackPropertiesMap = {
|
|
||||||
// LOGIN / SIGN UP events
|
|
||||||
'Sign In': {resumedSession: boolean} // CAN BE SERVER
|
|
||||||
'Create Account': {} // CAN BE SERVER
|
|
||||||
'Try Create Account': {}
|
|
||||||
'Signin:PressedForgotPassword': {}
|
|
||||||
'Signin:PressedSelectService': {}
|
|
||||||
// COMPOSER / CREATE POST events
|
|
||||||
'Create Post': {imageCount: string | number} // CAN BE SERVER
|
|
||||||
'Composer:PastedPhotos': {}
|
|
||||||
'Composer:CameraOpened': {}
|
|
||||||
'Composer:GalleryOpened': {}
|
|
||||||
'Composer:ThreadgateOpened': {}
|
|
||||||
'HomeScreen:PressCompose': {}
|
|
||||||
'ProfileScreen:PressCompose': {}
|
|
||||||
// EDIT PROFILE events
|
|
||||||
'EditHandle:ViewCustomForm': {}
|
|
||||||
'EditHandle:ViewProvidedForm': {}
|
|
||||||
'EditHandle:SetNewHandle': {}
|
|
||||||
'EditProfile:AvatarSelected': {}
|
|
||||||
'EditProfile:BannerSelected': {}
|
|
||||||
'EditProfile:Save': {} // CAN BE SERVER
|
|
||||||
// FEED events
|
|
||||||
'Feed:onRefresh': {}
|
|
||||||
'Feed:onEndReached': {}
|
|
||||||
// POST events
|
|
||||||
'Post:Like': {} // CAN BE SERVER
|
|
||||||
'Post:Unlike': {} // CAN BE SERVER
|
|
||||||
'Post:Repost': {} // CAN BE SERVER
|
|
||||||
'Post:Unrepost': {} // CAN BE SERVER
|
|
||||||
'Post:Delete': {} // CAN BE SERVER
|
|
||||||
'Post:ThreadMute': {} // CAN BE SERVER
|
|
||||||
'Post:ThreadUnmute': {} // CAN BE SERVER
|
|
||||||
'Post:Reply': {} // CAN BE SERVER
|
|
||||||
'Post:EditThreadgateOpened': {}
|
|
||||||
'Post:ThreadgateEdited': {}
|
|
||||||
// PROFILE events
|
|
||||||
'Profile:Follow': {
|
|
||||||
username: string
|
|
||||||
}
|
|
||||||
'Profile:Unfollow': {
|
|
||||||
username: string
|
|
||||||
}
|
|
||||||
// PROFILE HEADER events
|
|
||||||
'ProfileHeader:EditProfileButtonClicked': {}
|
|
||||||
'ProfileHeader:FollowersButtonClicked': {
|
|
||||||
handle: string
|
|
||||||
}
|
|
||||||
'ProfileHeader:FollowsButtonClicked': {
|
|
||||||
handle: string
|
|
||||||
}
|
|
||||||
'ProfileHeader:ShareButtonClicked': {}
|
|
||||||
'ProfileHeader:MuteAccountButtonClicked': {}
|
|
||||||
'ProfileHeader:UnmuteAccountButtonClicked': {}
|
|
||||||
'ProfileHeader:ReportAccountButtonClicked': {}
|
|
||||||
'ProfileHeader:AddToListsButtonClicked': {}
|
|
||||||
'ProfileHeader:BlockAccountButtonClicked': {}
|
|
||||||
'ProfileHeader:UnblockAccountButtonClicked': {}
|
|
||||||
'ProfileHeader:FollowButtonClicked': {}
|
|
||||||
'ProfileHeader:UnfollowButtonClicked': {}
|
|
||||||
'ProfileHeader:SuggestedFollowsOpened': {}
|
|
||||||
'ProfileHeader:SuggestedFollowFollowed': {}
|
|
||||||
'ViewHeader:MenuButtonClicked': {}
|
|
||||||
// SETTINGS events
|
|
||||||
'Settings:SwitchAccountButtonClicked': {}
|
|
||||||
'Settings:AddAccountButtonClicked': {}
|
|
||||||
'Settings:ChangeHandleButtonClicked': {}
|
|
||||||
'Settings:InvitecodesButtonClicked': {}
|
|
||||||
'Settings:SignOutButtonClicked': {}
|
|
||||||
'Settings:ContentlanguagesButtonClicked': {}
|
|
||||||
// MENU events
|
|
||||||
'Menu:ItemClicked': {url: string}
|
|
||||||
'Menu:FeedbackClicked': {}
|
|
||||||
'Menu:HelpClicked': {}
|
|
||||||
// MOBILE SHELL events
|
|
||||||
'MobileShell:MyProfileButtonPressed': {}
|
|
||||||
'MobileShell:HomeButtonPressed': {}
|
|
||||||
'MobileShell:SearchButtonPressed': {}
|
|
||||||
'MobileShell:NotificationsButtonPressed': {}
|
|
||||||
'MobileShell:FeedsButtonPressed': {}
|
|
||||||
'MobileShell:MessagesButtonPressed': {}
|
|
||||||
// NOTIFICATIONS events
|
|
||||||
'Notificatons:OpenApp': {}
|
|
||||||
// LISTS events
|
|
||||||
'Lists:onRefresh': {}
|
|
||||||
'Lists:onEndReached': {}
|
|
||||||
'CreateList:AvatarSelected': {}
|
|
||||||
'CreateList:SaveCurateList': {} // CAN BE SERVER
|
|
||||||
'CreateList:SaveModList': {} // CAN BE SERVER
|
|
||||||
'Lists:Mute': {} // CAN BE SERVER
|
|
||||||
'Lists:Unmute': {} // CAN BE SERVER
|
|
||||||
'Lists:Block': {} // CAN BE SERVER
|
|
||||||
'Lists:Unblock': {} // CAN BE SERVER
|
|
||||||
'Lists:Delete': {} // CAN BE SERVER
|
|
||||||
'Lists:Share': {} // CAN BE SERVER
|
|
||||||
// CUSTOM FEED events
|
|
||||||
'CustomFeed:Save': {}
|
|
||||||
'CustomFeed:Unsave': {}
|
|
||||||
'CustomFeed:Like': {}
|
|
||||||
'CustomFeed:Unlike': {}
|
|
||||||
'CustomFeed:Share': {}
|
|
||||||
'CustomFeed:Pin': {
|
|
||||||
uri: string
|
|
||||||
name?: string
|
|
||||||
}
|
|
||||||
'CustomFeed:Unpin': {
|
|
||||||
uri: string
|
|
||||||
name?: string
|
|
||||||
}
|
|
||||||
'CustomFeed:Reorder': {
|
|
||||||
uri: string
|
|
||||||
name?: string
|
|
||||||
index: number
|
|
||||||
}
|
|
||||||
'CustomFeed:LoadMore': {}
|
|
||||||
'MultiFeed:onEndReached': {}
|
|
||||||
'MultiFeed:onRefresh': {}
|
|
||||||
// MODERATION events
|
|
||||||
'Moderation:ContentfilteringButtonClicked': {}
|
|
||||||
// ONBOARDING events
|
|
||||||
'Onboarding:Begin': {}
|
|
||||||
'Onboarding:Complete': {}
|
|
||||||
'Onboarding:Skipped': {}
|
|
||||||
'Onboarding:Reset': {}
|
|
||||||
'Onboarding:SuggestedFollowFollowed': {}
|
|
||||||
'Onboarding:CustomFeedAdded': {}
|
|
||||||
// Onboarding v2
|
|
||||||
'OnboardingV2:Begin': {}
|
|
||||||
'OnboardingV2:StepInterests:Start': {}
|
|
||||||
'OnboardingV2:StepInterests:End': {
|
|
||||||
selectedInterests: string[]
|
|
||||||
selectedInterestsLength: number
|
|
||||||
}
|
|
||||||
'OnboardingV2:StepInterests:Error': {}
|
|
||||||
'OnboardingV2:StepSuggestedAccounts:Start': {}
|
|
||||||
'OnboardingV2:StepSuggestedAccounts:End': {
|
|
||||||
selectedAccountsLength: number
|
|
||||||
}
|
|
||||||
'OnboardingV2:StepFollowingFeed:Start': {}
|
|
||||||
'OnboardingV2:StepFollowingFeed:End': {}
|
|
||||||
'OnboardingV2:StepAlgoFeeds:Start': {}
|
|
||||||
'OnboardingV2:StepAlgoFeeds:End': {
|
|
||||||
selectedPrimaryFeeds: string[]
|
|
||||||
selectedPrimaryFeedsLength: number
|
|
||||||
selectedSecondaryFeeds: string[]
|
|
||||||
selectedSecondaryFeedsLength: number
|
|
||||||
}
|
|
||||||
'OnboardingV2:StepTopicalFeeds:Start': {}
|
|
||||||
'OnboardingV2:StepTopicalFeeds:End': {
|
|
||||||
selectedFeeds: string[]
|
|
||||||
selectedFeedsLength: number
|
|
||||||
}
|
|
||||||
'OnboardingV2:StepModeration:Start': {}
|
|
||||||
'OnboardingV2:StepModeration:End': {}
|
|
||||||
'OnboardingV2:StepProfile:Start': {}
|
|
||||||
'OnboardingV2:StepProfile:End': {}
|
|
||||||
'OnboardingV2:StepFinished:Start': {}
|
|
||||||
'OnboardingV2:StepFinished:End': {}
|
|
||||||
'OnboardingV2:Complete': {}
|
|
||||||
'OnboardingV2:Skip': {}
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ScreenPropertiesMap = {
|
|
||||||
Login: {}
|
|
||||||
CreateAccount: {}
|
|
||||||
'Choose Account': {}
|
|
||||||
'Signin:ForgotPassword': {}
|
|
||||||
'Signin:SetNewPasswordForm': {}
|
|
||||||
'Signin:PasswordUpdatedForm': {}
|
|
||||||
Feed: {}
|
|
||||||
Notifications: {}
|
|
||||||
Profile: {}
|
|
||||||
'Profile:Preview': {}
|
|
||||||
Settings: {}
|
|
||||||
AppPasswords: {}
|
|
||||||
Moderation: {}
|
|
||||||
PreferencesExternalEmbeds: {}
|
|
||||||
BlockedAccounts: {}
|
|
||||||
MutedAccounts: {}
|
|
||||||
SavedFeeds: {}
|
|
||||||
}
|
|
||||||
@@ -8,7 +8,7 @@ import {FeedAPI, FeedAPIResponse} from './types'
|
|||||||
|
|
||||||
export class AuthorFeedAPI implements FeedAPI {
|
export class AuthorFeedAPI implements FeedAPI {
|
||||||
agent: BskyAgent
|
agent: BskyAgent
|
||||||
params: GetAuthorFeed.QueryParams
|
_params: GetAuthorFeed.QueryParams
|
||||||
|
|
||||||
constructor({
|
constructor({
|
||||||
agent,
|
agent,
|
||||||
@@ -18,7 +18,13 @@ export class AuthorFeedAPI implements FeedAPI {
|
|||||||
feedParams: GetAuthorFeed.QueryParams
|
feedParams: GetAuthorFeed.QueryParams
|
||||||
}) {
|
}) {
|
||||||
this.agent = agent
|
this.agent = agent
|
||||||
this.params = feedParams
|
this._params = feedParams
|
||||||
|
}
|
||||||
|
|
||||||
|
get params() {
|
||||||
|
const params = {...this._params}
|
||||||
|
params.includePins = params.filter !== 'posts_with_media'
|
||||||
|
return params
|
||||||
}
|
}
|
||||||
|
|
||||||
async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> {
|
async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> {
|
||||||
@@ -57,8 +63,9 @@ export class AuthorFeedAPI implements FeedAPI {
|
|||||||
return feed.filter(post => {
|
return feed.filter(post => {
|
||||||
const isReply = post.reply
|
const isReply = post.reply
|
||||||
const isRepost = AppBskyFeedDefs.isReasonRepost(post.reason)
|
const isRepost = AppBskyFeedDefs.isReasonRepost(post.reason)
|
||||||
|
const isPin = AppBskyFeedDefs.isReasonPin(post.reason)
|
||||||
if (!isReply) return true
|
if (!isReply) return true
|
||||||
if (isRepost) return true
|
if (isRepost || isPin) return true
|
||||||
return isReply && isAuthorReplyChain(this.params.actor, post, feed)
|
return isReply && isAuthorReplyChain(this.params.actor, post, feed)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,17 +13,19 @@ import {isNative} from '#/platform/detection'
|
|||||||
|
|
||||||
const DEFAULT_TARGET_SCALE = isNative || isTouchDevice ? 0.98 : 1
|
const DEFAULT_TARGET_SCALE = isNative || isTouchDevice ? 0.98 : 1
|
||||||
|
|
||||||
|
const AnimatedPressable = Animated.createAnimatedComponent(Pressable)
|
||||||
|
|
||||||
export function PressableScale({
|
export function PressableScale({
|
||||||
targetScale = DEFAULT_TARGET_SCALE,
|
targetScale = DEFAULT_TARGET_SCALE,
|
||||||
children,
|
children,
|
||||||
contentContainerStyle,
|
style,
|
||||||
onPressIn,
|
onPressIn,
|
||||||
onPressOut,
|
onPressOut,
|
||||||
...rest
|
...rest
|
||||||
}: {
|
}: {
|
||||||
targetScale?: number
|
targetScale?: number
|
||||||
contentContainerStyle?: StyleProp<ViewStyle>
|
style?: StyleProp<ViewStyle>
|
||||||
} & Exclude<PressableProps, 'onPressIn' | 'onPressOut'>) {
|
} & Exclude<PressableProps, 'onPressIn' | 'onPressOut' | 'style'>) {
|
||||||
const scale = useSharedValue(1)
|
const scale = useSharedValue(1)
|
||||||
|
|
||||||
const animatedStyle = useAnimatedStyle(() => ({
|
const animatedStyle = useAnimatedStyle(() => ({
|
||||||
@@ -31,7 +33,7 @@ export function PressableScale({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<AnimatedPressable
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
onPressIn={e => {
|
onPressIn={e => {
|
||||||
'worklet'
|
'worklet'
|
||||||
@@ -49,10 +51,9 @@ export function PressableScale({
|
|||||||
cancelAnimation(scale)
|
cancelAnimation(scale)
|
||||||
scale.value = withTiming(1, {duration: 100})
|
scale.value = withTiming(1, {duration: 100})
|
||||||
}}
|
}}
|
||||||
|
style={[animatedStyle, style]}
|
||||||
{...rest}>
|
{...rest}>
|
||||||
<Animated.View style={[animatedStyle, contentContainerStyle]}>
|
{children}
|
||||||
{children as React.ReactNode}
|
</AnimatedPressable>
|
||||||
</Animated.View>
|
|
||||||
</Pressable>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import {useCallback, useState} from 'react'
|
|||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {isWeb} from '#/platform/detection'
|
import {isWeb} from '#/platform/detection'
|
||||||
import {SessionAccount, useSessionApi} from '#/state/session'
|
import {SessionAccount, useSessionApi} from '#/state/session'
|
||||||
@@ -14,7 +13,6 @@ import {LogEvents} from '../statsig/statsig'
|
|||||||
export function useAccountSwitcher() {
|
export function useAccountSwitcher() {
|
||||||
const [pendingDid, setPendingDid] = useState<string | null>(null)
|
const [pendingDid, setPendingDid] = useState<string | null>(null)
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {resumeSession} = useSessionApi()
|
const {resumeSession} = useSessionApi()
|
||||||
const {requestSwitchToAccount} = useLoggedOutViewControls()
|
const {requestSwitchToAccount} = useLoggedOutViewControls()
|
||||||
|
|
||||||
@@ -23,7 +21,6 @@ export function useAccountSwitcher() {
|
|||||||
account: SessionAccount,
|
account: SessionAccount,
|
||||||
logContext: LogEvents['account:loggedIn']['logContext'],
|
logContext: LogEvents['account:loggedIn']['logContext'],
|
||||||
) => {
|
) => {
|
||||||
track('Settings:SwitchAccountButtonClicked')
|
|
||||||
if (pendingDid) {
|
if (pendingDid) {
|
||||||
// The session API isn't resilient to race conditions so let's just ignore this.
|
// The session API isn't resilient to race conditions so let's just ignore this.
|
||||||
return
|
return
|
||||||
@@ -62,7 +59,7 @@ export function useAccountSwitcher() {
|
|||||||
setPendingDid(null)
|
setPendingDid(null)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[_, track, resumeSession, requestSwitchToAccount, pendingDid],
|
[_, resumeSession, requestSwitchToAccount, pendingDid],
|
||||||
)
|
)
|
||||||
|
|
||||||
return {onPressSwitchAccount, pendingDid}
|
return {onPressSwitchAccount, pendingDid}
|
||||||
|
|||||||
@@ -3,19 +3,18 @@ import * as Notifications from 'expo-notifications'
|
|||||||
import {CommonActions, useNavigation} from '@react-navigation/native'
|
import {CommonActions, useNavigation} from '@react-navigation/native'
|
||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
|
import {useAccountSwitcher} from '#/lib/hooks/useAccountSwitcher'
|
||||||
|
import {NavigationProp} from '#/lib/routes/types'
|
||||||
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {track} from 'lib/analytics/analytics'
|
import {isAndroid} from '#/platform/detection'
|
||||||
import {useAccountSwitcher} from 'lib/hooks/useAccountSwitcher'
|
import {useCurrentConvoId} from '#/state/messages/current-convo-id'
|
||||||
import {NavigationProp} from 'lib/routes/types'
|
import {RQKEY as RQKEY_NOTIFS} from '#/state/queries/notifications/feed'
|
||||||
import {logEvent} from 'lib/statsig/statsig'
|
import {invalidateCachedUnreadPage} from '#/state/queries/notifications/unread'
|
||||||
import {isAndroid} from 'platform/detection'
|
import {truncateAndInvalidate} from '#/state/queries/util'
|
||||||
import {useCurrentConvoId} from 'state/messages/current-convo-id'
|
import {useSession} from '#/state/session'
|
||||||
import {RQKEY as RQKEY_NOTIFS} from 'state/queries/notifications/feed'
|
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
||||||
import {invalidateCachedUnreadPage} from 'state/queries/notifications/unread'
|
import {useCloseAllActiveElements} from '#/state/util'
|
||||||
import {truncateAndInvalidate} from 'state/queries/util'
|
|
||||||
import {useSession} from 'state/session'
|
|
||||||
import {useLoggedOutViewControls} from 'state/shell/logged-out'
|
|
||||||
import {useCloseAllActiveElements} from 'state/util'
|
|
||||||
import {resetToTab} from '#/Navigation'
|
import {resetToTab} from '#/Navigation'
|
||||||
|
|
||||||
type NotificationReason =
|
type NotificationReason =
|
||||||
@@ -228,7 +227,6 @@ export function useNotificationsHandler() {
|
|||||||
{},
|
{},
|
||||||
logger.DebugContext.notifications,
|
logger.DebugContext.notifications,
|
||||||
)
|
)
|
||||||
track('Notificatons:OpenApp')
|
|
||||||
logEvent('notifications:openApp', {})
|
logEvent('notifications:openApp', {})
|
||||||
invalidateCachedUnreadPage()
|
invalidateCachedUnreadPage()
|
||||||
truncateAndInvalidate(queryClient, RQKEY_NOTIFS())
|
truncateAndInvalidate(queryClient, RQKEY_NOTIFS())
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {Dimensions} from 'react-native'
|
import {Dimensions} from 'react-native'
|
||||||
|
|
||||||
import {isSafari} from 'lib/browser'
|
import {isSafari} from '#/lib/browser'
|
||||||
import {isWeb} from 'platform/detection'
|
import {isWeb} from '#/platform/detection'
|
||||||
|
|
||||||
const {height: SCREEN_HEIGHT} = Dimensions.get('window')
|
const {height: SCREEN_HEIGHT} = Dimensions.get('window')
|
||||||
|
|
||||||
@@ -185,6 +185,20 @@ export function parseEmbedPlayerFromUrl(
|
|||||||
playerUri: `https://open.spotify.com/embed/track/${id ?? idOrType}`,
|
playerUri: `https://open.spotify.com/embed/track/${id ?? idOrType}`,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (typeOrLocale === 'episode' || idOrType === 'episode') {
|
||||||
|
return {
|
||||||
|
type: 'spotify_song',
|
||||||
|
source: 'spotify',
|
||||||
|
playerUri: `https://open.spotify.com/embed/episode/${id ?? idOrType}`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeOrLocale === 'show' || idOrType === 'show') {
|
||||||
|
return {
|
||||||
|
type: 'spotify_song',
|
||||||
|
source: 'spotify',
|
||||||
|
playerUri: `https://open.spotify.com/embed/show/${id ?? idOrType}`,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import {View} from 'react-native'
|
|||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {logEvent} from '#/lib/statsig/statsig'
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {SessionAccount, useSession, useSessionApi} from '#/state/session'
|
import {SessionAccount, useSession, useSessionApi} from '#/state/session'
|
||||||
@@ -23,16 +22,11 @@ export const ChooseAccountForm = ({
|
|||||||
onPressBack: () => void
|
onPressBack: () => void
|
||||||
}) => {
|
}) => {
|
||||||
const [pendingDid, setPendingDid] = React.useState<string | null>(null)
|
const [pendingDid, setPendingDid] = React.useState<string | null>(null)
|
||||||
const {track, screen} = useAnalytics()
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
const {resumeSession} = useSessionApi()
|
const {resumeSession} = useSessionApi()
|
||||||
const {setShowLoggedOut} = useLoggedOutViewControls()
|
const {setShowLoggedOut} = useLoggedOutViewControls()
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
screen('Choose Account')
|
|
||||||
}, [screen])
|
|
||||||
|
|
||||||
const onSelect = React.useCallback(
|
const onSelect = React.useCallback(
|
||||||
async (account: SessionAccount) => {
|
async (account: SessionAccount) => {
|
||||||
if (pendingDid) {
|
if (pendingDid) {
|
||||||
@@ -56,7 +50,6 @@ export const ChooseAccountForm = ({
|
|||||||
logContext: 'ChooseAccountForm',
|
logContext: 'ChooseAccountForm',
|
||||||
withPassword: false,
|
withPassword: false,
|
||||||
})
|
})
|
||||||
track('Sign In', {resumedSession: true})
|
|
||||||
Toast.show(_(msg`Signed in as @${account.handle}`))
|
Toast.show(_(msg`Signed in as @${account.handle}`))
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
logger.error('choose account: initSession failed', {
|
logger.error('choose account: initSession failed', {
|
||||||
@@ -70,7 +63,6 @@ export const ChooseAccountForm = ({
|
|||||||
},
|
},
|
||||||
[
|
[
|
||||||
currentAccount,
|
currentAccount,
|
||||||
track,
|
|
||||||
resumeSession,
|
resumeSession,
|
||||||
pendingDid,
|
pendingDid,
|
||||||
onSelectAccount,
|
onSelectAccount,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, {useEffect, useState} from 'react'
|
import React, {useState} from 'react'
|
||||||
import {ActivityIndicator, Keyboard, View} from 'react-native'
|
import {ActivityIndicator, Keyboard, View} from 'react-native'
|
||||||
import {ComAtprotoServerDescribeServer} from '@atproto/api'
|
import {ComAtprotoServerDescribeServer} from '@atproto/api'
|
||||||
import {BskyAgent} from '@atproto/api'
|
import {BskyAgent} from '@atproto/api'
|
||||||
@@ -6,7 +6,6 @@ import {msg, Trans} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import * as EmailValidator from 'email-validator'
|
import * as EmailValidator from 'email-validator'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {isNetworkError} from '#/lib/strings/errors'
|
import {isNetworkError} from '#/lib/strings/errors'
|
||||||
import {cleanError} from '#/lib/strings/errors'
|
import {cleanError} from '#/lib/strings/errors'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
@@ -41,13 +40,8 @@ export const ForgotPasswordForm = ({
|
|||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const [isProcessing, setIsProcessing] = useState<boolean>(false)
|
const [isProcessing, setIsProcessing] = useState<boolean>(false)
|
||||||
const [email, setEmail] = useState<string>('')
|
const [email, setEmail] = useState<string>('')
|
||||||
const {screen} = useAnalytics()
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
screen('Signin:ForgotPassword')
|
|
||||||
}, [screen])
|
|
||||||
|
|
||||||
const onPressSelectService = React.useCallback(() => {
|
const onPressSelectService = React.useCallback(() => {
|
||||||
Keyboard.dismiss()
|
Keyboard.dismiss()
|
||||||
}, [])
|
}, [])
|
||||||
|
|||||||
@@ -13,15 +13,14 @@ import {
|
|||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
import {useRequestNotificationsPermission} from '#/lib/notifications/notifications'
|
||||||
import {isNetworkError} from '#/lib/strings/errors'
|
import {isNetworkError} from '#/lib/strings/errors'
|
||||||
import {cleanError} from '#/lib/strings/errors'
|
import {cleanError} from '#/lib/strings/errors'
|
||||||
import {createFullHandle} from '#/lib/strings/handles'
|
import {createFullHandle} from '#/lib/strings/handles'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
|
import {useSetHasCheckedForStarterPack} from '#/state/preferences/used-starter-packs'
|
||||||
import {useSessionApi} from '#/state/session'
|
import {useSessionApi} from '#/state/session'
|
||||||
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
||||||
import {useRequestNotificationsPermission} from 'lib/notifications/notifications'
|
|
||||||
import {useSetHasCheckedForStarterPack} from 'state/preferences/used-starter-packs'
|
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||||
import {FormError} from '#/components/forms/FormError'
|
import {FormError} from '#/components/forms/FormError'
|
||||||
@@ -57,7 +56,6 @@ export const LoginForm = ({
|
|||||||
onPressBack: () => void
|
onPressBack: () => void
|
||||||
onPressForgotPassword: () => void
|
onPressForgotPassword: () => void
|
||||||
}) => {
|
}) => {
|
||||||
const {track} = useAnalytics()
|
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const [isProcessing, setIsProcessing] = useState<boolean>(false)
|
const [isProcessing, setIsProcessing] = useState<boolean>(false)
|
||||||
const [isAuthFactorTokenNeeded, setIsAuthFactorTokenNeeded] =
|
const [isAuthFactorTokenNeeded, setIsAuthFactorTokenNeeded] =
|
||||||
@@ -74,8 +72,7 @@ export const LoginForm = ({
|
|||||||
|
|
||||||
const onPressSelectService = React.useCallback(() => {
|
const onPressSelectService = React.useCallback(() => {
|
||||||
Keyboard.dismiss()
|
Keyboard.dismiss()
|
||||||
track('Signin:PressedSelectService')
|
}, [])
|
||||||
}, [track])
|
|
||||||
|
|
||||||
const onPressNext = async () => {
|
const onPressNext = async () => {
|
||||||
if (isProcessing) return
|
if (isProcessing) return
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import React, {useEffect} from 'react'
|
import React from 'react'
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {atoms as a, useBreakpoints} from '#/alf'
|
import {atoms as a, useBreakpoints} from '#/alf'
|
||||||
import {Button, ButtonText} from '#/components/Button'
|
import {Button, ButtonText} from '#/components/Button'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
@@ -14,14 +13,9 @@ export const PasswordUpdatedForm = ({
|
|||||||
}: {
|
}: {
|
||||||
onPressNext: () => void
|
onPressNext: () => void
|
||||||
}) => {
|
}) => {
|
||||||
const {screen} = useAnalytics()
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {gtMobile} = useBreakpoints()
|
const {gtMobile} = useBreakpoints()
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
screen('Signin:PasswordUpdatedForm')
|
|
||||||
}, [screen])
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormContainer
|
<FormContainer
|
||||||
testID="passwordUpdatedForm"
|
testID="passwordUpdatedForm"
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import React, {useEffect, useState} from 'react'
|
import React, {useState} from 'react'
|
||||||
import {ActivityIndicator, View} from 'react-native'
|
import {ActivityIndicator, View} from 'react-native'
|
||||||
import {BskyAgent} from '@atproto/api'
|
import {BskyAgent} from '@atproto/api'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {isNetworkError} from '#/lib/strings/errors'
|
import {isNetworkError} from '#/lib/strings/errors'
|
||||||
import {cleanError} from '#/lib/strings/errors'
|
import {cleanError} from '#/lib/strings/errors'
|
||||||
import {checkAndFormatResetCode} from '#/lib/strings/password'
|
import {checkAndFormatResetCode} from '#/lib/strings/password'
|
||||||
@@ -31,14 +30,9 @@ export const SetNewPasswordForm = ({
|
|||||||
onPressBack: () => void
|
onPressBack: () => void
|
||||||
onPasswordSet: () => void
|
onPasswordSet: () => void
|
||||||
}) => {
|
}) => {
|
||||||
const {screen} = useAnalytics()
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
screen('Signin:SetNewPasswordForm')
|
|
||||||
}, [screen])
|
|
||||||
|
|
||||||
const [isProcessing, setIsProcessing] = useState<boolean>(false)
|
const [isProcessing, setIsProcessing] = useState<boolean>(false)
|
||||||
const [resetCode, setResetCode] = useState<string>('')
|
const [resetCode, setResetCode] = useState<string>('')
|
||||||
const [password, setPassword] = useState<string>('')
|
const [password, setPassword] = useState<string>('')
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import {LayoutAnimationConfig} from 'react-native-reanimated'
|
|||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {DEFAULT_SERVICE} from '#/lib/constants'
|
import {DEFAULT_SERVICE} from '#/lib/constants'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {useServiceQuery} from '#/state/queries/service'
|
import {useServiceQuery} from '#/state/queries/service'
|
||||||
@@ -31,7 +30,6 @@ export const Login = ({onPressBack}: {onPressBack: () => void}) => {
|
|||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
|
|
||||||
const {accounts} = useSession()
|
const {accounts} = useSession()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {requestedAccountSwitchTo} = useLoggedOutView()
|
const {requestedAccountSwitchTo} = useLoggedOutView()
|
||||||
const requestedAccount = accounts.find(
|
const requestedAccount = accounts.find(
|
||||||
acc => acc.did === requestedAccountSwitchTo,
|
acc => acc.did === requestedAccountSwitchTo,
|
||||||
@@ -87,7 +85,6 @@ export const Login = ({onPressBack}: {onPressBack: () => void}) => {
|
|||||||
}, [serviceError, serviceUrl, _])
|
}, [serviceError, serviceUrl, _])
|
||||||
|
|
||||||
const onPressForgotPassword = () => {
|
const onPressForgotPassword = () => {
|
||||||
track('Signin:PressedForgotPassword')
|
|
||||||
setCurrentForm(Forms.ForgotPassword)
|
setCurrentForm(Forms.ForgotPassword)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {msg, Trans} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useFocusEffect} from '@react-navigation/native'
|
import {useFocusEffect} from '@react-navigation/native'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {getLabelingServiceTitle} from '#/lib/moderation'
|
import {getLabelingServiceTitle} from '#/lib/moderation'
|
||||||
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
@@ -163,7 +162,6 @@ export function ModerationScreenInner({
|
|||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {screen} = useAnalytics()
|
|
||||||
const {gtMobile} = useBreakpoints()
|
const {gtMobile} = useBreakpoints()
|
||||||
const {mutedWordsDialogControl} = useGlobalDialogsControlContext()
|
const {mutedWordsDialogControl} = useGlobalDialogsControlContext()
|
||||||
const birthdateDialogControl = Dialog.useDialogControl()
|
const birthdateDialogControl = Dialog.useDialogControl()
|
||||||
@@ -175,9 +173,8 @@ export function ModerationScreenInner({
|
|||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
screen('Moderation')
|
|
||||||
setMinimalShellMode(false)
|
setMinimalShellMode(false)
|
||||||
}, [screen, setMinimalShellMode]),
|
}, [setMinimalShellMode]),
|
||||||
)
|
)
|
||||||
|
|
||||||
const {mutateAsync: setAdultContentPref, variables: optimisticAdultContent} =
|
const {mutateAsync: setAdultContentPref, variables: optimisticAdultContent} =
|
||||||
|
|||||||
@@ -7,27 +7,26 @@ import {msg, Trans} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
import {uploadBlob} from '#/lib/api'
|
||||||
import {
|
import {
|
||||||
BSKY_APP_ACCOUNT_DID,
|
BSKY_APP_ACCOUNT_DID,
|
||||||
DISCOVER_SAVED_FEED,
|
DISCOVER_SAVED_FEED,
|
||||||
TIMELINE_SAVED_FEED,
|
TIMELINE_SAVED_FEED,
|
||||||
} from '#/lib/constants'
|
} from '#/lib/constants'
|
||||||
|
import {useRequestNotificationsPermission} from '#/lib/notifications/notifications'
|
||||||
import {logEvent} from '#/lib/statsig/statsig'
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
|
import {useSetHasCheckedForStarterPack} from '#/state/preferences/used-starter-packs'
|
||||||
|
import {getAllListMembers} from '#/state/queries/list-members'
|
||||||
import {preferencesQueryKey} from '#/state/queries/preferences'
|
import {preferencesQueryKey} from '#/state/queries/preferences'
|
||||||
import {RQKEY as profileRQKey} from '#/state/queries/profile'
|
import {RQKEY as profileRQKey} from '#/state/queries/profile'
|
||||||
import {useAgent} from '#/state/session'
|
import {useAgent} from '#/state/session'
|
||||||
import {useOnboardingDispatch} from '#/state/shell'
|
import {useOnboardingDispatch} from '#/state/shell'
|
||||||
import {useProgressGuideControls} from '#/state/shell/progress-guide'
|
import {useProgressGuideControls} from '#/state/shell/progress-guide'
|
||||||
import {uploadBlob} from 'lib/api'
|
|
||||||
import {useRequestNotificationsPermission} from 'lib/notifications/notifications'
|
|
||||||
import {useSetHasCheckedForStarterPack} from 'state/preferences/used-starter-packs'
|
|
||||||
import {getAllListMembers} from 'state/queries/list-members'
|
|
||||||
import {
|
import {
|
||||||
useActiveStarterPack,
|
useActiveStarterPack,
|
||||||
useSetActiveStarterPack,
|
useSetActiveStarterPack,
|
||||||
} from 'state/shell/starter-pack'
|
} from '#/state/shell/starter-pack'
|
||||||
import {
|
import {
|
||||||
DescriptionText,
|
DescriptionText,
|
||||||
OnboardingControls,
|
OnboardingControls,
|
||||||
@@ -48,7 +47,6 @@ import {Text} from '#/components/Typography'
|
|||||||
export function StepFinished() {
|
export function StepFinished() {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {state, dispatch} = React.useContext(Context)
|
const {state, dispatch} = React.useContext(Context)
|
||||||
const onboardDispatch = useOnboardingDispatch()
|
const onboardDispatch = useOnboardingDispatch()
|
||||||
const [saving, setSaving] = React.useState(false)
|
const [saving, setSaving] = React.useState(false)
|
||||||
@@ -190,8 +188,6 @@ export function StepFinished() {
|
|||||||
startProgressGuide('like-10-and-follow-7')
|
startProgressGuide('like-10-and-follow-7')
|
||||||
dispatch({type: 'finish'})
|
dispatch({type: 'finish'})
|
||||||
onboardDispatch({type: 'finish'})
|
onboardDispatch({type: 'finish'})
|
||||||
track('OnboardingV2:StepFinished:End')
|
|
||||||
track('OnboardingV2:Complete')
|
|
||||||
logEvent('onboarding:finished:nextPressed', {
|
logEvent('onboarding:finished:nextPressed', {
|
||||||
usedStarterPack: Boolean(starterPack),
|
usedStarterPack: Boolean(starterPack),
|
||||||
starterPackName: AppBskyGraphStarterpack.isRecord(starterPack?.record)
|
starterPackName: AppBskyGraphStarterpack.isRecord(starterPack?.record)
|
||||||
@@ -214,7 +210,6 @@ export function StepFinished() {
|
|||||||
agent,
|
agent,
|
||||||
dispatch,
|
dispatch,
|
||||||
onboardDispatch,
|
onboardDispatch,
|
||||||
track,
|
|
||||||
activeStarterPack,
|
activeStarterPack,
|
||||||
state,
|
state,
|
||||||
requestNotificationsPermission,
|
requestNotificationsPermission,
|
||||||
@@ -223,10 +218,6 @@ export function StepFinished() {
|
|||||||
startProgressGuide,
|
startProgressGuide,
|
||||||
])
|
])
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
track('OnboardingV2:StepFinished:Start')
|
|
||||||
}, [track])
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[a.align_start]}>
|
<View style={[a.align_start]}>
|
||||||
<IconCircle icon={Check} style={[a.mb_2xl]} />
|
<IconCircle icon={Check} style={[a.mb_2xl]} />
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import {msg, Trans} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useQuery} from '@tanstack/react-query'
|
import {useQuery} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {logEvent} from '#/lib/statsig/statsig'
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
import {capitalize} from '#/lib/strings/capitalize'
|
import {capitalize} from '#/lib/strings/capitalize'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
@@ -36,7 +35,6 @@ export function StepInterests() {
|
|||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {gtMobile} = useBreakpoints()
|
const {gtMobile} = useBreakpoints()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const interestsDisplayNames = useInterestsDisplayNames()
|
const interestsDisplayNames = useInterestsDisplayNames()
|
||||||
|
|
||||||
const {state, dispatch} = React.useContext(Context)
|
const {state, dispatch} = React.useContext(Context)
|
||||||
@@ -90,7 +88,6 @@ export function StepInterests() {
|
|||||||
`onboarding: getTaggedSuggestions fetch or processing failed`,
|
`onboarding: getTaggedSuggestions fetch or processing failed`,
|
||||||
)
|
)
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
track('OnboardingV2:StepInterests:Error')
|
|
||||||
|
|
||||||
throw new Error(`a network error occurred`)
|
throw new Error(`a network error occurred`)
|
||||||
}
|
}
|
||||||
@@ -108,11 +105,6 @@ export function StepInterests() {
|
|||||||
selectedInterests: interests,
|
selectedInterests: interests,
|
||||||
})
|
})
|
||||||
dispatch({type: 'next'})
|
dispatch({type: 'next'})
|
||||||
|
|
||||||
track('OnboardingV2:StepInterests:End', {
|
|
||||||
selectedInterests: interests,
|
|
||||||
selectedInterestsLength: interests.length,
|
|
||||||
})
|
|
||||||
logEvent('onboarding:interests:nextPressed', {
|
logEvent('onboarding:interests:nextPressed', {
|
||||||
selectedInterests: interests,
|
selectedInterests: interests,
|
||||||
selectedInterestsLength: interests.length,
|
selectedInterestsLength: interests.length,
|
||||||
@@ -121,18 +113,12 @@ export function StepInterests() {
|
|||||||
logger.info(`onboading: error saving interests`)
|
logger.info(`onboading: error saving interests`)
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
}
|
}
|
||||||
}, [interests, data, setSaving, dispatch, track])
|
}, [interests, data, setSaving, dispatch])
|
||||||
|
|
||||||
const skipOnboarding = React.useCallback(() => {
|
const skipOnboarding = React.useCallback(() => {
|
||||||
onboardDispatch({type: 'finish'})
|
onboardDispatch({type: 'finish'})
|
||||||
dispatch({type: 'finish'})
|
dispatch({type: 'finish'})
|
||||||
track('OnboardingV2:Skip')
|
}, [onboardDispatch, dispatch])
|
||||||
}, [onboardDispatch, dispatch, track])
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
track('OnboardingV2:Begin')
|
|
||||||
track('OnboardingV2:StepInterests:Start')
|
|
||||||
}, [track])
|
|
||||||
|
|
||||||
const title = isError ? (
|
const title = isError ? (
|
||||||
<Trans>Oh no! Something went wrong.</Trans>
|
<Trans>Oh no! Something went wrong.</Trans>
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import ViewShot from 'react-native-view-shot'
|
import type ViewShot from 'react-native-view-shot'
|
||||||
|
|
||||||
import {useAvatar} from '#/screens/Onboarding/StepProfile/index'
|
import {useAvatar} from '#/screens/Onboarding/StepProfile/index'
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
|
|
||||||
|
const LazyViewShot = React.lazy(
|
||||||
|
// @ts-expect-error dynamic import
|
||||||
|
() => import('react-native-view-shot/src/index'),
|
||||||
|
)
|
||||||
|
|
||||||
const SIZE_MULTIPLIER = 5
|
const SIZE_MULTIPLIER = 5
|
||||||
|
|
||||||
export interface PlaceholderCanvasRef {
|
export interface PlaceholderCanvasRef {
|
||||||
capture: () => Promise<string>
|
capture: () => Promise<string | undefined>
|
||||||
}
|
}
|
||||||
|
|
||||||
// This component is supposed to be invisible to the user. We only need this for ViewShot to have something to
|
// This component is supposed to be invisible to the user. We only need this for ViewShot to have something to
|
||||||
@@ -16,7 +21,7 @@ export interface PlaceholderCanvasRef {
|
|||||||
export const PlaceholderCanvas = React.forwardRef<PlaceholderCanvasRef, {}>(
|
export const PlaceholderCanvas = React.forwardRef<PlaceholderCanvasRef, {}>(
|
||||||
function PlaceholderCanvas({}, ref) {
|
function PlaceholderCanvas({}, ref) {
|
||||||
const {avatar} = useAvatar()
|
const {avatar} = useAvatar()
|
||||||
const viewshotRef = React.useRef()
|
const viewshotRef = React.useRef<ViewShot>(null)
|
||||||
const Icon = avatar.placeholder.component
|
const Icon = avatar.placeholder.component
|
||||||
|
|
||||||
const styles = React.useMemo(
|
const styles = React.useMemo(
|
||||||
@@ -32,13 +37,16 @@ export const PlaceholderCanvas = React.forwardRef<PlaceholderCanvasRef, {}>(
|
|||||||
)
|
)
|
||||||
|
|
||||||
React.useImperativeHandle(ref, () => ({
|
React.useImperativeHandle(ref, () => ({
|
||||||
// @ts-ignore this library doesn't have types
|
capture: async () => {
|
||||||
capture: viewshotRef.current.capture,
|
if (viewshotRef.current?.capture) {
|
||||||
|
return await viewshotRef.current.capture()
|
||||||
|
}
|
||||||
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<ViewShot
|
<LazyViewShot
|
||||||
// @ts-ignore this library doesn't have types
|
// @ts-ignore this library doesn't have types
|
||||||
ref={viewshotRef}
|
ref={viewshotRef}
|
||||||
options={{
|
options={{
|
||||||
@@ -60,7 +68,7 @@ export const PlaceholderCanvas = React.forwardRef<PlaceholderCanvasRef, {}>(
|
|||||||
style={{color: 'white'}}
|
style={{color: 'white'}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</ViewShot>
|
</LazyViewShot>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,14 +9,13 @@ import {
|
|||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
import {usePhotoLibraryPermission} from '#/lib/hooks/usePermissions'
|
||||||
|
import {compressIfNeeded} from '#/lib/media/manip'
|
||||||
|
import {openCropper} from '#/lib/media/picker'
|
||||||
|
import {getDataUriSize} from '#/lib/media/util'
|
||||||
|
import {useRequestNotificationsPermission} from '#/lib/notifications/notifications'
|
||||||
import {logEvent, useGate} from '#/lib/statsig/statsig'
|
import {logEvent, useGate} from '#/lib/statsig/statsig'
|
||||||
import {usePhotoLibraryPermission} from 'lib/hooks/usePermissions'
|
import {isNative, isWeb} from '#/platform/detection'
|
||||||
import {compressIfNeeded} from 'lib/media/manip'
|
|
||||||
import {openCropper} from 'lib/media/picker'
|
|
||||||
import {getDataUriSize} from 'lib/media/util'
|
|
||||||
import {useRequestNotificationsPermission} from 'lib/notifications/notifications'
|
|
||||||
import {isNative, isWeb} from 'platform/detection'
|
|
||||||
import {
|
import {
|
||||||
DescriptionText,
|
DescriptionText,
|
||||||
OnboardingControls,
|
OnboardingControls,
|
||||||
@@ -68,7 +67,6 @@ export function StepProfile() {
|
|||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {gtMobile} = useBreakpoints()
|
const {gtMobile} = useBreakpoints()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {requestPhotoAccessIfNeeded} = usePhotoLibraryPermission()
|
const {requestPhotoAccessIfNeeded} = usePhotoLibraryPermission()
|
||||||
const gate = useGate()
|
const gate = useGate()
|
||||||
const requestNotificationsPermission = useRequestNotificationsPermission()
|
const requestNotificationsPermission = useRequestNotificationsPermission()
|
||||||
@@ -87,10 +85,6 @@ export function StepProfile() {
|
|||||||
|
|
||||||
const canvasRef = React.useRef<PlaceholderCanvasRef>(null)
|
const canvasRef = React.useRef<PlaceholderCanvasRef>(null)
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
track('OnboardingV2:StepProfile:Start')
|
|
||||||
}, [track])
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
requestNotificationsPermission('StartOnboarding')
|
requestNotificationsPermission('StartOnboarding')
|
||||||
}, [gate, requestNotificationsPermission])
|
}, [gate, requestNotificationsPermission])
|
||||||
@@ -132,6 +126,10 @@ export function StepProfile() {
|
|||||||
|
|
||||||
const onContinue = React.useCallback(async () => {
|
const onContinue = React.useCallback(async () => {
|
||||||
let imageUri = avatar?.image?.path
|
let imageUri = avatar?.image?.path
|
||||||
|
|
||||||
|
// In the event that view-shot didn't load in time and the user pressed continue, this will just be undefined
|
||||||
|
// and the default avatar will be used. We don't want to block getting through create if this fails for some
|
||||||
|
// reason
|
||||||
if (!imageUri || avatar.useCreatedAvatar) {
|
if (!imageUri || avatar.useCreatedAvatar) {
|
||||||
imageUri = await canvasRef.current?.capture()
|
imageUri = await canvasRef.current?.capture()
|
||||||
}
|
}
|
||||||
@@ -151,9 +149,8 @@ export function StepProfile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dispatch({type: 'next'})
|
dispatch({type: 'next'})
|
||||||
track('OnboardingV2:StepProfile:End')
|
|
||||||
logEvent('onboarding:profile:nextPressed', {})
|
logEvent('onboarding:profile:nextPressed', {})
|
||||||
}, [avatar, dispatch, track])
|
}, [avatar, dispatch])
|
||||||
|
|
||||||
const onDoneCreating = React.useCallback(() => {
|
const onDoneCreating = React.useCallback(() => {
|
||||||
setAvatar(prev => ({
|
setAvatar(prev => ({
|
||||||
|
|||||||
@@ -51,13 +51,15 @@ export type OnboardingAction =
|
|||||||
| {
|
| {
|
||||||
type: 'setProfileStepResults'
|
type: 'setProfileStepResults'
|
||||||
isCreatedAvatar: boolean
|
isCreatedAvatar: boolean
|
||||||
image?: OnboardingState['profileStepResults']['image']
|
image: OnboardingState['profileStepResults']['image'] | undefined
|
||||||
imageUri: string
|
imageUri: string | undefined
|
||||||
imageMime: string
|
imageMime: string
|
||||||
creatorState?: {
|
creatorState:
|
||||||
emoji: Emoji
|
| {
|
||||||
backgroundColor: AvatarColor
|
emoji: Emoji
|
||||||
}
|
backgroundColor: AvatarColor
|
||||||
|
}
|
||||||
|
| undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ApiResponseMap = {
|
export type ApiResponseMap = {
|
||||||
|
|||||||
@@ -12,18 +12,17 @@ import {useLingui} from '@lingui/react'
|
|||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
import {MAX_LABELERS} from '#/lib/constants'
|
import {MAX_LABELERS} from '#/lib/constants'
|
||||||
|
import {useHaptics} from '#/lib/haptics'
|
||||||
import {isAppLabeler} from '#/lib/moderation'
|
import {isAppLabeler} from '#/lib/moderation'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
|
import {isIOS} from '#/platform/detection'
|
||||||
|
import {useProfileShadow} from '#/state/cache/profile-shadow'
|
||||||
import {Shadow} from '#/state/cache/types'
|
import {Shadow} from '#/state/cache/types'
|
||||||
import {useModalControls} from '#/state/modals'
|
import {useModalControls} from '#/state/modals'
|
||||||
import {useLabelerSubscriptionMutation} from '#/state/queries/labeler'
|
import {useLabelerSubscriptionMutation} from '#/state/queries/labeler'
|
||||||
import {useLikeMutation, useUnlikeMutation} from '#/state/queries/like'
|
import {useLikeMutation, useUnlikeMutation} from '#/state/queries/like'
|
||||||
import {usePreferencesQuery} from '#/state/queries/preferences'
|
import {usePreferencesQuery} from '#/state/queries/preferences'
|
||||||
import {useRequireAuth, useSession} from '#/state/session'
|
import {useRequireAuth, useSession} from '#/state/session'
|
||||||
import {useAnalytics} from 'lib/analytics/analytics'
|
|
||||||
import {useHaptics} from 'lib/haptics'
|
|
||||||
import {isIOS} from 'platform/detection'
|
|
||||||
import {useProfileShadow} from 'state/cache/profile-shadow'
|
|
||||||
import {ProfileMenu} from '#/view/com/profile/ProfileMenu'
|
import {ProfileMenu} from '#/view/com/profile/ProfileMenu'
|
||||||
import * as Toast from '#/view/com/util/Toast'
|
import * as Toast from '#/view/com/util/Toast'
|
||||||
import {atoms as a, tokens, useBreakpoints, useTheme} from '#/alf'
|
import {atoms as a, tokens, useBreakpoints, useTheme} from '#/alf'
|
||||||
@@ -66,7 +65,6 @@ let ProfileHeaderLabeler = ({
|
|||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {currentAccount, hasSession} = useSession()
|
const {currentAccount, hasSession} = useSession()
|
||||||
const {openModal} = useModalControls()
|
const {openModal} = useModalControls()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const requireAuth = useRequireAuth()
|
const requireAuth = useRequireAuth()
|
||||||
const playHaptic = useHaptics()
|
const playHaptic = useHaptics()
|
||||||
const cantSubscribePrompt = Prompt.usePromptControl()
|
const cantSubscribePrompt = Prompt.usePromptControl()
|
||||||
@@ -102,12 +100,10 @@ let ProfileHeaderLabeler = ({
|
|||||||
|
|
||||||
if (likeUri) {
|
if (likeUri) {
|
||||||
await unlikeMod({uri: likeUri})
|
await unlikeMod({uri: likeUri})
|
||||||
track('CustomFeed:Unlike')
|
|
||||||
setLikeCount(c => c - 1)
|
setLikeCount(c => c - 1)
|
||||||
setLikeUri('')
|
setLikeUri('')
|
||||||
} else {
|
} else {
|
||||||
const res = await likeMod({uri: labeler.uri, cid: labeler.cid})
|
const res = await likeMod({uri: labeler.uri, cid: labeler.cid})
|
||||||
track('CustomFeed:Like')
|
|
||||||
setLikeCount(c => c + 1)
|
setLikeCount(c => c + 1)
|
||||||
setLikeUri(res.uri)
|
setLikeUri(res.uri)
|
||||||
}
|
}
|
||||||
@@ -120,15 +116,14 @@ let ProfileHeaderLabeler = ({
|
|||||||
)
|
)
|
||||||
logger.error(`Failed to toggle labeler like`, {message: e.message})
|
logger.error(`Failed to toggle labeler like`, {message: e.message})
|
||||||
}
|
}
|
||||||
}, [labeler, playHaptic, likeUri, unlikeMod, track, likeMod, _])
|
}, [labeler, playHaptic, likeUri, unlikeMod, likeMod, _])
|
||||||
|
|
||||||
const onPressEditProfile = React.useCallback(() => {
|
const onPressEditProfile = React.useCallback(() => {
|
||||||
track('ProfileHeader:EditProfileButtonClicked')
|
|
||||||
openModal({
|
openModal({
|
||||||
name: 'edit-profile',
|
name: 'edit-profile',
|
||||||
profile,
|
profile,
|
||||||
})
|
})
|
||||||
}, [track, openModal, profile])
|
}, [openModal, profile])
|
||||||
|
|
||||||
const onPressSubscribe = React.useCallback(
|
const onPressSubscribe = React.useCallback(
|
||||||
() =>
|
() =>
|
||||||
|
|||||||
@@ -9,8 +9,10 @@ import {
|
|||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
|
import {sanitizeDisplayName} from '#/lib/strings/display-names'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {isIOS} from '#/platform/detection'
|
import {isIOS} from '#/platform/detection'
|
||||||
|
import {useProfileShadow} from '#/state/cache/profile-shadow'
|
||||||
import {Shadow} from '#/state/cache/types'
|
import {Shadow} from '#/state/cache/types'
|
||||||
import {useModalControls} from '#/state/modals'
|
import {useModalControls} from '#/state/modals'
|
||||||
import {
|
import {
|
||||||
@@ -18,9 +20,6 @@ import {
|
|||||||
useProfileFollowMutationQueue,
|
useProfileFollowMutationQueue,
|
||||||
} from '#/state/queries/profile'
|
} from '#/state/queries/profile'
|
||||||
import {useRequireAuth, useSession} from '#/state/session'
|
import {useRequireAuth, useSession} from '#/state/session'
|
||||||
import {useAnalytics} from 'lib/analytics/analytics'
|
|
||||||
import {sanitizeDisplayName} from 'lib/strings/display-names'
|
|
||||||
import {useProfileShadow} from 'state/cache/profile-shadow'
|
|
||||||
import {ProfileMenu} from '#/view/com/profile/ProfileMenu'
|
import {ProfileMenu} from '#/view/com/profile/ProfileMenu'
|
||||||
import * as Toast from '#/view/com/util/Toast'
|
import * as Toast from '#/view/com/util/Toast'
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
@@ -59,7 +58,6 @@ let ProfileHeaderStandard = ({
|
|||||||
const {currentAccount, hasSession} = useSession()
|
const {currentAccount, hasSession} = useSession()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {openModal} = useModalControls()
|
const {openModal} = useModalControls()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const moderation = useMemo(
|
const moderation = useMemo(
|
||||||
() => moderateProfile(profile, moderationOpts),
|
() => moderateProfile(profile, moderationOpts),
|
||||||
[profile, moderationOpts],
|
[profile, moderationOpts],
|
||||||
@@ -77,17 +75,15 @@ let ProfileHeaderStandard = ({
|
|||||||
profile.viewer?.blockingByList
|
profile.viewer?.blockingByList
|
||||||
|
|
||||||
const onPressEditProfile = React.useCallback(() => {
|
const onPressEditProfile = React.useCallback(() => {
|
||||||
track('ProfileHeader:EditProfileButtonClicked')
|
|
||||||
openModal({
|
openModal({
|
||||||
name: 'edit-profile',
|
name: 'edit-profile',
|
||||||
profile,
|
profile,
|
||||||
})
|
})
|
||||||
}, [track, openModal, profile])
|
}, [openModal, profile])
|
||||||
|
|
||||||
const onPressFollow = () => {
|
const onPressFollow = () => {
|
||||||
requireAuth(async () => {
|
requireAuth(async () => {
|
||||||
try {
|
try {
|
||||||
track('ProfileHeader:FollowButtonClicked')
|
|
||||||
await queueFollow()
|
await queueFollow()
|
||||||
Toast.show(
|
Toast.show(
|
||||||
_(
|
_(
|
||||||
@@ -109,7 +105,6 @@ let ProfileHeaderStandard = ({
|
|||||||
const onPressUnfollow = () => {
|
const onPressUnfollow = () => {
|
||||||
requireAuth(async () => {
|
requireAuth(async () => {
|
||||||
try {
|
try {
|
||||||
track('ProfileHeader:UnfollowButtonClicked')
|
|
||||||
await queueUnfollow()
|
await queueUnfollow()
|
||||||
Toast.show(
|
Toast.show(
|
||||||
_(
|
_(
|
||||||
@@ -129,7 +124,6 @@ let ProfileHeaderStandard = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const unblockAccount = React.useCallback(async () => {
|
const unblockAccount = React.useCallback(async () => {
|
||||||
track('ProfileHeader:UnblockAccountButtonClicked')
|
|
||||||
try {
|
try {
|
||||||
await queueUnblock()
|
await queueUnblock()
|
||||||
Toast.show(_(msg`Account unblocked`))
|
Toast.show(_(msg`Account unblocked`))
|
||||||
@@ -139,7 +133,7 @@ let ProfileHeaderStandard = ({
|
|||||||
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
|
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [_, queueUnblock, track])
|
}, [_, queueUnblock])
|
||||||
|
|
||||||
const isMe = React.useMemo(
|
const isMe = React.useMemo(
|
||||||
() => currentAccount?.did === profile.did,
|
() => currentAccount?.did === profile.did,
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import * as EmailValidator from 'email-validator'
|
|||||||
import type tldts from 'tldts'
|
import type tldts from 'tldts'
|
||||||
|
|
||||||
import {logEvent} from '#/lib/statsig/statsig'
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
|
import {isEmailMaybeInvalid} from '#/lib/strings/email'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {isEmailMaybeInvalid} from 'lib/strings/email'
|
|
||||||
import {ScreenTransition} from '#/screens/Login/ScreenTransition'
|
import {ScreenTransition} from '#/screens/Login/ScreenTransition'
|
||||||
import {is13, is18, useSignupContext} from '#/screens/Signup/state'
|
import {is13, is18, useSignupContext} from '#/screens/Signup/state'
|
||||||
import {Policies} from '#/screens/Signup/StepInfo/Policies'
|
import {Policies} from '#/screens/Signup/StepInfo/Policies'
|
||||||
@@ -59,6 +59,9 @@ export function StepInfo({
|
|||||||
import('tldts/dist/index.cjs.min.js').then(tldts => {
|
import('tldts/dist/index.cjs.min.js').then(tldts => {
|
||||||
tldtsRef.current = tldts
|
tldtsRef.current = tldts
|
||||||
})
|
})
|
||||||
|
// This will get used in the avatar creator a few steps later, so lets preload it now
|
||||||
|
// @ts-expect-error - valid path
|
||||||
|
import('react-native-view-shot/src/index')
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const onNextPress = () => {
|
const onNextPress = () => {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import {AppBskyGraphStarterpack} from '@atproto/api'
|
|||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {FEEDBACK_FORM_URL} from '#/lib/constants'
|
import {FEEDBACK_FORM_URL} from '#/lib/constants'
|
||||||
import {useServiceQuery} from '#/state/queries/service'
|
import {useServiceQuery} from '#/state/queries/service'
|
||||||
import {useStarterPackQuery} from '#/state/queries/starter-packs'
|
import {useStarterPackQuery} from '#/state/queries/starter-packs'
|
||||||
@@ -31,7 +30,6 @@ import {Text} from '#/components/Typography'
|
|||||||
export function Signup({onPressBack}: {onPressBack: () => void}) {
|
export function Signup({onPressBack}: {onPressBack: () => void}) {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {screen} = useAnalytics()
|
|
||||||
const [state, dispatch] = React.useReducer(reducer, initialState)
|
const [state, dispatch] = React.useReducer(reducer, initialState)
|
||||||
const {gtMobile} = useBreakpoints()
|
const {gtMobile} = useBreakpoints()
|
||||||
const submit = useSubmitSignup()
|
const submit = useSubmitSignup()
|
||||||
@@ -56,10 +54,6 @@ export function Signup({onPressBack}: {onPressBack: () => void}) {
|
|||||||
refetch,
|
refetch,
|
||||||
} = useServiceQuery(state.serviceUrl)
|
} = useServiceQuery(state.serviceUrl)
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
screen('CreateAccount')
|
|
||||||
}, [screen])
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (isFetching) {
|
if (isFetching) {
|
||||||
dispatch({type: 'setIsLoading', value: true})
|
dispatch({type: 'setIsLoading', value: true})
|
||||||
|
|||||||
Vendored
+2
@@ -21,6 +21,7 @@ export interface PostShadow {
|
|||||||
repostUri: string | undefined
|
repostUri: string | undefined
|
||||||
isDeleted: boolean
|
isDeleted: boolean
|
||||||
embed: AppBskyEmbedRecord.View | AppBskyEmbedRecordWithMedia.View | undefined
|
embed: AppBskyEmbedRecord.View | AppBskyEmbedRecordWithMedia.View | undefined
|
||||||
|
pinned: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const POST_TOMBSTONE = Symbol('PostTombstone')
|
export const POST_TOMBSTONE = Symbol('PostTombstone')
|
||||||
@@ -113,6 +114,7 @@ function mergeShadow(
|
|||||||
...(post.viewer || {}),
|
...(post.viewer || {}),
|
||||||
like: 'likeUri' in shadow ? shadow.likeUri : post.viewer?.like,
|
like: 'likeUri' in shadow ? shadow.likeUri : post.viewer?.like,
|
||||||
repost: 'repostUri' in shadow ? shadow.repostUri : post.viewer?.repost,
|
repost: 'repostUri' in shadow ? shadow.repostUri : post.viewer?.repost,
|
||||||
|
pinned: 'pinned' in shadow ? shadow.pinned : post.viewer?.pinned,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
import {msg} from '@lingui/macro'
|
||||||
|
import {useLingui} from '@lingui/react'
|
||||||
|
import {useMutation, useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
|
import {logger} from '#/logger'
|
||||||
|
import {RQKEY as FEED_RQKEY} from '#/state/queries/post-feed'
|
||||||
|
import * as Toast from '#/view/com/util/Toast'
|
||||||
|
import {updatePostShadow} from '../cache/post-shadow'
|
||||||
|
import {useAgent, useSession} from '../session'
|
||||||
|
import {useProfileUpdateMutation} from './profile'
|
||||||
|
|
||||||
|
export function usePinnedPostMutation() {
|
||||||
|
const {_} = useLingui()
|
||||||
|
const {currentAccount} = useSession()
|
||||||
|
const agent = useAgent()
|
||||||
|
const queryClient = useQueryClient()
|
||||||
|
const {mutateAsync: profileUpdateMutate} = useProfileUpdateMutation()
|
||||||
|
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: async ({
|
||||||
|
postUri,
|
||||||
|
postCid,
|
||||||
|
action,
|
||||||
|
}: {
|
||||||
|
postUri: string
|
||||||
|
postCid: string
|
||||||
|
action: 'pin' | 'unpin'
|
||||||
|
}) => {
|
||||||
|
const pinCurrentPost = action === 'pin'
|
||||||
|
let prevPinnedPost: string | undefined
|
||||||
|
try {
|
||||||
|
updatePostShadow(queryClient, postUri, {pinned: pinCurrentPost})
|
||||||
|
|
||||||
|
// get the currently pinned post so we can optimistically remove the pin from it
|
||||||
|
if (!currentAccount) throw new Error('Not logged in')
|
||||||
|
const {data: profile} = await agent.getProfile({
|
||||||
|
actor: currentAccount.did,
|
||||||
|
})
|
||||||
|
prevPinnedPost = profile.pinnedPost?.uri
|
||||||
|
if (prevPinnedPost && prevPinnedPost !== postUri) {
|
||||||
|
updatePostShadow(queryClient, prevPinnedPost, {pinned: false})
|
||||||
|
}
|
||||||
|
|
||||||
|
await profileUpdateMutate({
|
||||||
|
profile,
|
||||||
|
updates: existing => {
|
||||||
|
existing.pinnedPost = pinCurrentPost
|
||||||
|
? {uri: postUri, cid: postCid}
|
||||||
|
: undefined
|
||||||
|
return existing
|
||||||
|
},
|
||||||
|
checkCommitted: res =>
|
||||||
|
pinCurrentPost
|
||||||
|
? res.data.pinnedPost?.uri === postUri
|
||||||
|
: !res.data.pinnedPost,
|
||||||
|
})
|
||||||
|
|
||||||
|
if (pinCurrentPost) {
|
||||||
|
Toast.show(_(msg`Post pinned`))
|
||||||
|
} else {
|
||||||
|
Toast.show(_(msg`Post unpinned`))
|
||||||
|
}
|
||||||
|
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: FEED_RQKEY(
|
||||||
|
`author|${currentAccount.did}|posts_and_author_threads`,
|
||||||
|
),
|
||||||
|
})
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: FEED_RQKEY(
|
||||||
|
`author|${currentAccount.did}|posts_with_replies`,
|
||||||
|
),
|
||||||
|
})
|
||||||
|
} catch (e: any) {
|
||||||
|
Toast.show(_(msg`Failed to pin post`))
|
||||||
|
logger.error('Failed to pin post', {message: String(e)})
|
||||||
|
// revert optimistic update
|
||||||
|
updatePostShadow(queryClient, postUri, {
|
||||||
|
pinned: !pinCurrentPost,
|
||||||
|
})
|
||||||
|
if (prevPinnedPost && prevPinnedPost !== postUri) {
|
||||||
|
updatePostShadow(queryClient, prevPinnedPost, {pinned: true})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -91,6 +91,7 @@ export interface FeedPostSlice {
|
|||||||
feedContext: string | undefined
|
feedContext: string | undefined
|
||||||
reason?:
|
reason?:
|
||||||
| AppBskyFeedDefs.ReasonRepost
|
| AppBskyFeedDefs.ReasonRepost
|
||||||
|
| AppBskyFeedDefs.ReasonPin
|
||||||
| ReasonFeedSource
|
| ReasonFeedSource
|
||||||
| {[k: string]: unknown; $type: string}
|
| {[k: string]: unknown; $type: string}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import {useCallback} from 'react'
|
|||||||
import {AppBskyActorDefs, AppBskyFeedDefs, AtUri} from '@atproto/api'
|
import {AppBskyActorDefs, AppBskyFeedDefs, AtUri} from '@atproto/api'
|
||||||
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
|
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {track} from '#/lib/analytics/analytics'
|
|
||||||
import {useToggleMutationQueue} from '#/lib/hooks/useToggleMutationQueue'
|
import {useToggleMutationQueue} from '#/lib/hooks/useToggleMutationQueue'
|
||||||
import {logEvent, LogEvents, toClout} from '#/lib/statsig/statsig'
|
import {logEvent, LogEvents, toClout} from '#/lib/statsig/statsig'
|
||||||
import {updatePostShadow} from '#/state/cache/post-shadow'
|
import {updatePostShadow} from '#/state/cache/post-shadow'
|
||||||
@@ -193,9 +192,6 @@ function usePostLikeMutation(
|
|||||||
})
|
})
|
||||||
return agent.like(uri, cid)
|
return agent.like(uri, cid)
|
||||||
},
|
},
|
||||||
onSuccess() {
|
|
||||||
track('Post:Like')
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,9 +204,6 @@ function usePostUnlikeMutation(
|
|||||||
logEvent('post:unlike:sampled', {logContext})
|
logEvent('post:unlike:sampled', {logContext})
|
||||||
return agent.deleteLike(likeUri)
|
return agent.deleteLike(likeUri)
|
||||||
},
|
},
|
||||||
onSuccess() {
|
|
||||||
track('Post:Unlike')
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,9 +278,6 @@ function usePostRepostMutation(
|
|||||||
logEvent('post:repost:sampled', {logContext})
|
logEvent('post:repost:sampled', {logContext})
|
||||||
return agent.repost(post.uri, post.cid)
|
return agent.repost(post.uri, post.cid)
|
||||||
},
|
},
|
||||||
onSuccess() {
|
|
||||||
track('Post:Repost')
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,9 +290,6 @@ function usePostUnrepostMutation(
|
|||||||
logEvent('post:unrepost:sampled', {logContext})
|
logEvent('post:unrepost:sampled', {logContext})
|
||||||
return agent.deleteRepost(repostUri)
|
return agent.deleteRepost(repostUri)
|
||||||
},
|
},
|
||||||
onSuccess() {
|
|
||||||
track('Post:Unrepost')
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,9 +300,8 @@ export function usePostDeleteMutation() {
|
|||||||
mutationFn: async ({uri}) => {
|
mutationFn: async ({uri}) => {
|
||||||
await agent.deletePost(uri)
|
await agent.deletePost(uri)
|
||||||
},
|
},
|
||||||
onSuccess(data, variables) {
|
onSuccess(_, variables) {
|
||||||
updatePostShadow(queryClient, variables.uri, {isDeleted: true})
|
updatePostShadow(queryClient, variables.uri, {isDeleted: true})
|
||||||
track('Post:Delete')
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import {
|
|||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
|
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {track} from '#/lib/analytics/analytics'
|
|
||||||
import {PROD_DEFAULT_FEED} from '#/lib/constants'
|
import {PROD_DEFAULT_FEED} from '#/lib/constants'
|
||||||
import {replaceEqualDeep} from '#/lib/functions'
|
import {replaceEqualDeep} from '#/lib/functions'
|
||||||
import {getAge} from '#/lib/strings/time'
|
import {getAge} from '#/lib/strings/time'
|
||||||
@@ -218,7 +217,6 @@ export function useAddSavedFeedsMutation() {
|
|||||||
>({
|
>({
|
||||||
mutationFn: async savedFeeds => {
|
mutationFn: async savedFeeds => {
|
||||||
await agent.addSavedFeeds(savedFeeds)
|
await agent.addSavedFeeds(savedFeeds)
|
||||||
track('CustomFeed:Save')
|
|
||||||
// triggers a refetch
|
// triggers a refetch
|
||||||
await queryClient.invalidateQueries({
|
await queryClient.invalidateQueries({
|
||||||
queryKey: preferencesQueryKey,
|
queryKey: preferencesQueryKey,
|
||||||
@@ -234,7 +232,6 @@ export function useRemoveFeedMutation() {
|
|||||||
return useMutation<void, unknown, Pick<AppBskyActorDefs.SavedFeed, 'id'>>({
|
return useMutation<void, unknown, Pick<AppBskyActorDefs.SavedFeed, 'id'>>({
|
||||||
mutationFn: async savedFeed => {
|
mutationFn: async savedFeed => {
|
||||||
await agent.removeSavedFeeds([savedFeed.id])
|
await agent.removeSavedFeeds([savedFeed.id])
|
||||||
track('CustomFeed:Unsave')
|
|
||||||
// triggers a refetch
|
// triggers a refetch
|
||||||
await queryClient.invalidateQueries({
|
await queryClient.invalidateQueries({
|
||||||
queryKey: preferencesQueryKey,
|
queryKey: preferencesQueryKey,
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import {
|
|||||||
useQueryClient,
|
useQueryClient,
|
||||||
} from '@tanstack/react-query'
|
} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {track} from '#/lib/analytics/analytics'
|
|
||||||
import {uploadBlob} from '#/lib/api'
|
import {uploadBlob} from '#/lib/api'
|
||||||
import {until} from '#/lib/async/until'
|
import {until} from '#/lib/async/until'
|
||||||
import {useToggleMutationQueue} from '#/lib/hooks/useToggleMutationQueue'
|
import {useToggleMutationQueue} from '#/lib/hooks/useToggleMutationQueue'
|
||||||
@@ -160,6 +159,9 @@ export function useProfileUpdateMutation() {
|
|||||||
} else {
|
} else {
|
||||||
existing.displayName = updates.displayName
|
existing.displayName = updates.displayName
|
||||||
existing.description = updates.description
|
existing.description = updates.description
|
||||||
|
if ('pinnedPost' in updates) {
|
||||||
|
existing.pinnedPost = updates.pinnedPost
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (newUserAvatarPromise) {
|
if (newUserAvatarPromise) {
|
||||||
const res = await newUserAvatarPromise
|
const res = await newUserAvatarPromise
|
||||||
@@ -316,9 +318,6 @@ function useProfileFollowMutation(
|
|||||||
})
|
})
|
||||||
return await agent.follow(did)
|
return await agent.follow(did)
|
||||||
},
|
},
|
||||||
onSuccess(data, variables) {
|
|
||||||
track('Profile:Follow', {username: variables.did})
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,7 +328,6 @@ function useProfileUnfollowMutation(
|
|||||||
return useMutation<void, Error, {did: string; followUri: string}>({
|
return useMutation<void, Error, {did: string; followUri: string}>({
|
||||||
mutationFn: async ({followUri}) => {
|
mutationFn: async ({followUri}) => {
|
||||||
logEvent('profile:unfollow:sampled', {logContext})
|
logEvent('profile:unfollow:sampled', {logContext})
|
||||||
track('Profile:Unfollow', {username: followUri})
|
|
||||||
return await agent.deleteFollow(followUri)
|
return await agent.deleteFollow(followUri)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -105,17 +105,16 @@ export function useSuggestedFollowsQuery(options?: SuggestedFollowsOptions) {
|
|||||||
|
|
||||||
export function useSuggestedFollowsByActorQuery({did}: {did: string}) {
|
export function useSuggestedFollowsByActorQuery({did}: {did: string}) {
|
||||||
const agent = useAgent()
|
const agent = useAgent()
|
||||||
return useQuery<AppBskyGraphGetSuggestedFollowsByActor.OutputSchema, Error>({
|
return useQuery({
|
||||||
queryKey: suggestedFollowsByActorQueryKey(did),
|
queryKey: suggestedFollowsByActorQueryKey(did),
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const res = await agent.app.bsky.graph.getSuggestedFollowsByActor({
|
const res = await agent.app.bsky.graph.getSuggestedFollowsByActor({
|
||||||
actor: did,
|
actor: did,
|
||||||
})
|
})
|
||||||
const data = res.data.isFallback ? {suggestions: []} : res.data
|
const suggestions = res.data.isFallback
|
||||||
data.suggestions = data.suggestions.filter(profile => {
|
? []
|
||||||
return !profile.viewer?.following
|
: res.data.suggestions.filter(profile => !profile.viewer?.following)
|
||||||
})
|
return {suggestions}
|
||||||
return data
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {AtpSessionEvent, BskyAgent} from '@atproto/api'
|
import {AtpSessionEvent, BskyAgent} from '@atproto/api'
|
||||||
|
|
||||||
import {track} from '#/lib/analytics/analytics'
|
|
||||||
import {logEvent} from '#/lib/statsig/statsig'
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
import {isWeb} from '#/platform/detection'
|
import {isWeb} from '#/platform/detection'
|
||||||
import * as persisted from '#/state/persisted'
|
import * as persisted from '#/state/persisted'
|
||||||
@@ -70,7 +69,6 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
|||||||
async params => {
|
async params => {
|
||||||
addSessionDebugLog({type: 'method:start', method: 'createAccount'})
|
addSessionDebugLog({type: 'method:start', method: 'createAccount'})
|
||||||
const signal = cancelPendingTask()
|
const signal = cancelPendingTask()
|
||||||
track('Try Create Account')
|
|
||||||
logEvent('account:create:begin', {})
|
logEvent('account:create:begin', {})
|
||||||
const {agent, account} = await createAgentAndCreateAccount(
|
const {agent, account} = await createAgentAndCreateAccount(
|
||||||
params,
|
params,
|
||||||
@@ -85,7 +83,6 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
|||||||
newAgent: agent,
|
newAgent: agent,
|
||||||
newAccount: account,
|
newAccount: account,
|
||||||
})
|
})
|
||||||
track('Create Account')
|
|
||||||
logEvent('account:create:success', {})
|
logEvent('account:create:success', {})
|
||||||
addSessionDebugLog({type: 'method:end', method: 'createAccount', account})
|
addSessionDebugLog({type: 'method:end', method: 'createAccount', account})
|
||||||
},
|
},
|
||||||
@@ -109,7 +106,6 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
|
|||||||
newAgent: agent,
|
newAgent: agent,
|
||||||
newAccount: account,
|
newAccount: account,
|
||||||
})
|
})
|
||||||
track('Sign In', {resumedSession: false})
|
|
||||||
logEvent('account:loggedIn', {logContext, withPassword: true})
|
logEvent('account:loggedIn', {logContext, withPassword: true})
|
||||||
addSessionDebugLog({type: 'method:end', method: 'login', account})
|
addSessionDebugLog({type: 'method:end', method: 'login', account})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import {track} from '#/lib/analytics/analytics'
|
|
||||||
import * as persisted from '#/state/persisted'
|
import * as persisted from '#/state/persisted'
|
||||||
|
|
||||||
export const OnboardingScreenSteps = {
|
export const OnboardingScreenSteps = {
|
||||||
@@ -55,17 +54,14 @@ function reducer(state: StateContext, action: Action): StateContext {
|
|||||||
return compute({...state, step: nextStep})
|
return compute({...state, step: nextStep})
|
||||||
}
|
}
|
||||||
case 'start': {
|
case 'start': {
|
||||||
track('Onboarding:Begin')
|
|
||||||
persisted.write('onboarding', {step: 'Welcome'})
|
persisted.write('onboarding', {step: 'Welcome'})
|
||||||
return compute({...state, step: 'Welcome'})
|
return compute({...state, step: 'Welcome'})
|
||||||
}
|
}
|
||||||
case 'finish': {
|
case 'finish': {
|
||||||
track('Onboarding:Complete')
|
|
||||||
persisted.write('onboarding', {step: 'Home'})
|
persisted.write('onboarding', {step: 'Home'})
|
||||||
return compute({...state, step: 'Home'})
|
return compute({...state, step: 'Home'})
|
||||||
}
|
}
|
||||||
case 'skip': {
|
case 'skip': {
|
||||||
track('Onboarding:Skipped')
|
|
||||||
persisted.write('onboarding', {step: 'Home'})
|
persisted.write('onboarding', {step: 'Home'})
|
||||||
return compute({...state, step: 'Home'})
|
return compute({...state, step: 'Home'})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
|||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
import {logEvent} from '#/lib/statsig/statsig'
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
import {s} from '#/lib/styles'
|
import {s} from '#/lib/styles'
|
||||||
@@ -32,7 +31,6 @@ export function LoggedOut({onDismiss}: {onDismiss?: () => void}) {
|
|||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {screen} = useAnalytics()
|
|
||||||
const {requestedAccountSwitchTo} = useLoggedOutView()
|
const {requestedAccountSwitchTo} = useLoggedOutView()
|
||||||
const [screenState, setScreenState] = React.useState<ScreenState>(() => {
|
const [screenState, setScreenState] = React.useState<ScreenState>(() => {
|
||||||
if (requestedAccountSwitchTo === 'new') {
|
if (requestedAccountSwitchTo === 'new') {
|
||||||
@@ -48,9 +46,8 @@ export function LoggedOut({onDismiss}: {onDismiss?: () => void}) {
|
|||||||
const {clearRequestedAccount} = useLoggedOutViewControls()
|
const {clearRequestedAccount} = useLoggedOutViewControls()
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
screen('Login')
|
|
||||||
setMinimalShellMode(true)
|
setMinimalShellMode(true)
|
||||||
}, [screen, setMinimalShellMode])
|
}, [setMinimalShellMode])
|
||||||
|
|
||||||
const onPressDismiss = React.useCallback(() => {
|
const onPressDismiss = React.useCallback(() => {
|
||||||
if (onDismiss) {
|
if (onDismiss) {
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
|||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import * as apilib from '#/lib/api/index'
|
import * as apilib from '#/lib/api/index'
|
||||||
import {until} from '#/lib/async/until'
|
import {until} from '#/lib/async/until'
|
||||||
import {MAX_GRAPHEME_LENGTH} from '#/lib/constants'
|
import {MAX_GRAPHEME_LENGTH} from '#/lib/constants'
|
||||||
@@ -147,7 +146,6 @@ export const ComposePost = ({
|
|||||||
const {data: currentProfile} = useProfileQuery({did: currentAccount!.did})
|
const {data: currentProfile} = useProfileQuery({did: currentAccount!.did})
|
||||||
const {isModalActive} = useModals()
|
const {isModalActive} = useModals()
|
||||||
const {closeComposer} = useComposerControls()
|
const {closeComposer} = useComposerControls()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const {isMobile} = useWebMediaQueries()
|
const {isMobile} = useWebMediaQueries()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
@@ -310,7 +308,6 @@ export const ComposePost = ({
|
|||||||
|
|
||||||
const onPhotoPasted = useCallback(
|
const onPhotoPasted = useCallback(
|
||||||
async (uri: string) => {
|
async (uri: string) => {
|
||||||
track('Composer:PastedPhotos')
|
|
||||||
if (uri.startsWith('data:video/')) {
|
if (uri.startsWith('data:video/')) {
|
||||||
selectVideo({uri, type: 'video', height: 0, width: 0})
|
selectVideo({uri, type: 'video', height: 0, width: 0})
|
||||||
} else {
|
} else {
|
||||||
@@ -318,7 +315,7 @@ export const ComposePost = ({
|
|||||||
onImageAdd([res])
|
onImageAdd([res])
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[track, selectVideo, onImageAdd],
|
[selectVideo, onImageAdd],
|
||||||
)
|
)
|
||||||
|
|
||||||
const isAltTextRequiredAndMissing = useMemo(() => {
|
const isAltTextRequiredAndMissing = useMemo(() => {
|
||||||
@@ -446,10 +443,6 @@ export const ComposePost = ({
|
|||||||
logContext: 'Composer',
|
logContext: 'Composer',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
track('Create Post', {
|
|
||||||
imageCount: images.length,
|
|
||||||
})
|
|
||||||
if (replyTo && replyTo.uri) track('Post:Reply')
|
|
||||||
}
|
}
|
||||||
if (postUri && !replyTo) {
|
if (postUri && !replyTo) {
|
||||||
emitPostCreated()
|
emitPostCreated()
|
||||||
@@ -499,7 +492,6 @@ export const ComposePost = ({
|
|||||||
setExtLink,
|
setExtLink,
|
||||||
setLangPrefs,
|
setLangPrefs,
|
||||||
threadgateAllowUISettings,
|
threadgateAllowUISettings,
|
||||||
track,
|
|
||||||
videoAltText,
|
videoAltText,
|
||||||
videoUploadState.asset,
|
videoUploadState.asset,
|
||||||
videoUploadState.pendingPublish,
|
videoUploadState.pendingPublish,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import * as MediaLibrary from 'expo-media-library'
|
|||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {POST_IMG_MAX} from '#/lib/constants'
|
import {POST_IMG_MAX} from '#/lib/constants'
|
||||||
import {useCameraPermission} from '#/lib/hooks/usePermissions'
|
import {useCameraPermission} from '#/lib/hooks/usePermissions'
|
||||||
import {openCamera} from '#/lib/media/picker'
|
import {openCamera} from '#/lib/media/picker'
|
||||||
@@ -20,7 +19,6 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function OpenCameraBtn({disabled, onAdd}: Props) {
|
export function OpenCameraBtn({disabled, onAdd}: Props) {
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {requestCameraAccessIfNeeded} = useCameraPermission()
|
const {requestCameraAccessIfNeeded} = useCameraPermission()
|
||||||
const [mediaPermissionRes, requestMediaPermission] =
|
const [mediaPermissionRes, requestMediaPermission] =
|
||||||
@@ -28,7 +26,6 @@ export function OpenCameraBtn({disabled, onAdd}: Props) {
|
|||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
|
|
||||||
const onPressTakePicture = useCallback(async () => {
|
const onPressTakePicture = useCallback(async () => {
|
||||||
track('Composer:CameraOpened')
|
|
||||||
try {
|
try {
|
||||||
if (!(await requestCameraAccessIfNeeded())) {
|
if (!(await requestCameraAccessIfNeeded())) {
|
||||||
return
|
return
|
||||||
@@ -58,7 +55,6 @@ export function OpenCameraBtn({disabled, onAdd}: Props) {
|
|||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
onAdd,
|
onAdd,
|
||||||
track,
|
|
||||||
requestCameraAccessIfNeeded,
|
requestCameraAccessIfNeeded,
|
||||||
mediaPermissionRes,
|
mediaPermissionRes,
|
||||||
requestMediaPermission,
|
requestMediaPermission,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import React, {useCallback} from 'react'
|
|||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {usePhotoLibraryPermission} from '#/lib/hooks/usePermissions'
|
import {usePhotoLibraryPermission} from '#/lib/hooks/usePermissions'
|
||||||
import {openPicker} from '#/lib/media/picker'
|
import {openPicker} from '#/lib/media/picker'
|
||||||
import {isNative} from '#/platform/detection'
|
import {isNative} from '#/platform/detection'
|
||||||
@@ -19,14 +18,11 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function SelectPhotoBtn({size, disabled, onAdd}: Props) {
|
export function SelectPhotoBtn({size, disabled, onAdd}: Props) {
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {requestPhotoAccessIfNeeded} = usePhotoLibraryPermission()
|
const {requestPhotoAccessIfNeeded} = usePhotoLibraryPermission()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
|
|
||||||
const onPressSelectPhotos = useCallback(async () => {
|
const onPressSelectPhotos = useCallback(async () => {
|
||||||
track('Composer:GalleryOpened')
|
|
||||||
|
|
||||||
if (isNative && !(await requestPhotoAccessIfNeeded())) {
|
if (isNative && !(await requestPhotoAccessIfNeeded())) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -41,7 +37,7 @@ export function SelectPhotoBtn({size, disabled, onAdd}: Props) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
onAdd(results)
|
onAdd(results)
|
||||||
}, [track, requestPhotoAccessIfNeeded, size, onAdd])
|
}, [requestPhotoAccessIfNeeded, size, onAdd])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -245,7 +245,11 @@ export const TextInput = forwardRef(function TextInputImpl(
|
|||||||
multiline
|
multiline
|
||||||
scrollEnabled={false}
|
scrollEnabled={false}
|
||||||
numberOfLines={4}
|
numberOfLines={4}
|
||||||
style={[inputTextStyle, a.w_full, {textAlignVertical: 'top'}]}
|
style={[
|
||||||
|
inputTextStyle,
|
||||||
|
a.w_full,
|
||||||
|
{textAlignVertical: 'top', minHeight: 60},
|
||||||
|
]}
|
||||||
{...props}>
|
{...props}>
|
||||||
{textDecorated}
|
{textDecorated}
|
||||||
</PasteInput>
|
</PasteInput>
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
import React, {useEffect, useRef} from 'react'
|
import React, {useRef} from 'react'
|
||||||
import {Animated, TouchableOpacity, StyleSheet, View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {useAnimatedValue} from 'lib/hooks/useAnimatedValue'
|
import Animated, {FadeInDown, FadeOut} from 'react-native-reanimated'
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
|
||||||
import {Text} from 'view/com/util/text/Text'
|
|
||||||
import {UserAvatar} from 'view/com/util/UserAvatar'
|
|
||||||
import {useGrapheme} from '../hooks/useGrapheme'
|
|
||||||
import {useActorAutocompleteQuery} from '#/state/queries/actor-autocomplete'
|
|
||||||
import {Trans} from '@lingui/macro'
|
|
||||||
import {AppBskyActorDefs} from '@atproto/api'
|
import {AppBskyActorDefs} from '@atproto/api'
|
||||||
|
import {Trans} from '@lingui/macro'
|
||||||
|
|
||||||
|
import {PressableScale} from '#/lib/custom-animations/PressableScale'
|
||||||
|
import {sanitizeDisplayName} from '#/lib/strings/display-names'
|
||||||
|
import {sanitizeHandle} from '#/lib/strings/handles'
|
||||||
|
import {useActorAutocompleteQuery} from '#/state/queries/actor-autocomplete'
|
||||||
|
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
||||||
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
|
import {Text} from '#/components/Typography'
|
||||||
|
import {useGrapheme} from '../hooks/useGrapheme'
|
||||||
|
|
||||||
export function Autocomplete({
|
export function Autocomplete({
|
||||||
prefix,
|
prefix,
|
||||||
@@ -16,8 +20,8 @@ export function Autocomplete({
|
|||||||
prefix: string
|
prefix: string
|
||||||
onSelect: (item: string) => void
|
onSelect: (item: string) => void
|
||||||
}) {
|
}) {
|
||||||
const pal = usePalette('default')
|
const t = useTheme()
|
||||||
const positionInterp = useAnimatedValue(0)
|
|
||||||
const {getGraphemeString} = useGrapheme()
|
const {getGraphemeString} = useGrapheme()
|
||||||
const isActive = !!prefix
|
const isActive = !!prefix
|
||||||
const {data: suggestions, isFetching} = useActorAutocompleteQuery(prefix)
|
const {data: suggestions, isFetching} = useActorAutocompleteQuery(prefix)
|
||||||
@@ -28,108 +32,85 @@ export function Autocomplete({
|
|||||||
suggestionsRef.current = suggestions
|
suggestionsRef.current = suggestions
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
if (!isActive) return null
|
||||||
Animated.timing(positionInterp, {
|
|
||||||
toValue: isActive ? 1 : 0,
|
|
||||||
duration: 200,
|
|
||||||
useNativeDriver: true,
|
|
||||||
}).start()
|
|
||||||
}, [positionInterp, isActive])
|
|
||||||
|
|
||||||
const topAnimStyle = {
|
|
||||||
transform: [
|
|
||||||
{
|
|
||||||
translateY: positionInterp.interpolate({
|
|
||||||
inputRange: [0, 1],
|
|
||||||
outputRange: [200, 0],
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Animated.View style={topAnimStyle}>
|
<Animated.View
|
||||||
{isActive ? (
|
entering={FadeInDown.duration(200)}
|
||||||
<View style={[pal.view, styles.container, pal.border]}>
|
exiting={FadeOut.duration(100)}
|
||||||
{suggestionsRef.current?.length ? (
|
style={[
|
||||||
suggestionsRef.current.slice(0, 5).map(item => {
|
t.atoms.bg,
|
||||||
// Eventually use an average length
|
a.mt_sm,
|
||||||
const MAX_CHARS = 40
|
a.border,
|
||||||
const MAX_HANDLE_CHARS = 20
|
a.rounded_sm,
|
||||||
|
t.atoms.border_contrast_high,
|
||||||
|
{marginLeft: -62},
|
||||||
|
]}>
|
||||||
|
{suggestionsRef.current?.length ? (
|
||||||
|
suggestionsRef.current.slice(0, 5).map((item, index, arr) => {
|
||||||
|
// Eventually use an average length
|
||||||
|
const MAX_CHARS = 40
|
||||||
|
const MAX_HANDLE_CHARS = 20
|
||||||
|
|
||||||
// Using this approach because styling is not respecting
|
// Using this approach because styling is not respecting
|
||||||
// bounding box wrapping (before converting to ellipsis)
|
// bounding box wrapping (before converting to ellipsis)
|
||||||
const {name: displayHandle, remainingCharacters} =
|
const {name: displayHandle, remainingCharacters} = getGraphemeString(
|
||||||
getGraphemeString(item.handle, MAX_HANDLE_CHARS)
|
item.handle,
|
||||||
|
MAX_HANDLE_CHARS,
|
||||||
|
)
|
||||||
|
|
||||||
const {name: displayName} = getGraphemeString(
|
const {name: displayName} = getGraphemeString(
|
||||||
item.displayName ?? item.handle,
|
item.displayName || item.handle,
|
||||||
MAX_CHARS -
|
MAX_CHARS -
|
||||||
MAX_HANDLE_CHARS +
|
MAX_HANDLE_CHARS +
|
||||||
(remainingCharacters > 0 ? remainingCharacters : 0),
|
(remainingCharacters > 0 ? remainingCharacters : 0),
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity
|
<View
|
||||||
testID="autocompleteButton"
|
style={[
|
||||||
key={item.handle}
|
index !== arr.length - 1 && a.border_b,
|
||||||
style={[pal.border, styles.item]}
|
t.atoms.border_contrast_high,
|
||||||
onPress={() => onSelect(item.handle)}
|
a.px_sm,
|
||||||
accessibilityLabel={`Select ${item.handle}`}
|
a.py_md,
|
||||||
accessibilityHint="">
|
]}
|
||||||
<View style={styles.avatarAndHandle}>
|
key={item.handle}>
|
||||||
<UserAvatar
|
<PressableScale
|
||||||
avatar={item.avatar ?? null}
|
testID="autocompleteButton"
|
||||||
size={24}
|
style={[
|
||||||
type={item.associated?.labeler ? 'labeler' : 'user'}
|
a.flex_row,
|
||||||
/>
|
a.gap_sm,
|
||||||
<Text type="md-medium" style={pal.text}>
|
a.justify_between,
|
||||||
{displayName}
|
a.align_center,
|
||||||
</Text>
|
]}
|
||||||
</View>
|
onPress={() => onSelect(item.handle)}
|
||||||
<Text type="sm" style={pal.textLight} numberOfLines={1}>
|
accessibilityLabel={`Select ${item.handle}`}
|
||||||
@{displayHandle}
|
accessibilityHint="">
|
||||||
|
<View style={[a.flex_row, a.gap_sm, a.align_center]}>
|
||||||
|
<UserAvatar
|
||||||
|
avatar={item.avatar ?? null}
|
||||||
|
size={24}
|
||||||
|
type={item.associated?.labeler ? 'labeler' : 'user'}
|
||||||
|
/>
|
||||||
|
<Text
|
||||||
|
style={[a.text_md, a.font_bold]}
|
||||||
|
emoji={true}
|
||||||
|
numberOfLines={1}>
|
||||||
|
{sanitizeDisplayName(displayName)}
|
||||||
</Text>
|
</Text>
|
||||||
</TouchableOpacity>
|
</View>
|
||||||
)
|
<Text style={[t.atoms.text_contrast_medium]} numberOfLines={1}>
|
||||||
})
|
{sanitizeHandle(displayHandle, '@')}
|
||||||
) : (
|
</Text>
|
||||||
<Text type="sm" style={[pal.text, pal.border, styles.noResults]}>
|
</PressableScale>
|
||||||
{isFetching ? (
|
</View>
|
||||||
<Trans>Loading...</Trans>
|
)
|
||||||
) : (
|
})
|
||||||
<Trans>No result</Trans>
|
) : (
|
||||||
)}
|
<Text style={[a.text_md, a.px_sm, a.py_md]}>
|
||||||
</Text>
|
{isFetching ? <Trans>Loading...</Trans> : <Trans>No result</Trans>}
|
||||||
)}
|
</Text>
|
||||||
</View>
|
)}
|
||||||
) : null}
|
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
container: {
|
|
||||||
marginLeft: -50, // Composer avatar width
|
|
||||||
top: 10,
|
|
||||||
borderTopWidth: 1,
|
|
||||||
},
|
|
||||||
item: {
|
|
||||||
borderBottomWidth: 1,
|
|
||||||
paddingVertical: 12,
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: 'row',
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'space-between',
|
|
||||||
gap: 6,
|
|
||||||
},
|
|
||||||
avatarAndHandle: {
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: 'row',
|
|
||||||
gap: 6,
|
|
||||||
alignItems: 'center',
|
|
||||||
},
|
|
||||||
noResults: {
|
|
||||||
paddingVertical: 12,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {useLingui} from '@lingui/react'
|
|||||||
|
|
||||||
import {isNative} from '#/platform/detection'
|
import {isNative} from '#/platform/detection'
|
||||||
import {ThreadgateAllowUISetting} from '#/state/queries/threadgate'
|
import {ThreadgateAllowUISetting} from '#/state/queries/threadgate'
|
||||||
import {useAnalytics} from 'lib/analytics/analytics'
|
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||||
import * as Dialog from '#/components/Dialog'
|
import * as Dialog from '#/components/Dialog'
|
||||||
@@ -30,13 +29,11 @@ export function ThreadgateBtn({
|
|||||||
|
|
||||||
style?: StyleProp<AnimatedStyle<ViewStyle>>
|
style?: StyleProp<AnimatedStyle<ViewStyle>>
|
||||||
}) {
|
}) {
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const control = Dialog.useDialogControl()
|
const control = Dialog.useDialogControl()
|
||||||
|
|
||||||
const onPress = () => {
|
const onPress = () => {
|
||||||
track('Composer:ThreadgateOpened')
|
|
||||||
if (isNative && Keyboard.isVisible()) {
|
if (isNative && Keyboard.isVisible()) {
|
||||||
Keyboard.dismiss()
|
Keyboard.dismiss()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,11 @@ import {useLingui} from '@lingui/react'
|
|||||||
import {NavigationProp, useNavigation} from '@react-navigation/native'
|
import {NavigationProp, useNavigation} from '@react-navigation/native'
|
||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
|
import {ComposeIcon2} from '#/lib/icons'
|
||||||
import {getRootNavigation, getTabState, TabState} from '#/lib/routes/helpers'
|
import {getRootNavigation, getTabState, TabState} from '#/lib/routes/helpers'
|
||||||
|
import {AllNavigatorParams} from '#/lib/routes/types'
|
||||||
import {logEvent} from '#/lib/statsig/statsig'
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
|
import {s} from '#/lib/styles'
|
||||||
import {isNative} from '#/platform/detection'
|
import {isNative} from '#/platform/detection'
|
||||||
import {listenSoftReset} from '#/state/events'
|
import {listenSoftReset} from '#/state/events'
|
||||||
import {FeedFeedbackProvider, useFeedFeedback} from '#/state/feed-feedback'
|
import {FeedFeedbackProvider, useFeedFeedback} from '#/state/feed-feedback'
|
||||||
@@ -17,10 +20,6 @@ import {truncateAndInvalidate} from '#/state/queries/util'
|
|||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import {useSetMinimalShellMode} from '#/state/shell'
|
import {useSetMinimalShellMode} from '#/state/shell'
|
||||||
import {useComposerControls} from '#/state/shell/composer'
|
import {useComposerControls} from '#/state/shell/composer'
|
||||||
import {useAnalytics} from 'lib/analytics/analytics'
|
|
||||||
import {ComposeIcon2} from 'lib/icons'
|
|
||||||
import {AllNavigatorParams} from 'lib/routes/types'
|
|
||||||
import {s} from 'lib/styles'
|
|
||||||
import {useHeaderOffset} from '#/components/hooks/useHeaderOffset'
|
import {useHeaderOffset} from '#/components/hooks/useHeaderOffset'
|
||||||
import {Feed} from '../posts/Feed'
|
import {Feed} from '../posts/Feed'
|
||||||
import {FAB} from '../util/fab/FAB'
|
import {FAB} from '../util/fab/FAB'
|
||||||
@@ -54,7 +53,6 @@ export function FeedPage({
|
|||||||
const {openComposer} = useComposerControls()
|
const {openComposer} = useComposerControls()
|
||||||
const [isScrolledDown, setIsScrolledDown] = React.useState(false)
|
const [isScrolledDown, setIsScrolledDown] = React.useState(false)
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {screen, track} = useAnalytics()
|
|
||||||
const headerOffset = useHeaderOffset()
|
const headerOffset = useHeaderOffset()
|
||||||
const feedFeedback = useFeedFeedback(feed, hasSession)
|
const feedFeedback = useFeedFeedback(feed, hasSession)
|
||||||
const scrollElRef = React.useRef<ListMethods>(null)
|
const scrollElRef = React.useRef<ListMethods>(null)
|
||||||
@@ -89,14 +87,12 @@ export function FeedPage({
|
|||||||
if (!isPageFocused) {
|
if (!isPageFocused) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
screen('Feed')
|
|
||||||
return listenSoftReset(onSoftReset)
|
return listenSoftReset(onSoftReset)
|
||||||
}, [onSoftReset, screen, isPageFocused])
|
}, [onSoftReset, isPageFocused])
|
||||||
|
|
||||||
const onPressCompose = React.useCallback(() => {
|
const onPressCompose = React.useCallback(() => {
|
||||||
track('HomeScreen:PressCompose')
|
|
||||||
openComposer({})
|
openComposer({})
|
||||||
}, [openComposer, track])
|
}, [openComposer])
|
||||||
|
|
||||||
const onPressLoadLatest = React.useCallback(() => {
|
const onPressLoadLatest = React.useCallback(() => {
|
||||||
scrollToTop()
|
scrollToTop()
|
||||||
|
|||||||
@@ -7,21 +7,21 @@ import {
|
|||||||
ViewStyle,
|
ViewStyle,
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import {AppBskyActorDefs, AppBskyGraphDefs} from '@atproto/api'
|
import {AppBskyActorDefs, AppBskyGraphDefs} from '@atproto/api'
|
||||||
import {List, ListRef} from '../util/List'
|
import {msg} from '@lingui/macro'
|
||||||
import {ProfileCardFeedLoadingPlaceholder} from '../util/LoadingPlaceholder'
|
import {useLingui} from '@lingui/react'
|
||||||
import {ErrorMessage} from '../util/error/ErrorMessage'
|
|
||||||
import {LoadMoreRetryBtn} from '../util/LoadMoreRetryBtn'
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
import {ProfileCard} from '../profile/ProfileCard'
|
import {cleanError} from '#/lib/strings/errors'
|
||||||
import {Button} from '../util/forms/Button'
|
|
||||||
import {useAnalytics} from 'lib/analytics/analytics'
|
|
||||||
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
|
||||||
import {useListMembersQuery} from '#/state/queries/list-members'
|
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {useModalControls} from '#/state/modals'
|
import {useModalControls} from '#/state/modals'
|
||||||
|
import {useListMembersQuery} from '#/state/queries/list-members'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import {cleanError} from '#/lib/strings/errors'
|
import {ProfileCard} from '../profile/ProfileCard'
|
||||||
import {useLingui} from '@lingui/react'
|
import {ErrorMessage} from '../util/error/ErrorMessage'
|
||||||
import {msg} from '@lingui/macro'
|
import {Button} from '../util/forms/Button'
|
||||||
|
import {List, ListRef} from '../util/List'
|
||||||
|
import {ProfileCardFeedLoadingPlaceholder} from '../util/LoadingPlaceholder'
|
||||||
|
import {LoadMoreRetryBtn} from '../util/LoadMoreRetryBtn'
|
||||||
|
|
||||||
const LOADING_ITEM = {_reactKey: '__loading__'}
|
const LOADING_ITEM = {_reactKey: '__loading__'}
|
||||||
const EMPTY_ITEM = {_reactKey: '__empty__'}
|
const EMPTY_ITEM = {_reactKey: '__empty__'}
|
||||||
@@ -51,7 +51,6 @@ export function ListMembers({
|
|||||||
headerOffset?: number
|
headerOffset?: number
|
||||||
desktopFixedHeightOffset?: number
|
desktopFixedHeightOffset?: number
|
||||||
}) {
|
}) {
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const [isRefreshing, setIsRefreshing] = React.useState(false)
|
const [isRefreshing, setIsRefreshing] = React.useState(false)
|
||||||
const {isMobile} = useWebMediaQueries()
|
const {isMobile} = useWebMediaQueries()
|
||||||
@@ -98,7 +97,6 @@ export function ListMembers({
|
|||||||
// =
|
// =
|
||||||
|
|
||||||
const onRefresh = React.useCallback(async () => {
|
const onRefresh = React.useCallback(async () => {
|
||||||
track('Lists:onRefresh')
|
|
||||||
setIsRefreshing(true)
|
setIsRefreshing(true)
|
||||||
try {
|
try {
|
||||||
await refetch()
|
await refetch()
|
||||||
@@ -106,17 +104,16 @@ export function ListMembers({
|
|||||||
logger.error('Failed to refresh lists', {message: err})
|
logger.error('Failed to refresh lists', {message: err})
|
||||||
}
|
}
|
||||||
setIsRefreshing(false)
|
setIsRefreshing(false)
|
||||||
}, [refetch, track, setIsRefreshing])
|
}, [refetch, setIsRefreshing])
|
||||||
|
|
||||||
const onEndReached = React.useCallback(async () => {
|
const onEndReached = React.useCallback(async () => {
|
||||||
if (isFetching || !hasNextPage || isError) return
|
if (isFetching || !hasNextPage || isError) return
|
||||||
track('Lists:onEndReached')
|
|
||||||
try {
|
try {
|
||||||
await fetchNextPage()
|
await fetchNextPage()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error('Failed to load more lists', {message: err})
|
logger.error('Failed to load more lists', {message: err})
|
||||||
}
|
}
|
||||||
}, [isFetching, hasNextPage, isError, fetchNextPage, track])
|
}, [isFetching, hasNextPage, isError, fetchNextPage])
|
||||||
|
|
||||||
const onPressRetryLoadMore = React.useCallback(() => {
|
const onPressRetryLoadMore = React.useCallback(() => {
|
||||||
fetchNextPage()
|
fetchNextPage()
|
||||||
|
|||||||
@@ -11,15 +11,14 @@ import {AppBskyGraphDefs as GraphDefs} from '@atproto/api'
|
|||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
import {cleanError} from '#/lib/strings/errors'
|
import {cleanError} from '#/lib/strings/errors'
|
||||||
|
import {s} from '#/lib/styles'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
|
import {isWeb} from '#/platform/detection'
|
||||||
|
import {useModerationOpts} from '#/state/preferences/moderation-opts'
|
||||||
import {MyListsFilter, useMyListsQuery} from '#/state/queries/my-lists'
|
import {MyListsFilter, useMyListsQuery} from '#/state/queries/my-lists'
|
||||||
import {useAnalytics} from 'lib/analytics/analytics'
|
import {EmptyState} from '#/view/com/util/EmptyState'
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
|
||||||
import {s} from 'lib/styles'
|
|
||||||
import {isWeb} from 'platform/detection'
|
|
||||||
import {useModerationOpts} from 'state/preferences/moderation-opts'
|
|
||||||
import {EmptyState} from 'view/com/util/EmptyState'
|
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import * as ListCard from '#/components/ListCard'
|
import * as ListCard from '#/components/ListCard'
|
||||||
import {ErrorMessage} from '../util/error/ErrorMessage'
|
import {ErrorMessage} from '../util/error/ErrorMessage'
|
||||||
@@ -44,7 +43,6 @@ export function MyLists({
|
|||||||
}) {
|
}) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const moderationOpts = useModerationOpts()
|
const moderationOpts = useModerationOpts()
|
||||||
const [isPTRing, setIsPTRing] = React.useState(false)
|
const [isPTRing, setIsPTRing] = React.useState(false)
|
||||||
@@ -71,7 +69,6 @@ export function MyLists({
|
|||||||
// =
|
// =
|
||||||
|
|
||||||
const onRefresh = React.useCallback(async () => {
|
const onRefresh = React.useCallback(async () => {
|
||||||
track('Lists:onRefresh')
|
|
||||||
setIsPTRing(true)
|
setIsPTRing(true)
|
||||||
try {
|
try {
|
||||||
await refetch()
|
await refetch()
|
||||||
@@ -79,7 +76,7 @@ export function MyLists({
|
|||||||
logger.error('Failed to refresh lists', {message: err})
|
logger.error('Failed to refresh lists', {message: err})
|
||||||
}
|
}
|
||||||
setIsPTRing(false)
|
setIsPTRing(false)
|
||||||
}, [refetch, track, setIsPTRing])
|
}, [refetch, setIsPTRing])
|
||||||
|
|
||||||
// rendering
|
// rendering
|
||||||
// =
|
// =
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import {msg} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {cleanError} from '#/lib/strings/errors'
|
import {cleanError} from '#/lib/strings/errors'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {isNative, isWeb} from '#/platform/detection'
|
import {isNative, isWeb} from '#/platform/detection'
|
||||||
@@ -48,7 +47,6 @@ export const ProfileLists = React.forwardRef<SectionRef, ProfileListsProps>(
|
|||||||
ref,
|
ref,
|
||||||
) {
|
) {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const [isPTRing, setIsPTRing] = React.useState(false)
|
const [isPTRing, setIsPTRing] = React.useState(false)
|
||||||
const opts = React.useMemo(() => ({enabled}), [enabled])
|
const opts = React.useMemo(() => ({enabled}), [enabled])
|
||||||
@@ -102,7 +100,6 @@ export const ProfileLists = React.forwardRef<SectionRef, ProfileListsProps>(
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
const onRefresh = React.useCallback(async () => {
|
const onRefresh = React.useCallback(async () => {
|
||||||
track('Lists:onRefresh')
|
|
||||||
setIsPTRing(true)
|
setIsPTRing(true)
|
||||||
try {
|
try {
|
||||||
await refetch()
|
await refetch()
|
||||||
@@ -110,18 +107,16 @@ export const ProfileLists = React.forwardRef<SectionRef, ProfileListsProps>(
|
|||||||
logger.error('Failed to refresh lists', {message: err})
|
logger.error('Failed to refresh lists', {message: err})
|
||||||
}
|
}
|
||||||
setIsPTRing(false)
|
setIsPTRing(false)
|
||||||
}, [refetch, track, setIsPTRing])
|
}, [refetch, setIsPTRing])
|
||||||
|
|
||||||
const onEndReached = React.useCallback(async () => {
|
const onEndReached = React.useCallback(async () => {
|
||||||
if (isFetching || !hasNextPage || isError) return
|
if (isFetching || !hasNextPage || isError) return
|
||||||
|
|
||||||
track('Lists:onEndReached')
|
|
||||||
try {
|
try {
|
||||||
await fetchNextPage()
|
await fetchNextPage()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error('Failed to load more lists', {message: err})
|
logger.error('Failed to load more lists', {message: err})
|
||||||
}
|
}
|
||||||
}, [isFetching, hasNextPage, isError, fetchNextPage, track])
|
}, [isFetching, hasNextPage, isError, fetchNextPage])
|
||||||
|
|
||||||
const onPressRetryLoadMore = React.useCallback(() => {
|
const onPressRetryLoadMore = React.useCallback(() => {
|
||||||
fetchNextPage()
|
fetchNextPage()
|
||||||
|
|||||||
@@ -11,17 +11,16 @@ import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
|||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
|
import {cleanError} from '#/lib/strings/errors'
|
||||||
|
import {createFullHandle, makeValidHandle} from '#/lib/strings/handles'
|
||||||
|
import {s} from '#/lib/styles'
|
||||||
|
import {useTheme} from '#/lib/ThemeContext'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {useModalControls} from '#/state/modals'
|
import {useModalControls} from '#/state/modals'
|
||||||
import {useFetchDid, useUpdateHandleMutation} from '#/state/queries/handle'
|
import {useFetchDid, useUpdateHandleMutation} from '#/state/queries/handle'
|
||||||
import {useServiceQuery} from '#/state/queries/service'
|
import {useServiceQuery} from '#/state/queries/service'
|
||||||
import {SessionAccount, useAgent, useSession} from '#/state/session'
|
import {SessionAccount, useAgent, useSession} from '#/state/session'
|
||||||
import {useAnalytics} from 'lib/analytics/analytics'
|
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
|
||||||
import {cleanError} from 'lib/strings/errors'
|
|
||||||
import {createFullHandle, makeValidHandle} from 'lib/strings/handles'
|
|
||||||
import {s} from 'lib/styles'
|
|
||||||
import {useTheme} from 'lib/ThemeContext'
|
|
||||||
import {ErrorMessage} from '../util/error/ErrorMessage'
|
import {ErrorMessage} from '../util/error/ErrorMessage'
|
||||||
import {Button} from '../util/forms/Button'
|
import {Button} from '../util/forms/Button'
|
||||||
import {SelectableBtn} from '../util/forms/SelectableBtn'
|
import {SelectableBtn} from '../util/forms/SelectableBtn'
|
||||||
@@ -67,7 +66,6 @@ export function Inner({
|
|||||||
}) {
|
}) {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {closeModal} = useModalControls()
|
const {closeModal} = useModalControls()
|
||||||
const {mutateAsync: updateHandle, isPending: isUpdateHandlePending} =
|
const {mutateAsync: updateHandle, isPending: isUpdateHandlePending} =
|
||||||
useUpdateHandleMutation()
|
useUpdateHandleMutation()
|
||||||
@@ -91,10 +89,7 @@ export function Inner({
|
|||||||
setHandle('')
|
setHandle('')
|
||||||
setCanSave(false)
|
setCanSave(false)
|
||||||
setCustom(!isCustom)
|
setCustom(!isCustom)
|
||||||
track(
|
}, [setCustom, isCustom])
|
||||||
isCustom ? 'EditHandle:ViewCustomForm' : 'EditHandle:ViewProvidedForm',
|
|
||||||
)
|
|
||||||
}, [setCustom, isCustom, track])
|
|
||||||
const onPressSave = React.useCallback(async () => {
|
const onPressSave = React.useCallback(async () => {
|
||||||
if (!userDomain) {
|
if (!userDomain) {
|
||||||
logger.error(`ChangeHandle: userDomain is undefined`, {
|
logger.error(`ChangeHandle: userDomain is undefined`, {
|
||||||
@@ -105,7 +100,6 @@ export function Inner({
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
track('EditHandle:SetNewHandle')
|
|
||||||
const newHandle = isCustom ? handle : createFullHandle(handle, userDomain)
|
const newHandle = isCustom ? handle : createFullHandle(handle, userDomain)
|
||||||
logger.debug(`Updating handle to ${newHandle}`)
|
logger.debug(`Updating handle to ${newHandle}`)
|
||||||
await updateHandle({
|
await updateHandle({
|
||||||
@@ -125,7 +119,6 @@ export function Inner({
|
|||||||
userDomain,
|
userDomain,
|
||||||
isCustom,
|
isCustom,
|
||||||
onChanged,
|
onChanged,
|
||||||
track,
|
|
||||||
closeModal,
|
closeModal,
|
||||||
updateHandle,
|
updateHandle,
|
||||||
serviceInfo,
|
serviceInfo,
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import {AppBskyGraphDefs, RichText as RichTextAPI} from '@atproto/api'
|
|||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
import {compressIfNeeded} from '#/lib/media/manip'
|
import {compressIfNeeded} from '#/lib/media/manip'
|
||||||
@@ -54,7 +53,6 @@ export function Component({
|
|||||||
const [error, setError] = useState<string>('')
|
const [error, setError] = useState<string>('')
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const listCreateMutation = useListCreateMutation()
|
const listCreateMutation = useListCreateMutation()
|
||||||
const listMetadataMutation = useListMetadataMutation()
|
const listMetadataMutation = useListMetadataMutation()
|
||||||
@@ -120,7 +118,6 @@ export function Component({
|
|||||||
setAvatar(undefined)
|
setAvatar(undefined)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
track('CreateList:AvatarSelected')
|
|
||||||
try {
|
try {
|
||||||
const finalImg = await compressIfNeeded(img, 1000000)
|
const finalImg = await compressIfNeeded(img, 1000000)
|
||||||
setNewAvatar(finalImg)
|
setNewAvatar(finalImg)
|
||||||
@@ -129,15 +126,10 @@ export function Component({
|
|||||||
setError(cleanError(e))
|
setError(cleanError(e))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[track, setNewAvatar, setAvatar, setError],
|
[setNewAvatar, setAvatar, setError],
|
||||||
)
|
)
|
||||||
|
|
||||||
const onPressSave = useCallback(async () => {
|
const onPressSave = useCallback(async () => {
|
||||||
if (isCurateList) {
|
|
||||||
track('CreateList:SaveCurateList')
|
|
||||||
} else {
|
|
||||||
track('CreateList:SaveModList')
|
|
||||||
}
|
|
||||||
const nameTrimmed = name.trim()
|
const nameTrimmed = name.trim()
|
||||||
if (!nameTrimmed) {
|
if (!nameTrimmed) {
|
||||||
setError(_(msg`Name is required`))
|
setError(_(msg`Name is required`))
|
||||||
@@ -200,7 +192,6 @@ export function Component({
|
|||||||
}
|
}
|
||||||
setProcessing(false)
|
setProcessing(false)
|
||||||
}, [
|
}, [
|
||||||
track,
|
|
||||||
setProcessing,
|
setProcessing,
|
||||||
setError,
|
setError,
|
||||||
error,
|
error,
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import {AppBskyActorDefs} from '@atproto/api'
|
|||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {MAX_DESCRIPTION, MAX_DISPLAY_NAME} from '#/lib/constants'
|
import {MAX_DESCRIPTION, MAX_DISPLAY_NAME} from '#/lib/constants'
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
import {compressIfNeeded} from '#/lib/media/manip'
|
import {compressIfNeeded} from '#/lib/media/manip'
|
||||||
@@ -47,7 +46,6 @@ export function Component({
|
|||||||
}) {
|
}) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {closeModal} = useModalControls()
|
const {closeModal} = useModalControls()
|
||||||
const updateMutation = useProfileUpdateMutation()
|
const updateMutation = useProfileUpdateMutation()
|
||||||
@@ -81,7 +79,6 @@ export function Component({
|
|||||||
setUserAvatar(null)
|
setUserAvatar(null)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
track('EditProfile:AvatarSelected')
|
|
||||||
try {
|
try {
|
||||||
const finalImg = await compressIfNeeded(img, 1000000)
|
const finalImg = await compressIfNeeded(img, 1000000)
|
||||||
setNewUserAvatar(finalImg)
|
setNewUserAvatar(finalImg)
|
||||||
@@ -90,7 +87,7 @@ export function Component({
|
|||||||
setImageError(cleanError(e))
|
setImageError(cleanError(e))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[track, setNewUserAvatar, setUserAvatar, setImageError],
|
[setNewUserAvatar, setUserAvatar, setImageError],
|
||||||
)
|
)
|
||||||
|
|
||||||
const onSelectNewBanner = useCallback(
|
const onSelectNewBanner = useCallback(
|
||||||
@@ -101,7 +98,6 @@ export function Component({
|
|||||||
setUserBanner(null)
|
setUserBanner(null)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
track('EditProfile:BannerSelected')
|
|
||||||
try {
|
try {
|
||||||
const finalImg = await compressIfNeeded(img, 1000000)
|
const finalImg = await compressIfNeeded(img, 1000000)
|
||||||
setNewUserBanner(finalImg)
|
setNewUserBanner(finalImg)
|
||||||
@@ -110,11 +106,10 @@ export function Component({
|
|||||||
setImageError(cleanError(e))
|
setImageError(cleanError(e))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[track, setNewUserBanner, setUserBanner, setImageError],
|
[setNewUserBanner, setUserBanner, setImageError],
|
||||||
)
|
)
|
||||||
|
|
||||||
const onPressSave = useCallback(async () => {
|
const onPressSave = useCallback(async () => {
|
||||||
track('EditProfile:Save')
|
|
||||||
setImageError('')
|
setImageError('')
|
||||||
try {
|
try {
|
||||||
await updateMutation.mutateAsync({
|
await updateMutation.mutateAsync({
|
||||||
@@ -133,7 +128,6 @@ export function Component({
|
|||||||
logger.error('Failed to update user profile', {message: String(e)})
|
logger.error('Failed to update user profile', {message: String(e)})
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
track,
|
|
||||||
updateMutation,
|
updateMutation,
|
||||||
profile,
|
profile,
|
||||||
onUpdate,
|
onUpdate,
|
||||||
|
|||||||
@@ -161,10 +161,17 @@ export const PagerWithHeader = React.forwardRef<PagerRef, PagerWithHeaderProps>(
|
|||||||
(e: NativeScrollEvent) => {
|
(e: NativeScrollEvent) => {
|
||||||
'worklet'
|
'worklet'
|
||||||
const nextScrollY = e.contentOffset.y
|
const nextScrollY = e.contentOffset.y
|
||||||
scrollY.value = nextScrollY
|
// HACK: onScroll is reporting some strange values on load (negative header height).
|
||||||
runOnJS(queueThrottledOnScroll)()
|
// Highly improbable that you'd be overscrolled by over 400px -
|
||||||
|
// in fact, I actually can't do it, so let's just ignore those. -sfn
|
||||||
|
const isPossiblyInvalid =
|
||||||
|
headerHeight > 0 && Math.round(nextScrollY * 2) / 2 === -headerHeight
|
||||||
|
if (!isPossiblyInvalid) {
|
||||||
|
scrollY.value = nextScrollY
|
||||||
|
runOnJS(queueThrottledOnScroll)()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[scrollY, queueThrottledOnScroll],
|
[scrollY, queueThrottledOnScroll, headerHeight],
|
||||||
)
|
)
|
||||||
|
|
||||||
const onPageSelectedInner = React.useCallback(
|
const onPageSelectedInner = React.useCallback(
|
||||||
|
|||||||
@@ -63,11 +63,7 @@ export function PostThreadComposePrompt({
|
|||||||
avatar={profile?.avatar}
|
avatar={profile?.avatar}
|
||||||
type={profile?.associated?.labeler ? 'labeler' : 'user'}
|
type={profile?.associated?.labeler ? 'labeler' : 'user'}
|
||||||
/>
|
/>
|
||||||
<Text
|
<Text style={[a.text_md, t.atoms.text_contrast_medium]}>
|
||||||
style={[
|
|
||||||
isTabletOrDesktop ? a.text_md : a.text_sm,
|
|
||||||
t.atoms.text_contrast_medium,
|
|
||||||
]}>
|
|
||||||
<Trans>Write your reply</Trans>
|
<Trans>Write your reply</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -6,19 +6,18 @@ import {msg, Trans} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useNavigation} from '@react-navigation/native'
|
import {useNavigation} from '@react-navigation/native'
|
||||||
|
|
||||||
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
|
import {s} from '#/lib/styles'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {track} from 'lib/analytics/analytics'
|
import {Shadow, useProfileShadow} from '#/state/cache/profile-shadow'
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
|
||||||
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
|
||||||
import {s} from 'lib/styles'
|
|
||||||
import {Shadow, useProfileShadow} from 'state/cache/profile-shadow'
|
|
||||||
import {
|
import {
|
||||||
useProfileFollowMutationQueue,
|
useProfileFollowMutationQueue,
|
||||||
useProfileQuery,
|
useProfileQuery,
|
||||||
} from 'state/queries/profile'
|
} from '#/state/queries/profile'
|
||||||
import {useRequireAuth} from 'state/session'
|
import {useRequireAuth} from '#/state/session'
|
||||||
import {Text} from 'view/com/util/text/Text'
|
import {Text} from '#/view/com/util/text/Text'
|
||||||
import * as Toast from 'view/com/util/Toast'
|
import * as Toast from '#/view/com/util/Toast'
|
||||||
|
|
||||||
export function PostThreadFollowBtn({did}: {did: string}) {
|
export function PostThreadFollowBtn({did}: {did: string}) {
|
||||||
const {data: profile, isLoading} = useProfileQuery({did})
|
const {data: profile, isLoading} = useProfileQuery({did})
|
||||||
@@ -89,7 +88,6 @@ function PostThreadFollowBtnLoaded({
|
|||||||
if (!isFollowing) {
|
if (!isFollowing) {
|
||||||
requireAuth(async () => {
|
requireAuth(async () => {
|
||||||
try {
|
try {
|
||||||
track('ProfileHeader:FollowButtonClicked')
|
|
||||||
await queueFollow()
|
await queueFollow()
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
if (e?.name !== 'AbortError') {
|
if (e?.name !== 'AbortError') {
|
||||||
@@ -101,7 +99,6 @@ function PostThreadFollowBtnLoaded({
|
|||||||
} else {
|
} else {
|
||||||
requireAuth(async () => {
|
requireAuth(async () => {
|
||||||
try {
|
try {
|
||||||
track('ProfileHeader:UnfollowButtonClicked')
|
|
||||||
await queueUnfollow()
|
await queueUnfollow()
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
if (e?.name !== 'AbortError') {
|
if (e?.name !== 'AbortError') {
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import {msg} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {DISCOVER_FEED_URI, KNOWN_SHUTDOWN_FEEDS} from '#/lib/constants'
|
import {DISCOVER_FEED_URI, KNOWN_SHUTDOWN_FEEDS} from '#/lib/constants'
|
||||||
import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender'
|
import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender'
|
||||||
import {logEvent, useGate} from '#/lib/statsig/statsig'
|
import {logEvent, useGate} from '#/lib/statsig/statsig'
|
||||||
@@ -196,7 +195,6 @@ let Feed = ({
|
|||||||
initialNumToRender?: number
|
initialNumToRender?: number
|
||||||
}): React.ReactNode => {
|
}): React.ReactNode => {
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const {currentAccount, hasSession} = useSession()
|
const {currentAccount, hasSession} = useSession()
|
||||||
@@ -405,7 +403,6 @@ let Feed = ({
|
|||||||
// =
|
// =
|
||||||
|
|
||||||
const onRefresh = React.useCallback(async () => {
|
const onRefresh = React.useCallback(async () => {
|
||||||
track('Feed:onRefresh')
|
|
||||||
logEvent('feed:refresh:sampled', {
|
logEvent('feed:refresh:sampled', {
|
||||||
feedType: feedType,
|
feedType: feedType,
|
||||||
feedUrl: feed,
|
feedUrl: feed,
|
||||||
@@ -419,7 +416,7 @@ let Feed = ({
|
|||||||
logger.error('Failed to refresh posts feed', {message: err})
|
logger.error('Failed to refresh posts feed', {message: err})
|
||||||
}
|
}
|
||||||
setIsPTRing(false)
|
setIsPTRing(false)
|
||||||
}, [refetch, track, setIsPTRing, onHasNew, feed, feedType])
|
}, [refetch, setIsPTRing, onHasNew, feed, feedType])
|
||||||
|
|
||||||
const onEndReached = React.useCallback(async () => {
|
const onEndReached = React.useCallback(async () => {
|
||||||
if (isFetching || !hasNextPage || isError) return
|
if (isFetching || !hasNextPage || isError) return
|
||||||
@@ -429,7 +426,6 @@ let Feed = ({
|
|||||||
feedUrl: feed,
|
feedUrl: feed,
|
||||||
itemCount: feedItems.length,
|
itemCount: feedItems.length,
|
||||||
})
|
})
|
||||||
track('Feed:onEndReached')
|
|
||||||
try {
|
try {
|
||||||
await fetchNextPage()
|
await fetchNextPage()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -440,7 +436,6 @@ let Feed = ({
|
|||||||
hasNextPage,
|
hasNextPage,
|
||||||
isError,
|
isError,
|
||||||
fetchNextPage,
|
fetchNextPage,
|
||||||
track,
|
|
||||||
feed,
|
feed,
|
||||||
feedType,
|
feedType,
|
||||||
feedItems.length,
|
feedItems.length,
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ import {PostMeta} from '#/view/com/util/PostMeta'
|
|||||||
import {Text} from '#/view/com/util/text/Text'
|
import {Text} from '#/view/com/util/text/Text'
|
||||||
import {PreviewableUserAvatar} from '#/view/com/util/UserAvatar'
|
import {PreviewableUserAvatar} from '#/view/com/util/UserAvatar'
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
import {Repost_Stroke2_Corner2_Rounded as Repost} from '#/components/icons/Repost'
|
import {Pin_Stroke2_Corner0_Rounded as PinIcon} from '#/components/icons/Pin'
|
||||||
|
import {Repost_Stroke2_Corner2_Rounded as RepostIcon} from '#/components/icons/Repost'
|
||||||
import {ContentHider} from '#/components/moderation/ContentHider'
|
import {ContentHider} from '#/components/moderation/ContentHider'
|
||||||
import {LabelsOnMyPost} from '#/components/moderation/LabelsOnMe'
|
import {LabelsOnMyPost} from '#/components/moderation/LabelsOnMe'
|
||||||
import {PostAlerts} from '#/components/moderation/PostAlerts'
|
import {PostAlerts} from '#/components/moderation/PostAlerts'
|
||||||
@@ -52,6 +53,7 @@ interface FeedItemProps {
|
|||||||
record: AppBskyFeedPost.Record
|
record: AppBskyFeedPost.Record
|
||||||
reason:
|
reason:
|
||||||
| AppBskyFeedDefs.ReasonRepost
|
| AppBskyFeedDefs.ReasonRepost
|
||||||
|
| AppBskyFeedDefs.ReasonPin
|
||||||
| ReasonFeedSource
|
| ReasonFeedSource
|
||||||
| {[k: string]: unknown; $type: string}
|
| {[k: string]: unknown; $type: string}
|
||||||
| undefined
|
| undefined
|
||||||
@@ -295,7 +297,7 @@ let FeedItemInner = ({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
onBeforePress={onOpenReposter}>
|
onBeforePress={onOpenReposter}>
|
||||||
<Repost
|
<RepostIcon
|
||||||
style={{color: pal.colors.textLight, marginRight: 3}}
|
style={{color: pal.colors.textLight, marginRight: 3}}
|
||||||
width={14}
|
width={14}
|
||||||
height={14}
|
height={14}
|
||||||
@@ -337,6 +339,21 @@ let FeedItemInner = ({
|
|||||||
)}
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
</Link>
|
</Link>
|
||||||
|
) : AppBskyFeedDefs.isReasonPin(reason) ? (
|
||||||
|
<View style={styles.includeReason}>
|
||||||
|
<PinIcon
|
||||||
|
style={{color: pal.colors.textLight, marginRight: 3}}
|
||||||
|
width={14}
|
||||||
|
height={14}
|
||||||
|
/>
|
||||||
|
<Text
|
||||||
|
type="sm-bold"
|
||||||
|
style={pal.textLight}
|
||||||
|
lineHeight={1.2}
|
||||||
|
numberOfLines={1}>
|
||||||
|
<Trans>Pinned</Trans>
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
) : null}
|
) : null}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -6,23 +6,22 @@ import {msg, Trans} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
|
import {HITSLOP_10} from '#/lib/constants'
|
||||||
|
import {makeProfileLink} from '#/lib/routes/links'
|
||||||
|
import {shareUrl} from '#/lib/sharing'
|
||||||
|
import {toShareUrl} from '#/lib/strings/url-helpers'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {useAnalytics} from 'lib/analytics/analytics'
|
import {Shadow} from '#/state/cache/types'
|
||||||
import {HITSLOP_10} from 'lib/constants'
|
import {useModalControls} from '#/state/modals'
|
||||||
import {makeProfileLink} from 'lib/routes/links'
|
|
||||||
import {shareUrl} from 'lib/sharing'
|
|
||||||
import {toShareUrl} from 'lib/strings/url-helpers'
|
|
||||||
import {Shadow} from 'state/cache/types'
|
|
||||||
import {useModalControls} from 'state/modals'
|
|
||||||
import {
|
import {
|
||||||
RQKEY as profileQueryKey,
|
RQKEY as profileQueryKey,
|
||||||
useProfileBlockMutationQueue,
|
useProfileBlockMutationQueue,
|
||||||
useProfileFollowMutationQueue,
|
useProfileFollowMutationQueue,
|
||||||
useProfileMuteMutationQueue,
|
useProfileMuteMutationQueue,
|
||||||
} from 'state/queries/profile'
|
} from '#/state/queries/profile'
|
||||||
import {useSession} from 'state/session'
|
import {useSession} from '#/state/session'
|
||||||
import {EventStopper} from 'view/com/util/EventStopper'
|
import {EventStopper} from '#/view/com/util/EventStopper'
|
||||||
import * as Toast from 'view/com/util/Toast'
|
import * as Toast from '#/view/com/util/Toast'
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {ArrowOutOfBox_Stroke2_Corner0_Rounded as Share} from '#/components/icons/ArrowOutOfBox'
|
import {ArrowOutOfBox_Stroke2_Corner0_Rounded as Share} from '#/components/icons/ArrowOutOfBox'
|
||||||
import {Flag_Stroke2_Corner0_Rounded as Flag} from '#/components/icons/Flag'
|
import {Flag_Stroke2_Corner0_Rounded as Flag} from '#/components/icons/Flag'
|
||||||
@@ -49,7 +48,6 @@ let ProfileMenu = ({
|
|||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
// TODO ALF this
|
// TODO ALF this
|
||||||
const alf = useTheme()
|
const alf = useTheme()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {openModal} = useModalControls()
|
const {openModal} = useModalControls()
|
||||||
const reportDialogControl = useReportDialogControl()
|
const reportDialogControl = useReportDialogControl()
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
@@ -83,12 +81,10 @@ let ProfileMenu = ({
|
|||||||
}, [queryClient, profile.did])
|
}, [queryClient, profile.did])
|
||||||
|
|
||||||
const onPressShare = React.useCallback(() => {
|
const onPressShare = React.useCallback(() => {
|
||||||
track('ProfileHeader:ShareButtonClicked')
|
|
||||||
shareUrl(toShareUrl(makeProfileLink(profile)))
|
shareUrl(toShareUrl(makeProfileLink(profile)))
|
||||||
}, [track, profile])
|
}, [profile])
|
||||||
|
|
||||||
const onPressAddRemoveLists = React.useCallback(() => {
|
const onPressAddRemoveLists = React.useCallback(() => {
|
||||||
track('ProfileHeader:AddToListsButtonClicked')
|
|
||||||
openModal({
|
openModal({
|
||||||
name: 'user-add-remove-lists',
|
name: 'user-add-remove-lists',
|
||||||
subject: profile.did,
|
subject: profile.did,
|
||||||
@@ -97,11 +93,10 @@ let ProfileMenu = ({
|
|||||||
onAdd: invalidateProfileQuery,
|
onAdd: invalidateProfileQuery,
|
||||||
onRemove: invalidateProfileQuery,
|
onRemove: invalidateProfileQuery,
|
||||||
})
|
})
|
||||||
}, [track, profile, openModal, invalidateProfileQuery])
|
}, [profile, openModal, invalidateProfileQuery])
|
||||||
|
|
||||||
const onPressMuteAccount = React.useCallback(async () => {
|
const onPressMuteAccount = React.useCallback(async () => {
|
||||||
if (profile.viewer?.muted) {
|
if (profile.viewer?.muted) {
|
||||||
track('ProfileHeader:UnmuteAccountButtonClicked')
|
|
||||||
try {
|
try {
|
||||||
await queueUnmute()
|
await queueUnmute()
|
||||||
Toast.show(_(msg`Account unmuted`))
|
Toast.show(_(msg`Account unmuted`))
|
||||||
@@ -112,7 +107,6 @@ let ProfileMenu = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
track('ProfileHeader:MuteAccountButtonClicked')
|
|
||||||
try {
|
try {
|
||||||
await queueMute()
|
await queueMute()
|
||||||
Toast.show(_(msg`Account muted`))
|
Toast.show(_(msg`Account muted`))
|
||||||
@@ -123,11 +117,10 @@ let ProfileMenu = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [profile.viewer?.muted, track, queueUnmute, _, queueMute])
|
}, [profile.viewer?.muted, queueUnmute, _, queueMute])
|
||||||
|
|
||||||
const blockAccount = React.useCallback(async () => {
|
const blockAccount = React.useCallback(async () => {
|
||||||
if (profile.viewer?.blocking) {
|
if (profile.viewer?.blocking) {
|
||||||
track('ProfileHeader:UnblockAccountButtonClicked')
|
|
||||||
try {
|
try {
|
||||||
await queueUnblock()
|
await queueUnblock()
|
||||||
Toast.show(_(msg`Account unblocked`))
|
Toast.show(_(msg`Account unblocked`))
|
||||||
@@ -138,7 +131,6 @@ let ProfileMenu = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
track('ProfileHeader:BlockAccountButtonClicked')
|
|
||||||
try {
|
try {
|
||||||
await queueBlock()
|
await queueBlock()
|
||||||
Toast.show(_(msg`Account blocked`))
|
Toast.show(_(msg`Account blocked`))
|
||||||
@@ -149,10 +141,9 @@ let ProfileMenu = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [profile.viewer?.blocking, track, _, queueUnblock, queueBlock])
|
}, [profile.viewer?.blocking, _, queueUnblock, queueBlock])
|
||||||
|
|
||||||
const onPressFollowAccount = React.useCallback(async () => {
|
const onPressFollowAccount = React.useCallback(async () => {
|
||||||
track('ProfileHeader:FollowButtonClicked')
|
|
||||||
try {
|
try {
|
||||||
await queueFollow()
|
await queueFollow()
|
||||||
Toast.show(_(msg`Account followed`))
|
Toast.show(_(msg`Account followed`))
|
||||||
@@ -162,10 +153,9 @@ let ProfileMenu = ({
|
|||||||
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
|
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [_, queueFollow, track])
|
}, [_, queueFollow])
|
||||||
|
|
||||||
const onPressUnfollowAccount = React.useCallback(async () => {
|
const onPressUnfollowAccount = React.useCallback(async () => {
|
||||||
track('ProfileHeader:UnfollowButtonClicked')
|
|
||||||
try {
|
try {
|
||||||
await queueUnfollow()
|
await queueUnfollow()
|
||||||
Toast.show(_(msg`Account unfollowed`))
|
Toast.show(_(msg`Account unfollowed`))
|
||||||
@@ -175,12 +165,11 @@ let ProfileMenu = ({
|
|||||||
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
|
Toast.show(_(msg`There was an issue! ${e.toString()}`), 'xmark')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [_, queueUnfollow, track])
|
}, [_, queueUnfollow])
|
||||||
|
|
||||||
const onPressReportAccount = React.useCallback(() => {
|
const onPressReportAccount = React.useCallback(() => {
|
||||||
track('ProfileHeader:ReportAccountButtonClicked')
|
|
||||||
reportDialogControl.open()
|
reportDialogControl.open()
|
||||||
}, [track, reportDialogControl])
|
}, [reportDialogControl])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EventStopper onKeyDown={false}>
|
<EventStopper onKeyDown={false}>
|
||||||
|
|||||||
@@ -9,12 +9,11 @@ import {
|
|||||||
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||||
import {useNavigation} from '@react-navigation/native'
|
import {useNavigation} from '@react-navigation/native'
|
||||||
|
|
||||||
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
|
import {NavigationProp} from '#/lib/routes/types'
|
||||||
import {isWeb} from '#/platform/detection'
|
import {isWeb} from '#/platform/detection'
|
||||||
import {useSetDrawerOpen} from '#/state/shell'
|
import {useSetDrawerOpen} from '#/state/shell'
|
||||||
import {useAnalytics} from 'lib/analytics/analytics'
|
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
|
||||||
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
|
||||||
import {NavigationProp} from 'lib/routes/types'
|
|
||||||
import {Menu_Stroke2_Corner0_Rounded as Menu} from '#/components/icons/Menu'
|
import {Menu_Stroke2_Corner0_Rounded as Menu} from '#/components/icons/Menu'
|
||||||
import {CenteredView} from './Views'
|
import {CenteredView} from './Views'
|
||||||
|
|
||||||
@@ -31,7 +30,6 @@ export function SimpleViewHeader({
|
|||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const setDrawerOpen = useSetDrawerOpen()
|
const setDrawerOpen = useSetDrawerOpen()
|
||||||
const navigation = useNavigation<NavigationProp>()
|
const navigation = useNavigation<NavigationProp>()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {isMobile} = useWebMediaQueries()
|
const {isMobile} = useWebMediaQueries()
|
||||||
const canGoBack = navigation.canGoBack()
|
const canGoBack = navigation.canGoBack()
|
||||||
|
|
||||||
@@ -44,9 +42,8 @@ export function SimpleViewHeader({
|
|||||||
}, [navigation])
|
}, [navigation])
|
||||||
|
|
||||||
const onPressMenu = React.useCallback(() => {
|
const onPressMenu = React.useCallback(() => {
|
||||||
track('ViewHeader:MenuButtonClicked')
|
|
||||||
setDrawerOpen(true)
|
setDrawerOpen(true)
|
||||||
}, [track, setDrawerOpen])
|
}, [setDrawerOpen])
|
||||||
|
|
||||||
const Container = isMobile ? View : CenteredView
|
const Container = isMobile ? View : CenteredView
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {msg} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useNavigation} from '@react-navigation/native'
|
import {useNavigation} from '@react-navigation/native'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {useMinimalShellHeaderTransform} from '#/lib/hooks/useMinimalShellTransform'
|
import {useMinimalShellHeaderTransform} from '#/lib/hooks/useMinimalShellTransform'
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
@@ -42,7 +41,6 @@ export function ViewHeader({
|
|||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const setDrawerOpen = useSetDrawerOpen()
|
const setDrawerOpen = useSetDrawerOpen()
|
||||||
const navigation = useNavigation<NavigationProp>()
|
const navigation = useNavigation<NavigationProp>()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {isDesktop, isTablet} = useWebMediaQueries()
|
const {isDesktop, isTablet} = useWebMediaQueries()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
|
|
||||||
@@ -55,9 +53,8 @@ export function ViewHeader({
|
|||||||
}, [navigation])
|
}, [navigation])
|
||||||
|
|
||||||
const onPressMenu = React.useCallback(() => {
|
const onPressMenu = React.useCallback(() => {
|
||||||
track('ViewHeader:MenuButtonClicked')
|
|
||||||
setDrawerOpen(true)
|
setDrawerOpen(true)
|
||||||
}, [track, setDrawerOpen])
|
}, [setDrawerOpen])
|
||||||
|
|
||||||
if (isDesktop) {
|
if (isDesktop) {
|
||||||
if (showOnDesktop) {
|
if (showOnDesktop) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, {memo} from 'react'
|
import React, {memo, useCallback} from 'react'
|
||||||
import {
|
import {
|
||||||
Platform,
|
Platform,
|
||||||
Pressable,
|
Pressable,
|
||||||
@@ -18,9 +18,13 @@ import {msg, Trans} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useNavigation} from '@react-navigation/native'
|
import {useNavigation} from '@react-navigation/native'
|
||||||
|
|
||||||
|
import {getCurrentRoute} from '#/lib/routes/helpers'
|
||||||
import {makeProfileLink} from '#/lib/routes/links'
|
import {makeProfileLink} from '#/lib/routes/links'
|
||||||
import {CommonNavigatorParams, NavigationProp} from '#/lib/routes/types'
|
import {CommonNavigatorParams, NavigationProp} from '#/lib/routes/types'
|
||||||
|
import {shareUrl} from '#/lib/sharing'
|
||||||
import {richTextToString} from '#/lib/strings/rich-text-helpers'
|
import {richTextToString} from '#/lib/strings/rich-text-helpers'
|
||||||
|
import {toShareUrl} from '#/lib/strings/url-helpers'
|
||||||
|
import {useTheme} from '#/lib/ThemeContext'
|
||||||
import {getTranslatorLink} from '#/locale/helpers'
|
import {getTranslatorLink} from '#/locale/helpers'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {isWeb} from '#/platform/detection'
|
import {isWeb} from '#/platform/detection'
|
||||||
@@ -29,6 +33,7 @@ import {useFeedFeedbackContext} from '#/state/feed-feedback'
|
|||||||
import {useLanguagePrefs} from '#/state/preferences'
|
import {useLanguagePrefs} from '#/state/preferences'
|
||||||
import {useHiddenPosts, useHiddenPostsApi} from '#/state/preferences'
|
import {useHiddenPosts, useHiddenPostsApi} from '#/state/preferences'
|
||||||
import {useOpenLink} from '#/state/preferences/in-app-browser'
|
import {useOpenLink} from '#/state/preferences/in-app-browser'
|
||||||
|
import {usePinnedPostMutation} from '#/state/queries/pinned-post'
|
||||||
import {
|
import {
|
||||||
usePostDeleteMutation,
|
usePostDeleteMutation,
|
||||||
useThreadMuteMutationQueue,
|
useThreadMuteMutationQueue,
|
||||||
@@ -38,10 +43,6 @@ import {getMaybeDetachedQuoteEmbed} from '#/state/queries/postgate/util'
|
|||||||
import {useToggleReplyVisibilityMutation} from '#/state/queries/threadgate'
|
import {useToggleReplyVisibilityMutation} from '#/state/queries/threadgate'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import {useMergedThreadgateHiddenReplies} from '#/state/threadgate-hidden-replies'
|
import {useMergedThreadgateHiddenReplies} from '#/state/threadgate-hidden-replies'
|
||||||
import {getCurrentRoute} from 'lib/routes/helpers'
|
|
||||||
import {shareUrl} from 'lib/sharing'
|
|
||||||
import {toShareUrl} from 'lib/strings/url-helpers'
|
|
||||||
import {useTheme} from 'lib/ThemeContext'
|
|
||||||
import {atoms as a, useBreakpoints, useTheme as useAlf} from '#/alf'
|
import {atoms as a, useBreakpoints, useTheme as useAlf} from '#/alf'
|
||||||
import {useDialogControl} from '#/components/Dialog'
|
import {useDialogControl} from '#/components/Dialog'
|
||||||
import {useGlobalDialogsControlContext} from '#/components/dialogs/Context'
|
import {useGlobalDialogsControlContext} from '#/components/dialogs/Context'
|
||||||
@@ -65,6 +66,7 @@ import {EyeSlash_Stroke2_Corner0_Rounded as EyeSlash} from '#/components/icons/E
|
|||||||
import {Filter_Stroke2_Corner0_Rounded as Filter} from '#/components/icons/Filter'
|
import {Filter_Stroke2_Corner0_Rounded as Filter} from '#/components/icons/Filter'
|
||||||
import {Mute_Stroke2_Corner0_Rounded as Mute} from '#/components/icons/Mute'
|
import {Mute_Stroke2_Corner0_Rounded as Mute} from '#/components/icons/Mute'
|
||||||
import {PaperPlane_Stroke2_Corner0_Rounded as Send} from '#/components/icons/PaperPlane'
|
import {PaperPlane_Stroke2_Corner0_Rounded as Send} from '#/components/icons/PaperPlane'
|
||||||
|
import {Pin_Stroke2_Corner0_Rounded as PinIcon} from '#/components/icons/Pin'
|
||||||
import {SettingsGear2_Stroke2_Corner0_Rounded as Gear} from '#/components/icons/SettingsGear2'
|
import {SettingsGear2_Stroke2_Corner0_Rounded as Gear} from '#/components/icons/SettingsGear2'
|
||||||
import {SpeakerVolumeFull_Stroke2_Corner0_Rounded as Unmute} from '#/components/icons/Speaker'
|
import {SpeakerVolumeFull_Stroke2_Corner0_Rounded as Unmute} from '#/components/icons/Speaker'
|
||||||
import {Trash_Stroke2_Corner0_Rounded as Trash} from '#/components/icons/Trash'
|
import {Trash_Stroke2_Corner0_Rounded as Trash} from '#/components/icons/Trash'
|
||||||
@@ -106,7 +108,9 @@ let PostDropdownBtn = ({
|
|||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const defaultCtrlColor = theme.palette.default.postCtrl
|
const defaultCtrlColor = theme.palette.default.postCtrl
|
||||||
const langPrefs = useLanguagePrefs()
|
const langPrefs = useLanguagePrefs()
|
||||||
const postDeleteMutation = usePostDeleteMutation()
|
const {mutateAsync: deletePostMutate} = usePostDeleteMutation()
|
||||||
|
const {mutateAsync: pinPostMutate, isPending: isPinPending} =
|
||||||
|
usePinnedPostMutation()
|
||||||
const hiddenPosts = useHiddenPosts()
|
const hiddenPosts = useHiddenPosts()
|
||||||
const {hidePost} = useHiddenPostsApi()
|
const {hidePost} = useHiddenPostsApi()
|
||||||
const feedFeedback = useFeedFeedbackContext()
|
const feedFeedback = useFeedFeedbackContext()
|
||||||
@@ -149,8 +153,9 @@ let PostDropdownBtn = ({
|
|||||||
threadgateRecord,
|
threadgateRecord,
|
||||||
})
|
})
|
||||||
const isReplyHiddenByThreadgate = threadgateHiddenReplies.has(postUri)
|
const isReplyHiddenByThreadgate = threadgateHiddenReplies.has(postUri)
|
||||||
|
const isPinned = post.viewer?.pinned
|
||||||
|
|
||||||
const {mutateAsync: toggleQuoteDetachment, isPending} =
|
const {mutateAsync: toggleQuoteDetachment, isPending: isDetachPending} =
|
||||||
useToggleQuoteDetachmentMutation()
|
useToggleQuoteDetachmentMutation()
|
||||||
|
|
||||||
const prefetchPostInteractionSettings = usePrefetchPostInteractionSettings({
|
const prefetchPostInteractionSettings = usePrefetchPostInteractionSettings({
|
||||||
@@ -169,7 +174,7 @@ let PostDropdownBtn = ({
|
|||||||
)
|
)
|
||||||
|
|
||||||
const onDeletePost = React.useCallback(() => {
|
const onDeletePost = React.useCallback(() => {
|
||||||
postDeleteMutation.mutateAsync({uri: postUri}).then(
|
deletePostMutate({uri: postUri}).then(
|
||||||
() => {
|
() => {
|
||||||
Toast.show(_(msg`Post deleted`))
|
Toast.show(_(msg`Post deleted`))
|
||||||
|
|
||||||
@@ -197,7 +202,7 @@ let PostDropdownBtn = ({
|
|||||||
}, [
|
}, [
|
||||||
navigation,
|
navigation,
|
||||||
postUri,
|
postUri,
|
||||||
postDeleteMutation,
|
deletePostMutate,
|
||||||
postAuthor,
|
postAuthor,
|
||||||
currentAccount,
|
currentAccount,
|
||||||
isAuthor,
|
isAuthor,
|
||||||
@@ -344,6 +349,14 @@ let PostDropdownBtn = ({
|
|||||||
toggleReplyVisibility,
|
toggleReplyVisibility,
|
||||||
])
|
])
|
||||||
|
|
||||||
|
const onPressPin = useCallback(() => {
|
||||||
|
pinPostMutate({
|
||||||
|
postUri,
|
||||||
|
postCid,
|
||||||
|
action: isPinned ? 'unpin' : 'pin',
|
||||||
|
})
|
||||||
|
}, [isPinned, pinPostMutate, postCid, postUri])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EventStopper onKeyDown={false}>
|
<EventStopper onKeyDown={false}>
|
||||||
<Menu.Root>
|
<Menu.Root>
|
||||||
@@ -372,6 +385,33 @@ let PostDropdownBtn = ({
|
|||||||
</Menu.Trigger>
|
</Menu.Trigger>
|
||||||
|
|
||||||
<Menu.Outer>
|
<Menu.Outer>
|
||||||
|
{isAuthor && (
|
||||||
|
<>
|
||||||
|
<Menu.Group>
|
||||||
|
<Menu.Item
|
||||||
|
testID="pinPostBtn"
|
||||||
|
label={
|
||||||
|
isPinned
|
||||||
|
? _(msg`Unpin from profile`)
|
||||||
|
: _(msg`Pin to your profile`)
|
||||||
|
}
|
||||||
|
disabled={isPinPending}
|
||||||
|
onPress={onPressPin}>
|
||||||
|
<Menu.ItemText>
|
||||||
|
{isPinned
|
||||||
|
? _(msg`Unpin from profile`)
|
||||||
|
: _(msg`Pin to your profile`)}
|
||||||
|
</Menu.ItemText>
|
||||||
|
<Menu.ItemIcon
|
||||||
|
icon={isPinPending ? Loader : PinIcon}
|
||||||
|
position="right"
|
||||||
|
/>
|
||||||
|
</Menu.Item>
|
||||||
|
</Menu.Group>
|
||||||
|
<Menu.Divider />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
<Menu.Group>
|
<Menu.Group>
|
||||||
{(!hideInPWI || hasSession) && (
|
{(!hideInPWI || hasSession) && (
|
||||||
<>
|
<>
|
||||||
@@ -536,7 +576,7 @@ let PostDropdownBtn = ({
|
|||||||
|
|
||||||
{canDetachQuote && (
|
{canDetachQuote && (
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
disabled={isPending}
|
disabled={isDetachPending}
|
||||||
testID="postDropdownHideBtn"
|
testID="postDropdownHideBtn"
|
||||||
label={
|
label={
|
||||||
quoteEmbed.isDetached
|
quoteEmbed.isDetached
|
||||||
@@ -555,7 +595,7 @@ let PostDropdownBtn = ({
|
|||||||
</Menu.ItemText>
|
</Menu.ItemText>
|
||||||
<Menu.ItemIcon
|
<Menu.ItemIcon
|
||||||
icon={
|
icon={
|
||||||
isPending
|
isDetachPending
|
||||||
? Loader
|
? Loader
|
||||||
: quoteEmbed.isDetached
|
: quoteEmbed.isDetached
|
||||||
? Eye
|
? Eye
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import {msg, Trans} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useFocusEffect} from '@react-navigation/native'
|
import {useFocusEffect} from '@react-navigation/native'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
||||||
@@ -36,7 +35,6 @@ type Props = NativeStackScreenProps<
|
|||||||
export function AccessibilitySettingsScreen({}: Props) {
|
export function AccessibilitySettingsScreen({}: Props) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {screen} = useAnalytics()
|
|
||||||
const {isMobile, isTabletOrMobile} = useWebMediaQueries()
|
const {isMobile, isTabletOrMobile} = useWebMediaQueries()
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
|
|
||||||
@@ -51,9 +49,8 @@ export function AccessibilitySettingsScreen({}: Props) {
|
|||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
screen('PreferencesExternalEmbeds')
|
|
||||||
setMinimalShellMode(false)
|
setMinimalShellMode(false)
|
||||||
}, [screen, setMinimalShellMode]),
|
}, [setMinimalShellMode]),
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import {useLingui} from '@lingui/react'
|
|||||||
import {useFocusEffect} from '@react-navigation/native'
|
import {useFocusEffect} from '@react-navigation/native'
|
||||||
import {NativeStackScreenProps} from '@react-navigation/native-stack'
|
import {NativeStackScreenProps} from '@react-navigation/native-stack'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
import {CommonNavigatorParams} from '#/lib/routes/types'
|
import {CommonNavigatorParams} from '#/lib/routes/types'
|
||||||
@@ -28,7 +27,7 @@ import {Button} from '#/view/com/util/forms/Button'
|
|||||||
import {Text} from '#/view/com/util/text/Text'
|
import {Text} from '#/view/com/util/text/Text'
|
||||||
import * as Toast from '#/view/com/util/Toast'
|
import * as Toast from '#/view/com/util/Toast'
|
||||||
import {ViewHeader} from '#/view/com/util/ViewHeader'
|
import {ViewHeader} from '#/view/com/util/ViewHeader'
|
||||||
import {CenteredView} from 'view/com/util/Views'
|
import {CenteredView} from '#/view/com/util/Views'
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
import {useDialogControl} from '#/components/Dialog'
|
import {useDialogControl} from '#/components/Dialog'
|
||||||
import * as Prompt from '#/components/Prompt'
|
import * as Prompt from '#/components/Prompt'
|
||||||
@@ -38,16 +37,14 @@ export function AppPasswords({}: Props) {
|
|||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {screen} = useAnalytics()
|
|
||||||
const {isTabletOrDesktop} = useWebMediaQueries()
|
const {isTabletOrDesktop} = useWebMediaQueries()
|
||||||
const {openModal} = useModalControls()
|
const {openModal} = useModalControls()
|
||||||
const {data: appPasswords, error} = useAppPasswordsQuery()
|
const {data: appPasswords, error} = useAppPasswordsQuery()
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
screen('AppPasswords')
|
|
||||||
setMinimalShellMode(false)
|
setMinimalShellMode(false)
|
||||||
}, [screen, setMinimalShellMode]),
|
}, [setMinimalShellMode]),
|
||||||
)
|
)
|
||||||
|
|
||||||
const onAdd = React.useCallback(async () => {
|
const onAdd = React.useCallback(async () => {
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import {useLingui} from '@lingui/react'
|
|||||||
import {useFocusEffect} from '@react-navigation/native'
|
import {useFocusEffect} from '@react-navigation/native'
|
||||||
|
|
||||||
import {APP_LANGUAGES, LANGUAGES} from '#/lib/../locale/languages'
|
import {APP_LANGUAGES, LANGUAGES} from '#/lib/../locale/languages'
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
||||||
@@ -32,21 +31,18 @@ export function LanguageSettingsScreen(_props: Props) {
|
|||||||
const langPrefs = useLanguagePrefs()
|
const langPrefs = useLanguagePrefs()
|
||||||
const setLangPrefs = useLanguagePrefsApi()
|
const setLangPrefs = useLanguagePrefsApi()
|
||||||
const {isTabletOrDesktop} = useWebMediaQueries()
|
const {isTabletOrDesktop} = useWebMediaQueries()
|
||||||
const {screen, track} = useAnalytics()
|
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {openModal} = useModalControls()
|
const {openModal} = useModalControls()
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
screen('Settings')
|
|
||||||
setMinimalShellMode(false)
|
setMinimalShellMode(false)
|
||||||
}, [screen, setMinimalShellMode]),
|
}, [setMinimalShellMode]),
|
||||||
)
|
)
|
||||||
|
|
||||||
const onPressContentLanguages = React.useCallback(() => {
|
const onPressContentLanguages = React.useCallback(() => {
|
||||||
track('Settings:ContentlanguagesButtonClicked')
|
|
||||||
openModal({name: 'content-languages-settings'})
|
openModal({name: 'content-languages-settings'})
|
||||||
}, [track, openModal])
|
}, [openModal])
|
||||||
|
|
||||||
const onChangePrimaryLanguage = React.useCallback(
|
const onChangePrimaryLanguage = React.useCallback(
|
||||||
(value: Parameters<PickerSelectProps['onValueChange']>[0]) => {
|
(value: Parameters<PickerSelectProps['onValueChange']>[0]) => {
|
||||||
|
|||||||
@@ -12,16 +12,15 @@ import {useLingui} from '@lingui/react'
|
|||||||
import {useFocusEffect} from '@react-navigation/native'
|
import {useFocusEffect} from '@react-navigation/native'
|
||||||
import {NativeStackScreenProps} from '@react-navigation/native-stack'
|
import {NativeStackScreenProps} from '@react-navigation/native-stack'
|
||||||
|
|
||||||
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
|
import {CommonNavigatorParams} from '#/lib/routes/types'
|
||||||
import {cleanError} from '#/lib/strings/errors'
|
import {cleanError} from '#/lib/strings/errors'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {useMyBlockedAccountsQuery} from '#/state/queries/my-blocked-accounts'
|
import {useMyBlockedAccountsQuery} from '#/state/queries/my-blocked-accounts'
|
||||||
import {useSetMinimalShellMode} from '#/state/shell'
|
import {useSetMinimalShellMode} from '#/state/shell'
|
||||||
import {useAnalytics} from 'lib/analytics/analytics'
|
import {ProfileCard} from '#/view/com/profile/ProfileCard'
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
import {CenteredView} from '#/view/com/util/Views'
|
||||||
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
|
||||||
import {CommonNavigatorParams} from 'lib/routes/types'
|
|
||||||
import {ProfileCard} from 'view/com/profile/ProfileCard'
|
|
||||||
import {CenteredView} from 'view/com/util/Views'
|
|
||||||
import {ErrorScreen} from '../com/util/error/ErrorScreen'
|
import {ErrorScreen} from '../com/util/error/ErrorScreen'
|
||||||
import {Text} from '../com/util/text/Text'
|
import {Text} from '../com/util/text/Text'
|
||||||
import {ViewHeader} from '../com/util/ViewHeader'
|
import {ViewHeader} from '../com/util/ViewHeader'
|
||||||
@@ -35,7 +34,6 @@ export function ModerationBlockedAccounts({}: Props) {
|
|||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {isTabletOrDesktop} = useWebMediaQueries()
|
const {isTabletOrDesktop} = useWebMediaQueries()
|
||||||
const {screen} = useAnalytics()
|
|
||||||
|
|
||||||
const [isPTRing, setIsPTRing] = React.useState(false)
|
const [isPTRing, setIsPTRing] = React.useState(false)
|
||||||
const {
|
const {
|
||||||
@@ -58,9 +56,8 @@ export function ModerationBlockedAccounts({}: Props) {
|
|||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
screen('BlockedAccounts')
|
|
||||||
setMinimalShellMode(false)
|
setMinimalShellMode(false)
|
||||||
}, [screen, setMinimalShellMode]),
|
}, [setMinimalShellMode]),
|
||||||
)
|
)
|
||||||
|
|
||||||
const onRefresh = React.useCallback(async () => {
|
const onRefresh = React.useCallback(async () => {
|
||||||
|
|||||||
@@ -12,16 +12,15 @@ import {useLingui} from '@lingui/react'
|
|||||||
import {useFocusEffect} from '@react-navigation/native'
|
import {useFocusEffect} from '@react-navigation/native'
|
||||||
import {NativeStackScreenProps} from '@react-navigation/native-stack'
|
import {NativeStackScreenProps} from '@react-navigation/native-stack'
|
||||||
|
|
||||||
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
|
import {CommonNavigatorParams} from '#/lib/routes/types'
|
||||||
import {cleanError} from '#/lib/strings/errors'
|
import {cleanError} from '#/lib/strings/errors'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {useMyMutedAccountsQuery} from '#/state/queries/my-muted-accounts'
|
import {useMyMutedAccountsQuery} from '#/state/queries/my-muted-accounts'
|
||||||
import {useSetMinimalShellMode} from '#/state/shell'
|
import {useSetMinimalShellMode} from '#/state/shell'
|
||||||
import {useAnalytics} from 'lib/analytics/analytics'
|
import {ProfileCard} from '#/view/com/profile/ProfileCard'
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
import {CenteredView} from '#/view/com/util/Views'
|
||||||
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
|
||||||
import {CommonNavigatorParams} from 'lib/routes/types'
|
|
||||||
import {ProfileCard} from 'view/com/profile/ProfileCard'
|
|
||||||
import {CenteredView} from 'view/com/util/Views'
|
|
||||||
import {ErrorScreen} from '../com/util/error/ErrorScreen'
|
import {ErrorScreen} from '../com/util/error/ErrorScreen'
|
||||||
import {Text} from '../com/util/text/Text'
|
import {Text} from '../com/util/text/Text'
|
||||||
import {ViewHeader} from '../com/util/ViewHeader'
|
import {ViewHeader} from '../com/util/ViewHeader'
|
||||||
@@ -35,7 +34,6 @@ export function ModerationMutedAccounts({}: Props) {
|
|||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {isTabletOrDesktop} = useWebMediaQueries()
|
const {isTabletOrDesktop} = useWebMediaQueries()
|
||||||
const {screen} = useAnalytics()
|
|
||||||
|
|
||||||
const [isPTRing, setIsPTRing] = React.useState(false)
|
const [isPTRing, setIsPTRing] = React.useState(false)
|
||||||
const {
|
const {
|
||||||
@@ -58,9 +56,8 @@ export function ModerationMutedAccounts({}: Props) {
|
|||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
screen('MutedAccounts')
|
|
||||||
setMinimalShellMode(false)
|
setMinimalShellMode(false)
|
||||||
}, [screen, setMinimalShellMode]),
|
}, [setMinimalShellMode]),
|
||||||
)
|
)
|
||||||
|
|
||||||
const onRefresh = React.useCallback(async () => {
|
const onRefresh = React.useCallback(async () => {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import {useLingui} from '@lingui/react'
|
|||||||
import {useFocusEffect, useIsFocused} from '@react-navigation/native'
|
import {useFocusEffect, useIsFocused} from '@react-navigation/native'
|
||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
|
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
|
||||||
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
import {ComposeIcon2} from '#/lib/icons'
|
import {ComposeIcon2} from '#/lib/icons'
|
||||||
@@ -27,11 +26,11 @@ import {useSetMinimalShellMode} from '#/state/shell'
|
|||||||
import {useComposerControls} from '#/state/shell/composer'
|
import {useComposerControls} from '#/state/shell/composer'
|
||||||
import {Feed} from '#/view/com/notifications/Feed'
|
import {Feed} from '#/view/com/notifications/Feed'
|
||||||
import {FAB} from '#/view/com/util/fab/FAB'
|
import {FAB} from '#/view/com/util/fab/FAB'
|
||||||
|
import {ListMethods} from '#/view/com/util/List'
|
||||||
|
import {LoadLatestBtn} from '#/view/com/util/load-latest/LoadLatestBtn'
|
||||||
import {MainScrollProvider} from '#/view/com/util/MainScrollProvider'
|
import {MainScrollProvider} from '#/view/com/util/MainScrollProvider'
|
||||||
import {ViewHeader} from '#/view/com/util/ViewHeader'
|
import {ViewHeader} from '#/view/com/util/ViewHeader'
|
||||||
import {ListMethods} from 'view/com/util/List'
|
import {CenteredView} from '#/view/com/util/Views'
|
||||||
import {LoadLatestBtn} from 'view/com/util/load-latest/LoadLatestBtn'
|
|
||||||
import {CenteredView} from 'view/com/util/Views'
|
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Button} from '#/components/Button'
|
import {Button} from '#/components/Button'
|
||||||
import {SettingsGear2_Stroke2_Corner0_Rounded as SettingsIcon} from '#/components/icons/SettingsGear2'
|
import {SettingsGear2_Stroke2_Corner0_Rounded as SettingsIcon} from '#/components/icons/SettingsGear2'
|
||||||
@@ -49,7 +48,6 @@ export function NotificationsScreen({route: {params}}: Props) {
|
|||||||
const [isScrolledDown, setIsScrolledDown] = React.useState(false)
|
const [isScrolledDown, setIsScrolledDown] = React.useState(false)
|
||||||
const [isLoadingLatest, setIsLoadingLatest] = React.useState(false)
|
const [isLoadingLatest, setIsLoadingLatest] = React.useState(false)
|
||||||
const scrollElRef = React.useRef<ListMethods>(null)
|
const scrollElRef = React.useRef<ListMethods>(null)
|
||||||
const {screen} = useAnalytics()
|
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const {isDesktop} = useWebMediaQueries()
|
const {isDesktop} = useWebMediaQueries()
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
@@ -101,9 +99,8 @@ export function NotificationsScreen({route: {params}}: Props) {
|
|||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
setMinimalShellMode(false)
|
setMinimalShellMode(false)
|
||||||
logger.debug('NotificationsScreen: Focus')
|
logger.debug('NotificationsScreen: Focus')
|
||||||
screen('Notifications')
|
|
||||||
onFocusCheckLatest()
|
onFocusCheckLatest()
|
||||||
}, [screen, setMinimalShellMode, onFocusCheckLatest]),
|
}, [setMinimalShellMode, onFocusCheckLatest]),
|
||||||
)
|
)
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (!isScreenFocused) {
|
if (!isScreenFocused) {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import {StyleSheet, View} from 'react-native'
|
|||||||
import {Trans} from '@lingui/macro'
|
import {Trans} from '@lingui/macro'
|
||||||
import {useFocusEffect} from '@react-navigation/native'
|
import {useFocusEffect} from '@react-navigation/native'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
||||||
@@ -30,14 +29,12 @@ type Props = NativeStackScreenProps<
|
|||||||
export function PreferencesExternalEmbeds({}: Props) {
|
export function PreferencesExternalEmbeds({}: Props) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {screen} = useAnalytics()
|
|
||||||
const {isTabletOrMobile} = useWebMediaQueries()
|
const {isTabletOrMobile} = useWebMediaQueries()
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
screen('PreferencesExternalEmbeds')
|
|
||||||
setMinimalShellMode(false)
|
setMinimalShellMode(false)
|
||||||
}, [screen, setMinimalShellMode]),
|
}, [setMinimalShellMode]),
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import {
|
|||||||
useQueryClient,
|
useQueryClient,
|
||||||
} from '@tanstack/react-query'
|
} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {useSetTitle} from '#/lib/hooks/useSetTitle'
|
import {useSetTitle} from '#/lib/hooks/useSetTitle'
|
||||||
import {ComposeIcon2} from '#/lib/icons'
|
import {ComposeIcon2} from '#/lib/icons'
|
||||||
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
||||||
@@ -167,7 +166,6 @@ function ProfileScreenLoaded({
|
|||||||
const {hasSession, currentAccount} = useSession()
|
const {hasSession, currentAccount} = useSession()
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {openComposer} = useComposerControls()
|
const {openComposer} = useComposerControls()
|
||||||
const {screen, track} = useAnalytics()
|
|
||||||
const {
|
const {
|
||||||
data: labelerInfo,
|
data: labelerInfo,
|
||||||
error: labelerError,
|
error: labelerError,
|
||||||
@@ -296,11 +294,10 @@ function ProfileScreenLoaded({
|
|||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
setMinimalShellMode(false)
|
setMinimalShellMode(false)
|
||||||
screen('Profile')
|
|
||||||
return listenSoftReset(() => {
|
return listenSoftReset(() => {
|
||||||
scrollSectionToTop(currentPage)
|
scrollSectionToTop(currentPage)
|
||||||
})
|
})
|
||||||
}, [setMinimalShellMode, screen, currentPage, scrollSectionToTop]),
|
}, [setMinimalShellMode, currentPage, scrollSectionToTop]),
|
||||||
)
|
)
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
@@ -316,7 +313,6 @@ function ProfileScreenLoaded({
|
|||||||
// =
|
// =
|
||||||
|
|
||||||
const onPressCompose = () => {
|
const onPressCompose = () => {
|
||||||
track('ProfileScreen:PressCompose')
|
|
||||||
const mention =
|
const mention =
|
||||||
profile.handle === currentAccount?.handle ||
|
profile.handle === currentAccount?.handle ||
|
||||||
isInvalidHandle(profile.handle)
|
isInvalidHandle(profile.handle)
|
||||||
|
|||||||
@@ -8,6 +8,17 @@ import {NativeStackScreenProps} from '@react-navigation/native-stack'
|
|||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {HITSLOP_20} from '#/lib/constants'
|
import {HITSLOP_20} from '#/lib/constants'
|
||||||
|
import {useHaptics} from '#/lib/haptics'
|
||||||
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
|
import {useSetTitle} from '#/lib/hooks/useSetTitle'
|
||||||
|
import {ComposeIcon2} from '#/lib/icons'
|
||||||
|
import {makeCustomFeedLink} from '#/lib/routes/links'
|
||||||
|
import {CommonNavigatorParams} from '#/lib/routes/types'
|
||||||
|
import {NavigationProp} from '#/lib/routes/types'
|
||||||
|
import {shareUrl} from '#/lib/sharing'
|
||||||
|
import {makeRecordUri} from '#/lib/strings/url-helpers'
|
||||||
|
import {toShareUrl} from '#/lib/strings/url-helpers'
|
||||||
|
import {s} from '#/lib/styles'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {isNative} from '#/platform/detection'
|
import {isNative} from '#/platform/detection'
|
||||||
import {listenSoftReset} from '#/state/events'
|
import {listenSoftReset} from '#/state/events'
|
||||||
@@ -27,30 +38,18 @@ import {useResolveUriQuery} from '#/state/queries/resolve-uri'
|
|||||||
import {truncateAndInvalidate} from '#/state/queries/util'
|
import {truncateAndInvalidate} from '#/state/queries/util'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import {useComposerControls} from '#/state/shell/composer'
|
import {useComposerControls} from '#/state/shell/composer'
|
||||||
import {useAnalytics} from 'lib/analytics/analytics'
|
import {PagerWithHeader} from '#/view/com/pager/PagerWithHeader'
|
||||||
import {useHaptics} from 'lib/haptics'
|
import {Feed} from '#/view/com/posts/Feed'
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
import {ProfileSubpageHeader} from '#/view/com/profile/ProfileSubpageHeader'
|
||||||
import {useSetTitle} from 'lib/hooks/useSetTitle'
|
import {EmptyState} from '#/view/com/util/EmptyState'
|
||||||
import {ComposeIcon2} from 'lib/icons'
|
import {FAB} from '#/view/com/util/fab/FAB'
|
||||||
import {makeCustomFeedLink} from 'lib/routes/links'
|
import {Button} from '#/view/com/util/forms/Button'
|
||||||
import {CommonNavigatorParams} from 'lib/routes/types'
|
import {ListRef} from '#/view/com/util/List'
|
||||||
import {NavigationProp} from 'lib/routes/types'
|
import {LoadLatestBtn} from '#/view/com/util/load-latest/LoadLatestBtn'
|
||||||
import {shareUrl} from 'lib/sharing'
|
import {LoadingScreen} from '#/view/com/util/LoadingScreen'
|
||||||
import {makeRecordUri} from 'lib/strings/url-helpers'
|
import {Text} from '#/view/com/util/text/Text'
|
||||||
import {toShareUrl} from 'lib/strings/url-helpers'
|
import * as Toast from '#/view/com/util/Toast'
|
||||||
import {s} from 'lib/styles'
|
import {CenteredView} from '#/view/com/util/Views'
|
||||||
import {PagerWithHeader} from 'view/com/pager/PagerWithHeader'
|
|
||||||
import {Feed} from 'view/com/posts/Feed'
|
|
||||||
import {ProfileSubpageHeader} from 'view/com/profile/ProfileSubpageHeader'
|
|
||||||
import {EmptyState} from 'view/com/util/EmptyState'
|
|
||||||
import {FAB} from 'view/com/util/fab/FAB'
|
|
||||||
import {Button} from 'view/com/util/forms/Button'
|
|
||||||
import {ListRef} from 'view/com/util/List'
|
|
||||||
import {LoadLatestBtn} from 'view/com/util/load-latest/LoadLatestBtn'
|
|
||||||
import {LoadingScreen} from 'view/com/util/LoadingScreen'
|
|
||||||
import {Text} from 'view/com/util/text/Text'
|
|
||||||
import * as Toast from 'view/com/util/Toast'
|
|
||||||
import {CenteredView} from 'view/com/util/Views'
|
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Button as NewButton, ButtonText} from '#/components/Button'
|
import {Button as NewButton, ButtonText} from '#/components/Button'
|
||||||
import {useRichText} from '#/components/hooks/useRichText'
|
import {useRichText} from '#/components/hooks/useRichText'
|
||||||
@@ -158,7 +157,6 @@ export function ProfileFeedScreenInner({
|
|||||||
const {hasSession, currentAccount} = useSession()
|
const {hasSession, currentAccount} = useSession()
|
||||||
const reportDialogControl = useReportDialogControl()
|
const reportDialogControl = useReportDialogControl()
|
||||||
const {openComposer} = useComposerControls()
|
const {openComposer} = useComposerControls()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const playHaptic = useHaptics()
|
const playHaptic = useHaptics()
|
||||||
const feedSectionRef = React.useRef<SectionRef>(null)
|
const feedSectionRef = React.useRef<SectionRef>(null)
|
||||||
const isScreenFocused = useIsFocused()
|
const isScreenFocused = useIsFocused()
|
||||||
@@ -247,8 +245,7 @@ export function ProfileFeedScreenInner({
|
|||||||
const onPressShare = React.useCallback(() => {
|
const onPressShare = React.useCallback(() => {
|
||||||
const url = toShareUrl(feedInfo.route.href)
|
const url = toShareUrl(feedInfo.route.href)
|
||||||
shareUrl(url)
|
shareUrl(url)
|
||||||
track('CustomFeed:Share')
|
}, [feedInfo])
|
||||||
}, [feedInfo, track])
|
|
||||||
|
|
||||||
const onPressReport = React.useCallback(() => {
|
const onPressReport = React.useCallback(() => {
|
||||||
reportDialogControl.open()
|
reportDialogControl.open()
|
||||||
@@ -515,7 +512,6 @@ function AboutSection({
|
|||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const [likeUri, setLikeUri] = React.useState(feedInfo.likeUri)
|
const [likeUri, setLikeUri] = React.useState(feedInfo.likeUri)
|
||||||
const {hasSession} = useSession()
|
const {hasSession} = useSession()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const playHaptic = useHaptics()
|
const playHaptic = useHaptics()
|
||||||
const {mutateAsync: likeFeed, isPending: isLikePending} = useLikeMutation()
|
const {mutateAsync: likeFeed, isPending: isLikePending} = useLikeMutation()
|
||||||
const {mutateAsync: unlikeFeed, isPending: isUnlikePending} =
|
const {mutateAsync: unlikeFeed, isPending: isUnlikePending} =
|
||||||
@@ -532,11 +528,9 @@ function AboutSection({
|
|||||||
|
|
||||||
if (isLiked && likeUri) {
|
if (isLiked && likeUri) {
|
||||||
await unlikeFeed({uri: likeUri})
|
await unlikeFeed({uri: likeUri})
|
||||||
track('CustomFeed:Unlike')
|
|
||||||
setLikeUri('')
|
setLikeUri('')
|
||||||
} else {
|
} else {
|
||||||
const res = await likeFeed({uri: feedInfo.uri, cid: feedInfo.cid})
|
const res = await likeFeed({uri: feedInfo.uri, cid: feedInfo.cid})
|
||||||
track('CustomFeed:Like')
|
|
||||||
setLikeUri(res.uri)
|
setLikeUri(res.uri)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -548,7 +542,7 @@ function AboutSection({
|
|||||||
)
|
)
|
||||||
logger.error('Failed up toggle like', {message: err})
|
logger.error('Failed up toggle like', {message: err})
|
||||||
}
|
}
|
||||||
}, [playHaptic, isLiked, likeUri, unlikeFeed, track, likeFeed, feedInfo, _])
|
}, [playHaptic, isLiked, likeUri, unlikeFeed, likeFeed, feedInfo, _])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[styles.aboutSectionContainer]}>
|
<View style={[styles.aboutSectionContainer]}>
|
||||||
|
|||||||
@@ -14,8 +14,19 @@ import {useFocusEffect, useIsFocused} from '@react-navigation/native'
|
|||||||
import {useNavigation} from '@react-navigation/native'
|
import {useNavigation} from '@react-navigation/native'
|
||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
import {useHaptics} from '#/lib/haptics'
|
||||||
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
|
import {useSetTitle} from '#/lib/hooks/useSetTitle'
|
||||||
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
|
import {ComposeIcon2} from '#/lib/icons'
|
||||||
|
import {makeListLink, makeProfileLink} from '#/lib/routes/links'
|
||||||
|
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
||||||
|
import {NavigationProp} from '#/lib/routes/types'
|
||||||
|
import {shareUrl} from '#/lib/sharing'
|
||||||
import {cleanError} from '#/lib/strings/errors'
|
import {cleanError} from '#/lib/strings/errors'
|
||||||
|
import {sanitizeHandle} from '#/lib/strings/handles'
|
||||||
|
import {toShareUrl} from '#/lib/strings/url-helpers'
|
||||||
|
import {s} from '#/lib/styles'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {isNative, isWeb} from '#/platform/detection'
|
import {isNative, isWeb} from '#/platform/detection'
|
||||||
import {listenSoftReset} from '#/state/events'
|
import {listenSoftReset} from '#/state/events'
|
||||||
@@ -41,33 +52,24 @@ import {truncateAndInvalidate} from '#/state/queries/util'
|
|||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import {useSetMinimalShellMode} from '#/state/shell'
|
import {useSetMinimalShellMode} from '#/state/shell'
|
||||||
import {useComposerControls} from '#/state/shell/composer'
|
import {useComposerControls} from '#/state/shell/composer'
|
||||||
import {useHaptics} from 'lib/haptics'
|
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
|
||||||
import {useSetTitle} from 'lib/hooks/useSetTitle'
|
|
||||||
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
|
||||||
import {ComposeIcon2} from 'lib/icons'
|
|
||||||
import {makeListLink, makeProfileLink} from 'lib/routes/links'
|
|
||||||
import {CommonNavigatorParams, NativeStackScreenProps} from 'lib/routes/types'
|
|
||||||
import {NavigationProp} from 'lib/routes/types'
|
|
||||||
import {shareUrl} from 'lib/sharing'
|
|
||||||
import {sanitizeHandle} from 'lib/strings/handles'
|
|
||||||
import {toShareUrl} from 'lib/strings/url-helpers'
|
|
||||||
import {s} from 'lib/styles'
|
|
||||||
import {ListMembers} from '#/view/com/lists/ListMembers'
|
import {ListMembers} from '#/view/com/lists/ListMembers'
|
||||||
import {PagerWithHeader} from 'view/com/pager/PagerWithHeader'
|
import {PagerWithHeader} from '#/view/com/pager/PagerWithHeader'
|
||||||
import {Feed} from 'view/com/posts/Feed'
|
import {Feed} from '#/view/com/posts/Feed'
|
||||||
import {ProfileSubpageHeader} from 'view/com/profile/ProfileSubpageHeader'
|
import {ProfileSubpageHeader} from '#/view/com/profile/ProfileSubpageHeader'
|
||||||
import {EmptyState} from 'view/com/util/EmptyState'
|
import {EmptyState} from '#/view/com/util/EmptyState'
|
||||||
import {FAB} from 'view/com/util/fab/FAB'
|
import {FAB} from '#/view/com/util/fab/FAB'
|
||||||
import {Button} from 'view/com/util/forms/Button'
|
import {Button} from '#/view/com/util/forms/Button'
|
||||||
import {DropdownItem, NativeDropdown} from 'view/com/util/forms/NativeDropdown'
|
import {
|
||||||
import {TextLink} from 'view/com/util/Link'
|
DropdownItem,
|
||||||
import {ListRef} from 'view/com/util/List'
|
NativeDropdown,
|
||||||
import {LoadLatestBtn} from 'view/com/util/load-latest/LoadLatestBtn'
|
} from '#/view/com/util/forms/NativeDropdown'
|
||||||
import {LoadingScreen} from 'view/com/util/LoadingScreen'
|
import {TextLink} from '#/view/com/util/Link'
|
||||||
import {Text} from 'view/com/util/text/Text'
|
import {ListRef} from '#/view/com/util/List'
|
||||||
import * as Toast from 'view/com/util/Toast'
|
import {LoadLatestBtn} from '#/view/com/util/load-latest/LoadLatestBtn'
|
||||||
import {CenteredView} from 'view/com/util/Views'
|
import {LoadingScreen} from '#/view/com/util/LoadingScreen'
|
||||||
|
import {Text} from '#/view/com/util/text/Text'
|
||||||
|
import * as Toast from '#/view/com/util/Toast'
|
||||||
|
import {CenteredView} from '#/view/com/util/Views'
|
||||||
import {ListHiddenScreen} from '#/screens/List/ListHiddenScreen'
|
import {ListHiddenScreen} from '#/screens/List/ListHiddenScreen'
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {useDialogControl} from '#/components/Dialog'
|
import {useDialogControl} from '#/components/Dialog'
|
||||||
@@ -306,7 +308,6 @@ function Header({
|
|||||||
const isBlocking = !!list.viewer?.blocked
|
const isBlocking = !!list.viewer?.blocked
|
||||||
const isMuting = !!list.viewer?.muted
|
const isMuting = !!list.viewer?.muted
|
||||||
const isOwner = list.creator.did === currentAccount?.did
|
const isOwner = list.creator.did === currentAccount?.did
|
||||||
const {track} = useAnalytics()
|
|
||||||
const playHaptic = useHaptics()
|
const playHaptic = useHaptics()
|
||||||
|
|
||||||
const {mutateAsync: addSavedFeeds, isPending: isAddSavedFeedPending} =
|
const {mutateAsync: addSavedFeeds, isPending: isAddSavedFeedPending} =
|
||||||
@@ -384,7 +385,6 @@ function Header({
|
|||||||
try {
|
try {
|
||||||
await listMuteMutation.mutateAsync({uri: list.uri, mute: true})
|
await listMuteMutation.mutateAsync({uri: list.uri, mute: true})
|
||||||
Toast.show(_(msg`List muted`))
|
Toast.show(_(msg`List muted`))
|
||||||
track('Lists:Mute')
|
|
||||||
} catch {
|
} catch {
|
||||||
Toast.show(
|
Toast.show(
|
||||||
_(
|
_(
|
||||||
@@ -392,13 +392,12 @@ function Header({
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}, [list, listMuteMutation, track, _])
|
}, [list, listMuteMutation, _])
|
||||||
|
|
||||||
const onUnsubscribeMute = useCallback(async () => {
|
const onUnsubscribeMute = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
await listMuteMutation.mutateAsync({uri: list.uri, mute: false})
|
await listMuteMutation.mutateAsync({uri: list.uri, mute: false})
|
||||||
Toast.show(_(msg`List unmuted`))
|
Toast.show(_(msg`List unmuted`))
|
||||||
track('Lists:Unmute')
|
|
||||||
} catch {
|
} catch {
|
||||||
Toast.show(
|
Toast.show(
|
||||||
_(
|
_(
|
||||||
@@ -406,13 +405,12 @@ function Header({
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}, [list, listMuteMutation, track, _])
|
}, [list, listMuteMutation, _])
|
||||||
|
|
||||||
const onSubscribeBlock = useCallback(async () => {
|
const onSubscribeBlock = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
await listBlockMutation.mutateAsync({uri: list.uri, block: true})
|
await listBlockMutation.mutateAsync({uri: list.uri, block: true})
|
||||||
Toast.show(_(msg`List blocked`))
|
Toast.show(_(msg`List blocked`))
|
||||||
track('Lists:Block')
|
|
||||||
} catch {
|
} catch {
|
||||||
Toast.show(
|
Toast.show(
|
||||||
_(
|
_(
|
||||||
@@ -420,13 +418,12 @@ function Header({
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}, [list, listBlockMutation, track, _])
|
}, [list, listBlockMutation, _])
|
||||||
|
|
||||||
const onUnsubscribeBlock = useCallback(async () => {
|
const onUnsubscribeBlock = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
await listBlockMutation.mutateAsync({uri: list.uri, block: false})
|
await listBlockMutation.mutateAsync({uri: list.uri, block: false})
|
||||||
Toast.show(_(msg`List unblocked`))
|
Toast.show(_(msg`List unblocked`))
|
||||||
track('Lists:Unblock')
|
|
||||||
} catch {
|
} catch {
|
||||||
Toast.show(
|
Toast.show(
|
||||||
_(
|
_(
|
||||||
@@ -434,7 +431,7 @@ function Header({
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}, [list, listBlockMutation, track, _])
|
}, [list, listBlockMutation, _])
|
||||||
|
|
||||||
const onPressEdit = useCallback(() => {
|
const onPressEdit = useCallback(() => {
|
||||||
openModal({
|
openModal({
|
||||||
@@ -451,7 +448,6 @@ function Header({
|
|||||||
}
|
}
|
||||||
|
|
||||||
Toast.show(_(msg`List deleted`))
|
Toast.show(_(msg`List deleted`))
|
||||||
track('Lists:Delete')
|
|
||||||
if (navigation.canGoBack()) {
|
if (navigation.canGoBack()) {
|
||||||
navigation.goBack()
|
navigation.goBack()
|
||||||
} else {
|
} else {
|
||||||
@@ -461,7 +457,6 @@ function Header({
|
|||||||
list,
|
list,
|
||||||
listDeleteMutation,
|
listDeleteMutation,
|
||||||
navigation,
|
navigation,
|
||||||
track,
|
|
||||||
_,
|
_,
|
||||||
removeSavedFeed,
|
removeSavedFeed,
|
||||||
savedFeedConfig,
|
savedFeedConfig,
|
||||||
@@ -474,8 +469,7 @@ function Header({
|
|||||||
const onPressShare = useCallback(() => {
|
const onPressShare = useCallback(() => {
|
||||||
const url = toShareUrl(`/profile/${list.creator.did}/lists/${rkey}`)
|
const url = toShareUrl(`/profile/${list.creator.did}/lists/${rkey}`)
|
||||||
shareUrl(url)
|
shareUrl(url)
|
||||||
track('Lists:Share')
|
}, [list, rkey])
|
||||||
}, [list, rkey, track])
|
|
||||||
|
|
||||||
const dropdownItems: DropdownItem[] = useMemo(() => {
|
const dropdownItems: DropdownItem[] = useMemo(() => {
|
||||||
let items: DropdownItem[] = [
|
let items: DropdownItem[] = [
|
||||||
|
|||||||
@@ -7,7 +7,11 @@ import {useLingui} from '@lingui/react'
|
|||||||
import {useFocusEffect} from '@react-navigation/native'
|
import {useFocusEffect} from '@react-navigation/native'
|
||||||
import {NativeStackScreenProps} from '@react-navigation/native-stack'
|
import {NativeStackScreenProps} from '@react-navigation/native-stack'
|
||||||
|
|
||||||
import {track} from '#/lib/analytics/analytics'
|
import {useHaptics} from '#/lib/haptics'
|
||||||
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
|
import {CommonNavigatorParams} from '#/lib/routes/types'
|
||||||
|
import {colors, s} from '#/lib/styles'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {
|
import {
|
||||||
useOverwriteSavedFeedsMutation,
|
useOverwriteSavedFeedsMutation,
|
||||||
@@ -16,18 +20,12 @@ import {
|
|||||||
} from '#/state/queries/preferences'
|
} from '#/state/queries/preferences'
|
||||||
import {UsePreferencesQueryResponse} from '#/state/queries/preferences/types'
|
import {UsePreferencesQueryResponse} from '#/state/queries/preferences/types'
|
||||||
import {useSetMinimalShellMode} from '#/state/shell'
|
import {useSetMinimalShellMode} from '#/state/shell'
|
||||||
import {useAnalytics} from 'lib/analytics/analytics'
|
import {FeedSourceCard} from '#/view/com/feeds/FeedSourceCard'
|
||||||
import {useHaptics} from 'lib/haptics'
|
import {TextLink} from '#/view/com/util/Link'
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
import {Text} from '#/view/com/util/text/Text'
|
||||||
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
import * as Toast from '#/view/com/util/Toast'
|
||||||
import {CommonNavigatorParams} from 'lib/routes/types'
|
import {ViewHeader} from '#/view/com/util/ViewHeader'
|
||||||
import {colors, s} from 'lib/styles'
|
import {CenteredView, ScrollView} from '#/view/com/util/Views'
|
||||||
import {FeedSourceCard} from 'view/com/feeds/FeedSourceCard'
|
|
||||||
import {TextLink} from 'view/com/util/Link'
|
|
||||||
import {Text} from 'view/com/util/text/Text'
|
|
||||||
import * as Toast from 'view/com/util/Toast'
|
|
||||||
import {ViewHeader} from 'view/com/util/ViewHeader'
|
|
||||||
import {CenteredView, ScrollView} from 'view/com/util/Views'
|
|
||||||
import {NoFollowingFeed} from '#/screens/Feeds/NoFollowingFeed'
|
import {NoFollowingFeed} from '#/screens/Feeds/NoFollowingFeed'
|
||||||
import {NoSavedFeedsOfAnyType} from '#/screens/Feeds/NoSavedFeedsOfAnyType'
|
import {NoSavedFeedsOfAnyType} from '#/screens/Feeds/NoSavedFeedsOfAnyType'
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
@@ -51,7 +49,6 @@ export function SavedFeeds({}: Props) {
|
|||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {isMobile, isTabletOrDesktop} = useWebMediaQueries()
|
const {isMobile, isTabletOrDesktop} = useWebMediaQueries()
|
||||||
const {screen} = useAnalytics()
|
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
const {data: preferences} = usePreferencesQuery()
|
const {data: preferences} = usePreferencesQuery()
|
||||||
const {
|
const {
|
||||||
@@ -77,9 +74,8 @@ export function SavedFeeds({}: Props) {
|
|||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
screen('SavedFeeds')
|
|
||||||
setMinimalShellMode(false)
|
setMinimalShellMode(false)
|
||||||
}, [screen, setMinimalShellMode]),
|
}, [setMinimalShellMode]),
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -256,10 +252,6 @@ function ListItem({
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await overwriteSavedFeeds(nextFeeds)
|
await overwriteSavedFeeds(nextFeeds)
|
||||||
track('CustomFeed:Reorder', {
|
|
||||||
uri: feed.value,
|
|
||||||
index: nextIndex,
|
|
||||||
})
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Toast.show(_(msg`There was an issue contacting the server`), 'xmark')
|
Toast.show(_(msg`There was an issue contacting the server`), 'xmark')
|
||||||
logger.error('Failed to set pinned feed order', {message: e})
|
logger.error('Failed to set pinned feed order', {message: e})
|
||||||
@@ -282,10 +274,6 @@ function ListItem({
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await overwriteSavedFeeds(nextFeeds)
|
await overwriteSavedFeeds(nextFeeds)
|
||||||
track('CustomFeed:Reorder', {
|
|
||||||
uri: feed.value,
|
|
||||||
index: nextIndex,
|
|
||||||
})
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Toast.show(_(msg`There was an issue contacting the server`), 'xmark')
|
Toast.show(_(msg`There was an issue contacting the server`), 'xmark')
|
||||||
logger.error('Failed to set pinned feed order', {message: e})
|
logger.error('Failed to set pinned feed order', {message: e})
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import AsyncStorage from '@react-native-async-storage/async-storage'
|
|||||||
import {useFocusEffect, useNavigation} from '@react-navigation/native'
|
import {useFocusEffect, useNavigation} from '@react-navigation/native'
|
||||||
|
|
||||||
import {LANGUAGES} from '#/lib/../locale/languages'
|
import {LANGUAGES} from '#/lib/../locale/languages'
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {createHitslop} from '#/lib/constants'
|
import {createHitslop} from '#/lib/constants'
|
||||||
import {HITSLOP_10} from '#/lib/constants'
|
import {HITSLOP_10} from '#/lib/constants'
|
||||||
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
|
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
|
||||||
@@ -601,7 +600,6 @@ export function SearchScreen(
|
|||||||
const navigation = useNavigation<NavigationProp>()
|
const navigation = useNavigation<NavigationProp>()
|
||||||
const textInput = React.useRef<TextInput>(null)
|
const textInput = React.useRef<TextInput>(null)
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const setDrawerOpen = useSetDrawerOpen()
|
const setDrawerOpen = useSetDrawerOpen()
|
||||||
const setMinimalShellMode = useSetMinimalShellMode()
|
const setMinimalShellMode = useSetMinimalShellMode()
|
||||||
|
|
||||||
@@ -656,9 +654,8 @@ export function SearchScreen(
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const onPressMenu = React.useCallback(() => {
|
const onPressMenu = React.useCallback(() => {
|
||||||
track('ViewHeader:MenuButtonClicked')
|
|
||||||
setDrawerOpen(true)
|
setDrawerOpen(true)
|
||||||
}, [track, setDrawerOpen])
|
}, [setDrawerOpen])
|
||||||
|
|
||||||
const onPressClearQuery = React.useCallback(() => {
|
const onPressClearQuery = React.useCallback(() => {
|
||||||
scrollToTopWeb()
|
scrollToTopWeb()
|
||||||
@@ -845,14 +842,14 @@ export function SearchScreen(
|
|||||||
a.gap_sm,
|
a.gap_sm,
|
||||||
t.atoms.bg,
|
t.atoms.bg,
|
||||||
web({
|
web({
|
||||||
height: headerHeight,
|
height: headerHeight + a.mb_sm.marginBottom,
|
||||||
position: 'sticky',
|
position: 'sticky',
|
||||||
top: 0,
|
top: 0,
|
||||||
zIndex: 1,
|
zIndex: 1,
|
||||||
}),
|
}),
|
||||||
]}
|
]}
|
||||||
sideBorders={gtMobile}>
|
sideBorders={gtMobile}>
|
||||||
<View style={[a.flex_row, a.gap_sm]}>
|
<View style={[a.flex_row, a.gap_sm, a.mb_sm]}>
|
||||||
{!gtMobile && (
|
{!gtMobile && (
|
||||||
<Button
|
<Button
|
||||||
testID="viewHeaderBackOrMenuBtn"
|
testID="viewHeaderBackOrMenuBtn"
|
||||||
@@ -985,7 +982,7 @@ let SearchInputBox = ({
|
|||||||
const t = useThemeNew()
|
const t = useThemeNew()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[a.flex_1, a.mb_sm]}>
|
<View style={[a.flex_1]}>
|
||||||
<TextField.Root>
|
<TextField.Root>
|
||||||
<TextField.Icon icon={MagnifyingGlass} />
|
<TextField.Icon icon={MagnifyingGlass} />
|
||||||
<TextField.Input
|
<TextField.Input
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import {useLingui} from '@lingui/react'
|
|||||||
import {useFocusEffect, useNavigation} from '@react-navigation/native'
|
import {useFocusEffect, useNavigation} from '@react-navigation/native'
|
||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {appVersion, BUNDLE_DATE, bundleInfo} from '#/lib/app-info'
|
import {appVersion, BUNDLE_DATE, bundleInfo} from '#/lib/app-info'
|
||||||
import {STATUS_PAGE_URL} from '#/lib/constants'
|
import {STATUS_PAGE_URL} from '#/lib/constants'
|
||||||
import {useAccountSwitcher} from '#/lib/hooks/useAccountSwitcher'
|
import {useAccountSwitcher} from '#/lib/hooks/useAccountSwitcher'
|
||||||
@@ -146,7 +145,6 @@ export function SettingsScreen({}: Props) {
|
|||||||
const onboardingDispatch = useOnboardingDispatch()
|
const onboardingDispatch = useOnboardingDispatch()
|
||||||
const navigation = useNavigation<NavigationProp>()
|
const navigation = useNavigation<NavigationProp>()
|
||||||
const {isMobile} = useWebMediaQueries()
|
const {isMobile} = useWebMediaQueries()
|
||||||
const {screen, track} = useAnalytics()
|
|
||||||
const {openModal} = useModalControls()
|
const {openModal} = useModalControls()
|
||||||
const {accounts, currentAccount} = useSession()
|
const {accounts, currentAccount} = useSession()
|
||||||
const {mutate: clearPreferences} = useClearPreferencesMutation()
|
const {mutate: clearPreferences} = useClearPreferencesMutation()
|
||||||
@@ -178,19 +176,16 @@ export function SettingsScreen({}: Props) {
|
|||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
screen('Settings')
|
|
||||||
setMinimalShellMode(false)
|
setMinimalShellMode(false)
|
||||||
}, [screen, setMinimalShellMode]),
|
}, [setMinimalShellMode]),
|
||||||
)
|
)
|
||||||
|
|
||||||
const onPressAddAccount = React.useCallback(() => {
|
const onPressAddAccount = React.useCallback(() => {
|
||||||
track('Settings:AddAccountButtonClicked')
|
|
||||||
setShowLoggedOut(true)
|
setShowLoggedOut(true)
|
||||||
closeAllActiveElements()
|
closeAllActiveElements()
|
||||||
}, [track, setShowLoggedOut, closeAllActiveElements])
|
}, [setShowLoggedOut, closeAllActiveElements])
|
||||||
|
|
||||||
const onPressChangeHandle = React.useCallback(() => {
|
const onPressChangeHandle = React.useCallback(() => {
|
||||||
track('Settings:ChangeHandleButtonClicked')
|
|
||||||
openModal({
|
openModal({
|
||||||
name: 'change-handle',
|
name: 'change-handle',
|
||||||
onChanged() {
|
onChanged() {
|
||||||
@@ -202,7 +197,7 @@ export function SettingsScreen({}: Props) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}, [track, queryClient, openModal, currentAccount])
|
}, [queryClient, openModal, currentAccount])
|
||||||
|
|
||||||
const onPressExportRepository = React.useCallback(() => {
|
const onPressExportRepository = React.useCallback(() => {
|
||||||
exportCarControl.open()
|
exportCarControl.open()
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import {msg, Plural, Trans} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {StackActions, useNavigation} from '@react-navigation/native'
|
import {StackActions, useNavigation} from '@react-navigation/native'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {FEEDBACK_FORM_URL, HELP_DESK_URL} from '#/lib/constants'
|
import {FEEDBACK_FORM_URL, HELP_DESK_URL} from '#/lib/constants'
|
||||||
import {useNavigationTabState} from '#/lib/hooks/useNavigationTabState'
|
import {useNavigationTabState} from '#/lib/hooks/useNavigationTabState'
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
@@ -146,7 +145,6 @@ let DrawerContent = ({}: {}): React.ReactNode => {
|
|||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const setDrawerOpen = useSetDrawerOpen()
|
const setDrawerOpen = useSetDrawerOpen()
|
||||||
const navigation = useNavigation<NavigationProp>()
|
const navigation = useNavigation<NavigationProp>()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {isAtHome, isAtSearch, isAtFeeds, isAtNotifications, isAtMyProfile} =
|
const {isAtHome, isAtSearch, isAtFeeds, isAtNotifications, isAtMyProfile} =
|
||||||
useNavigationTabState()
|
useNavigationTabState()
|
||||||
const {hasSession, currentAccount} = useSession()
|
const {hasSession, currentAccount} = useSession()
|
||||||
@@ -157,7 +155,6 @@ let DrawerContent = ({}: {}): React.ReactNode => {
|
|||||||
|
|
||||||
const onPressTab = React.useCallback(
|
const onPressTab = React.useCallback(
|
||||||
(tab: string) => {
|
(tab: string) => {
|
||||||
track('Menu:ItemClicked', {url: tab})
|
|
||||||
const state = navigation.getState()
|
const state = navigation.getState()
|
||||||
setDrawerOpen(false)
|
setDrawerOpen(false)
|
||||||
if (isWeb) {
|
if (isWeb) {
|
||||||
@@ -180,7 +177,7 @@ let DrawerContent = ({}: {}): React.ReactNode => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[track, navigation, setDrawerOpen, currentAccount],
|
[navigation, setDrawerOpen, currentAccount],
|
||||||
)
|
)
|
||||||
|
|
||||||
const onPressHome = React.useCallback(() => onPressTab('Home'), [onPressTab])
|
const onPressHome = React.useCallback(() => onPressTab('Home'), [onPressTab])
|
||||||
@@ -200,37 +197,32 @@ let DrawerContent = ({}: {}): React.ReactNode => {
|
|||||||
}, [onPressTab])
|
}, [onPressTab])
|
||||||
|
|
||||||
const onPressMyFeeds = React.useCallback(() => {
|
const onPressMyFeeds = React.useCallback(() => {
|
||||||
track('Menu:ItemClicked', {url: 'Feeds'})
|
|
||||||
navigation.navigate('Feeds')
|
navigation.navigate('Feeds')
|
||||||
setDrawerOpen(false)
|
setDrawerOpen(false)
|
||||||
}, [navigation, setDrawerOpen, track])
|
}, [navigation, setDrawerOpen])
|
||||||
|
|
||||||
const onPressLists = React.useCallback(() => {
|
const onPressLists = React.useCallback(() => {
|
||||||
track('Menu:ItemClicked', {url: 'Lists'})
|
|
||||||
navigation.navigate('Lists')
|
navigation.navigate('Lists')
|
||||||
setDrawerOpen(false)
|
setDrawerOpen(false)
|
||||||
}, [navigation, track, setDrawerOpen])
|
}, [navigation, setDrawerOpen])
|
||||||
|
|
||||||
const onPressSettings = React.useCallback(() => {
|
const onPressSettings = React.useCallback(() => {
|
||||||
track('Menu:ItemClicked', {url: 'Settings'})
|
|
||||||
navigation.navigate('Settings')
|
navigation.navigate('Settings')
|
||||||
setDrawerOpen(false)
|
setDrawerOpen(false)
|
||||||
}, [navigation, track, setDrawerOpen])
|
}, [navigation, setDrawerOpen])
|
||||||
|
|
||||||
const onPressFeedback = React.useCallback(() => {
|
const onPressFeedback = React.useCallback(() => {
|
||||||
track('Menu:FeedbackClicked')
|
|
||||||
Linking.openURL(
|
Linking.openURL(
|
||||||
FEEDBACK_FORM_URL({
|
FEEDBACK_FORM_URL({
|
||||||
email: currentAccount?.email,
|
email: currentAccount?.email,
|
||||||
handle: currentAccount?.handle,
|
handle: currentAccount?.handle,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
}, [track, currentAccount])
|
}, [currentAccount])
|
||||||
|
|
||||||
const onPressHelp = React.useCallback(() => {
|
const onPressHelp = React.useCallback(() => {
|
||||||
track('Menu:HelpClicked')
|
|
||||||
Linking.openURL(HELP_DESK_URL)
|
Linking.openURL(HELP_DESK_URL)
|
||||||
}, [track])
|
}, [])
|
||||||
|
|
||||||
// rendering
|
// rendering
|
||||||
// =
|
// =
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {useLingui} from '@lingui/react'
|
|||||||
import {BottomTabBarProps} from '@react-navigation/bottom-tabs'
|
import {BottomTabBarProps} from '@react-navigation/bottom-tabs'
|
||||||
import {StackActions} from '@react-navigation/native'
|
import {StackActions} from '@react-navigation/native'
|
||||||
|
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
|
||||||
import {PressableScale} from '#/lib/custom-animations/PressableScale'
|
import {PressableScale} from '#/lib/custom-animations/PressableScale'
|
||||||
import {useHaptics} from '#/lib/haptics'
|
import {useHaptics} from '#/lib/haptics'
|
||||||
import {useDedupe} from '#/lib/hooks/useDedupe'
|
import {useDedupe} from '#/lib/hooks/useDedupe'
|
||||||
@@ -62,7 +61,6 @@ export function BottomBar({navigation}: BottomTabBarProps) {
|
|||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const safeAreaInsets = useSafeAreaInsets()
|
const safeAreaInsets = useSafeAreaInsets()
|
||||||
const {track} = useAnalytics()
|
|
||||||
const {footerHeight} = useShellLayout()
|
const {footerHeight} = useShellLayout()
|
||||||
const {isAtHome, isAtSearch, isAtNotifications, isAtMyProfile, isAtMessages} =
|
const {isAtHome, isAtSearch, isAtNotifications, isAtMyProfile, isAtMessages} =
|
||||||
useNavigationTabState()
|
useNavigationTabState()
|
||||||
@@ -90,7 +88,6 @@ export function BottomBar({navigation}: BottomTabBarProps) {
|
|||||||
|
|
||||||
const onPressTab = React.useCallback(
|
const onPressTab = React.useCallback(
|
||||||
(tab: TabOptions) => {
|
(tab: TabOptions) => {
|
||||||
track(`MobileShell:${tab}ButtonPressed`)
|
|
||||||
const state = navigation.getState()
|
const state = navigation.getState()
|
||||||
const tabState = getTabState(state, tab)
|
const tabState = getTabState(state, tab)
|
||||||
if (tabState === TabState.InsideAtRoot) {
|
if (tabState === TabState.InsideAtRoot) {
|
||||||
@@ -101,7 +98,7 @@ export function BottomBar({navigation}: BottomTabBarProps) {
|
|||||||
dedupe(() => navigation.navigate(`${tab}Tab`))
|
dedupe(() => navigation.navigate(`${tab}Tab`))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[track, navigation, dedupe],
|
[navigation, dedupe],
|
||||||
)
|
)
|
||||||
const onPressHome = React.useCallback(() => onPressTab('Home'), [onPressTab])
|
const onPressHome = React.useCallback(() => onPressTab('Home'), [onPressTab])
|
||||||
const onPressSearch = React.useCallback(
|
const onPressSearch = React.useCallback(
|
||||||
@@ -354,17 +351,16 @@ function Btn({
|
|||||||
return (
|
return (
|
||||||
<PressableScale
|
<PressableScale
|
||||||
testID={testID}
|
testID={testID}
|
||||||
style={styles.ctrl}
|
style={[styles.ctrl, a.flex_1]}
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
onLongPress={onLongPress}
|
onLongPress={onLongPress}
|
||||||
accessible={accessible}
|
accessible={accessible}
|
||||||
accessibilityLabel={accessibilityLabel}
|
accessibilityLabel={accessibilityLabel}
|
||||||
accessibilityHint={accessibilityHint}
|
accessibilityHint={accessibilityHint}
|
||||||
targetScale={0.8}
|
targetScale={0.8}>
|
||||||
contentContainerStyle={[a.flex_1]}>
|
|
||||||
{icon}
|
{icon}
|
||||||
{notificationCount ? (
|
{notificationCount ? (
|
||||||
<View style={[styles.notificationCount, {top: -5}]}>
|
<View style={[styles.notificationCount]}>
|
||||||
<Text style={styles.notificationCountLabel}>{notificationCount}</Text>
|
<Text style={styles.notificationCountLabel}>{notificationCount}</Text>
|
||||||
</View>
|
</View>
|
||||||
) : undefined}
|
) : undefined}
|
||||||
|
|||||||
Reference in New Issue
Block a user