Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function* getFromStorage(key: string): Generator<*, mixed, *> {
const host: URL | null = yield select(getUiState('host'));
const userData = yield select(getUserData);
// $FlowFixMe: array methods buggy with Enums
if (prefixedKeys.includes(key) && !host && !userData) {
throw new Error('Need to fill host before getting prefixed keys from storage');
}
const data = yield call(
storageGetPromise,
// $FlowFixMe: array methods buggy with Enums
prefixedKeys.includes(key) ? `${host}_${userData.accountId}_${key}` : key,
);
return data;
}
export function* setToStorage(key: string, data: *): Generator<*, Promise, *> {
const host: URL | null = yield select(getUiState('host'));
const userData = yield select(getUserData);
// $FlowFixMe: array methods buggy with Enums
if (prefixedKeys.includes(key) && !host && !userData) {
throw new Error('Can\'t set prefixed variable to storage if no host provided');
}
return storageSetPromise(
// $FlowFixMe: array methods buggy with Enums
prefixedKeys.includes(key) ? `${host}_${userData.accountId}_${key}` : key,
data,
);
}
function* handleTick({
timerChannel,
screenshotsEnabled,
}) {
let idleWindowTask = null;
let prevScreenshotId = null;
const screenshotsPeriod = yield eff.select(getUiState('screenshotsPeriod'));
while (true) {
yield eff.take(timerChannel);
const bufferSeconds = yield eff.flush(timerChannel);
yield eff.put(timerActions.tick(
1 + bufferSeconds.length,
));
const time = yield eff.select(getTimerState('time'));
if (bufferSeconds.length) {
console.log('!!!!!!!!!!!!!!!!!');
Sentry.captureMessage(`bufferSeconds is ${bufferSeconds.length}`);
}
yield eff.call(setTimeToTray);
const [
showIdleWindow,
export function* savePersistStorage() {
const persistUiState = yield eff.select(
getUiState(Object.keys(persistInitialUiState)),
);
const hostname = yield eff.select(
getUiState('hostname'),
);
yield eff.call(
setElectronStorage,
`persistUiState_${hostname}`,
persistUiState,
);
const accounts = yield eff.select(
getUiState('accounts'),
);
yield eff.call(
setElectronStorage,
'accounts',
accounts,
);
}
{
type: 'warning',
buttons: ['YES', 'NO'],
defaultId: 0,
message: 'Are you sure',
detail: clearAppDataMessage,
},
);
if (response === 0) {
yield eff.call(
setElectronStorage,
'accounts',
[],
);
const hostname = yield eff.select(
getUiState('hostname'),
);
yield eff.call(
setElectronStorage,
`persistUiState_${hostname}`,
{},
);
yield eff.put(uiActions.setUiState({
readyToQuit: true,
}));
if (process.env.NODE_ENV === 'development') {
yield eff.call(
remote.session.defaultSession.clearCache,
() => {},
);
yield eff.call(remote.session.defaultSession.clearStorageData);
remote.getCurrentWindow().webContents.reload();
...(
adjustEstimate === 'manual'
? {
reduceBy,
} : {}
),
},
body: {
started,
timeSpentSeconds,
comment,
},
},
);
if (isAuto) {
const hostname = yield eff.select(getUiState('hostname'));
const isCloud = hostname.endsWith('.atlassian.net');
let screenshots = yield eff.select(getUiState('screenshots'));
yield eff.all(
screenshots
.filter(s => s.status === 'offline')
.map(s => (
eff.call(
uploadScreenshots,
{
isCloud,
filenameImage: s.filename,
filenameThumb: s.filenameThumb,
imagePath: s.imagePath,
imageThumbPath: s.imageThumbPath,
},
)
function mapStateToProps(state) {
return {
sidebarType: getUiState('sidebarType')(state),
};
}
function mapStateToProps(state) {
return {
time: getTimerState('time')(state),
report: getTrackingIssueReport(state),
screenshotUploading: false,
screenshotsAllowed: false,
trackingIssue: getTrackingIssue(state),
worklogComment: getUiState('worklogComment')(state),
remainingEstimateValue: getUiState('remainingEstimateValue')(state),
remainingEstimateNewValue: getUiState('remainingEstimateNewValue')(state),
remainingEstimateReduceByValue: getUiState('remainingEstimateReduceByValue')(state),
isCommentDialogOpen: getUiState('isCommentDialogOpen')(state),
showLoggedOnStop: getUiState('showLoggedOnStop')(state),
};
}
function mapStateToProps(state) {
const selectedIssueId = getUiState('selectedIssueId')(state);
return {
comments: getResourceMappedList(
'issuesComments',
`issue_${selectedIssueId}`,
)(state),
commentsFetching: getResourceStatus(
state,
`issuesComments.requests.issue_${selectedIssueId}.status`,
).pending,
selectedIssueId,
adding: getUiState('commentAdding')(state),
self: getUserData(state),
};
}
function mapStateToProps(state) {
return {
worklogs: getSelectedIssueWorklogs(state),
issue: getSelectedIssue(state),
selectedWorklogId: getUiState('selectedWorklogId')(state),
selectedIssue: getSelectedIssue(state),
scrollToIndex: getUiState('issueViewWorklogsScrollToIndex')(state),
};
}