Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native: integrate new contacts into UI #4127

Open
wants to merge 41 commits into
base: develop
Choose a base branch
from
Open

Conversation

latter-bolden
Copy link
Member

@latter-bolden latter-bolden commented Oct 30, 2024

Adds support for using the new contacts agent including:

  • ability to add and remove contacts from the user profile screen
  • ability to assign nickname and avatar overwrites for contacts
  • sceen for viewing your contacts
  • pre-populated suggestions powered by Pals and DMs
  • integration with activity for contact profile updates

You'll need to have contact activity enabled %landscape and %groups to work with it (should now be on wannec)

I still want to execute a rename on contacts table as discussed, but I don't think it needs to block.

Fixes TLON-3136
Fixes TLON-3192
Fixes TLON-2743
Fixes TLON-3218

@latter-bolden latter-bolden marked this pull request as ready for review November 1, 2024 15:41
Copy link

linear bot commented Nov 1, 2024

@latter-bolden latter-bolden marked this pull request as draft November 4, 2024 13:48
@latter-bolden latter-bolden marked this pull request as ready for review November 21, 2024 14:32
@latter-bolden latter-bolden requested review from dnbrwstr, jamesacklin and patosullivan and removed request for dnbrwstr, arthyn and mikolajpp November 21, 2024 14:32
Copy link
Contributor

@dnbrwstr dnbrwstr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm! Pretty much exclusively nits.

@@ -23,5 +23,5 @@ export function formatUserId(
}

export function getDisplayName(contact: db.Contact) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can contact be empty? Either the param should be optional/nullable, or we shouldn't need this check here.

@@ -186,6 +206,37 @@ export const activityEvents = sqliteTable(
}
);

export const activityEventContactGroups = sqliteTable(
'activyt_event_contact_group_pins',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo


peerNickname: text('peerNickname'),
customNickname: text('customNickname'),
nickname: text('nickname').generatedAlwaysAs(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooo interesting

@@ -72,53 +161,192 @@ export const removePinnedGroup = async (groupId: string) => {
});
};

export const setPinnedGroups = async (groupIds: string[]) => {
console.log(`api set pinned`, groupIds);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stray logs in this function

return Object.entries(contacts).flatMap(([ship, contact]) =>
contact === null ? [] : [toClientContact(ship, contact)]
);
export const v0PeersToClientProfiles = (
Copy link
Contributor

@dnbrwstr dnbrwstr Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment about what a v0Peer is would be nice

@@ -19,11 +19,20 @@ function SummaryMessageRaw({
const plural = summary.all.length > 1;
const authors = useActivitySummaryAuthors(summary);

console.log(`summary message debug`, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stray log

const [pinnedGroups, setPinnedGroups] = useState<db.Group[]>(
(userContact?.pinnedGroups
?.map((pin) => pin.group)
.filter(Boolean) as db.Group[]) ?? []
);

const currentNickname = useMemo(() => {
return props.userId === currentUserId
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lotsa reps of props.userId === currentUserId, would be nice to just have an isCurrentUser local var

imageUrl={overrideUrl ?? contact?.avatarImage ?? undefined}
imageUrl={
overrideUrl ??
contact?.customAvatarImage ??
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't the calculated column for contact.avatarImage already handle coalescing these values?

}

return (
<View paddingLeft="$xl" paddingVertical="$xl">
Copy link
Contributor

@dnbrwstr dnbrwstr Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use SectionListHeader, ensure contentContainerStyle matches ChatList

@@ -2705,6 +2707,67 @@ export const updateContact = createWriteQuery(
['contacts']
);

export const upsertContact = createWriteQuery(
'upsertContact',
async (contact: Contact, ctx: QueryCtx) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the insert/onConflict pattern we're using most other places not work here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants