Skip to content

Commit

Permalink
Merge branch 'PB-34226_When-starting-the-application-without-internet…
Browse files Browse the repository at this point in the history
…-connection-the-refresh-button-works' into 'release'

PB-34225_As-a-user-I-want-to-see-the-error-message-screen-without-it-to-crash_Pierre-Colart

See merge request passbolt/desktop/passbolt-windows!156
  • Loading branch information
scadra committed Jul 26, 2024
2 parents 26011ce + 3112a0e commit b63513c
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
3 changes: 1 addition & 2 deletions passbolt/Models/Messaging/AllowedTopics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ public class AllowedTopics
public const string BACKGROUND_SET_LOCALE = "passbolt.background.set-locale";
public const string BACKGROUND_AUTHENTICATION_ERROR = "passbolt.background.authentication-error";
public const string RENDERED_READY = "passbolt.rendered.is-ready";
public const string RENDERED_STARTED = "passbolt.rendered.started";
public const string BACKGROUND_GET_COOKIE = "passbolt.background.get-cookie";
public const string BACKGROUND_ROTATE_KEY = "passbolt.background.rotate-private-key";
public const string RENDERED_RELOAD = "passbolt.tab.reload";

private static List<string> topics = new List<string>() { BACKGROUND_READY, ERROR, BACKGROUND_DOWNLOAD_FILE, BACKGROUND_STORE_PASSPHRASE, BACKGROUND_SET_THEME, BACKGROUND_SET_SECURITY_TOKEN, BACKGROUND_SET_LOCALE, RENDERED_READY, BACKGROUND_AFTER_LOGOUT, BACKGROUND_GET_COOKIE, BACKGROUND_ROTATE_KEY, BACKGROUND_AUTHENTICATION_ERROR, RENDERED_RELOAD, RENDERED_STARTED };
private static List<string> topics = new List<string>() { BACKGROUND_READY, ERROR, BACKGROUND_DOWNLOAD_FILE, BACKGROUND_STORE_PASSPHRASE, BACKGROUND_SET_THEME, BACKGROUND_SET_SECURITY_TOKEN, BACKGROUND_SET_LOCALE, RENDERED_READY, BACKGROUND_AFTER_LOGOUT, BACKGROUND_GET_COOKIE, BACKGROUND_ROTATE_KEY, BACKGROUND_AUTHENTICATION_ERROR, RENDERED_RELOAD };
private static List<string> requestIds = new List<string>();
private static Dictionary<string, string> pendingRequests = new Dictionary<string, string>();

Expand Down
14 changes: 2 additions & 12 deletions passbolt/Models/Messaging/Webviews/RenderedTopic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ namespace passbolt.Models.Messaging
public class RenderedTopic : WebviewTopic
{
private List<string> topics = new List<string>();
private bool isRefreshed = false;

public RenderedTopic(WebView2 background, WebView2 rendered, LocalFolderService localFolderService, RenderedWebviewService renderedWebviewService) : base(background, rendered, localFolderService, renderedWebviewService) {
topics.AddRange(ListHelper.GetClassContantsToList(typeof(AccountRecoveryTopics)));
Expand Down Expand Up @@ -58,7 +57,6 @@ public RenderedTopic(WebView2 background, WebView2 rendered, LocalFolderService
topics.AddRange(ListHelper.GetClassContantsToList(typeof(UserTopics)));
topics.Add(AllowedTopics.RENDERED_READY);
topics.Add(AllowedTopics.RENDERED_RELOAD);
topics.Add(AllowedTopics.RENDERED_STARTED);
}


Expand All @@ -82,23 +80,15 @@ public override async void ProceedMessage(IPC ipc)
{
AllowedTopics.AddRequestId(ipc.requestId);
}
if(ipc.topic == AllowedTopics.RENDERED_STARTED)
{
if(this.isRefreshed)
{
rendered.CoreWebView2.PostWebMessageAsJson(SerializationHelper.SerializeToJson(new IPC(AllowedTopics.BACKGROUND_READY)));
this.isRefreshed = false;
}
}
if (ipc.topic == RbacTopics.FIND_ME)
{
//We intercept the requestId and save it to map the response
AllowedTopics.AddPendingRequest(ipc.requestId, RbacTopics.FIND_ME);
}
if(ipc.topic == AllowedTopics.RENDERED_RELOAD)
{
rendered.CoreWebView2.Reload();
this.isRefreshed = true;
rendered.CoreWebView2.Reload();
background.CoreWebView2.Reload();
return;
}

Expand Down
1 change: 0 additions & 1 deletion passbolt/Webviews/Rendered/src/AppAuthentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class AppAuthentication extends Component {
*/
async listen() {
await localStorage.clear();
this.props.port.emit("passbolt.rendered.started");
this.props.port.on("passbolt.background.is-ready", this.handleBackgroundReady);
}

Expand Down
1 change: 0 additions & 1 deletion passbolt/Webviews/Rendered/src/AppImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class AppImport extends Component {
}

async componentDidMount() {
this.props.port.emit("passbolt.rendered.started");
await localStorage.clear();
}

Expand Down

0 comments on commit b63513c

Please sign in to comment.