All files / src/lib/electron/dialog confirmIncompatiblePlugin.ts

66.67% Statements 4/6
0% Branches 0/4
0% Functions 0/1
66.67% Lines 4/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 301x 1x   1x                                                 1x  
import { dialog } from "electron";
import l10n from "shared/lib/lang/l10n";
 
const confirmIncompatiblePlugin = (
  version: string,
  pluginSupportedVersion: string
) => {
  const isPrerelease = version.includes("-alpha") || version.includes("-beta");
 
  return dialog.showMessageBoxSync({
    type: "info",
    buttons: [l10n("FIELD_INSTALL_ANYWAY"), l10n("DIALOG_CANCEL")],
    defaultId: 0,
    cancelId: 1,
    title: l10n("DIALOG_PLUGIN_INCOMPATIBLE_WITH_YOUR_GBSTUDIO"),
    message: l10n("DIALOG_PLUGIN_INCOMPATIBLE_WITH_YOUR_GBSTUDIO"),
    detail: l10n(
      isPrerelease
        ? "DIALOG_PLUGIN_INCOMPATIBLE_WITH_YOUR_GBSTUDIO_PRERELEASE_DESC"
        : "DIALOG_PLUGIN_INCOMPATIBLE_WITH_YOUR_GBSTUDIO_DESC",
      {
        version,
        pluginSupportedVersion,
      }
    ),
  });
};
 
export default confirmIncompatiblePlugin;