Browse Source

fix(mixin): access platformService as property, not function, in PlatformServiceMixin

- Fix all computed properties to use platformService as a property
- Add descriptive @ts-expect-error comments for dynamic property access
- Resolves 'this.platformService is not a function' runtime error
- Lint clean
pull/142/head
Matthew Raymer 2 days ago
parent
commit
9b1b0e828e
  1. 7
      src/components/DataExportSection.vue
  2. 20
      src/utils/PlatformServiceMixin.ts

7
src/components/DataExportSection.vue

@ -100,6 +100,13 @@ export default class DataExportSection extends Vue {
*/ */
notify = createNotifyHelpers(this.$notify); notify = createNotifyHelpers(this.$notify);
/**
* NOTE: PlatformServiceMixin provides both concise helpers (e.g. $contacts, capabilities)
* and the full platformService instance for advanced/native features (e.g. writeAndShareFile).
* Always use 'this.platformService' as a property (never as a function).
*/
declare readonly platformService: import("@/services/PlatformService").PlatformService;
/** /**
* Computed property to check if we're on web platform * Computed property to check if we're on web platform
*/ */

20
src/utils/PlatformServiceMixin.ts

@ -121,30 +121,26 @@ export const PlatformServiceMixin = {
* Platform detection utilities * Platform detection utilities
*/ */
isCapacitor(): boolean { isCapacitor(): boolean {
return (this as unknown as VueComponentWithMixin) // @ts-expect-error Accessing computed property value from Vue instance
.platformService() return this["platformService"].isCapacitor();
.isCapacitor();
}, },
isWeb(): boolean { isWeb(): boolean {
return (this as unknown as VueComponentWithMixin) // @ts-expect-error Accessing computed property value from Vue instance
.platformService() return this["platformService"].isWeb();
.isWeb();
}, },
isElectron(): boolean { isElectron(): boolean {
return (this as unknown as VueComponentWithMixin) // @ts-expect-error Accessing computed property value from Vue instance
.platformService() return this["platformService"].isElectron();
.isElectron();
}, },
/** /**
* Platform capabilities * Platform capabilities
*/ */
capabilities() { capabilities() {
return (this as unknown as VueComponentWithMixin) // @ts-expect-error Accessing computed property value from Vue instance
.platformService() return this["platformService"].getCapabilities();
.getCapabilities();
}, },
}, },

Loading…
Cancel
Save