Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32129689
D15420.1765025064.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
10 KB
Referenced Files
None
Subscribers
None
D15420.1765025064.diff
View Options
diff --git a/lib/shared/threads/protocols/dm-thread-protocol.js b/lib/shared/threads/protocols/dm-thread-protocol.js
--- a/lib/shared/threads/protocols/dm-thread-protocol.js
+++ b/lib/shared/threads/protocols/dm-thread-protocol.js
@@ -910,6 +910,10 @@
description:
'Comm DMs are end-to-end encrypted and stored locally on your ' +
'device for maximum privacy.',
+ topLevelThread: {
+ type: 'label',
+ label: 'Local DM',
+ },
},
supportsEncryptedMultimedia: true,
diff --git a/lib/shared/threads/protocols/farcaster-thread-protocol.js b/lib/shared/threads/protocols/farcaster-thread-protocol.js
--- a/lib/shared/threads/protocols/farcaster-thread-protocol.js
+++ b/lib/shared/threads/protocols/farcaster-thread-protocol.js
@@ -956,6 +956,10 @@
'Farcaster Direct Casts are the native messaging protocol in ' +
'Farcaster. They are not end-to-end encrypted, and the Farcaster ' +
'team can see the contents of your messages.',
+ topLevelThread: {
+ type: 'label',
+ label: 'Farcaster',
+ },
},
supportsEncryptedMultimedia: false,
diff --git a/lib/shared/threads/protocols/keyserver-thread-protocol.js b/lib/shared/threads/protocols/keyserver-thread-protocol.js
--- a/lib/shared/threads/protocols/keyserver-thread-protocol.js
+++ b/lib/shared/threads/protocols/keyserver-thread-protocol.js
@@ -713,6 +713,9 @@
"Genesis chats are a legacy chat type hosted on Ashoat's keyserver. " +
'They are not end-to-end encrypted, and Ashoat can see the contents ' +
'of your messages.',
+ topLevelThread: {
+ type: 'keyserverAdmin',
+ },
},
supportsEncryptedMultimedia: true,
diff --git a/lib/shared/threads/thread-spec.js b/lib/shared/threads/thread-spec.js
--- a/lib/shared/threads/thread-spec.js
+++ b/lib/shared/threads/thread-spec.js
@@ -503,6 +503,9 @@
+threadAncestorLabel: (ancestorPath: React.Node) => React.Node,
+protocolIcon: 'lock' | 'server' | 'farcaster',
+description: string,
+ +topLevelThread:
+ | { +type: 'keyserverAdmin' }
+ | { +type: 'label', +label: 'Farcaster' | 'Local DM' },
},
+supportsEncryptedMultimedia: boolean,
+supportsSendingVideos: boolean,
diff --git a/native/chat/parent-thread-header.react.js b/native/chat/parent-thread-header.react.js
--- a/native/chat/parent-thread-header.react.js
+++ b/native/chat/parent-thread-header.react.js
@@ -9,8 +9,8 @@
import { useNavigateToThread } from './message-list-types.js';
import Button from '../components/button.react.js';
-import CommunityPill from '../components/community-pill.react.js';
import ThreadVisibility from '../components/thread-visibility.react.js';
+import TopLevelThreadPill from '../components/top-level-thread-pill.react.js';
import { useColors, useStyles } from '../themes/colors.js';
type Props = {
@@ -38,7 +38,7 @@
<>
<Text style={styles.within}>within</Text>
<Button onPress={onPressParentThread}>
- <CommunityPill community={parentThreadInfo} />
+ <TopLevelThreadPill threadInfo={parentThreadInfo} />
</Button>
</>
);
diff --git a/native/components/community-pill.react.js b/native/components/community-pill.react.js
deleted file mode 100644
--- a/native/components/community-pill.react.js
+++ /dev/null
@@ -1,68 +0,0 @@
-// @flow
-
-import * as React from 'react';
-import { StyleSheet, View } from 'react-native';
-
-import { useKeyserverAdmin } from 'lib/shared/user-utils.js';
-import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js';
-
-import CommIcon from './comm-icon.react.js';
-import Pill from './pill.react.js';
-import ThreadPill from './thread-pill.react.js';
-import { useColors } from '../themes/colors.js';
-
-const threadPillRoundCorners = { left: false, right: true };
-
-type Props = {
- +community: ThreadInfo,
-};
-function CommunityPill(props: Props): React.Node {
- const { community } = props;
-
- const keyserverAdmin = useKeyserverAdmin(community);
- const keyserverOperatorUsername = keyserverAdmin?.username;
-
- const colors = useColors();
- const keyserverOperatorLabel: ?React.Node = React.useMemo(() => {
- if (!keyserverOperatorUsername) {
- return undefined;
- }
- const icon = (
- <CommIcon
- name="cloud-filled"
- size={12}
- color={colors.panelForegroundLabel}
- />
- );
- return (
- <Pill
- backgroundColor={colors.codeBackground}
- roundCorners={{ left: true, right: false }}
- label={keyserverOperatorUsername}
- icon={icon}
- />
- );
- }, [
- colors.codeBackground,
- colors.panelForegroundLabel,
- keyserverOperatorUsername,
- ]);
-
- return (
- <View style={styles.container}>
- {keyserverOperatorLabel}
- <ThreadPill
- threadInfo={community}
- roundCorners={threadPillRoundCorners}
- />
- </View>
- );
-}
-
-const styles = StyleSheet.create({
- container: {
- flexDirection: 'row',
- },
-});
-
-export default CommunityPill;
diff --git a/native/components/thread-ancestors.react.js b/native/components/thread-ancestors.react.js
--- a/native/components/thread-ancestors.react.js
+++ b/native/components/thread-ancestors.react.js
@@ -9,8 +9,8 @@
import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js';
import Button from './button.react.js';
-import CommunityPill from './community-pill.react.js';
import ThreadPill from './thread-pill.react.js';
+import TopLevelThreadPill from './top-level-thread-pill.react.js';
import { useNavigateToThread } from '../chat/message-list-types.js';
import { useSelector } from '../redux/redux-utils.js';
import { useColors, useStyles } from '../themes/colors.js';
@@ -47,7 +47,7 @@
const isLastThread = idx === ancestorThreads.length - 1;
const pill =
idx === 0 ? (
- <CommunityPill community={ancestorThreadInfo} />
+ <TopLevelThreadPill threadInfo={ancestorThreadInfo} />
) : (
<ThreadPill threadInfo={ancestorThreadInfo} />
);
diff --git a/native/components/thread-icon.react.js b/native/components/thread-icon.react.js
--- a/native/components/thread-icon.react.js
+++ b/native/components/thread-icon.react.js
@@ -2,12 +2,13 @@
import EntypoIcon from '@expo/vector-icons/Entypo.js';
import * as React from 'react';
-import { StyleSheet } from 'react-native';
+import { StyleSheet, View } from 'react-native';
import { threadTypeIsSidebar } from 'lib/shared/threads/thread-specs.js';
import { threadTypes, type ThreadType } from 'lib/types/thread-types-enum.js';
import SWMansionIcon from './swmansion-icon.react.js';
+import FarcasterLogo from '../vectors/farcaster-logo.react.js';
type Props = {
+threadType: ThreadType,
@@ -31,12 +32,30 @@
);
} else if (threadType === threadTypes.GENESIS_PERSONAL) {
return <SWMansionIcon name="users" size={18} color={color} />;
+ } else if (
+ threadType === threadTypes.FARCASTER_GROUP ||
+ threadType === threadTypes.FARCASTER_PERSONAL
+ ) {
+ return (
+ <View style={styles.farcasterIcon}>
+ <FarcasterLogo size={14} />
+ </View>
+ );
} else {
return <SWMansionIcon name="lock-on" size={18} color={color} />;
}
}
const styles = StyleSheet.create({
+ farcasterIcon: {
+ alignItems: 'center',
+ backgroundColor: '#855DCD',
+ borderRadius: 9,
+ height: 18,
+ justifyContent: 'center',
+ opacity: 0.7,
+ width: 18,
+ },
sidebarIcon: {
paddingTop: 2,
},
diff --git a/native/components/top-level-thread-pill.react.js b/native/components/top-level-thread-pill.react.js
new file mode 100644
--- /dev/null
+++ b/native/components/top-level-thread-pill.react.js
@@ -0,0 +1,107 @@
+// @flow
+
+import * as React from 'react';
+import { StyleSheet, View } from 'react-native';
+
+import { threadSpecs } from 'lib/shared/threads/thread-specs.js';
+import { useKeyserverAdmin } from 'lib/shared/user-utils.js';
+import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js';
+
+import CommIcon from './comm-icon.react.js';
+import Pill from './pill.react.js';
+import SWMansionIcon from './swmansion-icon.react.js';
+import ThreadPill from './thread-pill.react.js';
+import { useColors } from '../themes/colors.js';
+import FarcasterLogo from '../vectors/farcaster-logo.react.js';
+
+const threadPillRoundCorners = { left: false, right: true };
+
+type Props = {
+ +threadInfo: ThreadInfo,
+};
+function TopLevelThreadPill(props: Props): React.Node {
+ const { threadInfo } = props;
+
+ const keyserverAdmin = useKeyserverAdmin(threadInfo);
+ const keyserverOperatorUsername = keyserverAdmin?.username;
+
+ const colors = useColors();
+ const keyserverOperatorLabel: ?React.Node = React.useMemo(() => {
+ const topLevelThreadConfig =
+ threadSpecs[threadInfo.type].protocol().presentationDetails
+ .topLevelThread;
+
+ let label;
+ let icon;
+ if (topLevelThreadConfig.type === 'keyserverAdmin') {
+ if (!keyserverOperatorUsername) {
+ return undefined;
+ }
+ icon = (
+ <CommIcon
+ name="cloud-filled"
+ size={12}
+ color={colors.panelForegroundLabel}
+ />
+ );
+ label = keyserverOperatorUsername;
+ } else if (topLevelThreadConfig.label === 'Local DM') {
+ label = 'Local DM';
+ icon = (
+ <SWMansionIcon
+ name="lock-on"
+ size={18}
+ color={colors.panelForegroundLabel}
+ />
+ );
+ } else {
+ label = 'Farcaster';
+ icon = (
+ <View style={styles.farcasterIcon}>
+ <FarcasterLogo size={14} />
+ </View>
+ );
+ }
+
+ return (
+ <Pill
+ backgroundColor={colors.codeBackground}
+ roundCorners={{ left: true, right: false }}
+ label={label}
+ icon={icon}
+ />
+ );
+ }, [
+ colors.codeBackground,
+ colors.panelForegroundLabel,
+ keyserverOperatorUsername,
+ threadInfo.type,
+ ]);
+
+ return (
+ <View style={styles.container}>
+ {keyserverOperatorLabel}
+ <ThreadPill
+ threadInfo={threadInfo}
+ roundCorners={threadPillRoundCorners}
+ />
+ </View>
+ );
+}
+
+const styles = StyleSheet.create({
+ container: {
+ flexDirection: 'row',
+ },
+ farcasterIcon: {
+ alignItems: 'center',
+ backgroundColor: '#855DCD',
+ borderRadius: 9,
+ height: 18,
+ justifyContent: 'center',
+ opacity: 0.7,
+ width: 18,
+ },
+});
+
+export default TopLevelThreadPill;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 6, 12:44 PM (20 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5837511
Default Alt Text
D15420.1765025064.diff (10 KB)
Attached To
Mode
D15420: [native] Correctly display Farcaster threads' settings
Attached
Detach File
Event Timeline
Log In to Comment