Skip to content

Commit

Permalink
Merge pull request #1675 from safing/fix/clipboard-bug
Browse files Browse the repository at this point in the history
Fix clipboard issue when coping debug info
  • Loading branch information
dhaavi authored Sep 3, 2024
2 parents 3775f5c + f465f95 commit cfd8777
Show file tree
Hide file tree
Showing 12 changed files with 741 additions and 348 deletions.
147 changes: 67 additions & 80 deletions desktop/angular/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions desktop/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
"@fortawesome/free-brands-svg-icons": "^6.4.0",
"@fortawesome/free-regular-svg-icons": "^6.4.0",
"@fortawesome/free-solid-svg-icons": "^6.4.0",
"@tauri-apps/api": ">=2.0.0-beta.0",
"@tauri-apps/plugin-cli": ">=2.0.0-beta.0",
"@tauri-apps/plugin-clipboard-manager": ">=2.0.0-beta.0",
"@tauri-apps/plugin-dialog": ">=2.0.0-beta.0",
"@tauri-apps/plugin-notification": ">=2.0.0-beta.0",
"@tauri-apps/plugin-os": ">=2.0.0-beta.0",
"@tauri-apps/plugin-shell": "^2.0.0-beta",
"@tauri-apps/api": ">=2.0.0-rc.1",
"@tauri-apps/plugin-cli": ">=2.0.0-rc.1",
"@tauri-apps/plugin-clipboard-manager": ">=2.0.0-rc.1",
"@tauri-apps/plugin-dialog": ">=2.0.0-rc.1",
"@tauri-apps/plugin-notification": ">=2.0.0-rc.1",
"@tauri-apps/plugin-os": ">=2.0.0-rc.1",
"@tauri-apps/plugin-shell": "^2.0.0-rc",
"autoprefixer": "^10.4.14",
"d3": "^7.8.4",
"data-urls": "^5.0.0",
Expand Down
60 changes: 31 additions & 29 deletions desktop/angular/src/app/integration/taur-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { writeText } from '@tauri-apps/plugin-clipboard-manager';
import { open } from '@tauri-apps/plugin-shell';
import { listen, once } from '@tauri-apps/api/event';
import { invoke } from '@tauri-apps/api/core'
import { getCurrent, Window } from '@tauri-apps/api/window';
import { getCurrentWindow, Window } from '@tauri-apps/api/window';

// Returns a new uuidv4. If crypto.randomUUID is not available it fals back to
// using Math.random(). While this is not as random as it should be it's still
Expand Down Expand Up @@ -102,7 +102,7 @@ export class TauriIntegrationService implements IntegrationService {
// we waste some system resources due to tauri window objects and the angular
// application.

getCurrent().hide()
getCurrentWindow().hide()

return Promise.resolve();
}
Expand Down Expand Up @@ -164,7 +164,7 @@ export class TauriIntegrationService implements IntegrationService {
}

openApp() {
Window.getByLabel("splash")?.close();
Window.getByLabel("splash").then(splash => { splash?.close();});
const current = Window.getCurrent()

current.isVisible()
Expand All @@ -177,40 +177,42 @@ export class TauriIntegrationService implements IntegrationService {
}

closePrompt() {
Window.getByLabel("prompt")?.close();
Window.getByLabel("prompt").then(window => { window?.close();});
}

openPrompt() {
if (!this.withPrompts) {
return;
}

if (Window.getByLabel("prompt")) {
return;
}
Window.getByLabel("prompt").then(prompt => {
if (prompt) {
return;
}

const promptWindow = new Window("prompt", {
alwaysOnTop: true,
decorations: false,
minimizable: false,
maximizable: false,
resizable: false,
title: 'Portmaster Prompt',
visible: false, // the prompt marks it self as visible.
skipTaskbar: true,
closable: false,
center: true,
width: 600,
height: 300,

// in src/main.ts we check the current location path
// and if it matches /prompt, we bootstrap the PromptEntryPointComponent
// instead of the AppComponent.
url: `http://${window.location.host}/prompt`,
} as any)

promptWindow.once("tauri://error", (err) => {
console.error(err);
const promptWindow = new Window("prompt", {
alwaysOnTop: true,
decorations: false,
minimizable: false,
maximizable: false,
resizable: false,
title: 'Portmaster Prompt',
visible: false, // the prompt marks it self as visible.
skipTaskbar: true,
closable: false,
center: true,
width: 600,
height: 300,

// in src/main.ts we check the current location path
// and if it matches /prompt, we bootstrap the PromptEntryPointComponent
// instead of the AppComponent.
url: `http://${window.location.host}/prompt`,
} as any)

promptWindow.once("tauri://error", (err) => {
console.error(err);
});
});
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { CommonModule } from "@angular/common";
import { Component, OnInit, TrackByFunction, inject } from "@angular/core";
import { AppProfile, AppProfileService, PortapiService } from "@safing/portmaster-api";
import { combineLatest, combineLatestAll, forkJoin, map, merge, mergeAll, of, switchMap } from "rxjs";
import { combineLatest, forkJoin, map, of, switchMap } from "rxjs";
import { ConnectionPrompt, NotificationType, NotificationsService } from "../services";
import { SfngAppIconModule } from "../shared/app-icon";
import { getCurrent } from '@tauri-apps/api/window';
import { getCurrentWindow } from '@tauri-apps/api/window';
import { CountryFlagModule } from "../shared/country-flag";

interface Prompt {
Expand Down Expand Up @@ -64,7 +64,7 @@ export class PromptEntryPointComponent implements OnInit {

// show the prompt now since we're ready
if (this.prompts.length) {
getCurrent()!.show();
getCurrentWindow()!.show();

Check warning on line 67 in desktop/angular/src/app/prompt-entrypoint/prompt-entrypoint.ts

View workflow job for this annotation

GitHub Actions / Lint

Forbidden non-null assertion

Check warning on line 67 in desktop/angular/src/app/prompt-entrypoint/prompt-entrypoint.ts

View workflow job for this annotation

GitHub Actions / Lint

Forbidden non-null assertion
}
})
}
Expand Down
Loading

0 comments on commit cfd8777

Please sign in to comment.