mirror of
https://github.com/desktop/desktop
synced 2024-09-18 07:32:01 +00:00
Add measure to track app launches from the Downloads folder
This commit is contained in:
parent
3cef97f340
commit
229c43f213
|
@ -355,6 +355,12 @@ export interface IDailyMeasures {
|
|||
|
||||
/** Number of times the user has encountered an unhandled rejection */
|
||||
readonly unhandledRejectionCount: number
|
||||
|
||||
/**
|
||||
* Whether the app was launched from the Downloads folder or not. This is only
|
||||
* relevant on macOS, null will be sent otherwise.
|
||||
*/
|
||||
readonly launchedFromDownloadsFolder: boolean | null
|
||||
}
|
||||
|
||||
export class StatsDatabase extends Dexie {
|
||||
|
|
|
@ -139,6 +139,7 @@ const DefaultDailyMeasures: IDailyMeasures = {
|
|||
diffOptionsViewedCount: 0,
|
||||
repositoryViewChangeCount: 0,
|
||||
unhandledRejectionCount: 0,
|
||||
launchedFromDownloadsFolder: null,
|
||||
}
|
||||
|
||||
interface IOnboardingStats {
|
||||
|
@ -1375,6 +1376,14 @@ export class StatsStore implements IStatsStore {
|
|||
}))
|
||||
}
|
||||
|
||||
public recordLaunchedFromDownloadsFolder(
|
||||
launchedFromDownloadsFolder: boolean
|
||||
) {
|
||||
return this.updateDailyMeasures(m => ({
|
||||
launchedFromDownloadsFolder,
|
||||
}))
|
||||
}
|
||||
|
||||
/** Post some data to our stats endpoint. */
|
||||
private post(body: object): Promise<Response> {
|
||||
const options: RequestInit = {
|
||||
|
|
|
@ -295,6 +295,15 @@ export class App extends React.Component<IAppProps, IAppState> {
|
|||
|
||||
log.info(`launching: ${getVersion()} (${getOS()})`)
|
||||
log.info(`execPath: '${process.execPath}'`)
|
||||
|
||||
const launchedFromDownloadsFolder = this.isLaunchedFromDownloadsFolder(
|
||||
process.execPath
|
||||
)
|
||||
if (launchedFromDownloadsFolder !== null) {
|
||||
this.props.dispatcher.recordLaunchedFromDownloadsFolder(
|
||||
launchedFromDownloadsFolder
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private onMenuEvent(name: MenuEvent): any {
|
||||
|
@ -2658,6 +2667,21 @@ export class App extends React.Component<IAppProps, IAppState> {
|
|||
private isTutorialPaused() {
|
||||
return this.state.currentOnboardingTutorialStep === TutorialStep.Paused
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the app was launched from the Downloads folder or not. This is only
|
||||
* relevant on macOS, null will be returned otherwise.
|
||||
*
|
||||
* @param execPath Path of the process executable.
|
||||
*/
|
||||
private isLaunchedFromDownloadsFolder(execPath: string): boolean | null {
|
||||
if (!__DARWIN__) {
|
||||
return null
|
||||
}
|
||||
|
||||
const downloadsPath = remote.app.getPath('downloads')
|
||||
return execPath.startsWith(downloadsPath)
|
||||
}
|
||||
}
|
||||
|
||||
function NoRepositorySelected() {
|
||||
|
|
|
@ -2482,4 +2482,12 @@ export class Dispatcher {
|
|||
public recordDiffOptionsViewed() {
|
||||
return this.statsStore.recordDiffOptionsViewed()
|
||||
}
|
||||
|
||||
public recordLaunchedFromDownloadsFolder(
|
||||
launchedFromDownloadsFolder: boolean
|
||||
) {
|
||||
this.statsStore.recordLaunchedFromDownloadsFolder(
|
||||
launchedFromDownloadsFolder
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue