Skip to content

Commit

Permalink
Merge branch 'main' into mm/fix/helmreleases
Browse files Browse the repository at this point in the history
  • Loading branch information
mortada-codes committed Jun 20, 2023
2 parents bf92786 + 7ff4849 commit 83703dd
Show file tree
Hide file tree
Showing 76 changed files with 1,767 additions and 1,438 deletions.
4 changes: 2 additions & 2 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const config = {
url: `https://${organizationName}.github.io`,
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: `/${projectName}/`,

// baseUrl: `/${projectName}/`,
baseUrl: `/`,
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName, // Usually your GitHub org/user name.
Expand Down
14 changes: 13 additions & 1 deletion electron/app/ipc/ipcListeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import type {FileExplorerOptions, FileOptions} from '@shared/models/fileExplorer
import {AnyPlugin} from '@shared/models/plugin';
import {DISABLED_TELEMETRY} from '@shared/models/telemetry';
import {AnyTemplate, InterpolateTemplateOptions, TemplatePack} from '@shared/models/template';
import electronStore from '@shared/utils/electronStore';
import {disableSegment, enableSegment, getSegmentClient} from '@shared/utils/segment';

import autoUpdater from '../autoUpdater';
Expand All @@ -55,7 +56,7 @@ import {
updateTemplate,
updateTemplatePack,
} from '../services/templateService';
import {askActionConfirmation} from '../utils';
import {askActionConfirmation, calculateMinutesPassed} from '../utils';
import {dispatchToAllWindows} from './ipcMainRedux';

const userDataDir = app.getPath('userData');
Expand Down Expand Up @@ -103,7 +104,18 @@ const killTerminal = (id: string) => {
ipcMain.on('track-event', async (event: any, {eventName, payload}: any) => {
const segmentClient = getSegmentClient();
if (segmentClient) {
const minutesPassedSinceFirstTimeRun = calculateMinutesPassed(electronStore.get('main.firstTimeRunTimestamp'));

const properties: any = {appVersion: app.getVersion(), ...payload};

if (minutesPassedSinceFirstTimeRun >= 0 && minutesPassedSinceFirstTimeRun <= 10) {
properties['ftu10m'] = 1;
} else if (minutesPassedSinceFirstTimeRun > 10 && minutesPassedSinceFirstTimeRun <= 30) {
properties['ftu30m'] = 1;
} else if (minutesPassedSinceFirstTimeRun > 30 && minutesPassedSinceFirstTimeRun <= 60) {
properties['ftu60m'] = 1;
}

segmentClient.track({
event: eventName,
userId: machineId,
Expand Down
13 changes: 13 additions & 0 deletions electron/app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export const initTelemetry = (deviceID: string, disableEventTracking: boolean, a
},
});
electronStore.set('main.deviceID', deviceID);
electronStore.set('main.firstTimeRunTimestamp', Date.now());
}
};

Expand Down Expand Up @@ -248,3 +249,15 @@ export const checkMissingDependencies = (dependencies: Array<string>): Array<str
}
});
};

// will calculate the minutes that passed from the first time the app was run

export function calculateMinutesPassed(firstTimeRunTimestamp: number): number {
if (!firstTimeRunTimestamp) {
return -1;
}

const currentTimeInMillis = Date.now();
const minutesPassed = Math.floor((currentTimeInMillis - firstTimeRunTimestamp) / (1000 * 60));
return minutesPassed;
}
Loading

0 comments on commit 83703dd

Please sign in to comment.