-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: dm with text input, even from frames * make nav helper more robust for dm deeplinks * Deep link to group, handle group not found * Allow converse deep link in frames * handle converse://?text= deeplink * add /group app link * use URL to parse frame action target * Add test
- Loading branch information
Showing
16 changed files
with
329 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import { getConverseStateFromPath } from "./navHelpers"; | ||
|
||
jest.mock("../../components/StateHandlers/InitialStateHandler", () => ({ | ||
initialURL: "", | ||
})); | ||
|
||
describe("getConverseStateFromPath", () => { | ||
const navConfig = { | ||
initialRouteName: "Chats", | ||
screens: { | ||
Chats: "/", | ||
Conversation: { | ||
path: "/conversation", | ||
}, | ||
NewConversation: { | ||
path: "/newConversation", | ||
}, | ||
Profile: { | ||
path: "/profile", | ||
}, | ||
Group: { | ||
path: "/group", | ||
}, | ||
GroupLink: { | ||
path: "/groupLink/:groupLinkId", | ||
}, | ||
GroupInvite: { | ||
path: "/group-invite/:groupInviteId", | ||
}, | ||
ShareProfile: { | ||
path: "/shareProfile", | ||
}, | ||
WebviewPreview: { | ||
path: "/webviewPreview", | ||
}, | ||
}, | ||
}; | ||
|
||
it("should parse simple dm deeplink", () => { | ||
const state = getConverseStateFromPath("testNav")( | ||
"dm?peer=0xno12.eth", | ||
navConfig | ||
); | ||
const route = state?.routes[state.routes.length - 1]; | ||
expect(route?.name).toBe("Conversation"); | ||
expect((route?.params as any).mainConversationWithPeer).toBe("0xno12.eth"); | ||
expect((route?.params as any).text).toBeUndefined(); | ||
}); | ||
|
||
it("should parse simple dm universal link", () => { | ||
const state = getConverseStateFromPath("testNav")( | ||
"dm/0xno12.eth", | ||
navConfig | ||
); | ||
const route = state?.routes[state.routes.length - 1]; | ||
expect(route?.name).toBe("Conversation"); | ||
expect((route?.params as any).mainConversationWithPeer).toBe("0xno12.eth"); | ||
expect((route?.params as any).text).toBeUndefined(); | ||
}); | ||
|
||
it("should parse simple group deeplink", () => { | ||
const state = getConverseStateFromPath("testNav")( | ||
"group?groupId=f7349f84925aaeee5816d02b7798efbc", | ||
navConfig | ||
); | ||
const route = state?.routes[state.routes.length - 1]; | ||
expect(route?.name).toBe("Conversation"); | ||
expect((route?.params as any).topic).toBe( | ||
"/xmtp/mls/1/g-f7349f84925aaeee5816d02b7798efbc/proto" | ||
); | ||
expect((route?.params as any).text).toBeUndefined(); | ||
}); | ||
|
||
it("should parse simple group universal link", () => { | ||
const state = getConverseStateFromPath("testNav")( | ||
"group/f7349f84925aaeee5816d02b7798efbc", | ||
navConfig | ||
); | ||
const route = state?.routes[state.routes.length - 1]; | ||
expect(route?.name).toBe("Conversation"); | ||
expect((route?.params as any).topic).toBe( | ||
"/xmtp/mls/1/g-f7349f84925aaeee5816d02b7798efbc/proto" | ||
); | ||
expect((route?.params as any).text).toBeUndefined(); | ||
}); | ||
|
||
it("should parse simple dm deeplink with text", () => { | ||
const state = getConverseStateFromPath("testNav")( | ||
"dm?peer=0xno12.eth&text=hello", | ||
navConfig | ||
); | ||
const route = state?.routes[state.routes.length - 1]; | ||
expect(route?.name).toBe("Conversation"); | ||
expect((route?.params as any).mainConversationWithPeer).toBe("0xno12.eth"); | ||
expect((route?.params as any).text).toBe("hello"); | ||
}); | ||
|
||
it("should parse simple dm universal link with text", () => { | ||
const state = getConverseStateFromPath("testNav")( | ||
"dm/0xno12.eth?text=hello", | ||
navConfig | ||
); | ||
const route = state?.routes[state.routes.length - 1]; | ||
expect(route?.name).toBe("Conversation"); | ||
expect((route?.params as any).mainConversationWithPeer).toBe("0xno12.eth"); | ||
expect((route?.params as any).text).toBe("hello"); | ||
}); | ||
|
||
it("should parse simple group deeplink with text", () => { | ||
const state = getConverseStateFromPath("testNav")( | ||
"group?groupId=f7349f84925aaeee5816d02b7798efbc&text=hello", | ||
navConfig | ||
); | ||
const route = state?.routes[state.routes.length - 1]; | ||
expect(route?.name).toBe("Conversation"); | ||
expect((route?.params as any).topic).toBe( | ||
"/xmtp/mls/1/g-f7349f84925aaeee5816d02b7798efbc/proto" | ||
); | ||
expect((route?.params as any).text).toBe("hello"); | ||
}); | ||
|
||
it("should parse simple group universal link with text", () => { | ||
const state = getConverseStateFromPath("testNav")( | ||
"group/f7349f84925aaeee5816d02b7798efbc?text=hello", | ||
navConfig | ||
); | ||
const route = state?.routes[state.routes.length - 1]; | ||
expect(route?.name).toBe("Conversation"); | ||
expect((route?.params as any).topic).toBe( | ||
"/xmtp/mls/1/g-f7349f84925aaeee5816d02b7798efbc/proto" | ||
); | ||
expect((route?.params as any).text).toBe("hello"); | ||
}); | ||
}); |
Oops, something went wrong.