Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎛️ ControlHelper Rewrite #1052

Merged
Merged
Changes from 3 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
4f84643
Fixed JSON Object Dump
the-bay-kay Oct 4, 2023
1130508
Replaced moment objects with DateTime
the-bay-kay Oct 4, 2023
2e9173b
Fixed issue with UnixInteger conversion
the-bay-kay Oct 5, 2023
8825d06
Updated Logger usage, cleaned up controlHelper
the-bay-kay Oct 5, 2023
46832c7
Rewrote controlHelper as a separate TS file
the-bay-kay Oct 9, 2023
4960803
Small code-quality updates to controlHelper.ts
the-bay-kay Oct 10, 2023
6fd2e73
Email now uses socialShare library
the-bay-kay Oct 12, 2023
3420577
Updated debug statements, format changes
the-bay-kay Oct 16, 2023
92cd6fb
Split getData into multiple functions
the-bay-kay Oct 16, 2023
1ec3a49
Merge branch 'react-testing-setup' of https://github.com/jiji14/e-mis…
the-bay-kay Oct 17, 2023
d31a7a1
Set Up tests for controlHelper
the-bay-kay Oct 17, 2023
b8404da
Set up types folder, added new tests
the-bay-kay Oct 18, 2023
c22a605
Updated type files, improved tests
the-bay-kay Oct 18, 2023
20f6d04
Minor adjustments to controlHelper tests
the-bay-kay Oct 19, 2023
f0da15e
Changed time conversion, fixed minor issues
the-bay-kay Oct 23, 2023
5e61cb9
Updated types to match UnifiedDataLoader, PR #1073
the-bay-kay Oct 27, 2023
905e52c
Moved rewrites into `www/js/services`
the-bay-kay Oct 27, 2023
d107e21
Merge branch 'service_rewrite_2023' of https://github.com/e-mission/e…
the-bay-kay Oct 30, 2023
4b7b9d2
Updated `controlHelper` imports
the-bay-kay Oct 30, 2023
4dd295c
Refactored `controlHelper.ts`, updated fileIO
the-bay-kay Oct 31, 2023
24a9d95
Updated jest testing, cordovaMocks
the-bay-kay Oct 31, 2023
c2ab799
Added rejection test
the-bay-kay Nov 1, 2023
fffcd00
Expanded mocks, added tests
the-bay-kay Nov 1, 2023
05deecf
Merge branch 'service_rewrite_2023' into controlHelper-rewrite
the-bay-kay Nov 2, 2023
6723ca3
Merge branch 'type_interfaces' into controlHelper-rewrite
the-bay-kay Nov 2, 2023
58a3411
Ran prettier on controlHelper
the-bay-kay Nov 2, 2023
428f191
Fixed merge conflict artifact
the-bay-kay Nov 2, 2023
4afd9ec
remove js/diary/diaryTypes.ts
JGreenlee Nov 4, 2023
8cb3691
expand diaryTypes
JGreenlee Nov 4, 2023
12e8029
Expanded diaryTypes
the-bay-kay Nov 7, 2023
bc9dfaf
Merge branch 'type_interfaces' into update_type_interfaces
the-bay-kay Nov 9, 2023
4d19a9d
Merge pull request #1 from JGreenlee/update_type_interfaces
the-bay-kay Nov 9, 2023
4a96b9d
Minor adjustments to diaryTypes
the-bay-kay Nov 9, 2023
9247efe
Merge branch 'type_interfaces' into controlHelper-rewrite
the-bay-kay Nov 10, 2023
05b287a
index.html fix
the-bay-kay Nov 10, 2023
bc90720
Merge branch 'service_rewrite_2023' into controlHelper-rewrite
the-bay-kay Nov 10, 2023
2177000
Merge branch 'service_rewrite_2023' into controlHelper-rewrite
the-bay-kay Nov 13, 2023
2c02e37
Ran prettier, removed broken tests
the-bay-kay Nov 17, 2023
dbe76d1
Switched to old fileIO, fixes issue with android
the-bay-kay Nov 17, 2023
a232e3f
Revert "Switched to old fileIO, fixes issue with android"
the-bay-kay Nov 27, 2023
369b3ad
Changed fileIO directory to fix android issue
the-bay-kay Nov 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions www/js/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import angular from 'angular';
import { getRawEntries } from './commHelper';
import { DateTime } from 'luxon';

angular.module('emission.services', ['emission.plugin.logger'])

Expand Down Expand Up @@ -111,13 +112,15 @@ angular.module('emission.services', ['emission.plugin.logger'])
}

this.getMyData = function(startTs) {
var fmt = "YYYY-MM-DD";
// We are only retrieving data for a single day to avoid
// running out of memory on the phone
var startMoment = moment(startTs);
var endMoment = moment(startTs).endOf("day");
var dumpFile = startMoment.format(fmt) + "."
+ endMoment.format(fmt)
var startTime = DateTime.fromJSDate(startTs);
var endTime = startTime.endOf("day");
var startTimeString = startTime.toFormat("yyyy'-'MM'-'dd");
var endTimeString = endTime.toFormat("yyyy'-'MM'-'dd");

var dumpFile = startTimeString + "."
+ endTimeString
+ ".timeline";
alert("Going to retrieve data to "+dumpFile);

Expand Down Expand Up @@ -180,7 +183,7 @@ angular.module('emission.services', ['emission.plugin.logger'])
attachments: [
attachFile
],
subject: i18next.t('email-service.email-data.subject-data-dump-from-to', {start: startMoment.format(fmt),end: endMoment.format(fmt)}),
subject: i18next.t('email-service.email-data.subject-data-dump-from-to', {start: startTimeString ,end: endTimeString}),
body: i18next.t('email-service.email-data.body-data-consists-of-list-of-entries')
}
$window.cordova.plugins.email.open(email).then(resolve());
Expand All @@ -196,7 +199,13 @@ angular.module('emission.services', ['emission.plugin.logger'])
});
};

getRawEntries(null, startMoment.unix(), endMoment.unix())
// Simulate old conversion to get correct UnixInteger for endMoment data
const getUnixNum = (dateData) => {
var tempDate = dateData.toFormat('dd MMM yyyy');
return DateTime.fromFormat(tempDate, "dd MMM yyyy").toUnixInteger();
};

getRawEntries(null, getUnixNum(startTime), startTime.toUnixInteger())
.then(writeDumpFile)
.then(emailData)
.then(function() {
Expand Down