Skip to content

Commit

Permalink
Force update if tags list empty on v0.4.2. SHow loading indicator whe…
Browse files Browse the repository at this point in the history
…n searching tracks. Translate content script message (popup).
  • Loading branch information
leeroybrun committed Dec 14, 2016
1 parent 053cab5 commit 6b60d9e
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 8 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## v0.4.2

- [x] If tags list was empty, force reload on update to v0.4.x
- [x] Show loading indicator when searching tracks
- [x] Translate "Successful login on Shazam" message

## v0.4.1

- [x] Add Content Scripts to bundle

## v0.4.0

- [x] Store tags in IndexedDB instead of Local Storage
Expand Down
5 changes: 5 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"description":"The description of the application, displayed in the web store."
},

"shazamLoginSuccessOpenAgain": {
"message": "Shazam login is successful. Please open Shazify again.",
"description": ""
},

"introWelcome": {
"message": "Welcome",
"description": ""
Expand Down
5 changes: 5 additions & 0 deletions _locales/fr/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"description":"The description of the application, displayed in the web store."
},

"shazamLoginSuccessOpenAgain": {
"message": "La connexion à Shazam a bien fonctionné. Veuillez ouvrir à nouveau Shazify.",
"description": ""
},

"introWelcome": {
"message": "Bienvenue",
"description": ""
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAopSL/q/2d97dHxCQ1w26B4EONSEo4CZZYFqu3MlJKA5ifSXkyoNSlkG6afDuNoXmiTWFCAawRgGwuO3yi0QvfeMJpz+M9nXnt8PQsVP10Mb7o3SHIihxIXRMFAJvggvHW4NCuDznJixpo2ixEeCL8LGkS0ZL93MgYtEOuaGPdcBTiAUya3Nr3mdkn+nTHldQvthassiDYZystDTuKwkf0vTZkDCyWC8bfI7xZTxQ6IFcS2WQgUm0ix5hgv+qyOQzOwh26R6BQmZTFj7YiSqhgZsZRebhMcn+hxd8kSegS1ZAcKv/oS63Ej5/IAB5NijrPXR3zivQZ6oIJjr+xMOU9wIDAQAB",
"name": "Shazify",
"version": "0.4.1",
"version": "0.4.2",
"manifest_version": 2,
"description": "__MSG_appDesc__",
"homepage_url": "http://www.leeroy.me",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chrome-shazify",
"version": "0.4.1",
"version": "0.4.2",
"author": "Leeroy Brun <[email protected]>",
"private": true,
"description": "Easily sync your Shazam tracks with a Spotify playlist",
Expand Down
26 changes: 23 additions & 3 deletions src/background/UpdateService.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
var initVersion = parseInt(initVersionTxt);
var finalVersion = parseInt(finalVersionTxt);

Logger.info('[Updater] Init version : '+ initVersion +' | Final version : '+ finalVersion);

var startIndex = null;
var endIndex = null;

Expand Down Expand Up @@ -149,7 +151,7 @@

var oldTagsStorage = new StorageHelper('Tags', 'local');
oldTagsStorage.get(['tagsList', 'lastUpdate'], function(items) {
if(items.tagsList) {
if(items.tagsList && items.tagsList.length) {
async.eachLimit(items.tagsList, 5, function(oldTag, cbe) {
Logger.info('[Update] Moving tag '+ oldTag.shazamId +' to DB...');

Expand Down Expand Up @@ -179,10 +181,28 @@
return onceDone(items.lastUpdate);
});
} else {
return onceDone(items.lastUpdate);
// If tags list was emtpy, we set last update to 0 to force reloading
return onceDone(0);
}
});
}},
// v0.04.02
{'version': 402, 'perform': function(callback) {
Logger.info('[Update] Checking if we have any tag in DB, or force update...');

Tags.count(function(err, count) {
if(count === 0) {
Logger.info('[Update] No tags found, force update...');

Tags.data.clearCache();
Tags.data.set({ 'lastUpdate': 0 }, function() {
Tags.load();

return callback();
});
}
});
}}
}}
]
};

Expand Down
2 changes: 1 addition & 1 deletion src/contentscripts/shazam.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

/* The Close Button */
.shazify-modal-close {
color: #000000;
color: #ffffff;
position: absolute;
right:15px;
top:15px;
Expand Down
2 changes: 1 addition & 1 deletion src/contentscripts/shazamLocalStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function getAndSendLocalStorage() {
} else {
console.log('inid seems fine! Congrats! You are now logged in on Shazam.');

openModalOnlyOnce('<b>Shazify:</b> Login is successful! Please open Shazify again.');
openModalOnlyOnce('<b>Shazify:</b> '+ chrome.i18n.getMessage('shazamLoginSuccessOpenAgain'));
}
});

Expand Down
4 changes: 4 additions & 0 deletions src/popup/js/controllers/TagsCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ angular.module('Shazify').controller('TagsCtrl', function($scope, $location, $in
},

send: function() {
$scope.loading = true;

SpotifyService.genQuery($scope.newSearch.query.track, $scope.newSearch.query.artist, function(query) {
SpotifyService.searchTracks(query, function(err, tracks) {
if(err) {
Expand All @@ -186,6 +188,8 @@ angular.module('Shazify').controller('TagsCtrl', function($scope, $location, $in
}
}
}

$scope.loading = false;
});
});
},
Expand Down
1 change: 0 additions & 1 deletion src/popup/js/services/SpotifyService.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ angular.module('Shazify').factory('SpotifyService', function($timeout, $interval
searchTracks: function(query, callback) {
BackgroundService.Spotify.findTracks(query, function(err, tracks) {
$timeout(function() {
console.log(err, tracks);
callback(err, tracks);
}, 0);
});
Expand Down

0 comments on commit 6b60d9e

Please sign in to comment.