Skip to content

Instantly share code, notes, and snippets.

@yzen
Created March 27, 2015 21:08
Show Gist options
  • Save yzen/64b3529f0e1397b0123e to your computer and use it in GitHub Desktop.
Save yzen/64b3529f0e1397b0123e to your computer and use it in GitHub Desktop.
diff --git a/app/js/controller/list_controller.js b/app/js/controller/list_controller.js
index 7f4197c..762b3c3 100644
--- a/app/js/controller/list_controller.js
+++ b/app/js/controller/list_controller.js
@@ -6,6 +6,8 @@ import AppListView from 'js/view/app_list_view';
import AddonListView from 'js/view/addon_list_view';
import DetailsView from 'js/view/details_view';
+import { ActivityHandler } from 'js/lib/helpers';
+
export default class ListController extends Controller {
constructor() {
this.installedApps = Object.create(null);
@@ -16,6 +18,8 @@ export default class ListController extends Controller {
this.addonView = new AddonListView();
this.detailsView = new DetailsView();
+ this.activityHandler = new ActivityHandler();
+
this.tabsView.onTabChange(this.handleTabChange.bind(this));
document.addEventListener('visibilitychange',
this.refreshInstalledList.bind(this));
@@ -33,7 +37,7 @@ export default class ListController extends Controller {
createListIfNeeded() {
if (!this.alreadyCreated) {
- this.tabsView.render();
+ this.tabsView.render({selected: 1});
document.body.appendChild(this.tabsView.el);
this.appView.render();
document.body.appendChild(this.appView.el);
@@ -95,7 +99,7 @@ export default class ListController extends Controller {
}
handleTabChange(activeTab) {
- if (activeTab === 'Apps') {
+ if (activeTab === 'apps') {
this.appView.activate();
this.addonView.deactivate();
} else {
diff --git a/app/js/lib/helpers.js b/app/js/lib/helpers.js
index a41d428..1fe3037 100644
--- a/app/js/lib/helpers.js
+++ b/app/js/lib/helpers.js
@@ -49,3 +49,16 @@ export class ManifestHelper {
(manifest1.type === 'privileged' && manifest2.type !== 'certified');
}
}
+
+export class ActivityHandler {
+ constructor() {
+ navigator.mozSetMessageHandler('activity', this.handleActivity.bind(this));
+ }
+
+ handleActivity(activity) {
+ var activitySource = activity.source;
+ if (activitySource.name !== 'install') {
+ return;
+ }
+ }
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment