Skip to content

Commit

Permalink
first ugly draft
Browse files Browse the repository at this point in the history
  • Loading branch information
technoplato committed Jan 13, 2025
1 parent db9553b commit cc44c63
Show file tree
Hide file tree
Showing 3 changed files with 454 additions and 11 deletions.
19 changes: 19 additions & 0 deletions screens/NewConversation/NewConversation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { shortAddress } from "@/utils/strings/shortAddress";
import {
createConversation,
createConversationByAccount,
createGroupWithDefaultsByAccount,
getConversationByPeerByAccount,
getOptionalConversationByPeerByAccount,
} from "@/utils/xmtpRN/conversations";
Expand Down Expand Up @@ -542,6 +543,24 @@ export default function NewConversation({}) {
// message: something.content.text,
// });
} else {
const group = await createGroupWithDefaultsByAccount({
account: currentAccount(),
peerEthereumAddresses: pendingChatMembers.members.map(
(m) => m.address
),
});
await sendMessage({
conversation: group,
params: {
content: { text: dmCreationMessageText },
},
});
setConversationQueryData({
account: currentAccount(),
topic: group.topic,
conversation: group,
});
navigation.replace("Conversation", { topic: group.topic });

Check failure on line 563 in screens/NewConversation/NewConversation.tsx

View workflow job for this annotation

GitHub Actions / tsc

Property 'replace' does not exist on type 'Omit<NavigationProp<RootParamList>, "getState"> & { getState(): Readonly<{ key: string; index: number; routeNames: string[]; history?: unknown[] | undefined; routes: NavigationRoute<...>[]; type: string; stale: false; }> | undefined; }'.
}
// todo:
// create pendingChatMembers/dm
Expand Down
16 changes: 5 additions & 11 deletions screens/NewConversation/NewGroupSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ import {
getPreferredName,
getProfile,
} from "../../utils/profile";
import { createGroupByAccount } from "../../utils/xmtpRN/conversations";
import {
createGroupByAccount,
defaultPermissionPolicySet,
} from "../../utils/xmtpRN/conversations";
import { NewConversationModalParams } from "./NewConversationModal";
import { captureErrorWithToast } from "@/utils/capture-error";
import { getProfileSocialsQueryData } from "@/queries/useProfileSocialsQuery";
Expand All @@ -52,16 +55,7 @@ export default function NewGroupSummary({
const insets = useSafeAreaInsets();
const [creatingGroup, setCreatingGroup] = useState(false);
const [permissionPolicySet, setPermissionPolicySet] =
useState<PermissionPolicySet>({
addMemberPolicy: "allow",
removeMemberPolicy: "admin",
addAdminPolicy: "superAdmin",
removeAdminPolicy: "superAdmin",
updateGroupNamePolicy: "allow",
updateGroupDescriptionPolicy: "allow",
updateGroupImagePolicy: "allow",
updateGroupPinnedFrameUrlPolicy: "allow",
});
useState<PermissionPolicySet>(defaultPermissionPolicySet);
const account = useCurrentAccount();
const { photo: groupPhoto, addPhoto: addGroupPhoto } = usePhotoSelect();
const [
Expand Down
Loading

0 comments on commit cc44c63

Please sign in to comment.