Skip to content

Commit

Permalink
Updated to v8.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
klasjersevi committed Jul 13, 2021
1 parent 5c3acc8 commit 0b22d22
Show file tree
Hide file tree
Showing 19 changed files with 98 additions and 28 deletions.
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog for Weavy

## 8.5.0 (2021-07-13)

* Added "message"-event on apps in client for postMessage from the panel frame.
* Added .postMessage() on apps in client to send messages to the panel frame.
* Fixed an issue with sign out in Messenger.
* Trigger all downloads in top window for easier WebView handling.
* Fixed an issue with scrolling in Messenger.

## 8.4.4 (2021-07-09)

* Fixed an issue when downloading files in cross-domain environments.
Expand Down
Binary file modified lib/Weavy.Bundler.dll
Binary file not shown.
Binary file modified lib/Weavy.Bundler.pdb
Binary file not shown.
Binary file modified lib/Weavy.Core.dll
Binary file not shown.
Binary file modified lib/Weavy.Core.pdb
Binary file not shown.
Binary file modified lib/Weavy.Web.dll
Binary file not shown.
Binary file modified lib/Weavy.Web.pdb
Binary file not shown.
Binary file modified lib/wvy.exe
Binary file not shown.
Binary file modified lib/wvy.pdb
Binary file not shown.
4 changes: 2 additions & 2 deletions src/Areas/Apps/Scripts/messenger.js
Original file line number Diff line number Diff line change
Expand Up @@ -1343,11 +1343,11 @@ wvy.messenger = (function ($) {

// scroll to bottom of messages
function scrollToBottomOfMessages(origin) {
if (document.body.classList.contains("two")) {
if (document.body.classList.contains("two") || document.body.classList.contains("dual") && window.matchMedia("(min-width: 768px)").matches) {
toggleOSSleep({ matches: true });

var el = getScrollParent(document.getElementById("sending"));
//console.debug("scrolling #messages", origin, el.scrollHeight);
//console.log("scrolling #messages", origin, el.scrollHeight, document.body.classList.contains("two"), document.body.classList.contains("dual"), window.matchMedia("(min-width: 768px)"));
el.scrollTop = el.scrollHeight;

requestAnimationFrame(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/Areas/Apps/Views/Messenger/Messenger.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<button type="button" class="btn btn-icon dropdown-toggle top-right" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">@Svg.Icon("dots-vertical")</button>
<div class="dropdown-menu dropdown-menu-right">
<button type="button" class="dropdown-item" data-toggle="modal" data-target="#settings-modal">@T["Settings"]</button>
@if (WeavyContext.Browser.Mobile) {
@if (!WeavyContext.IsEmbedded && (WeavyContext.Browser.Mobile || WeavyContext.Browser.Tablet)) {
<a class="dropdown-item" href="~/sign-out?path=/@Weavy.Areas.Apps.Controllers.MessengerController.MESSENGER_PREFIX" id="signout">@T["Sign out"]</a>
}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
[assembly: Guid("70cffd0f-7b12-43ec-9c57-9080937a6b04")]

// Assembly version
[assembly: AssemblyVersion("8.4.4")]
[assembly: AssemblyVersion("8.5.0")]
35 changes: 35 additions & 0 deletions src/Scripts/src/client/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,22 @@
*/
weavy.on("panel-close", bridgePanelEvent.bind(app, "close", panelId, { space: app.space, app: app }));

/**
* Triggered when the app receives a postMessage sent from the panel frame.
*
* @category events
* @event WeavyApp#message
* @returns {Object}
* @property {WeavySpace} space - The space that the app belongs to
* @property {WeavyApp} app - The app that fires the event
* @extends WeavyPanels#event:message
*/
app.on("before:message", (e, message) => {
if (message.panelId === panelId) {
return WeavyUtils.assign(message, { space: app.space, app: app });
}
});

app.whenBuilt.resolve(app);
}
}
Expand Down Expand Up @@ -651,6 +667,25 @@
return whenRemoved;
}

/**
* Sends postMessage to the app panel frame.
* Returns a promise that is resolved when the message has been delivered and rejected if the message fails or has timed out.
*
* @category panel
* @function WeavyApp#postMessage
* @param {object} message - The Message to send
* @param {Transferable[]} [transfer] - A sequence of Transferable objects that are transferred with the message.
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage}
* @returns {external:Promise}
* */
WeavyApp.prototype.postMessage = function (message, transfer) {
var app = this;
return app.whenBuilt().then(function () {
return app.panel.postMessage(message, transfer);
});
}


/**
* Check if another app or an object is matching this app. It checks for a match of the id property or the key property.
*
Expand Down
14 changes: 13 additions & 1 deletion src/Scripts/src/client/panels.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,9 +797,21 @@
}
}


/**
* Triggered when the app receives a postMessage sent from the panel frame.
*
* @category events
* @event WeavyPanels#message
* @returns {Object}
* @property {string} panelId - Id of the panel
*/
weavy.on(wvy.postal, "message", { weavyId: weavy.getId(), windowName: panel.frame.name }, (e, message) => panel.triggerEvent("message", WeavyUtils.assign(message, { panelId: panelId })));

/**
* Sends a postMessage to the panel iframe.
*
* Returns a promise that is resolved when the message has been delivered and rejected if the message fails or has timed out.
*
* @function
* @name WeavyPanels~panel#postMessage
* @param {object} message - The Message to send
Expand Down
2 changes: 1 addition & 1 deletion src/Scripts/src/postal.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@
return;
}

message.weavyId = _parentWeavyId || true;
message.weavyId = message.weavyId || true;

return whenPostMessage(window.self, message, transfer);
}
Expand Down
5 changes: 5 additions & 0 deletions src/Scripts/src/server/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@
// close all dropdown menus
$('.dropdown-menu').removeClass("show");
});

window.addEventListener("beforeunload", function (e) {
// close all dropdown menus
$('.dropdown-menu').removeClass("show");
});
})(jQuery);
46 changes: 28 additions & 18 deletions src/Scripts/src/server/turbolinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ wvy.turbolinks = (function ($) {

// Show progress when navigating without Turbolinks
window.addEventListener("beforeunload", function (e) {
if (enabled && !(wvy.browser.mobile && !wvy.browser.webView)) {
console.log("BEFORE UNLOAD", e);
if (enabled && wvy.postal.isLeader && !(wvy.browser.mobile && !wvy.browser.webView)) {
console.debug("progress for unload", window.name);
showProgress();
}
});

window.addEventListener("unload", function () {
if (enabled && !(wvy.browser.mobile && !wvy.browser.webView)) {
if (enabled) {
hideProgress();
}
});
Expand Down Expand Up @@ -93,12 +93,13 @@ wvy.turbolinks = (function ($) {
}

// Open downloads natively in mobile
function openDownload(url, force) {
var link = wvy.url.hyperlink(url);
var isHttp = link.protocol.indexOf("http") === 0;
var isDownload = link.searchParams.has("d");
function openDownload(url, link) {
var downloadUrl = wvy.url.hyperlink(url);
var isHttp = downloadUrl.protocol.indexOf("http") === 0;
var isDownload = downloadUrl.searchParams.has("d");
var linkIsDownload = link && link.hasAttribute("download");

if (force || isDownload && isHttp) {
if (linkIsDownload || isDownload && isHttp) {
console.log("wvy.turbolinks: download url");

setTimeout(hideProgress, 1);
Expand All @@ -111,6 +112,16 @@ wvy.turbolinks = (function ($) {
}
} catch (e) { }


if (linkIsDownload) {
// a[download]
link.target = "_top";
} else if (!wvy.postal.isLeader) {
// ?d url
window.open(url, "_top");
return "window";
}

return true;
}

Expand Down Expand Up @@ -215,31 +226,30 @@ wvy.turbolinks = (function ($) {

// Catch navigating links before turbolinks:click
$(document).on("click", "a[href]", function (e) {
var nearestClickable = $(e.target).closest("A, BUTTON, .btn, input[type='button']").get(0);
var nearestClickable = e.target.closest("A, BUTTON, .btn, input[type='button']");

if (!e.isPropagationStopped() && !e.isDefaultPrevented() && (!nearestClickable || nearestClickable === this)) {
var href = this.href || $(this).attr("href");
var target = this.target || $(this).attr("target");
var href = this.href;
var target = this.target;

// Turbolinks listens to a[href]:not([target]):not([download])
// Turbolinks filters out extensions ending on other than .htm .html .xhtml

var targetIsBlank = target === '_blank';
var targetIsTop = target === '_top';
var targetIsDownload = $(this).is("[download]");
var isWebView = $("html").is(".webview");
var isWebView = document.documentElement.classList.contains("webview");

var forceExternal = targetIsBlank || isWebView && targetIsTop;
var forceDownload = targetIsDownload;

if (openExternal(href, forceExternal)) { // Check if url can open in new window
if (openExternal(href, forceExternal)) {
// If url can open in new window
e.preventDefault();
e.stopPropagation();
} else {
// Check if url is a download-url
var hasOpenedDownload = openDownload(href, forceDownload);
// If url is a download-url
var hasOpenedDownload = openDownload(href, this);
if (hasOpenedDownload) {
if (hasOpenedDownload === "native") {
if (hasOpenedDownload === "native" || hasOpenedDownload === "window") {
e.preventDefault();
}
e.stopPropagation();
Expand Down
8 changes: 4 additions & 4 deletions src/Weavy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -349,17 +349,17 @@
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Weavy.Bundler, Version=8.4.4.0, Culture=neutral, PublicKeyToken=null">
<Reference Include="Weavy.Bundler, Version=8.5.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\lib\Weavy.Bundler.dll</HintPath>
</Reference>
<Reference Include="Weavy.Core, Version=8.4.4.0, Culture=neutral, PublicKeyToken=null">
<Reference Include="Weavy.Core, Version=8.5.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\lib\Weavy.Core.dll</HintPath>
</Reference>
<Reference Include="Weavy.Web, Version=8.4.4.0, Culture=neutral, PublicKeyToken=null">
<Reference Include="Weavy.Web, Version=8.5.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\lib\Weavy.Web.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="wvy, Version=8.4.4.0, Culture=neutral, PublicKeyToken=null">
<Reference Include="wvy, Version=8.5.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\lib\wvy.exe</HintPath>
</Reference>
</ItemGroup>
Expand Down
Binary file modified tools/Weavy.Build.dll
Binary file not shown.

0 comments on commit 0b22d22

Please sign in to comment.