From b43ded7effc5bec4816f27d88dce59de0873b5c9 Mon Sep 17 00:00:00 2001 From: Samantha Puth Date: Tue, 3 Dec 2019 11:50:10 -0800 Subject: [PATCH 1/2] Run make release on changed files and add check if migration has already occurred --- README.md | 2 +- src/amplitude-client.js | 4 ++-- src/amplitude-snippet.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0637bee8..3d7c7cfa 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Please see our [installation guide](https://amplitude.zendesk.com/hc/en-us/artic [![npm version](https://badge.fury.io/js/amplitude-js.svg)](https://badge.fury.io/js/amplitude-js) [![Bower version](https://badge.fury.io/bo/amplitude-js.svg)](https://badge.fury.io/bo/amplitude-js) -[5.7.0 - Released on November 22, 2019](https://github.com/amplitude/Amplitude-JavaScript/releases/latest) +[5.7.1 - Released on December 3, 2019](https://github.com/amplitude/Amplitude-JavaScript/releases/latest) # JavaScript SDK Reference # diff --git a/src/amplitude-client.js b/src/amplitude-client.js index f32473f1..0c1c3d49 100644 --- a/src/amplitude-client.js +++ b/src/amplitude-client.js @@ -242,12 +242,12 @@ AmplitudeClient.prototype._migrateUnsentEvents = function _migrateUnsentEvents(c var itemsToSet = []; var itemsToRemove = []; - if (!!unsentEventsString) { + if (!!unsentEventsString && !unsentEventsString.includes(this._storageSuffix)) { itemsToSet.push(AsyncStorage.setItem(this.options.unsentKey + this._storageSuffix, JSON.stringify(unsentEventsString))); itemsToRemove.push(AsyncStorage.removeItem(this.options.unsentKey)); } - if (!!unsentIdentifyKey) { + if (!!unsentIdentifyKey && unsentIdentifyKey.includes(this._storageSuffix)) { itemsToSet.push(AsyncStorage.setItem(this.options.unsentIdentifyKey + this._storageSuffix, JSON.stringify(unsentIdentifyKey))); itemsToRemove.push(AsyncStorage.removeItem(this.options.unsentIdentifyKey)); } diff --git a/src/amplitude-snippet.js b/src/amplitude-snippet.js index 613d0d18..7d6ea141 100644 --- a/src/amplitude-snippet.js +++ b/src/amplitude-snippet.js @@ -2,10 +2,10 @@ var amplitude = window.amplitude || {'_q':[],'_iq':{}}; var as = document.createElement('script'); as.type = 'text/javascript'; - as.integrity = 'sha384-rSEVPt+HsYVwBs0EY4dB3fOcSZOW9cbAQV2CqsLFDjNbdiNyoXcGruquK0IyWxAZ'; + as.integrity = 'sha384-Ik1BT1T0ZKcBQi93L3Lh8pYLQvUANkj37BjU140rtlIwQSj9ePR4dOoqfWj9u5qU'; as.crossOrigin = 'anonymous'; as.async = true; - as.src = 'https://cdn.amplitude.com/libs/amplitude-5.7.0-min.gz.js'; + as.src = 'https://cdn.amplitude.com/libs/amplitude-5.7.1-min.gz.js'; as.onload = function() {if(!window.amplitude.runQueuedFunctions) {console.log('[Amplitude] Error: could not load SDK');}}; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(as, s); From be73bb8a2b209eeaae0e9fa9b10a32187ee50a0b Mon Sep 17 00:00:00 2001 From: Samantha Puth Date: Tue, 3 Dec 2019 11:57:44 -0800 Subject: [PATCH 2/2] Remove unnecessary check for this._storageSuffix in the value (bc it should exist in the key, not the value) --- src/amplitude-client.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amplitude-client.js b/src/amplitude-client.js index 0c1c3d49..f32473f1 100644 --- a/src/amplitude-client.js +++ b/src/amplitude-client.js @@ -242,12 +242,12 @@ AmplitudeClient.prototype._migrateUnsentEvents = function _migrateUnsentEvents(c var itemsToSet = []; var itemsToRemove = []; - if (!!unsentEventsString && !unsentEventsString.includes(this._storageSuffix)) { + if (!!unsentEventsString) { itemsToSet.push(AsyncStorage.setItem(this.options.unsentKey + this._storageSuffix, JSON.stringify(unsentEventsString))); itemsToRemove.push(AsyncStorage.removeItem(this.options.unsentKey)); } - if (!!unsentIdentifyKey && unsentIdentifyKey.includes(this._storageSuffix)) { + if (!!unsentIdentifyKey) { itemsToSet.push(AsyncStorage.setItem(this.options.unsentIdentifyKey + this._storageSuffix, JSON.stringify(unsentIdentifyKey))); itemsToRemove.push(AsyncStorage.removeItem(this.options.unsentIdentifyKey)); }