-
Notifications
You must be signed in to change notification settings - Fork 38
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
Issue SB-11205 fix: adding ets fixes error correction from server ts #10
Open
loganathan1989
wants to merge
3
commits into
project-sunbird:master
Choose a base branch
from
loganathan1989:SB-11205
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2187,6 +2187,16 @@ var Telemetry = (function() { | |
} | ||
} | ||
|
||
var calculateTsDifference = function (tsObj) { | ||
var tsDiff = 0; | ||
if (tsObj && tsObj.serverEts) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix indentation issue |
||
var serverTime = new Date(tsObj.serverEts.slice(0, -1)); | ||
var localTime = tsObj.localTime; | ||
tsDiff = Math.round((serverTime.getTime() - localTime.getTime())); | ||
} | ||
return tsDiff; | ||
} | ||
|
||
/** | ||
* Which is used to initialize the telemetry in globally. | ||
* @param {object} config [Telemetry configurations] | ||
|
@@ -2207,6 +2217,7 @@ var Telemetry = (function() { | |
} | ||
config.batchsize = config.batchsize ? (config.batchsize < 10 ? 10 : (config.batchsize > 1000 ? 1000 : config.batchsize)) : _defaultValue.batchsize; | ||
Telemetry.config = Object.assign(_defaultValue, config); | ||
Telemetry.config.tsDiff = calculateTsDifference(Telemetry.config.tsData); | ||
Telemetry.initialized = true; | ||
telemetryInstance.dispatcher = Telemetry.config.dispatcher ? Telemetry.config.dispatcher : libraryDispatcher; | ||
instance.updateConfigurations(config); | ||
|
@@ -2255,7 +2266,7 @@ var Telemetry = (function() { | |
*/ | ||
instance.getEvent = function(eventId, data) { | ||
telemetryInstance.telemetryEnvelop.eid = eventId; | ||
telemetryInstance.telemetryEnvelop.ets = (new Date()).getTime(); | ||
telemetryInstance.telemetryEnvelop.ets = new Number(new Date().getTime()) + Telemetry.config.tsDiff; | ||
telemetryInstance.telemetryEnvelop.ver = Telemetry._version; | ||
telemetryInstance.telemetryEnvelop.mid = ''; | ||
telemetryInstance.telemetryEnvelop.actor = Object.assign({}, { "id": Telemetry.config.uid || 'anonymous', "type": 'User' }, instance.getUpdatedValue('actor')); | ||
|
@@ -2373,6 +2384,9 @@ var Telemetry = (function() { | |
}, | ||
audio: { | ||
timeout: 1000, | ||
// On iOS 11, audio context can only be used in response to user interaction. | ||
// We require users to explicitly enable audio fingerprinting on iOS 11. | ||
// See https://stackoverflow.com/questions/46363048/onaudioprocess-not-called-on-ios11#46534088 | ||
excludeIOS11: true | ||
}, | ||
fonts: { | ||
|
@@ -2382,6 +2396,7 @@ var Telemetry = (function() { | |
extendedJsFonts: false | ||
}, | ||
screen: { | ||
// To ensure consistent fingerprints when users rotate their mobile devices | ||
detectScreenOrientation: true | ||
}, | ||
plugins: { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the cast to Number necessary?