Skip to content

Commit

Permalink
feat: Remove unused forwardFile
Browse files Browse the repository at this point in the history
  • Loading branch information
zatteo committed Jan 23, 2025
1 parent 19590cb commit dbc6aa8
Showing 1 changed file with 0 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { getSharingLink } from 'cozy-client/dist/models/sharing'
import minilog from 'cozy-minilog'

const log = minilog('ShareRestrictionModal/helpers')
Expand Down Expand Up @@ -66,49 +65,6 @@ export const makeTTL = selectedDate => {
}
}

/**
* forwardFile - Triggers the download of one or multiple files by the browser
* @param {object} options
* @param {import('cozy-client/types/CozyClient').default} options.client
* @param {import('cozy-client/types/types').IOCozyFile} options.file File to download
* @param {Function} options.t i18n function
* @param {string} options.ttl Time to live of the sharing link
* @param {string} options.password Password of the sharing link
* @param {Function} options.showAlert - Function to display an alert
*/
export const forwardFile = async ({
client,
file,
t,
ttl,
password,
showAlert
}) => {
try {
// We currently support only one file at a time
const url = await getSharingLink(client, [file._id], { ttl, password })
const isZipFile = file.class === 'zip'
const shareData = {
title: t('shareFile.title', {
name: file.name,
smart_count: isZipFile ? 2 : 1
}),
text: t('shareFile.text', {
name: file.name,
smart_count: isZipFile ? 2 : 1
}),
url
}
navigator.share(shareData)
} catch (error) {
showAlert({
message: t('shareFile.error'),
severity: 'error',
variant: 'filled'
})
}
}

/**
* createPermissions - Create the permissions of a file
* @param {object} options
Expand Down

0 comments on commit dbc6aa8

Please sign in to comment.