Skip to content

Commit

Permalink
Fix file save on desktop show browser instructions
Browse files Browse the repository at this point in the history
Previously, privacy.sexy was showing browser download/run instructions
modal on desktop version. However, this information is not relevant to
desktop users as they have option to run the script directly, and
locating a saved file is a straightforward process.

This commit prevents download/run instruction modal from appearing on
desktop version once a script is saved locally to the disk.
  • Loading branch information
undergroundwires committed Oct 14, 2024
1 parent eb8812b commit 65b10a3
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@click="saveCode"
/>
<ModalDialog v-model="areInstructionsVisible">
<RunInstructions :filename="filename" />
<BrowserRunInstructions :filename="filename" />
</ModalDialog>
</div>
</template>
Expand All @@ -23,12 +23,12 @@ import { ScriptFilename } from '@/application/CodeRunner/ScriptFilename';
import { FileType } from '@/presentation/common/Dialog';
import IconButton from '../IconButton.vue';
import { createScriptErrorDialog } from '../ScriptErrorDialog';
import RunInstructions from './RunInstructions/RunInstructions.vue';
import BrowserRunInstructions from './BrowserRunInstructions/BrowserRunInstructions.vue';
export default defineComponent({
components: {
IconButton,
RunInstructions,
BrowserRunInstructions,
ModalDialog,
},
setup() {
Expand All @@ -55,7 +55,12 @@ export default defineComponent({
}, scriptDiagnosticsCollector)));
return;
}
areInstructionsVisible.value = true;
if (!isRunningAsDesktopApplication) {
areInstructionsVisible.value = true;
}
// On desktop, it would be better to to prompt the user with a system
// dialog offering options after saving, such as:
// • Open Containing Folder • "Open File" in default text editor • Close
}
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect } from 'vitest';
import { VueWrapper, shallowMount } from '@vue/test-utils';
import CopyableCommand from '@/presentation/components/Code/CodeButtons/Save/RunInstructions/Steps/CopyableCommand.vue';
import CopyableCommand from '@/presentation/components/Code/CodeButtons/Save/BrowserRunInstructions/Steps/CopyableCommand.vue';
import { expectThrowsAsync } from '@tests/shared/Assertions/ExpectThrowsAsync';
import { InjectionKeys } from '@/presentation/injectionSymbols';
import type { Clipboard } from '@/presentation/components/Shared/Hooks/Clipboard/Clipboard';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { shallowMount } from '@vue/test-utils';
import PlatformInstructionSteps from '@/presentation/components/Code/CodeButtons/Save/RunInstructions/Steps/PlatformInstructionSteps.vue';
import PlatformInstructionSteps from '@/presentation/components/Code/CodeButtons/Save/BrowserRunInstructions/Steps/PlatformInstructionSteps.vue';
import { useCollectionState } from '@/presentation/components/Shared/Hooks/UseCollectionState';
import { InjectionKeys } from '@/presentation/injectionSymbols';
import { UseCollectionStateStub } from '@tests/unit/shared/Stubs/UseCollectionStateStub';
import { AllSupportedOperatingSystems, type SupportedOperatingSystem } from '@tests/shared/TestCases/SupportedOperatingSystems';
import { OperatingSystem } from '@/domain/OperatingSystem';
import { CategoryCollectionStateStub } from '@tests/unit/shared/Stubs/CategoryCollectionStateStub';
import WindowsInstructions from '@/presentation/components/Code/CodeButtons/Save/RunInstructions/Steps/Platforms/WindowsInstructions.vue';
import MacOsInstructions from '@/presentation/components/Code/CodeButtons/Save/RunInstructions/Steps/Platforms/MacOsInstructions.vue';
import LinuxInstructions from '@/presentation/components/Code/CodeButtons/Save/RunInstructions/Steps/Platforms/LinuxInstructions.vue';
import WindowsInstructions from '@/presentation/components/Code/CodeButtons/Save/BrowserRunInstructions/Steps/Platforms/WindowsInstructions.vue';
import MacOsInstructions from '@/presentation/components/Code/CodeButtons/Save/BrowserRunInstructions/Steps/Platforms/MacOsInstructions.vue';
import LinuxInstructions from '@/presentation/components/Code/CodeButtons/Save/BrowserRunInstructions/Steps/Platforms/LinuxInstructions.vue';
import type { Component } from 'vue';

describe('PlatformInstructionSteps', () => {
Expand Down

0 comments on commit 65b10a3

Please sign in to comment.