Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
84
gaia/distros/spark/apps/sharing/js/controllers/app_controller.js
Executable file
84
gaia/distros/spark/apps/sharing/js/controllers/app_controller.js
Executable file
|
|
@ -0,0 +1,84 @@
|
|||
define(["exports", "fxos-mvc/dist/mvc", "app/js/models/app", "app/js/services/apps_service", "app/js/services/http_client_service", "app/js/services/p2p_service"], function (exports, _fxosMvcDistMvc, _appJsModelsApp, _appJsServicesAppsService, _appJsServicesHttpClientService, _appJsServicesP2pService) {
|
||||
"use strict";
|
||||
|
||||
var _extends = function (child, parent) {
|
||||
child.prototype = Object.create(parent.prototype, {
|
||||
constructor: {
|
||||
value: child,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
child.__proto__ = parent;
|
||||
};
|
||||
|
||||
var Controller = _fxosMvcDistMvc.Controller;
|
||||
var App = _appJsModelsApp["default"];
|
||||
var AppsService = _appJsServicesAppsService["default"];
|
||||
var HttpClientService = _appJsServicesHttpClientService["default"];
|
||||
var P2pService = _appJsServicesP2pService["default"];
|
||||
var AppController = (function (Controller) {
|
||||
var AppController = function AppController(options) {
|
||||
var _this = this;
|
||||
Controller.call(this, options);
|
||||
|
||||
this._appsUpdated = function () {
|
||||
return _this.main();
|
||||
};
|
||||
|
||||
document.body.appendChild(this.view.el);
|
||||
};
|
||||
|
||||
_extends(AppController, Controller);
|
||||
|
||||
AppController.prototype.main = function (appId) {
|
||||
var _this2 = this;
|
||||
var proxApps = P2pService.getApps();
|
||||
|
||||
this._app = App.getApp(proxApps, { manifestURL: appId });
|
||||
this.header = this._app && this._app.manifest.name;
|
||||
|
||||
AppsService.getApps().then(function (installedApps) {
|
||||
_this2._app = App.markInstalledApps(installedApps, [_this2._app])[0];
|
||||
_this2.view.show(_this2._app);
|
||||
AppsService.addEventListener("updated", _this2._appsUpdated);
|
||||
});
|
||||
};
|
||||
|
||||
AppController.prototype.teardown = function () {
|
||||
this.view.hide();
|
||||
AppsService.removeEventListener("updated", this._appsUpdated);
|
||||
};
|
||||
|
||||
AppController.prototype.close = function () {
|
||||
this.teardown();
|
||||
};
|
||||
|
||||
AppController.prototype.download = function (e) {
|
||||
var _this3 = this;
|
||||
Sharing.ConfirmDownloadController.open(this._app, function () {
|
||||
var progressDialogController = Sharing.ProgressDialogController;
|
||||
|
||||
progressDialogController.main();
|
||||
|
||||
HttpClientService.downloadApp(_this3._app).then(progressDialogController.success.bind(progressDialogController), progressDialogController.error.bind(progressDialogController));
|
||||
});
|
||||
};
|
||||
|
||||
AppController.prototype.open = function () {
|
||||
var _this4 = this;
|
||||
navigator.mozApps.mgmt.getAll().then(function (apps) {
|
||||
apps.forEach(function (app) {
|
||||
if (app.manifestURL === _this4._app.manifestURL) {
|
||||
app.launch();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return AppController;
|
||||
})(Controller);
|
||||
|
||||
exports["default"] = AppController;
|
||||
});
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
define(["exports", "fxos-mvc/dist/mvc"], function (exports, _fxosMvcDistMvc) {
|
||||
"use strict";
|
||||
|
||||
var _extends = function (child, parent) {
|
||||
child.prototype = Object.create(parent.prototype, {
|
||||
constructor: {
|
||||
value: child,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
child.__proto__ = parent;
|
||||
};
|
||||
|
||||
var Controller = _fxosMvcDistMvc.Controller;
|
||||
var ConfirmDownloadController = (function (Controller) {
|
||||
var ConfirmDownloadController = function ConfirmDownloadController(options) {
|
||||
Controller.call(this, options);
|
||||
|
||||
this.view.render();
|
||||
};
|
||||
|
||||
_extends(ConfirmDownloadController, Controller);
|
||||
|
||||
ConfirmDownloadController.prototype.open = function (app, cb) {
|
||||
document.body.appendChild(this.view.el);
|
||||
this.view.open(app);
|
||||
|
||||
this._cb = cb;
|
||||
};
|
||||
|
||||
ConfirmDownloadController.prototype.cancel = function () {
|
||||
this.view.close();
|
||||
};
|
||||
|
||||
ConfirmDownloadController.prototype.install = function () {
|
||||
this.view.close();
|
||||
this._cb();
|
||||
};
|
||||
|
||||
return ConfirmDownloadController;
|
||||
})(Controller);
|
||||
|
||||
exports["default"] = ConfirmDownloadController;
|
||||
});
|
||||
59
gaia/distros/spark/apps/sharing/js/controllers/device_name_controller.js
Executable file
59
gaia/distros/spark/apps/sharing/js/controllers/device_name_controller.js
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
define(["exports", "fxos-mvc/dist/mvc", "app/js/services/device_name_service"], function (exports, _fxosMvcDistMvc, _appJsServicesDeviceNameService) {
|
||||
"use strict";
|
||||
|
||||
var _extends = function (child, parent) {
|
||||
child.prototype = Object.create(parent.prototype, {
|
||||
constructor: {
|
||||
value: child,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
child.__proto__ = parent;
|
||||
};
|
||||
|
||||
var Controller = _fxosMvcDistMvc.Controller;
|
||||
var DeviceNameService = _appJsServicesDeviceNameService["default"];
|
||||
var DeviceNameController = (function (Controller) {
|
||||
var DeviceNameController = function DeviceNameController(options) {
|
||||
var _this = this;
|
||||
Controller.call(this, options);
|
||||
|
||||
this.view.render();
|
||||
document.body.appendChild(this.view.el);
|
||||
|
||||
DeviceNameService.addEventListener("devicenamechange", function (e) {
|
||||
return _this._updateDeviceName(e);
|
||||
}, true);
|
||||
};
|
||||
|
||||
_extends(DeviceNameController, Controller);
|
||||
|
||||
DeviceNameController.prototype.main = function () {
|
||||
this.view.el.open();
|
||||
};
|
||||
|
||||
DeviceNameController.prototype.handleOpened = function () {};
|
||||
|
||||
DeviceNameController.prototype.handleClosed = function () {
|
||||
DeviceNameService.signalDeviceNameCanceled();
|
||||
};
|
||||
|
||||
DeviceNameController.prototype.handleSubmit = function () {
|
||||
DeviceNameService.setDeviceName(this.view.value);
|
||||
};
|
||||
|
||||
DeviceNameController.prototype.handleInput = function () {
|
||||
this.view.el.els.submit.disabled = !this.view.value;
|
||||
};
|
||||
|
||||
DeviceNameController.prototype._updateDeviceName = function (e) {
|
||||
this.view.value = e.deviceName;
|
||||
};
|
||||
|
||||
return DeviceNameController;
|
||||
})(Controller);
|
||||
|
||||
exports["default"] = DeviceNameController;
|
||||
});
|
||||
57
gaia/distros/spark/apps/sharing/js/controllers/main_controller.js
Executable file
57
gaia/distros/spark/apps/sharing/js/controllers/main_controller.js
Executable file
|
|
@ -0,0 +1,57 @@
|
|||
define(["exports", "fxos-mvc/dist/mvc", "app/js/views/main_view", "app/js/controllers/app_controller", "app/js/controllers/confirm_download_controller", "app/js/controllers/device_name_controller", "app/js/controllers/progress_dialog_controller", "app/js/controllers/proximity_apps_controller", "app/js/controllers/share_controller", "app/js/views/app_view", "app/js/views/confirm_download_view", "app/js/views/device_name_view", "app/js/views/progress_dialog_view", "app/js/services/activity_service", "app/js/services/achievements_service"], function (exports, _fxosMvcDistMvc, _appJsViewsMainView, _appJsControllersAppController, _appJsControllersConfirmDownloadController, _appJsControllersDeviceNameController, _appJsControllersProgressDialogController, _appJsControllersProximityAppsController, _appJsControllersShareController, _appJsViewsAppView, _appJsViewsConfirmDownloadView, _appJsViewsDeviceNameView, _appJsViewsProgressDialogView, _appJsServicesActivityService, _appJsServicesAchievementsService) {
|
||||
"use strict";
|
||||
|
||||
var _extends = function (child, parent) {
|
||||
child.prototype = Object.create(parent.prototype, {
|
||||
constructor: {
|
||||
value: child,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
child.__proto__ = parent;
|
||||
};
|
||||
|
||||
var Controller = _fxosMvcDistMvc.Controller;
|
||||
var MainView = _appJsViewsMainView["default"];
|
||||
var AppController = _appJsControllersAppController["default"];
|
||||
var ConfirmDownloadController = _appJsControllersConfirmDownloadController["default"];
|
||||
var DeviceNameController = _appJsControllersDeviceNameController["default"];
|
||||
var ProgressDialogController = _appJsControllersProgressDialogController["default"];
|
||||
var ProximityAppsController = _appJsControllersProximityAppsController["default"];
|
||||
var ShareController = _appJsControllersShareController["default"];
|
||||
var AppView = _appJsViewsAppView["default"];
|
||||
var ConfirmDownloadView = _appJsViewsConfirmDownloadView["default"];
|
||||
var DeviceNameView = _appJsViewsDeviceNameView["default"];
|
||||
var ProgressDialogView = _appJsViewsProgressDialogView["default"];
|
||||
var MainController = (function (Controller) {
|
||||
var MainController = function MainController() {
|
||||
Controller.call(this);
|
||||
|
||||
this.view = new MainView({
|
||||
controller: this,
|
||||
el: document.body
|
||||
});
|
||||
|
||||
window.Sharing = {
|
||||
AppController: new AppController({ view: new AppView() }),
|
||||
ConfirmDownloadController: new ConfirmDownloadController({ view: new ConfirmDownloadView() }),
|
||||
DeviceNameController: new DeviceNameController({ view: new DeviceNameView() }),
|
||||
ProgressDialogController: new ProgressDialogController({ view: new ProgressDialogView() }),
|
||||
ProximityAppsController: new ProximityAppsController(),
|
||||
ShareController: new ShareController()
|
||||
};
|
||||
|
||||
window.requestAnimationFrame(function () {
|
||||
document.documentElement.classList.remove("loading");
|
||||
});
|
||||
};
|
||||
|
||||
_extends(MainController, Controller);
|
||||
|
||||
return MainController;
|
||||
})(Controller);
|
||||
|
||||
exports["default"] = MainController;
|
||||
});
|
||||
57
gaia/distros/spark/apps/sharing/js/controllers/progress_dialog_controller.js
Executable file
57
gaia/distros/spark/apps/sharing/js/controllers/progress_dialog_controller.js
Executable file
|
|
@ -0,0 +1,57 @@
|
|||
define(["exports", "fxos-mvc/dist/mvc", "app/js/views/progress_dialog_view"], function (exports, _fxosMvcDistMvc, _appJsViewsProgressDialogView) {
|
||||
"use strict";
|
||||
|
||||
var _extends = function (child, parent) {
|
||||
child.prototype = Object.create(parent.prototype, {
|
||||
constructor: {
|
||||
value: child,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
child.__proto__ = parent;
|
||||
};
|
||||
|
||||
var Controller = _fxosMvcDistMvc.Controller;
|
||||
var ProgressDialogView = _appJsViewsProgressDialogView["default"];
|
||||
var ProgressDialogController = (function (Controller) {
|
||||
var ProgressDialogController = function ProgressDialogController() {
|
||||
this.view = new ProgressDialogView();
|
||||
this.view.init(this);
|
||||
};
|
||||
|
||||
_extends(ProgressDialogController, Controller);
|
||||
|
||||
ProgressDialogController.prototype.main = function () {
|
||||
var _this = this;
|
||||
this.view.render();
|
||||
document.body.appendChild(this.view.el);
|
||||
|
||||
setTimeout(function () {
|
||||
_this.view.open();
|
||||
});
|
||||
};
|
||||
|
||||
ProgressDialogController.prototype.teardown = function () {
|
||||
document.body.removeChild(this.view.el);
|
||||
};
|
||||
|
||||
ProgressDialogController.prototype.success = function (app) {
|
||||
var _this2 = this;
|
||||
this.view.success(app);
|
||||
|
||||
setTimeout(function () {
|
||||
_this2.view.close();
|
||||
}, 3000);
|
||||
};
|
||||
|
||||
ProgressDialogController.prototype.error = function (e) {
|
||||
this.view.error(e);
|
||||
};
|
||||
|
||||
return ProgressDialogController;
|
||||
})(Controller);
|
||||
|
||||
exports["default"] = ProgressDialogController;
|
||||
});
|
||||
181
gaia/distros/spark/apps/sharing/js/controllers/proximity_apps_controller.js
Executable file
181
gaia/distros/spark/apps/sharing/js/controllers/proximity_apps_controller.js
Executable file
|
|
@ -0,0 +1,181 @@
|
|||
define(["exports", "fxos-mvc/dist/mvc", "app/js/models/app", "app/js/services/apps_service", "app/js/services/broadcast_service", "app/js/services/http_client_service", "app/js/services/p2p_service", "app/js/services/wifi_service", "app/js/views/share_summary_view", "app/js/views/list_view", "app/js/views/proximity_empty_view", "app/js/views/templates/composite"], function (exports, _fxosMvcDistMvc, _appJsModelsApp, _appJsServicesAppsService, _appJsServicesBroadcastService, _appJsServicesHttpClientService, _appJsServicesP2pService, _appJsServicesWifiService, _appJsViewsShareSummaryView, _appJsViewsListView, _appJsViewsProximityEmptyView, _appJsViewsTemplatesComposite) {
|
||||
"use strict";
|
||||
|
||||
var _extends = function (child, parent) {
|
||||
child.prototype = Object.create(parent.prototype, {
|
||||
constructor: {
|
||||
value: child,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
child.__proto__ = parent;
|
||||
};
|
||||
|
||||
var Controller = _fxosMvcDistMvc.Controller;
|
||||
var App = _appJsModelsApp["default"];
|
||||
var AppsService = _appJsServicesAppsService["default"];
|
||||
var BroadcastService = _appJsServicesBroadcastService["default"];
|
||||
var HttpClientService = _appJsServicesHttpClientService["default"];
|
||||
var P2pService = _appJsServicesP2pService["default"];
|
||||
var WifiService = _appJsServicesWifiService["default"];
|
||||
var ShareSummaryView = _appJsViewsShareSummaryView["default"];
|
||||
var ListView = _appJsViewsListView["default"];
|
||||
var ProximityEmptyView = _appJsViewsProximityEmptyView["default"];
|
||||
var CompositeTemplate = _appJsViewsTemplatesComposite["default"];
|
||||
var ProximityAppsController = (function (Controller) {
|
||||
var ProximityAppsController = function ProximityAppsController() {
|
||||
var _this = this;
|
||||
this.shareSummaryView = new ShareSummaryView({
|
||||
controller: this
|
||||
});
|
||||
this.proximityEmptyView = new ProximityEmptyView({
|
||||
controller: this
|
||||
});
|
||||
this.proximityAppsView = new ListView({
|
||||
controller: this,
|
||||
id: "proximity-apps",
|
||||
title: "Available apps",
|
||||
type: "download",
|
||||
attr: "apps"
|
||||
});
|
||||
this.proximityAddonsView = new ListView({
|
||||
controller: this,
|
||||
id: "proximity-addons",
|
||||
title: "Available add-ons",
|
||||
type: "download",
|
||||
attr: "addons"
|
||||
});
|
||||
this.proximityThemesView = new ListView({
|
||||
controller: this,
|
||||
id: "proximity-themes",
|
||||
title: "Available themes",
|
||||
type: "download",
|
||||
attr: "themes"
|
||||
});
|
||||
this.marketplacesView = new ListView({
|
||||
controller: this,
|
||||
id: "marketplaces",
|
||||
title: "Marketplaces",
|
||||
type: "link",
|
||||
attr: "marketplaces"
|
||||
});
|
||||
this.view = new CompositeTemplate({
|
||||
controller: this,
|
||||
header: {
|
||||
title: "P2P Sharing"
|
||||
},
|
||||
active: true,
|
||||
id: "proximity-apps-container",
|
||||
views: [this.shareSummaryView, this.proximityEmptyView, this.proximityAppsView, this.proximityAddonsView, this.proximityThemesView, this.marketplacesView]
|
||||
});
|
||||
|
||||
BroadcastService.addEventListener("broadcast", function (e) {
|
||||
return _this._broadcastChanged(e);
|
||||
}, true);
|
||||
|
||||
P2pService.addEventListener("proximity", function () {
|
||||
return _this._renderList();
|
||||
}, true);
|
||||
|
||||
AppsService.addEventListener("updated", function () {
|
||||
return _this._renderList();
|
||||
}, true);
|
||||
|
||||
WifiService.addEventListener("statuschange", function () {
|
||||
return _this._renderList();
|
||||
});
|
||||
|
||||
this._renderList();
|
||||
};
|
||||
|
||||
_extends(ProximityAppsController, Controller);
|
||||
|
||||
ProximityAppsController.prototype.main = function () {
|
||||
this.view.el.classList.add("active");
|
||||
};
|
||||
|
||||
ProximityAppsController.prototype.teardown = function () {
|
||||
this.view.el.classList.remove("active");
|
||||
};
|
||||
|
||||
ProximityAppsController.prototype.download = function (e) {
|
||||
var id = e.target.dataset.id;
|
||||
var apps = P2pService.getApps();
|
||||
var app = App.getApp(apps, { manifestURL: id });
|
||||
|
||||
Sharing.ConfirmDownloadController.open(app, function () {
|
||||
var progressDialogController = Sharing.ProgressDialogController;
|
||||
|
||||
progressDialogController.main();
|
||||
|
||||
HttpClientService.downloadApp(app).then(progressDialogController.success.bind(progressDialogController), progressDialogController.error.bind(progressDialogController));
|
||||
});
|
||||
};
|
||||
|
||||
ProximityAppsController.prototype.open = function (e) {
|
||||
var id = e.target.dataset.id;
|
||||
navigator.mozApps.mgmt.getAll().then(function (apps) {
|
||||
apps.forEach(function (app) {
|
||||
if (app.manifestURL === id) {
|
||||
app.launch();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
ProximityAppsController.prototype.description = function (e) {
|
||||
// In case the tap hit a child node of the <div> element with the data-id
|
||||
// attribute set.
|
||||
var appId = e.target.dataset.id || e.target.parentNode.dataset.id;
|
||||
var list = e.target.closest(".app-list");
|
||||
if (list.classList.contains("link")) {
|
||||
this.open(e);
|
||||
} else {
|
||||
Sharing.AppController.main(appId);
|
||||
}
|
||||
};
|
||||
|
||||
ProximityAppsController.prototype.openSharePanel = function () {
|
||||
this.teardown();
|
||||
Sharing.ShareController.main();
|
||||
};
|
||||
|
||||
ProximityAppsController.prototype._broadcastChanged = function (e) {
|
||||
this.shareSummaryView.displayBroadcast(e.broadcast);
|
||||
};
|
||||
|
||||
ProximityAppsController.prototype._renderList = function () {
|
||||
var _this2 = this;
|
||||
var proxApps = P2pService.getApps();
|
||||
|
||||
AppsService.getApps(true /* include defaults */).then(function (installedApps) {
|
||||
var apps = App.filterApps(proxApps);
|
||||
var addons = App.filterAddons(proxApps);
|
||||
var themes = App.filterThemes(proxApps);
|
||||
var marketplaces = App.filterMarketplaces(installedApps);
|
||||
|
||||
var proximityEmpty = apps.length === 0 && addons.length === 0 && themes.length === 0;
|
||||
var noNetwork = !WifiService.isConnected();
|
||||
_this2.proximityEmptyView.render();
|
||||
_this2.proximityEmptyView.show({
|
||||
proximityEmpty: proximityEmpty,
|
||||
noNetwork: noNetwork
|
||||
});
|
||||
|
||||
_this2.proximityAppsView.render(App.markInstalledApps(installedApps, apps));
|
||||
|
||||
_this2.proximityAddonsView.render(App.markInstalledApps(installedApps, addons));
|
||||
|
||||
_this2.proximityThemesView.render(App.markInstalledApps(installedApps, themes));
|
||||
|
||||
_this2.marketplacesView.render(marketplaces);
|
||||
});
|
||||
};
|
||||
|
||||
return ProximityAppsController;
|
||||
})(Controller);
|
||||
|
||||
exports["default"] = ProximityAppsController;
|
||||
});
|
||||
168
gaia/distros/spark/apps/sharing/js/controllers/share_controller.js
Executable file
168
gaia/distros/spark/apps/sharing/js/controllers/share_controller.js
Executable file
|
|
@ -0,0 +1,168 @@
|
|||
define(["exports", "fxos-mvc/dist/mvc", "app/js/models/app", "app/js/services/apps_service", "app/js/services/broadcast_service", "app/js/services/device_name_service", "app/js/services/share_service", "app/js/views/share_settings_view", "app/js/views/list_view", "app/js/views/templates/composite"], function (exports, _fxosMvcDistMvc, _appJsModelsApp, _appJsServicesAppsService, _appJsServicesBroadcastService, _appJsServicesDeviceNameService, _appJsServicesShareService, _appJsViewsShareSettingsView, _appJsViewsListView, _appJsViewsTemplatesComposite) {
|
||||
"use strict";
|
||||
|
||||
var _extends = function (child, parent) {
|
||||
child.prototype = Object.create(parent.prototype, {
|
||||
constructor: {
|
||||
value: child,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
child.__proto__ = parent;
|
||||
};
|
||||
|
||||
var Controller = _fxosMvcDistMvc.Controller;
|
||||
var App = _appJsModelsApp["default"];
|
||||
var AppsService = _appJsServicesAppsService["default"];
|
||||
var BroadcastService = _appJsServicesBroadcastService["default"];
|
||||
var DeviceNameService = _appJsServicesDeviceNameService["default"];
|
||||
var ShareService = _appJsServicesShareService["default"];
|
||||
var ShareSettingsView = _appJsViewsShareSettingsView["default"];
|
||||
var ListView = _appJsViewsListView["default"];
|
||||
var CompositeTemplate = _appJsViewsTemplatesComposite["default"];
|
||||
var ShareController = (function (Controller) {
|
||||
var ShareController = function ShareController() {
|
||||
var _this = this;
|
||||
this.shareSettingsView = new ShareSettingsView({
|
||||
controller: this
|
||||
});
|
||||
this.sharedAppsView = new ListView({
|
||||
controller: this,
|
||||
id: "shared-apps",
|
||||
title: "My apps",
|
||||
type: "toggle",
|
||||
disabled: true
|
||||
});
|
||||
this.sharedAddonsView = new ListView({
|
||||
controller: this,
|
||||
id: "shared-addons",
|
||||
title: "My add-ons",
|
||||
type: "toggle",
|
||||
disabled: true
|
||||
});
|
||||
this.sharedThemesView = new ListView({
|
||||
controller: this,
|
||||
id: "shared-themes",
|
||||
title: "My themes",
|
||||
type: "toggle",
|
||||
disabled: true
|
||||
});
|
||||
this.view = new CompositeTemplate({
|
||||
controller: this,
|
||||
header: {
|
||||
title: "Share My Apps",
|
||||
action: "back"
|
||||
},
|
||||
id: "share-apps-container",
|
||||
views: [this.shareSettingsView, this.sharedAppsView, this.sharedAddonsView, this.sharedThemesView]
|
||||
});
|
||||
|
||||
BroadcastService.addEventListener("broadcast", function (e) {
|
||||
return _this._broadcastChanged(e);
|
||||
}, true);
|
||||
|
||||
DeviceNameService.addEventListener("devicenamechange", function (e) {
|
||||
return _this._deviceNameChanged(e);
|
||||
}, true);
|
||||
|
||||
DeviceNameService.addEventListener("devicenamechange-cancel", function () {
|
||||
return _this.back();
|
||||
});
|
||||
|
||||
AppsService.addEventListener("updated", function () {
|
||||
return _this._appsChanged();
|
||||
}, true);
|
||||
|
||||
DeviceNameService.getDeviceName().then(function (deviceName) {
|
||||
_this._deviceNameChanged({ deviceName: deviceName });
|
||||
});
|
||||
};
|
||||
|
||||
_extends(ShareController, Controller);
|
||||
|
||||
ShareController.prototype.main = function () {
|
||||
this.view.el.classList.add("active");
|
||||
|
||||
if (DeviceNameService.isDefault()) {
|
||||
Sharing.DeviceNameController.main();
|
||||
}
|
||||
};
|
||||
|
||||
ShareController.prototype.teardown = function () {
|
||||
this.view.el.classList.remove("active");
|
||||
};
|
||||
|
||||
ShareController.prototype._appsChanged = function () {
|
||||
var _this2 = this;
|
||||
// We want to fetch all of our apps, even if we're not broadcasting them, so
|
||||
// that we can show them greyed out.
|
||||
var options = { ignoreBroadcast: true };
|
||||
|
||||
Promise.all([AppsService.getApps(), ShareService.getApps(options)]).then(function (results) {
|
||||
var installedApps = results[0];
|
||||
var sharedApps = results[1];
|
||||
var apps = App.markSharedApps(sharedApps, installedApps);
|
||||
|
||||
_this2.sharedAppsView.render(App.filterApps(apps));
|
||||
_this2.sharedAddonsView.render(App.filterAddons(apps));
|
||||
_this2.sharedThemesView.render(App.filterThemes(apps));
|
||||
});
|
||||
};
|
||||
|
||||
ShareController.prototype.toggleBroadcasting = function (toggle) {
|
||||
BroadcastService.setBroadcast(toggle);
|
||||
};
|
||||
|
||||
ShareController.prototype._broadcastChanged = function (e) {
|
||||
var broadcast = e.broadcast;
|
||||
this.shareSettingsView.displayBroadcast(broadcast);
|
||||
this.sharedAppsView.toggle(!broadcast);
|
||||
this.sharedAddonsView.toggle(!broadcast);
|
||||
this.sharedThemesView.toggle(!broadcast);
|
||||
};
|
||||
|
||||
ShareController.prototype._deviceNameChanged = function (e) {
|
||||
this.shareSettingsView.deviceName = e.deviceName;
|
||||
};
|
||||
|
||||
ShareController.prototype.back = function () {
|
||||
this.teardown();
|
||||
Sharing.ProximityAppsController.main();
|
||||
};
|
||||
|
||||
ShareController.prototype.toggle = function (e) {
|
||||
if (e && e.preventDefault) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
var el = e.target.querySelector(".control") || e.target;
|
||||
var checked = el.checked;
|
||||
|
||||
AppsService.getApps().then(function (apps) {
|
||||
var app = App.getApp(apps, { manifestURL: el.dataset.id });
|
||||
|
||||
ShareService.setAppShare(app, !checked);
|
||||
|
||||
// If there's a .control element under this one, then the user must have
|
||||
// tapped on the description.
|
||||
if (e.target.querySelector(".control")) {
|
||||
el.toggle();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
ShareController.prototype.description = function (e) {
|
||||
this.toggle({ target: e.target.parentNode });
|
||||
};
|
||||
|
||||
ShareController.prototype.rename = function () {
|
||||
Sharing.DeviceNameController.main();
|
||||
};
|
||||
|
||||
return ShareController;
|
||||
})(Controller);
|
||||
|
||||
exports["default"] = ShareController;
|
||||
});
|
||||
Loading…
Reference in a new issue