Skip to content

Commit

Permalink
fix: Disable DataProxy's iframe when running inside of Flagship app
Browse files Browse the repository at this point in the history
When running inside of Flagship app, we don't want to load the
DataProxy's iframe

Instead we want to use the Flagship app's API

For now this API does not exist, so we just disable the DataProxy
feature

We could have enabled the iframe until the native API is implemented,
but for now this would introduce an infinite nested iframes bug as the
Flagship app's WebViews intercept all requests to `/` or `/index.html`
and inject the cozy-home code
  • Loading branch information
Ldoppea committed Nov 20, 2024
1 parent c4c4674 commit 61a2dea
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/dataproxy/DataProxyProvider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as Comlink from 'comlink'
import React, { useContext, useState, useEffect } from 'react'

import { useClient } from 'cozy-client'
import { isFlagshipApp } from 'cozy-device-helper'
import flag from 'cozy-flags'
import Minilog from 'cozy-minilog'

Expand Down Expand Up @@ -66,7 +67,11 @@ export const DataProxyProvider = React.memo(({ children }) => {
}
}

initIframe()
if (isFlagshipApp()) {
setDataProxyServicesAvailable(false)
} else {
initIframe()
}
}, [client])

const onIframeLoaded = () => {
Expand Down

0 comments on commit 61a2dea

Please sign in to comment.