<?xml version="1.0"?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
    <!-- see https://wixtoolset.org/documentation/manual/v3/xsd/wix/bundle.html-->
    <!-- Attributes explicitly not used:
        Condition - the single msi files have their own install conditions, no need to copy them here
    -->

    <Bundle Name="Cryptomator" UpgradeCode="29eea626-2e5b-4449-b5f8-4602925ddf7b" Version="$(var.BundleVersion)" Manufacturer="$(var.BundleVendor)"
     AboutUrl="$(var.AboutUrl)" HelpUrl="$(var.HelpUrl)" UpdateUrl="$(var.UpdateUrl)" Copyright="$(var.BundleCopyright)" IconSourceFile="bundle\resources\Cryptomator.ico">

        <!-- detect outdated WinFsp installations -->
        <?include "resources\winFspMetaData.wxi" ?>
        <util:ProductSearch
            Variable="InstalledWinFspVersion"
            Result="version"
            UpgradeCode="82F812D9-4083-4EF1-8BC8-0F1EDA05B46B"
        />
        <!-- Note: The bundle engine takes the Message format literaly -->
        <bal:Condition Message=
"The WinFsp driver used by Cryptomator is outdated and must be removed before the installation.

1. Open the view of installed apps
2. Search for &quot;WinFsp&quot;
3. Uninstall the listed application
4. Reboot your device
5. Restart this installer">(InstalledWinFspVersion = v0.0.0.0) OR ($(var.BundledWinFspVersion) &lt;= InstalledWinFspVersion)</bal:Condition>

        <!-- for definition of the standard themes, see https://github.com/wixtoolset/wix3/blob/master/src/ext/BalExtension/wixstdba/Resources/-->
        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLargeLicense">
            <!-- see https://wixtoolset.org/documentation/manual/v3/xsd/bal/wixstandardbootstrapperapplication.html -->
            <!-- Possible Attributes: LaunchTarget -->
            <bal:WixStandardBootstrapperApplication
                LicenseFile="bundle\resources\license.rtf"
                ShowVersion="yes"
                SuppressOptionsUI="yes"
                ThemeFile="bundle\customBootstrapperTheme.xml"
                LocalizationFile="bundle\customBootstrapperTheme.wxl"
                LogoFile="bundle\resources\logo.png"
            />
            <Payload SourceFile="bundle\resources\logoSide.png" />
        </BootstrapperApplicationRef>
        <Chain>
            <!-- see https://wixtoolset.org/documentation/manual/v3/xsd/wix/msipackage.html-->
            <MsiPackage
                SourceFile="resources\Cryptomator.msi"
                CacheId="cryptomator-bundle-cryptomator"
                DisplayInternalUI="no"
                Visible="no"
            />
            <MsiPackage
                SourceFile="resources\winfsp.msi"
                CacheId="cryptomator-bundle-winfsp"
                Visible="yes"
                DisplayInternalUI="no"
                Vital="no"
                Permanent="yes"
            />
        </Chain>
    </Bundle>
</Wix>