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 13, 2024
1 parent eb8812b commit 6a6955f
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 10 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 @@ -18,17 +18,17 @@ import {
import { injectKey } from '@/presentation/injectionSymbols';
import ModalDialog from '@/presentation/components/Shared/Modal/ModalDialog.vue';
import { ScriptingLanguage } from '@/domain/ScriptingLanguage';
import { type IScriptingDefinition } from '@/domain/IScriptingDefinition';
import { type IScriptingDefinition } from '@/domain/ScriptingDefinition';

Check failure on line 21 in src/presentation/components/Code/CodeButtons/Save/CodeSaveButton.vue

View workflow job for this annotation

GitHub Actions / build-web (macos, development)

'"@/domain/ScriptingDefinition"' has no exported member named 'IScriptingDefinition'. Did you mean 'ScriptingDefinition'?

Check failure on line 21 in src/presentation/components/Code/CodeButtons/Save/CodeSaveButton.vue

View workflow job for this annotation

GitHub Actions / build-web (macos, production)

'"@/domain/ScriptingDefinition"' has no exported member named 'IScriptingDefinition'. Did you mean 'ScriptingDefinition'?

Check failure on line 21 in src/presentation/components/Code/CodeButtons/Save/CodeSaveButton.vue

View workflow job for this annotation

GitHub Actions / build-web (macos, test)

'"@/domain/ScriptingDefinition"' has no exported member named 'IScriptingDefinition'. Did you mean 'ScriptingDefinition'?

Check failure on line 21 in src/presentation/components/Code/CodeButtons/Save/CodeSaveButton.vue

View workflow job for this annotation

GitHub Actions / build-web (ubuntu, development)

'"@/domain/ScriptingDefinition"' has no exported member named 'IScriptingDefinition'. Did you mean 'ScriptingDefinition'?

Check failure on line 21 in src/presentation/components/Code/CodeButtons/Save/CodeSaveButton.vue

View workflow job for this annotation

GitHub Actions / build-web (ubuntu, production)

'"@/domain/ScriptingDefinition"' has no exported member named 'IScriptingDefinition'. Did you mean 'ScriptingDefinition'?

Check failure on line 21 in src/presentation/components/Code/CodeButtons/Save/CodeSaveButton.vue

View workflow job for this annotation

GitHub Actions / build-web (ubuntu, test)

'"@/domain/ScriptingDefinition"' has no exported member named 'IScriptingDefinition'. Did you mean 'ScriptingDefinition'?

Check failure on line 21 in src/presentation/components/Code/CodeButtons/Save/CodeSaveButton.vue

View workflow job for this annotation

GitHub Actions / build-web (windows, development)

'"@/domain/ScriptingDefinition"' has no exported member named 'IScriptingDefinition'. Did you mean 'ScriptingDefinition'?

Check failure on line 21 in src/presentation/components/Code/CodeButtons/Save/CodeSaveButton.vue

View workflow job for this annotation

GitHub Actions / build-web (windows, production)

'"@/domain/ScriptingDefinition"' has no exported member named 'IScriptingDefinition'. Did you mean 'ScriptingDefinition'?

Check failure on line 21 in src/presentation/components/Code/CodeButtons/Save/CodeSaveButton.vue

View workflow job for this annotation

GitHub Actions / build-web (windows, test)

'"@/domain/ScriptingDefinition"' has no exported member named 'IScriptingDefinition'. Did you mean 'ScriptingDefinition'?
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 6a6955f

Please sign in to comment.