move completely to fetch
This commit is contained in:
parent
ee899a7332
commit
9932bc3eb5
168 changed files with 948 additions and 945 deletions
12
dashboard-ui/cordova/android/iap.js
vendored
12
dashboard-ui/cordova/android/iap.js
vendored
|
@ -68,11 +68,11 @@
|
|||
data: {
|
||||
Parameters: JSON.stringify(result)
|
||||
}
|
||||
}).done(function () {
|
||||
}).then(function () {
|
||||
|
||||
refreshPurchases();
|
||||
|
||||
}).fail(function (e) {
|
||||
}, function (e) {
|
||||
|
||||
refreshPurchases();
|
||||
});
|
||||
|
@ -123,14 +123,14 @@
|
|||
|
||||
function isPlaybackUnlockedViaOldApp(deferred) {
|
||||
|
||||
testDeviceId(ConnectionManager.deviceId()).done(function (isUnlocked) {
|
||||
testDeviceId(ConnectionManager.deviceId()).then(function (isUnlocked) {
|
||||
|
||||
if (isUnlocked) {
|
||||
deferred.resolveWith(null, [true]);
|
||||
return;
|
||||
}
|
||||
|
||||
testDeviceId(device.uuid).done(function (isUnlocked) {
|
||||
testDeviceId(device.uuid).then(function (isUnlocked) {
|
||||
|
||||
if (isUnlocked) {
|
||||
deferred.resolveWith(null, [true]);
|
||||
|
@ -159,11 +159,11 @@
|
|||
type: 'GET',
|
||||
url: 'https://mb3admin.com/admin/service/statistics/appAccess?application=AndroidV1&deviceId=' + deviceId
|
||||
|
||||
}).done(function () {
|
||||
}).then(function () {
|
||||
|
||||
appStorage.setItem(cacheKey, 'true');
|
||||
|
||||
}).fail(function (e) {
|
||||
}, function (e) {
|
||||
|
||||
if (e.status == 404) {
|
||||
appStorage.setItem(cacheKey, 'false');
|
||||
|
|
2
dashboard-ui/cordova/android/mediasession.js
vendored
2
dashboard-ui/cordova/android/mediasession.js
vendored
|
@ -156,7 +156,7 @@
|
|||
|
||||
Logger.log('binding remotecontrols to ' + player.name);
|
||||
|
||||
player.getPlayerState().done(function (state) {
|
||||
player.getPlayerState().then(function (state) {
|
||||
|
||||
if (state.NowPlayingItem) {
|
||||
player.beginPlayerUpdates();
|
||||
|
|
2
dashboard-ui/cordova/chromecast.js
vendored
2
dashboard-ui/cordova/chromecast.js
vendored
|
@ -76,7 +76,7 @@
|
|||
return deferred.promise();
|
||||
}
|
||||
|
||||
return ApiClient.fetchJSON(ApiClient.getUrl('System/Endpoint')).then(function (info) {
|
||||
return ApiClient.getJSON(ApiClient.getUrl('System/Endpoint')).then(function (info) {
|
||||
|
||||
endpointInfo = info;
|
||||
});
|
||||
|
|
4
dashboard-ui/cordova/generaldevice.js
vendored
4
dashboard-ui/cordova/generaldevice.js
vendored
|
@ -148,7 +148,7 @@
|
|||
Dashboard.showModalLoadingMsg();
|
||||
}
|
||||
|
||||
MediaController.getPlaybackInfo(item.Id, deviceProfile, startPosition).done(function (playbackInfoResult) {
|
||||
MediaController.getPlaybackInfo(item.Id, deviceProfile, startPosition).then(function (playbackInfoResult) {
|
||||
|
||||
if (validatePlaybackInfoResult(playbackInfoResult)) {
|
||||
|
||||
|
@ -158,7 +158,7 @@
|
|||
|
||||
if (mediaSource.RequiresOpening) {
|
||||
|
||||
getLiveStream(item.Id, playbackInfoResult.PlaySessionId, deviceProfile, startPosition, mediaSource, null, null).done(function (openLiveStreamResult) {
|
||||
getLiveStream(item.Id, playbackInfoResult.PlaySessionId, deviceProfile, startPosition, mediaSource, null, null).then(function (openLiveStreamResult) {
|
||||
|
||||
openLiveStreamResult.MediaSource.enableDirectPlay = supportsDirectPlay(openLiveStreamResult.MediaSource);
|
||||
|
||||
|
|
16
dashboard-ui/cordova/iap.js
vendored
16
dashboard-ui/cordova/iap.js
vendored
|
@ -123,24 +123,24 @@
|
|||
|
||||
} else {
|
||||
|
||||
promise = HttpClient.send({
|
||||
type: "POST",
|
||||
url: "http://mb3admin.com/admin/service/appstore/register",
|
||||
data: JSON.stringify(postData),
|
||||
contentType: "application/json",
|
||||
promise = fetch("http://mb3admin.com/admin/service/appstore/register", {
|
||||
|
||||
method: 'POST',
|
||||
body: JSON.stringify(postData),
|
||||
headers: {
|
||||
"X-Emby-Token": "EMBY-APPLE-VALIDATE"
|
||||
"X-Emby-Token": "EMBY-APPLE-VALIDATE",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
promise.done(function () {
|
||||
promise.then(function () {
|
||||
|
||||
setCachedResult(cacheKey, true);
|
||||
|
||||
callback(true, product);
|
||||
|
||||
}).fail(function (e) {
|
||||
}, function (e) {
|
||||
|
||||
if (e.status == 402) {
|
||||
|
||||
|
|
6
dashboard-ui/cordova/imagestore.js
vendored
6
dashboard-ui/cordova/imagestore.js
vendored
|
@ -80,7 +80,7 @@
|
|||
|
||||
//Logger.log('getImageUrl:' + originalUrl);
|
||||
|
||||
getFileSystem().done(function (fileSystem) {
|
||||
getFileSystem().then(function (fileSystem) {
|
||||
var path = fileSystem.root.toURL() + "/emby/cache/" + key;
|
||||
|
||||
resolveLocalFileSystemURL(path, function (fileEntry) {
|
||||
|
@ -116,11 +116,11 @@
|
|||
// return;
|
||||
//}
|
||||
|
||||
self.getImageUrl(url).done(function (localUrl) {
|
||||
self.getImageUrl(url).then(function (localUrl) {
|
||||
|
||||
setImageIntoElement(elem, localUrl);
|
||||
|
||||
}).fail(onFail);
|
||||
}, onFail);
|
||||
};
|
||||
|
||||
var imageIdIndex = 1;
|
||||
|
|
2
dashboard-ui/cordova/ios/backgroundfetch.js
vendored
2
dashboard-ui/cordova/ios/backgroundfetch.js
vendored
|
@ -40,7 +40,7 @@
|
|||
var promise = LocalSync.sync(syncOptions);
|
||||
|
||||
if (reportToFetcher) {
|
||||
promise.done(onSyncFinish).fail(onSyncFail);
|
||||
promise.then(onSyncFinish, onSyncFail);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
4
dashboard-ui/cordova/ios/tabbar.js
vendored
4
dashboard-ui/cordova/ios/tabbar.js
vendored
|
@ -108,11 +108,11 @@
|
|||
return;
|
||||
}
|
||||
|
||||
ApiClient.getUserViews({}, user.Id).done(function (result) {
|
||||
ApiClient.getUserViews({}, user.Id).then(function (result) {
|
||||
|
||||
onUserViewResponse(user, result.Items);
|
||||
|
||||
}).fail(function (result) {
|
||||
}, function (result) {
|
||||
|
||||
onUserViewResponse(user, []);
|
||||
});
|
||||
|
|
56
dashboard-ui/cordova/localassetmanager.js
vendored
56
dashboard-ui/cordova/localassetmanager.js
vendored
|
@ -17,13 +17,13 @@
|
|||
return deferred.promise();
|
||||
}
|
||||
|
||||
getLocalItem(itemId, serverId).done(function (localItem) {
|
||||
getLocalItem(itemId, serverId).then(function (localItem) {
|
||||
|
||||
if (localItem && localItem.Item.MediaSources.length) {
|
||||
|
||||
var mediaSource = localItem.Item.MediaSources[0];
|
||||
|
||||
fileExists(mediaSource.Path).done(function (exists) {
|
||||
fileExists(mediaSource.Path).then(function (exists) {
|
||||
|
||||
if (exists) {
|
||||
deferred.resolveWith(null, [mediaSource]);
|
||||
|
@ -32,13 +32,14 @@
|
|||
deferred.resolveWith(null, [null]);
|
||||
}
|
||||
|
||||
}).fail(getOnFail(deferred));
|
||||
}, getOnFail(deferred));
|
||||
return;
|
||||
}
|
||||
|
||||
deferred.resolveWith(null, [null]);
|
||||
|
||||
}).fail(getOnFail(deferred));
|
||||
}, getOnFail(deferred));
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
|
@ -348,7 +349,7 @@
|
|||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
|
||||
getLocalItem(itemId, serverId).done(function (item) {
|
||||
getLocalItem(itemId, serverId).then(function (item) {
|
||||
|
||||
getOfflineItemsDb(function (db) {
|
||||
|
||||
|
@ -359,16 +360,16 @@
|
|||
var files = item.AdditionalFiles || [];
|
||||
files.push(item.LocalPath);
|
||||
|
||||
deleteFiles(files).done(function () {
|
||||
deleteFiles(files).then(function () {
|
||||
|
||||
deferred.resolve();
|
||||
|
||||
}).fail(getOnFail(deferred));
|
||||
}, getOnFail(deferred));
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
}).fail(getOnFail(deferred));
|
||||
}, getOnFail(deferred));
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
|
@ -386,9 +387,9 @@
|
|||
return;
|
||||
}
|
||||
|
||||
deleteFile(file).done(function () {
|
||||
deleteFile(file).then(function () {
|
||||
deleteNextFile(files, index + 1, deferred);
|
||||
}).fail(function () {
|
||||
}, function () {
|
||||
deleteNextFile(files, index + 1, deferred);
|
||||
});
|
||||
}
|
||||
|
@ -420,7 +421,7 @@
|
|||
|
||||
function resolveFile(path, options, success, fail) {
|
||||
|
||||
getFileSystem().done(function (fileSystem) {
|
||||
getFileSystem().then(function (fileSystem) {
|
||||
|
||||
fileSystem.root.getFile(path, options || { create: false }, success, fail);
|
||||
});
|
||||
|
@ -541,7 +542,7 @@
|
|||
|
||||
Logger.log('downloading: ' + url + ' to ' + localPath);
|
||||
|
||||
createDirectory(getParentDirectoryPath(localPath)).done(function () {
|
||||
createDirectory(getParentDirectoryPath(localPath)).then(function () {
|
||||
|
||||
resolveFile(localPath, { create: true }, function (targetFile) {
|
||||
|
||||
|
@ -593,7 +594,7 @@
|
|||
|
||||
});
|
||||
|
||||
}).fail(getOnFail(deferred));;
|
||||
}, getOnFail(deferred));
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
|
@ -626,7 +627,7 @@
|
|||
|
||||
Logger.log('downloading: ' + url + ' to ' + localPath);
|
||||
|
||||
createDirectory(getParentDirectoryPath(localPath)).done(function () {
|
||||
createDirectory(getParentDirectoryPath(localPath)).then(function () {
|
||||
|
||||
resolveFile(localPath, { create: true }, function (targetFile) {
|
||||
|
||||
|
@ -679,7 +680,7 @@
|
|||
deferred.reject();
|
||||
});
|
||||
|
||||
}).fail(getOnFail(deferred));
|
||||
}, getOnFail(deferred));
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
|
@ -702,11 +703,11 @@
|
|||
parts.length = index + 1;
|
||||
var pathToCreate = parts.join('/');
|
||||
|
||||
createDirectoryInternal(pathToCreate).done(function () {
|
||||
createDirectoryInternal(pathToCreate).then(function () {
|
||||
|
||||
createDirectoryPart(path, index + 1, deferred);
|
||||
|
||||
}).fail(getOnFail(deferred));
|
||||
}, getOnFail(deferred));
|
||||
}
|
||||
|
||||
function createDirectoryInternal(path) {
|
||||
|
@ -714,7 +715,7 @@
|
|||
Logger.log('creating directory: ' + path);
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
|
||||
getFileSystem().done(function (fileSystem) {
|
||||
getFileSystem().then(function (fileSystem) {
|
||||
|
||||
fileSystem.root.getDirectory(path, { create: true, exclusive: false }, function (targetFile) {
|
||||
|
||||
|
@ -727,7 +728,7 @@
|
|||
deferred.reject();
|
||||
});
|
||||
|
||||
}).fail(getOnFail(deferred));
|
||||
}, getOnFail(deferred));
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
|
@ -796,30 +797,31 @@
|
|||
function hasImage(serverId, itemId, imageTag) {
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
getImageLocalPath(serverId, itemId, imageTag).done(function (localPath) {
|
||||
getImageLocalPath(serverId, itemId, imageTag).then(function (localPath) {
|
||||
|
||||
fileExists(localPath).done(function (exists) {
|
||||
fileExists(localPath).then(function (exists) {
|
||||
|
||||
deferred.resolveWith(null, [exists]);
|
||||
|
||||
}).fail(getOnFail(deferred));
|
||||
}, getOnFail(deferred));
|
||||
|
||||
}).fail(getOnFail(deferred));
|
||||
}, getOnFail(deferred));
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
function downloadImage(url, serverId, itemId, imageTag) {
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
getImageLocalPath(serverId, itemId, imageTag).done(function (localPath) {
|
||||
getImageLocalPath(serverId, itemId, imageTag).then(function (localPath) {
|
||||
|
||||
downloadFile(url, localPath).done(function () {
|
||||
downloadFile(url, localPath).then(function () {
|
||||
|
||||
deferred.resolve();
|
||||
|
||||
}).fail(getOnFail(deferred));
|
||||
}, getOnFail(deferred));
|
||||
|
||||
}, getOnFail(deferred));
|
||||
|
||||
}).fail(getOnFail(deferred));
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
|
|
12
dashboard-ui/cordova/registrationservices.js
vendored
12
dashboard-ui/cordova/registrationservices.js
vendored
|
@ -24,7 +24,7 @@
|
|||
|
||||
var prefix = $.browser.android ? 'android' : 'ios';
|
||||
|
||||
IapManager.isUnlockedOverride(feature).done(function (isUnlocked) {
|
||||
IapManager.isUnlockedOverride(feature).then(function (isUnlocked) {
|
||||
|
||||
if (isUnlocked) {
|
||||
deferred.resolve();
|
||||
|
@ -38,7 +38,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
IapManager.getSubscriptionOptions().done(function (subscriptionOptions) {
|
||||
IapManager.getSubscriptionOptions().then(function (subscriptionOptions) {
|
||||
|
||||
if (subscriptionOptions.filter(function (p) {
|
||||
return p.owned;
|
||||
|
@ -58,7 +58,7 @@
|
|||
}
|
||||
|
||||
// Get supporter status
|
||||
getRegistrationInfo(prefix + 'appunlock').done(onRegistrationInfoResponse).fail(function () {
|
||||
getRegistrationInfo(prefix + 'appunlock').then(onRegistrationInfoResponse, function () {
|
||||
onRegistrationInfoResponse({});
|
||||
});
|
||||
});
|
||||
|
@ -371,7 +371,7 @@
|
|||
|
||||
function validateSync(deferred) {
|
||||
|
||||
Dashboard.getPluginSecurityInfo().done(function (pluginSecurityInfo) {
|
||||
Dashboard.getPluginSecurityInfo().then(function (pluginSecurityInfo) {
|
||||
|
||||
if (pluginSecurityInfo.IsMBSupporter) {
|
||||
deferred.resolve();
|
||||
|
@ -384,7 +384,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
IapManager.getSubscriptionOptions().done(function (subscriptionOptions) {
|
||||
IapManager.getSubscriptionOptions().then(function (subscriptionOptions) {
|
||||
|
||||
var dialogOptions = {
|
||||
title: Globalize.translate('HeaderUnlockSync'),
|
||||
|
@ -396,7 +396,7 @@
|
|||
}
|
||||
|
||||
// Get supporter status
|
||||
getRegistrationInfo('Sync').done(onRegistrationInfoResponse).fail(function () {
|
||||
getRegistrationInfo('Sync').then(onRegistrationInfoResponse, function () {
|
||||
onRegistrationInfoResponse({});
|
||||
});
|
||||
});
|
||||
|
|
2
dashboard-ui/cordova/remotecontrols.js
vendored
2
dashboard-ui/cordova/remotecontrols.js
vendored
|
@ -158,7 +158,7 @@
|
|||
|
||||
Logger.log('binding remotecontrols to MediaPlayer');
|
||||
|
||||
player.getPlayerState().done(function (state) {
|
||||
player.getPlayerState().then(function (state) {
|
||||
|
||||
if (state.NowPlayingItem) {
|
||||
player.beginPlayerUpdates();
|
||||
|
|
7
dashboard-ui/cordova/serverdiscovery.js
vendored
7
dashboard-ui/cordova/serverdiscovery.js
vendored
|
@ -146,17 +146,18 @@
|
|||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
|
||||
deviceReadyPromise.done(function () {
|
||||
deviceReadyPromise.then(function () {
|
||||
|
||||
try {
|
||||
findServersInternal(timeoutMs).done(function (result) {
|
||||
findServersInternal(timeoutMs).then(function (result) {
|
||||
|
||||
deferred.resolveWith(null, [result]);
|
||||
|
||||
}).fail(function () {
|
||||
}, function () {
|
||||
|
||||
deferred.resolveWith(null, [[]]);
|
||||
});
|
||||
|
||||
} catch (err) {
|
||||
deferred.resolveWith(null, [[]]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue