Skip to content

Commit

Permalink
fix: Do not close cozy-app when opening ClouderyOffer view
Browse files Browse the repository at this point in the history
When calling `showClouderyOffer()` from a cozy-app, then this cozy-app
would be closed to display the ClouderyOffer view

This is not ideal as the `back` button would return to the Home view
instead of the previously displayed CozyApp

This was originally done because we followed the same model as the
OauthClientsLimitExceeded view. We wanted this for this view because it
was here to prevent the user to open cozy-apps. Also this view was
placed on the HomeScreen component so the user would still be able to
open the CozyApp screen displaying `cozy-settings` (so they can manage
their oauth clients)

We wrongly thought that the ClouderyOffer had the same needs, but it is
not the case. This view should be able to be displayed on top of
HomeView but also on top of CozyApp screen, and it should not close the
current CozyApp screen
  • Loading branch information
Ldoppea committed Jan 26, 2024
1 parent 0efc4e2 commit 134f5ee
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import {
} from '/screens/home/hooks/useLauncherContext'
import LauncherView from '/screens/konnectors/LauncherView'
import { useShareFiles } from '/app/domain/osReceive/services/shareFilesService'
import { ClouderyOffer } from '/app/view/IAP/ClouderyOffer'

// Polyfill needed for cozy-client connection
if (!global.btoa) {
Expand Down Expand Up @@ -164,6 +165,7 @@ const Nav = ({ client, setClient }) => (
</OsReceiveProvider>
</LoadingOverlayProvider>
</ErrorProvider>
{client && <ClouderyOffer />}
<LockScreenWrapper />
</SafeAreaProvider>
</NavigationContainer>
Expand Down
2 changes: 0 additions & 2 deletions src/app/domain/iap/services/clouderyOffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import type { InstanceInfo } from 'cozy-client/types/types'
import Minilog from 'cozy-minilog'

import { BuyingState } from '/app/view/IAP/hooks/useClouderyOffer'
import { navigate } from '/libs/RootNavigation'
import { getErrorMessage } from '/libs/functions/getErrorMessage'

const log = Minilog('💳 Cloudery Offer')
Expand All @@ -29,7 +28,6 @@ const START_IAP_URL = 'https://iapflagship'
export const clouderyOfferEventHandler = new EventEmitter()

export const showClouderyOffer = (href: string): void => {
navigate('home')
clouderyOfferEventHandler.emit(CLOUDERY_OFFER, href)
}

Expand Down
2 changes: 0 additions & 2 deletions src/screens/home/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import React from 'react'
import { View } from 'react-native'

import { OauthClientsLimitExceeded } from '/app/view/Limits/OauthClientsLimitExceeded'
import { ClouderyOffer } from '/app/view/IAP/ClouderyOffer'
import HomeView from '/screens/home/components/HomeView'
import { getColors } from '/ui/colors'
import { shouldShowCliskDevMode } from '/core/tools/env'
Expand Down Expand Up @@ -48,7 +47,6 @@ export const HomeScreen = ({
)}

<OauthClientsLimitExceeded navigation={navigation} />
<ClouderyOffer />
</View>
)
}

0 comments on commit 134f5ee

Please sign in to comment.