mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Issue #277 : Move storage services to dedicated package
This commit is contained in:
parent
d576c56068
commit
551e15e67b
@ -109,10 +109,13 @@
|
||||
this.canvasBackgroundController = new pskl.controller.CanvasBackgroundController();
|
||||
this.canvasBackgroundController.init();
|
||||
|
||||
this.localStorageService = new pskl.service.LocalStorageService(this.piskelController);
|
||||
this.galleryStorageService = new pskl.service.storage.GalleryStorageService(this.piskelController);
|
||||
this.galleryStorageService.init();
|
||||
|
||||
this.localStorageService = new pskl.service.storage.LocalStorageService(this.piskelController);
|
||||
this.localStorageService.init();
|
||||
|
||||
this.desktopStorageService = new pskl.service.DesktopStorageService(this.piskelController);
|
||||
this.desktopStorageService = new pskl.service.storage.DesktopStorageService(this.piskelController);
|
||||
this.desktopStorageService.init();
|
||||
|
||||
this.imageUploadService = new pskl.service.ImageUploadService();
|
||||
@ -135,13 +138,6 @@
|
||||
document.querySelector('#drawing-canvas-container'));
|
||||
this.fileDropperService.init();
|
||||
|
||||
if (this.isAppEngineVersion) {
|
||||
this.storageService = new pskl.service.AppEngineStorageService(this.piskelController);
|
||||
} else {
|
||||
this.storageService = new pskl.service.GithubStorageService(this.piskelController);
|
||||
}
|
||||
this.storageService.init();
|
||||
|
||||
var drawingLoop = new pskl.rendering.DrawingLoop();
|
||||
drawingLoop.addCallback(this.render, this);
|
||||
drawingLoop.start();
|
||||
|
@ -1,13 +0,0 @@
|
||||
(function () {
|
||||
var ns = $.namespace('pskl.service');
|
||||
|
||||
ns.GithubStorageService = function (piskelController) {
|
||||
this.piskelController = piskelController;
|
||||
};
|
||||
|
||||
ns.GithubStorageService.prototype.init = function () {};
|
||||
|
||||
ns.GithubStorageService.prototype.store = function (callbacks) {
|
||||
throw 'Github save is no longer available. Use local save instead';
|
||||
};
|
||||
})();
|
@ -1,5 +1,5 @@
|
||||
(function () {
|
||||
var ns = $.namespace('pskl.service');
|
||||
var ns = $.namespace('pskl.service.storage');
|
||||
|
||||
ns.DesktopStorageService = function(piskelController) {
|
||||
this.piskelController = piskelController || pskl.app.piskelController;
|
@ -1,14 +1,13 @@
|
||||
(function () {
|
||||
var ns = $.namespace('pskl.service');
|
||||
var ns = $.namespace('pskl.service.storage');
|
||||
|
||||
ns.AppEngineStorageService = function (piskelController) {
|
||||
ns.GalleryStorageService = function (piskelController) {
|
||||
this.piskelController = piskelController;
|
||||
};
|
||||
|
||||
ns.AppEngineStorageService.prototype.init = function () {};
|
||||
ns.GalleryStorageService.prototype.init = function () {};
|
||||
|
||||
ns.AppEngineStorageService.prototype.store = function (callbacks) {
|
||||
var piskel = this.piskelController.getPiskel();
|
||||
ns.GalleryStorageService.prototype.store = function (piskel, onSuccess, onError) {
|
||||
var descriptor = piskel.getDescriptor();
|
||||
|
||||
var data = {
|
||||
@ -25,16 +24,10 @@
|
||||
data.public = true;
|
||||
}
|
||||
|
||||
var success = function () {
|
||||
callbacks.success();
|
||||
callbacks.after();
|
||||
var errorCallback = function (response) {
|
||||
onError(response.status);
|
||||
};
|
||||
|
||||
var error = function (response) {
|
||||
callbacks.error(response.status);
|
||||
callbacks.after();
|
||||
};
|
||||
|
||||
pskl.utils.Xhr.post(Constants.APPENGINE_SAVE_URL, data, success, error);
|
||||
pskl.utils.Xhr.post(Constants.APPENGINE_SAVE_URL, data, onSuccess, errorCallback);
|
||||
};
|
||||
})();
|
@ -1,5 +1,5 @@
|
||||
(function () {
|
||||
var ns = $.namespace('pskl.service');
|
||||
var ns = $.namespace('pskl.service.storage');
|
||||
|
||||
ns.LocalStorageService = function (piskelController) {
|
||||
if (piskelController === undefined) {
|
@ -136,10 +136,6 @@
|
||||
"js/widgets/SizeInput.js",
|
||||
|
||||
// Services
|
||||
"js/service/LocalStorageService.js",
|
||||
"js/service/GithubStorageService.js",
|
||||
"js/service/AppEngineStorageService.js",
|
||||
"js/service/DesktopStorageService.js",
|
||||
"js/service/BackupService.js",
|
||||
"js/service/BeforeUnloadService.js",
|
||||
"js/service/HistoryService.js",
|
||||
@ -162,6 +158,9 @@
|
||||
"js/service/FileDropperService.js",
|
||||
"js/service/SelectedColorsService.js",
|
||||
"js/service/MouseStateService.js",
|
||||
"js/service/storage/LocalStorageService.js",
|
||||
"js/service/storage/GalleryStorageService.js",
|
||||
"js/service/storage/DesktopStorageService.js",
|
||||
|
||||
// Tools
|
||||
"js/tools/ToolsHelper.js",
|
||||
|
Loading…
Reference in New Issue
Block a user