Merge pull request #5013 from gabrielbazan7/fix/feedback

feedback feature refactor
This commit is contained in:
Gustavo Maximiliano Cortez 2016-11-14 17:36:08 -03:00 committed by GitHub
commit da7bb1170b
17 changed files with 104 additions and 57 deletions

View file

@ -24,5 +24,35 @@ angular.module('copayApp.services').factory('feedbackService', function($http, $
};
};
root.isVersionUpdated = function(currentVersion, savedVersion) {
if (!verifyTagFormat(currentVersion))
return 'Cannot verify the format of version tag: ' + currentVersion;
if (!verifyTagFormat(savedVersion))
return 'Cannot verify the format of the saved version tag: ' + savedVersion;
var current = formatTagNumber(currentVersion);
var saved = formatTagNumber(savedVersion);
if (saved.major > current.major || (saved.major == current.major && saved.minor > current.minor))
return false;
return true;
function verifyTagFormat(tag) {
var regex = /^v?\d+\.\d+\.\d+$/i;
return regex.exec(tag);
};
function formatTagNumber(tag) {
var formattedNumber = tag.replace(/^v/i, '').split('.');
return {
major: +formattedNumber[0],
minor: +formattedNumber[1],
patch: +formattedNumber[2]
};
};
};
return root;
});

View file

@ -221,12 +221,12 @@ angular.module('copayApp.services')
storage.remove('profile', cb);
};
root.setProfileCreationTime = function(time, cb) {
storage.set('profileCreationTime', time, cb);
root.setFeedbackInfo = function(feedbackValues, cb) {
storage.set('feedback', feedbackValues, cb);
};
root.getProfileCreationTime = function(cb) {
storage.get('profileCreationTime', cb);
root.getFeedbackInfo = function(cb) {
storage.get('feedback', cb);
};
root.storeFocusedWalletId = function(id, cb) {
@ -294,14 +294,6 @@ angular.module('copayApp.services')
storage.set('homeTip', val, cb);
};
root.getRateCardFlag = function(cb) {
storage.get('rateCardFlag', cb);
};
root.setRateCardFlag = function(val, cb) {
storage.set('rateCardFlag', val, cb);
};
root.setHideBalanceFlag = function(walletId, val, cb) {
storage.set('hideBalance-' + walletId, val, cb);
};