mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1170535: anchor the social share panel to the Hello button whilst sharing a room URL and enable the Social Provider Activation panel in release. r=mixedpuppy,Standard8
This commit is contained in:
parent
04e4fd34de
commit
ceb0bc88bf
@ -1747,13 +1747,9 @@ pref("loop.contextInConversations.enabled", true);
|
||||
|
||||
pref("social.sidebar.unload_timeout_ms", 10000);
|
||||
|
||||
// activation from inside of share panel is possible if activationPanelEnabled
|
||||
// Activation from inside of share panel is possible if activationPanelEnabled
|
||||
// is true. Pref'd off for release while usage testing is done through beta.
|
||||
#ifdef EARLY_BETA_OR_EARLIER
|
||||
pref("social.share.activationPanelEnabled", true);
|
||||
#else
|
||||
pref("social.share.activationPanelEnabled", false);
|
||||
#endif
|
||||
pref("social.shareDirectory", "https://activations.cdn.mozilla.net/sharePanel.html");
|
||||
|
||||
pref("dom.identity.enabled", false);
|
||||
|
@ -304,9 +304,12 @@ SocialActivationListener = {
|
||||
// and has never been visible, so we check the widget directly. If
|
||||
// there is no area for the widget we move it into the toolbar.
|
||||
let widget = CustomizableUI.getWidget("social-share-button");
|
||||
if (!widget.areaType) {
|
||||
// If the panel is already open, we can be sure that the provider can
|
||||
// already be accessed, possibly anchored to another toolbar button.
|
||||
// In that case we don't move the widget.
|
||||
if (!widget.areaType && SocialShare.panel.state != "open") {
|
||||
CustomizableUI.addWidgetToArea("social-share-button", CustomizableUI.AREA_NAVBAR);
|
||||
// ensure correct state
|
||||
// Ensure correct state.
|
||||
SocialUI.onCustomizeEnd(window);
|
||||
}
|
||||
|
||||
@ -473,6 +476,9 @@ SocialShare = {
|
||||
let widget = CustomizableUI.getWidget("social-share-button");
|
||||
return widget.forWindow(window).anchor;
|
||||
},
|
||||
// Holds the anchor node in use whilst the panel is open, because it may vary.
|
||||
_currentAnchor: null,
|
||||
|
||||
get panel() {
|
||||
return document.getElementById("social-share-panel");
|
||||
},
|
||||
@ -578,12 +584,13 @@ SocialShare = {
|
||||
},
|
||||
|
||||
onShowing: function() {
|
||||
this.anchor.setAttribute("open", "true");
|
||||
(this._currentAnchor || this.anchor).setAttribute("open", "true");
|
||||
this.iframe.addEventListener("click", this._onclick, true);
|
||||
},
|
||||
|
||||
onHidden: function() {
|
||||
this.anchor.removeAttribute("open");
|
||||
(this._currentAnchor || this.anchor).removeAttribute("open");
|
||||
this._currentAnchor = null;
|
||||
this.iframe.removeEventListener("click", this._onclick, true);
|
||||
this.iframe.setAttribute("src", "data:text/plain;charset=utf8,");
|
||||
// make sure that the frame is unloaded after it is hidden
|
||||
@ -597,7 +604,7 @@ SocialShare = {
|
||||
}
|
||||
},
|
||||
|
||||
sharePage: function(providerOrigin, graphData, target) {
|
||||
sharePage: function(providerOrigin, graphData, target, anchor) {
|
||||
// if providerOrigin is undefined, we use the last-used provider, or the
|
||||
// current/default provider. The provider selection in the share panel
|
||||
// will call sharePage with an origin for us to switch to.
|
||||
@ -630,7 +637,7 @@ SocialShare = {
|
||||
pageData[p] = graphData[p];
|
||||
}
|
||||
}
|
||||
this.sharePage(providerOrigin, pageData, target);
|
||||
this.sharePage(providerOrigin, pageData, target, anchor);
|
||||
});
|
||||
gBrowser.selectedBrowser.messageManager.sendAsyncMessage("PageMetadata:GetPageData");
|
||||
return;
|
||||
@ -640,7 +647,7 @@ SocialShare = {
|
||||
messageManager.addMessageListener("PageMetadata:MicrodataResult", _dataFn = (msg) => {
|
||||
messageManager.removeMessageListener("PageMetadata:MicrodataResult", _dataFn);
|
||||
pageData.microdata = msg.data;
|
||||
this.sharePage(providerOrigin, pageData, target);
|
||||
this.sharePage(providerOrigin, pageData, target, anchor);
|
||||
});
|
||||
gBrowser.selectedBrowser.messageManager.sendAsyncMessage("PageMetadata:GetMicrodata", null, { target });
|
||||
return;
|
||||
@ -653,7 +660,7 @@ SocialShare = {
|
||||
else
|
||||
provider = this.getSelectedProvider();
|
||||
if (!provider || !provider.shareURL) {
|
||||
this.showDirectory();
|
||||
this.showDirectory(anchor);
|
||||
return;
|
||||
}
|
||||
// check the menu button
|
||||
@ -713,10 +720,10 @@ SocialShare = {
|
||||
let uri = Services.io.newURI(shareEndpoint, null, null);
|
||||
iframe.setAttribute("origin", provider.origin);
|
||||
iframe.setAttribute("src", shareEndpoint);
|
||||
this._openPanel();
|
||||
this._openPanel(anchor);
|
||||
},
|
||||
|
||||
showDirectory: function() {
|
||||
showDirectory: function(anchor) {
|
||||
this._createFrame();
|
||||
let iframe = this.iframe;
|
||||
if (iframe.getAttribute("src") == "about:providerdirectory")
|
||||
@ -740,11 +747,12 @@ SocialShare = {
|
||||
}, true);
|
||||
}, true);
|
||||
iframe.setAttribute("src", "about:providerdirectory");
|
||||
this._openPanel();
|
||||
this._openPanel(anchor);
|
||||
},
|
||||
|
||||
_openPanel: function() {
|
||||
let anchor = document.getAnonymousElementByAttribute(this.anchor, "class", "toolbarbutton-icon");
|
||||
_openPanel: function(anchor) {
|
||||
this._currentAnchor = anchor || this.anchor;
|
||||
anchor = document.getAnonymousElementByAttribute(this._currentAnchor, "class", "toolbarbutton-icon");
|
||||
this.panel.openPopup(anchor, "bottomcenter topright", 0, 0, false, false);
|
||||
Services.telemetry.getHistogramById("SOCIAL_TOOLBAR_BUTTONS").add(0);
|
||||
}
|
||||
|
@ -77,7 +77,6 @@ loop.store = loop.store || {};
|
||||
* @type {Array}
|
||||
*/
|
||||
actions: [
|
||||
"addSocialShareButton",
|
||||
"addSocialShareProvider",
|
||||
"createRoom",
|
||||
"createdRoom",
|
||||
@ -375,15 +374,6 @@ loop.store = loop.store || {};
|
||||
this._mozLoop.notifyUITour("Loop:RoomURLShared");
|
||||
},
|
||||
|
||||
/**
|
||||
* Add the Social Share button to the browser toolbar.
|
||||
*
|
||||
* @param {sharedActions.AddSocialShareButton} actionData The action data.
|
||||
*/
|
||||
addSocialShareButton: function(actionData) {
|
||||
this._mozLoop.addSocialShareButton();
|
||||
},
|
||||
|
||||
/**
|
||||
* Open the share panel to add a Social share provider.
|
||||
*
|
||||
|
@ -79,16 +79,9 @@ loop.roomViews = (function(mozL10n) {
|
||||
dispatcher: React.PropTypes.instanceOf(loop.Dispatcher).isRequired,
|
||||
roomUrl: React.PropTypes.string,
|
||||
show: React.PropTypes.bool.isRequired,
|
||||
socialShareButtonAvailable: React.PropTypes.bool,
|
||||
socialShareProviders: React.PropTypes.array
|
||||
},
|
||||
|
||||
handleToolbarAddButtonClick: function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
this.props.dispatcher.dispatch(new sharedActions.AddSocialShareButton());
|
||||
},
|
||||
|
||||
handleAddServiceClick: function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
@ -121,34 +114,9 @@ loop.roomViews = (function(mozL10n) {
|
||||
"share-service-dropdown": true,
|
||||
"dropdown-menu": true,
|
||||
"visually-hidden": true,
|
||||
"share-button-unavailable": !this.props.socialShareButtonAvailable,
|
||||
"hide": !this.props.show
|
||||
});
|
||||
|
||||
// When the button is not yet available, we offer to put it in the navbar
|
||||
// for the user.
|
||||
if (!this.props.socialShareButtonAvailable) {
|
||||
return (
|
||||
React.createElement("div", {className: shareDropdown},
|
||||
React.createElement("div", {className: "share-panel-header"},
|
||||
mozL10n.get("share_panel_header")
|
||||
),
|
||||
React.createElement("div", {className: "share-panel-body"},
|
||||
|
||||
mozL10n.get("share_panel_body", {
|
||||
brandShortname: mozL10n.get("brandShortname"),
|
||||
clientSuperShortname: mozL10n.get("clientSuperShortname")
|
||||
})
|
||||
|
||||
),
|
||||
React.createElement("button", {className: "btn btn-info btn-toolbar-add",
|
||||
onClick: this.handleToolbarAddButtonClick},
|
||||
mozL10n.get("add_to_toolbar_button")
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
React.createElement("ul", {className: shareDropdown},
|
||||
React.createElement("li", {className: "dropdown-menu-item", onClick: this.handleAddServiceClick},
|
||||
@ -188,7 +156,8 @@ loop.roomViews = (function(mozL10n) {
|
||||
roomData: React.PropTypes.object.isRequired,
|
||||
savingContext: React.PropTypes.bool,
|
||||
show: React.PropTypes.bool.isRequired,
|
||||
showContext: React.PropTypes.bool.isRequired
|
||||
showContext: React.PropTypes.bool.isRequired,
|
||||
socialShareProviders: React.PropTypes.array
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
@ -223,6 +192,14 @@ loop.roomViews = (function(mozL10n) {
|
||||
handleShareButtonClick: function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var providers = this.props.socialShareProviders;
|
||||
// If there are no providers available currently, save a click by dispatching
|
||||
// the 'AddSocialShareProvider' right away.
|
||||
if (!providers || !providers.length) {
|
||||
this.props.dispatcher.dispatch(new sharedActions.AddSocialShareProvider());
|
||||
return;
|
||||
}
|
||||
|
||||
this.toggleDropdownMenu();
|
||||
},
|
||||
|
||||
@ -280,7 +257,6 @@ loop.roomViews = (function(mozL10n) {
|
||||
dispatcher: this.props.dispatcher,
|
||||
roomUrl: this.props.roomData.roomUrl,
|
||||
show: this.state.showMenu,
|
||||
socialShareButtonAvailable: this.props.socialShareButtonAvailable,
|
||||
socialShareProviders: this.props.socialShareProviders,
|
||||
ref: "menu"}),
|
||||
React.createElement(DesktopRoomContextView, {
|
||||
@ -709,7 +685,6 @@ loop.roomViews = (function(mozL10n) {
|
||||
savingContext: this.state.savingContext,
|
||||
show: shouldRenderInvitationOverlay,
|
||||
showContext: shouldRenderContextView,
|
||||
socialShareButtonAvailable: this.state.socialShareButtonAvailable,
|
||||
socialShareProviders: this.state.socialShareProviders}),
|
||||
React.createElement("div", {className: "video-layout-wrapper"},
|
||||
React.createElement("div", {className: "conversation room-conversation"},
|
||||
|
@ -79,16 +79,9 @@ loop.roomViews = (function(mozL10n) {
|
||||
dispatcher: React.PropTypes.instanceOf(loop.Dispatcher).isRequired,
|
||||
roomUrl: React.PropTypes.string,
|
||||
show: React.PropTypes.bool.isRequired,
|
||||
socialShareButtonAvailable: React.PropTypes.bool,
|
||||
socialShareProviders: React.PropTypes.array
|
||||
},
|
||||
|
||||
handleToolbarAddButtonClick: function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
this.props.dispatcher.dispatch(new sharedActions.AddSocialShareButton());
|
||||
},
|
||||
|
||||
handleAddServiceClick: function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
@ -121,34 +114,9 @@ loop.roomViews = (function(mozL10n) {
|
||||
"share-service-dropdown": true,
|
||||
"dropdown-menu": true,
|
||||
"visually-hidden": true,
|
||||
"share-button-unavailable": !this.props.socialShareButtonAvailable,
|
||||
"hide": !this.props.show
|
||||
});
|
||||
|
||||
// When the button is not yet available, we offer to put it in the navbar
|
||||
// for the user.
|
||||
if (!this.props.socialShareButtonAvailable) {
|
||||
return (
|
||||
<div className={shareDropdown}>
|
||||
<div className="share-panel-header">
|
||||
{mozL10n.get("share_panel_header")}
|
||||
</div>
|
||||
<div className="share-panel-body">
|
||||
{
|
||||
mozL10n.get("share_panel_body", {
|
||||
brandShortname: mozL10n.get("brandShortname"),
|
||||
clientSuperShortname: mozL10n.get("clientSuperShortname")
|
||||
})
|
||||
}
|
||||
</div>
|
||||
<button className="btn btn-info btn-toolbar-add"
|
||||
onClick={this.handleToolbarAddButtonClick}>
|
||||
{mozL10n.get("add_to_toolbar_button")}
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<ul className={shareDropdown}>
|
||||
<li className="dropdown-menu-item" onClick={this.handleAddServiceClick}>
|
||||
@ -188,7 +156,8 @@ loop.roomViews = (function(mozL10n) {
|
||||
roomData: React.PropTypes.object.isRequired,
|
||||
savingContext: React.PropTypes.bool,
|
||||
show: React.PropTypes.bool.isRequired,
|
||||
showContext: React.PropTypes.bool.isRequired
|
||||
showContext: React.PropTypes.bool.isRequired,
|
||||
socialShareProviders: React.PropTypes.array
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
@ -223,6 +192,14 @@ loop.roomViews = (function(mozL10n) {
|
||||
handleShareButtonClick: function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var providers = this.props.socialShareProviders;
|
||||
// If there are no providers available currently, save a click by dispatching
|
||||
// the 'AddSocialShareProvider' right away.
|
||||
if (!providers || !providers.length) {
|
||||
this.props.dispatcher.dispatch(new sharedActions.AddSocialShareProvider());
|
||||
return;
|
||||
}
|
||||
|
||||
this.toggleDropdownMenu();
|
||||
},
|
||||
|
||||
@ -280,7 +257,6 @@ loop.roomViews = (function(mozL10n) {
|
||||
dispatcher={this.props.dispatcher}
|
||||
roomUrl={this.props.roomData.roomUrl}
|
||||
show={this.state.showMenu}
|
||||
socialShareButtonAvailable={this.props.socialShareButtonAvailable}
|
||||
socialShareProviders={this.props.socialShareProviders}
|
||||
ref="menu" />
|
||||
<DesktopRoomContextView
|
||||
@ -709,7 +685,6 @@ loop.roomViews = (function(mozL10n) {
|
||||
savingContext={this.state.savingContext}
|
||||
show={shouldRenderInvitationOverlay}
|
||||
showContext={shouldRenderContextView}
|
||||
socialShareButtonAvailable={this.state.socialShareButtonAvailable}
|
||||
socialShareProviders={this.state.socialShareProviders} />
|
||||
<div className="video-layout-wrapper">
|
||||
<div className="conversation room-conversation">
|
||||
|
@ -944,40 +944,12 @@ body[platform="win"] .share-service-dropdown.overflow > .dropdown-menu-item {
|
||||
-moz-padding-end: 20px;
|
||||
}
|
||||
|
||||
.share-service-dropdown.share-button-unavailable {
|
||||
width: 230px;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.share-service-dropdown > .dropdown-menu-item > .icon {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.share-service-dropdown .share-panel-header {
|
||||
background-image: url("../img/icons-16x16.svg#share-darkgrey");
|
||||
background-size: 3em 3em;
|
||||
background-repeat: no-repeat;
|
||||
min-height: 3em;
|
||||
font-weight: bold;
|
||||
margin-bottom: 1em;
|
||||
padding-left: 4.5em;
|
||||
}
|
||||
|
||||
body[dir=rtl] .share-service-dropdown .share-panel-header {
|
||||
background-position: top right;
|
||||
padding-left: 0;
|
||||
padding-right: 4.5em;
|
||||
}
|
||||
|
||||
.share-service-dropdown .btn-toolbar-add {
|
||||
padding: 4px 2px;
|
||||
border-radius: 2px;
|
||||
margin-top: 1em;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dropdown-menu-item > .icon-add-share-service {
|
||||
background-image: url("../img/icons-16x16.svg#add");
|
||||
background-repeat: no-repeat;
|
||||
|
@ -400,13 +400,6 @@ loop.shared.actions = (function() {
|
||||
roomUrl: String
|
||||
}),
|
||||
|
||||
/**
|
||||
* Add the Social Share button to the browser toolbar.
|
||||
* XXX: should move to some roomActions module - refs bug 1079284
|
||||
*/
|
||||
AddSocialShareButton: Action.define("addSocialShareButton", {
|
||||
}),
|
||||
|
||||
/**
|
||||
* Open the share panel to add a Social share provider.
|
||||
* XXX: should move to some roomActions module - refs bug 1079284
|
||||
@ -436,7 +429,6 @@ loop.shared.actions = (function() {
|
||||
roomOwner: String,
|
||||
roomToken: String,
|
||||
roomUrl: String,
|
||||
socialShareButtonAvailable: Boolean,
|
||||
socialShareProviders: Array
|
||||
}),
|
||||
|
||||
@ -460,7 +452,6 @@ loop.shared.actions = (function() {
|
||||
* XXX: should move to some roomActions module - refs bug 1079284
|
||||
*/
|
||||
UpdateSocialShareInfo: Action.define("updateSocialShareInfo", {
|
||||
socialShareButtonAvailable: Boolean,
|
||||
socialShareProviders: Array
|
||||
}),
|
||||
|
||||
|
@ -115,8 +115,6 @@ loop.store.ActiveRoomStore = (function() {
|
||||
roomInfoFailure: null,
|
||||
// The name of the room.
|
||||
roomName: null,
|
||||
// Social API state.
|
||||
socialShareButtonAvailable: false,
|
||||
socialShareProviders: null
|
||||
};
|
||||
},
|
||||
@ -218,7 +216,6 @@ loop.store.ActiveRoomStore = (function() {
|
||||
roomName: roomData.decryptedContext.roomName,
|
||||
roomOwner: roomData.roomOwner,
|
||||
roomUrl: roomData.roomUrl,
|
||||
socialShareButtonAvailable: this._mozLoop.isSocialShareButtonAvailable(),
|
||||
socialShareProviders: this._mozLoop.getSocialShareProviders()
|
||||
}));
|
||||
|
||||
@ -337,7 +334,6 @@ loop.store.ActiveRoomStore = (function() {
|
||||
roomState: ROOM_STATES.READY,
|
||||
roomToken: actionData.roomToken,
|
||||
roomUrl: actionData.roomUrl,
|
||||
socialShareButtonAvailable: actionData.socialShareButtonAvailable,
|
||||
socialShareProviders: actionData.socialShareProviders
|
||||
});
|
||||
|
||||
@ -379,7 +375,6 @@ loop.store.ActiveRoomStore = (function() {
|
||||
*/
|
||||
updateSocialShareInfo: function(actionData) {
|
||||
this.setStoreState({
|
||||
socialShareButtonAvailable: actionData.socialShareButtonAvailable,
|
||||
socialShareProviders: actionData.socialShareProviders
|
||||
});
|
||||
},
|
||||
@ -418,7 +413,6 @@ loop.store.ActiveRoomStore = (function() {
|
||||
*/
|
||||
_handleSocialShareUpdate: function() {
|
||||
this.dispatchAction(new sharedActions.UpdateSocialShareInfo({
|
||||
socialShareButtonAvailable: this._mozLoop.isSocialShareButtonAvailable(),
|
||||
socialShareProviders: this._mozLoop.getSocialShareProviders()
|
||||
}));
|
||||
},
|
||||
|
@ -969,58 +969,6 @@ function injectLoopAPI(targetWindow) {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if the Social Share widget is available in any of the registered
|
||||
* widget areas (navbar, MenuPanel, etc).
|
||||
*
|
||||
* @return {Boolean} `true` if the widget is available and `false` when it's
|
||||
* still in the Customization palette.
|
||||
*/
|
||||
isSocialShareButtonAvailable: {
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: function() {
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
if (!win || !win.CustomizableUI) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let widget = win.CustomizableUI.getWidget(kShareWidgetId);
|
||||
if (widget) {
|
||||
if (!socialShareButtonListenersAdded) {
|
||||
let eventName = "social:" + kShareWidgetId;
|
||||
Services.obs.addObserver(onShareWidgetChanged, eventName + "-added", false);
|
||||
Services.obs.addObserver(onShareWidgetChanged, eventName + "-removed", false);
|
||||
socialShareButtonListenersAdded = true;
|
||||
}
|
||||
return !!widget.areaType;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Add the Social Share widget to the navbar area, but only when it's not
|
||||
* located anywhere else than the Customization palette.
|
||||
*/
|
||||
addSocialShareButton: {
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: function() {
|
||||
// Don't do anything if the button is already available.
|
||||
if (api.isSocialShareButtonAvailable.value()) {
|
||||
return;
|
||||
}
|
||||
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
if (!win || !win.CustomizableUI) {
|
||||
return;
|
||||
}
|
||||
win.CustomizableUI.addWidgetToArea(kShareWidgetId, win.CustomizableUI.AREA_NAVBAR);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Activates the Social Share panel with the Social Provider panel opened
|
||||
* when the popup open.
|
||||
@ -1029,23 +977,18 @@ function injectLoopAPI(targetWindow) {
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: function() {
|
||||
// Don't do anything if the button is _not_ available.
|
||||
if (!api.isSocialShareButtonAvailable.value()) {
|
||||
return;
|
||||
}
|
||||
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
if (!win || !win.SocialShare) {
|
||||
return;
|
||||
}
|
||||
win.SocialShare.showDirectory();
|
||||
win.SocialShare.showDirectory(win.LoopUI.toolbarButton.anchor);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a sorted list of Social Providers that can share URLs. See
|
||||
* `updateSocialProvidersCache()` for more information.
|
||||
*
|
||||
*
|
||||
* @return {Array} Sorted list of share-capable Social Providers.
|
||||
*/
|
||||
getSocialShareProviders: {
|
||||
@ -1087,7 +1030,8 @@ function injectLoopAPI(targetWindow) {
|
||||
if (body) {
|
||||
graphData.body = body;
|
||||
}
|
||||
win.SocialShare.sharePage(providerOrigin, graphData);
|
||||
win.SocialShare.sharePage(providerOrigin, graphData, null,
|
||||
win.LoopUI.toolbarButton.anchor);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -447,16 +447,6 @@ describe("loop.store.RoomStore", function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe("#addSocialShareButton", function() {
|
||||
it("should invoke to the correct mozLoop function", function() {
|
||||
fakeMozLoop.addSocialShareButton = sinon.stub();
|
||||
|
||||
store.addSocialShareButton(new sharedActions.AddSocialShareButton());
|
||||
|
||||
sinon.assert.calledOnce(fakeMozLoop.addSocialShareButton);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#addSocialShareProvider", function() {
|
||||
it("should invoke to the correct mozLoop function", function() {
|
||||
fakeMozLoop.addSocialShareProvider = sinon.stub();
|
||||
|
@ -28,7 +28,6 @@ describe("loop.roomViews", function () {
|
||||
previews: [],
|
||||
title: ""
|
||||
}),
|
||||
isSocialShareButtonAvailable: sinon.stub(),
|
||||
rooms: {
|
||||
get: sinon.stub().callsArgWith(1, null, {
|
||||
roomToken: "fakeToken",
|
||||
@ -211,11 +210,27 @@ describe("loop.roomViews", function () {
|
||||
});
|
||||
|
||||
describe("Share button", function() {
|
||||
beforeEach(function() {
|
||||
it("should dispatch a AddSocialShareProvider action when the share button is clicked", function() {
|
||||
view = mountTestComponent();
|
||||
|
||||
var shareBtn = view.getDOMNode().querySelector(".btn-share");
|
||||
|
||||
React.addons.TestUtils.Simulate.click(shareBtn);
|
||||
|
||||
sinon.assert.calledOnce(dispatcher.dispatch);
|
||||
sinon.assert.calledWith(dispatcher.dispatch,
|
||||
new sharedActions.AddSocialShareProvider());
|
||||
});
|
||||
|
||||
it("should toggle the share dropdown when the share button is clicked", function() {
|
||||
view = mountTestComponent({
|
||||
socialShareProviders: [{
|
||||
name: "foo",
|
||||
origin: "https://foo",
|
||||
iconURL: "http://example.com/foo.png"
|
||||
}]
|
||||
});
|
||||
|
||||
var shareBtn = view.getDOMNode().querySelector(".btn-share");
|
||||
|
||||
React.addons.TestUtils.Simulate.click(shareBtn);
|
||||
@ -552,18 +567,8 @@ describe("loop.roomViews", function () {
|
||||
expect(view.getDOMNode()).to.eql(null);
|
||||
});
|
||||
|
||||
it("should show different contents when the Share XUL button is not available", function() {
|
||||
view = mountTestComponent({
|
||||
socialShareProviders: []
|
||||
});
|
||||
|
||||
var node = view.getDOMNode();
|
||||
expect(node.querySelector(".share-panel-header")).to.not.eql(null);
|
||||
});
|
||||
|
||||
it("should show an empty list when no Social Providers are available", function() {
|
||||
view = mountTestComponent({
|
||||
socialShareButtonAvailable: true,
|
||||
socialShareProviders: []
|
||||
});
|
||||
|
||||
@ -574,7 +579,6 @@ describe("loop.roomViews", function () {
|
||||
|
||||
it("should show a list of available Social Providers", function() {
|
||||
view = mountTestComponent({
|
||||
socialShareButtonAvailable: true,
|
||||
socialShareProviders: [fakeProvider]
|
||||
});
|
||||
|
||||
@ -590,26 +594,10 @@ describe("loop.roomViews", function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe("#handleToolbarAddButtonClick", function() {
|
||||
it("should dispatch an action when the 'add to toolbar' button is clicked", function() {
|
||||
view = mountTestComponent({
|
||||
socialShareProviders: []
|
||||
});
|
||||
|
||||
var addButton = view.getDOMNode().querySelector(".btn-toolbar-add");
|
||||
React.addons.TestUtils.Simulate.click(addButton);
|
||||
|
||||
sinon.assert.calledOnce(dispatcher.dispatch);
|
||||
sinon.assert.calledWithExactly(dispatcher.dispatch,
|
||||
new sharedActions.AddSocialShareButton());
|
||||
});
|
||||
});
|
||||
|
||||
describe("#handleAddServiceClick", function() {
|
||||
it("should dispatch an action when the 'add provider' item is clicked", function() {
|
||||
view = mountTestComponent({
|
||||
socialShareProviders: [],
|
||||
socialShareButtonAvailable: true
|
||||
socialShareProviders: []
|
||||
});
|
||||
|
||||
var addItem = view.getDOMNode().querySelector(".dropdown-menu-item:first-child");
|
||||
@ -625,7 +613,6 @@ describe("loop.roomViews", function () {
|
||||
it("should dispatch an action when a provider item is clicked", function() {
|
||||
view = mountTestComponent({
|
||||
roomUrl: "http://example.com",
|
||||
socialShareButtonAvailable: true,
|
||||
socialShareProviders: [fakeProvider]
|
||||
});
|
||||
|
||||
|
@ -13,7 +13,6 @@ const {SocialService} = Cu.import("resource://gre/modules/SocialService.jsm", {}
|
||||
|
||||
add_task(loadLoopPanel);
|
||||
|
||||
const kShareWidgetId = "social-share-button";
|
||||
const kShareProvider = {
|
||||
name: "provider 1",
|
||||
origin: "https://example.com",
|
||||
@ -32,51 +31,7 @@ registerCleanupFunction(function* () {
|
||||
SocialShare.uninit();
|
||||
});
|
||||
|
||||
add_task(function* test_mozLoop_isSocialShareButtonAvailable() {
|
||||
Assert.ok(gMozLoopAPI, "mozLoop should exist");
|
||||
|
||||
// First make sure the Social Share button is not available. This is probably
|
||||
// already the case, but make it explicit here.
|
||||
CustomizableUI.removeWidgetFromArea(kShareWidgetId);
|
||||
|
||||
Assert.ok(!gMozLoopAPI.isSocialShareButtonAvailable(),
|
||||
"Social Share button should not be available");
|
||||
|
||||
// Add the widget to the navbar.
|
||||
CustomizableUI.addWidgetToArea(kShareWidgetId, CustomizableUI.AREA_NAVBAR);
|
||||
|
||||
Assert.ok(gMozLoopAPI.isSocialShareButtonAvailable(),
|
||||
"Social Share button should be available");
|
||||
|
||||
// Add the widget to the MenuPanel.
|
||||
CustomizableUI.addWidgetToArea(kShareWidgetId, CustomizableUI.AREA_PANEL);
|
||||
|
||||
Assert.ok(gMozLoopAPI.isSocialShareButtonAvailable(),
|
||||
"Social Share button should still be available");
|
||||
|
||||
// Test button removal during the same session.
|
||||
CustomizableUI.removeWidgetFromArea(kShareWidgetId);
|
||||
|
||||
Assert.ok(!gMozLoopAPI.isSocialShareButtonAvailable(),
|
||||
"Social Share button should not be available");
|
||||
});
|
||||
|
||||
add_task(function* test_mozLoop_addSocialShareButton() {
|
||||
gMozLoopAPI.addSocialShareButton();
|
||||
|
||||
Assert.ok(gMozLoopAPI.isSocialShareButtonAvailable(),
|
||||
"Social Share button should be available");
|
||||
|
||||
let widget = CustomizableUI.getWidget(kShareWidgetId);
|
||||
Assert.strictEqual(widget.areaType, CustomizableUI.TYPE_TOOLBAR,
|
||||
"Social Share button should be placed in the navbar");
|
||||
|
||||
CustomizableUI.removeWidgetFromArea(kShareWidgetId);
|
||||
});
|
||||
|
||||
add_task(function* test_mozLoop_addSocialShareProvider() {
|
||||
gMozLoopAPI.addSocialShareButton();
|
||||
|
||||
gMozLoopAPI.addSocialShareProvider();
|
||||
|
||||
yield promiseWaitForCondition(() => SocialShare.panel.state == "open");
|
||||
@ -85,7 +40,6 @@ add_task(function* test_mozLoop_addSocialShareProvider() {
|
||||
"Provider directory page should be visible");
|
||||
|
||||
SocialShare.panel.hidePopup();
|
||||
CustomizableUI.removeWidgetFromArea(kShareWidgetId);
|
||||
});
|
||||
|
||||
add_task(function* test_mozLoop_getSocialShareProviders() {
|
||||
@ -131,8 +85,6 @@ add_task(function* test_mozLoop_getSocialShareProviders() {
|
||||
});
|
||||
|
||||
add_task(function* test_mozLoop_socialShareRoom() {
|
||||
gMozLoopAPI.addSocialShareButton();
|
||||
|
||||
gMozLoopAPI.socialShareRoom(kShareProvider.origin, "https://someroom.com", "Some Title");
|
||||
|
||||
yield promiseWaitForCondition(() => SocialShare.panel.state == "open");
|
||||
@ -143,5 +95,4 @@ add_task(function* test_mozLoop_socialShareRoom() {
|
||||
"Provider's share page should be displayed");
|
||||
|
||||
SocialShare.panel.hidePopup();
|
||||
CustomizableUI.removeWidgetFromArea(kShareWidgetId);
|
||||
});
|
||||
|
@ -37,7 +37,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
},
|
||||
setScreenShareState: sinon.stub(),
|
||||
getActiveTabWindowId: sandbox.stub().callsArgWith(0, null, 42),
|
||||
isSocialShareButtonAvailable: sinon.stub().returns(false),
|
||||
getSocialShareProviders: sinon.stub().returns([])
|
||||
};
|
||||
|
||||
@ -289,7 +288,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
roomName: fakeRoomData.decryptedContext.roomName,
|
||||
roomOwner: fakeRoomData.roomOwner,
|
||||
roomUrl: fakeRoomData.roomUrl,
|
||||
socialShareButtonAvailable: false,
|
||||
socialShareProviders: []
|
||||
}));
|
||||
});
|
||||
@ -550,7 +548,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
roomOwner: "Me",
|
||||
roomToken: "fakeToken",
|
||||
roomUrl: "http://invalid",
|
||||
socialShareButtonAvailable: false,
|
||||
socialShareProviders: []
|
||||
};
|
||||
});
|
||||
@ -569,7 +566,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
expect(state.roomOwner).eql(fakeRoomInfo.roomOwner);
|
||||
expect(state.roomToken).eql(fakeRoomInfo.roomToken);
|
||||
expect(state.roomUrl).eql(fakeRoomInfo.roomUrl);
|
||||
expect(state.socialShareButtonAvailable).eql(false);
|
||||
expect(state.socialShareProviders).eql([]);
|
||||
});
|
||||
});
|
||||
@ -606,7 +602,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
|
||||
beforeEach(function() {
|
||||
fakeSocialShareInfo = {
|
||||
socialShareButtonAvailable: true,
|
||||
socialShareProviders: [{
|
||||
name: "foo",
|
||||
origin: "https://example.com",
|
||||
@ -619,8 +614,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
store.updateSocialShareInfo(new sharedActions.UpdateSocialShareInfo(fakeSocialShareInfo));
|
||||
|
||||
var state = store.getStoreState();
|
||||
expect(state.socialShareButtonAvailable)
|
||||
.eql(fakeSocialShareInfo.socialShareButtonAvailable);
|
||||
expect(state.socialShareProviders)
|
||||
.eql(fakeSocialShareInfo.socialShareProviders);
|
||||
});
|
||||
@ -1368,7 +1361,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
sinon.assert.calledOnce(dispatcher.dispatch);
|
||||
sinon.assert.calledWithExactly(dispatcher.dispatch,
|
||||
new sharedActions.UpdateSocialShareInfo({
|
||||
socialShareButtonAvailable: false,
|
||||
socialShareProviders: []
|
||||
}));
|
||||
});
|
||||
@ -1376,7 +1368,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
it("should call respective mozLoop methods", function() {
|
||||
store._handleSocialShareUpdate();
|
||||
|
||||
sinon.assert.calledOnce(fakeMozLoop.isSocialShareButtonAvailable);
|
||||
sinon.assert.calledOnce(fakeMozLoop.getSocialShareProviders);
|
||||
});
|
||||
});
|
||||
@ -1389,7 +1380,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
roomOwner: "Me",
|
||||
roomToken: "fakeToken",
|
||||
roomUrl: "http://invalid",
|
||||
socialShareButtonAvailable: false,
|
||||
socialShareProviders: []
|
||||
}));
|
||||
});
|
||||
@ -1438,7 +1428,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
||||
beforeEach(function() {
|
||||
store.setupRoomInfo(new sharedActions.SetupRoomInfo(
|
||||
_.extend(fakeRoomData, {
|
||||
socialShareButtonAvailable: false,
|
||||
socialShareProviders: []
|
||||
})
|
||||
));
|
||||
|
@ -74,11 +74,6 @@ share_tweet=Join me for a video conversation on {{clientShortname2}}!
|
||||
|
||||
share_button3=Share Link
|
||||
share_add_service_button=Add a Service
|
||||
add_to_toolbar_button=Add the Share panel to my toolbar
|
||||
share_panel_header=Share the web with your friends!
|
||||
## LOCALIZATION NOTE (share_panel_body): In this item, don't translate the part
|
||||
## between {{..}}.
|
||||
share_panel_body={{brandShortname}}'s new Share panel allows you to quickly share links or {{clientSuperShortname}} invitations with your favourite social networks.
|
||||
copy_url_button2=Copy Link
|
||||
copied_url_button=Copied!
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user