Remove common-interface dependency from cryptpad-common

This commit is contained in:
yflory
2017-11-13 12:00:15 +01:00
parent dc207393fd
commit c9e1de042c
26 changed files with 233 additions and 399 deletions

View File

@@ -29,13 +29,13 @@ define([
var Messages = Cryptpad.Messages;
var APP = {};
var onConnectError = function () {
Cryptpad.errorLoadingScreen(Messages.websocketError);
UI.errorLoadingScreen(Messages.websocketError);
};
var common;
var sFrameChan;
nThen(function (waitFor) {
$(waitFor(Cryptpad.addLoadingScreen));
$(waitFor(UI.addLoadingScreen));
SFCommon.create(waitFor(function (c) { APP.common = common = c; }));
}).nThen(function (waitFor) {
sFrameChan = common.getSframeChannel();
@@ -87,13 +87,13 @@ define([
UI.create(messenger, $(friendList), $(messaging), common);
Cryptpad.removeLoadingScreen();
UI.removeLoadingScreen();
/*
sFrameChan.query('Q_HEY_BUDDY', null, function (err, data) {
if (!data) { return; }
if (data.error) {
Cryptpad.warn(data.error);
UI.warn(data.error);
} else {
UI.log(data.response);
}

View File

@@ -4,13 +4,14 @@ define([
'/customize/messages.js',
'/common/common-util.js',
'/common/common-interface.js',
'/common/common-notifier.js',
'/common/hyperscript.js',
'/bower_components/marked/marked.min.js',
'/common/media-tag.js',
], function ($, Cryptpad, Messages, Util, UI, h, Marked, MediaTag) {
], function ($, Cryptpad, Messages, Util, UI, Notifier, h, Marked, MediaTag) {
'use strict';
var UI = {};
var MessengerUI = {};
var m = function (md) {
var d = h('div.cp-app-contacts-content');
@@ -42,7 +43,7 @@ define([
};
};
UI.create = function (messenger, $userlist, $messages, common) {
MessengerUI.create = function (messenger, $userlist, $messages, common) {
var origin = common.getMetadataMgr().getPrivateData().origin;
var state = window.state = {
@@ -391,7 +392,7 @@ define([
var initializing = true;
messenger.on('message', function (message) {
if (!initializing) { Cryptpad.notify(); }
if (!initializing) { Notifier.notify(); }
var curvePublic = message.curve;
var name = displayNames[curvePublic];
@@ -516,7 +517,7 @@ define([
count--;
if (count === 0) {
initializing = false;
Cryptpad.removeLoadingScreen();
UI.removeLoadingScreen();
}
};
ready();
@@ -526,5 +527,5 @@ define([
});
};
return UI;
return MessengerUI;
});