Skip to content

Commit

Permalink
Allow ethereum deeplinks inside frames (#1198)
Browse files Browse the repository at this point in the history
* Allow ethereum deeplinks inside frames

* Set and new file

* Bump app json

* [create-pull-request] automated change (#1195)

Co-authored-by: alexrisch <[email protected]>

* [create-pull-request] automated change (#1197)

Co-authored-by: alexrisch <[email protected]>

---------

Co-authored-by: Noé Malzieu <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: alexrisch <[email protected]>
  • Loading branch information
4 people authored Nov 14, 2024
1 parent 4a68dd4 commit bac8634
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"expo": {
"version": "2.0.7",
"version": "2.0.8",
"ios": {
"buildNumber": "16"
"buildNumber": "31"
},
"android": {
"versionCode": 223
"versionCode": 229
}
}
}
5 changes: 2 additions & 3 deletions components/Chat/Frame/FramePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
validateFrame,
} from "../../../utils/frames";
import { MessageToDisplay } from "../Message/Message";
import { AUTHORIZED_URL_PROTOCOLS } from "./urlProtocols";

export default function FramePreview({
initialFrame,
Expand Down Expand Up @@ -155,9 +156,7 @@ export default function FramePreview({
try {
const url = new URL(link);
if (
(url.protocol === "http:" ||
url.protocol === "https:" ||
url.protocol === `${config.scheme}:`) &&
AUTHORIZED_URL_PROTOCOLS.has(url.protocol) &&
(await Linking.canOpenURL(link))
) {
Linking.openURL(link);
Expand Down
6 changes: 6 additions & 0 deletions components/Chat/Frame/urlProtocols.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import config from "../../../config";

export const AUTHORIZED_URL_PROTOCOLS = new Set([
`${config.scheme}:`,
...config.framesAllowedSchemes.map((s) => `${s}:`),
]);
1 change: 1 addition & 0 deletions config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const defaultConfig = {
rpcEndpoint: process.env.EXPO_PUBLIC_EVM_RPC_ENDPOINT,
},
splitScreenThreshold: 600,
framesAllowedSchemes: ["http", "https", "ethereum"],
};

const isAndroid = Platform.OS === "android";
Expand Down

0 comments on commit bac8634

Please sign in to comment.