<?xml version="1.0" encoding="UTF-8"?>
<OfficeApp
  xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
  xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0"
  xsi:type="MailApp">

  <!-- Classic XML manifest. Works in classic Outlook (Windows, VSTO-capable),
       new Outlook (Windows), Outlook on the web, and Outlook for Mac — all four
       load Office.js web add-ins the same way. Only classic Outlook on Windows
       can ALSO run legacy VSTO/COM add-ins; new Outlook/OWA/Mac cannot, which is
       why this project is a web add-in and not a port of the VSTO code. -->

  <Id>e5ea0eff-e95e-4fc2-aa54-ad5a704aa5ed</Id>
  <Version>1.0.0.2</Version>
  <ProviderName>Independent developer</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>
  <DisplayName DefaultValue="Attachment Manager" />
  <Description DefaultValue="Rename, reorder, remove and zip attachments before sending." />
  <IconUrl DefaultValue="https://outlook-attachment-manager.pages.dev/assets/icon-32-v2.png" />
  <HighResolutionIconUrl DefaultValue="https://outlook-attachment-manager.pages.dev/assets/icon-80-v2.png" />
  <SupportUrl DefaultValue="https://outlook-attachment-manager.pages.dev" />

  <AppDomains>
    <AppDomain>https://outlook-attachment-manager.pages.dev</AppDomain>
  </AppDomains>

  <Hosts>
    <Host Name="Mailbox" />
  </Hosts>

  <Requirements>
    <Sets>
      <!-- 1.8 gives us getAttachmentsAsync / getAttachmentContentAsync /
           addFileAttachmentFromBase64Async / removeAttachmentAsync in compose mode,
           which is the whole toolkit this add-in needs. -->
      <Set Name="Mailbox" MinVersion="1.8" />
    </Sets>
  </Requirements>

  <FormSettings>
    <Form xsi:type="ItemEdit">
      <DesktopSettings>
        <SourceLocation DefaultValue="https://outlook-attachment-manager.pages.dev/taskpane" />
      </DesktopSettings>
    </Form>
  </FormSettings>

  <Permissions>ReadWriteItem</Permissions>

  <Rule xsi:type="RuleCollection" Mode="Or">
    <Rule xsi:type="ItemIs" ItemType="Message" FormType="Edit" />
  </Rule>

  <DisableEntityHighlighting>false</DisableEntityHighlighting>

  <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
    <Requirements>
      <bt:Sets DefaultMinVersion="1.8">
        <bt:Set Name="Mailbox" />
      </bt:Sets>
    </Requirements>
    <Hosts>
      <Host xsi:type="MailHost">
        <DesktopFormFactor>
          <FunctionFile resid="Commands.Url" />

          <!-- Ribbon button shown only when composing a message -->
          <ExtensionPoint xsi:type="MessageComposeCommandSurface">
            <OfficeTab id="TabDefault">
              <Group id="AttachmentManagerGroup">
                <Label resid="GroupLabel" />
                <Control xsi:type="Button" id="AttachmentManagerButton">
                  <Label resid="ButtonLabel" />
                  <Supertip>
                    <Title resid="ButtonLabel" />
                    <Description resid="ButtonTooltip" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="icon-16" />
                    <bt:Image size="32" resid="icon-32" />
                    <bt:Image size="80" resid="icon-80" />
                  </Icon>
                  <Action xsi:type="ShowTaskpane">
                    <SourceLocation resid="Taskpane.Url" />
                  </Action>
                </Control>
              </Group>
            </OfficeTab>
          </ExtensionPoint>
        </DesktopFormFactor>
      </Host>
    </Hosts>

    <Resources>
      <bt:Images>
        <bt:Image id="icon-16" DefaultValue="https://outlook-attachment-manager.pages.dev/assets/icon-16-v2.png" />
        <bt:Image id="icon-32" DefaultValue="https://outlook-attachment-manager.pages.dev/assets/icon-32-v2.png" />
        <bt:Image id="icon-80" DefaultValue="https://outlook-attachment-manager.pages.dev/assets/icon-80-v2.png" />
      </bt:Images>
      <bt:Urls>
        <bt:Url id="Commands.Url" DefaultValue="https://outlook-attachment-manager.pages.dev/commands" />
        <bt:Url id="Taskpane.Url" DefaultValue="https://outlook-attachment-manager.pages.dev/taskpane" />
      </bt:Urls>
      <bt:ShortStrings>
        <bt:String id="GroupLabel" DefaultValue="Attachments" />
        <bt:String id="ButtonLabel" DefaultValue="Attachment Manager" />
      </bt:ShortStrings>
      <bt:LongStrings>
        <bt:String id="ButtonTooltip" DefaultValue="Rename, reorder, remove or zip this message's attachments" />
      </bt:LongStrings>
    </Resources>

    <!-- Clients that support Mailbox 1.12+ (new Outlook, Outlook on the web, Mac,
         current classic Microsoft 365) use this block instead: same ribbon button
         plus the Send Guard OnMessageSend (Smart Alerts) hook. Older clients, e.g.
         classic Outlook 2021 build 2108, ignore it and keep the block above. -->
    <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
      <Requirements>
        <bt:Sets DefaultMinVersion="1.12">
          <bt:Set Name="Mailbox" />
        </bt:Sets>
      </Requirements>
      <Hosts>
        <Host xsi:type="MailHost">
          <Runtimes>
            <Runtime resid="WebViewRuntime.Url">
              <Override type="javascript" resid="JSRuntime.Url" />
            </Runtime>
          </Runtimes>
          <DesktopFormFactor>
            <FunctionFile resid="WebViewRuntime.Url" />

            <ExtensionPoint xsi:type="MessageComposeCommandSurface">
              <OfficeTab id="TabDefault">
                <Group id="AttachmentManagerGroup">
                  <Label resid="GroupLabel" />
                  <Control xsi:type="Button" id="AttachmentManagerButton">
                    <Label resid="ButtonLabel" />
                    <Supertip>
                      <Title resid="ButtonLabel" />
                      <Description resid="ButtonTooltip" />
                    </Supertip>
                    <Icon>
                      <bt:Image size="16" resid="icon-16" />
                      <bt:Image size="32" resid="icon-32" />
                      <bt:Image size="80" resid="icon-80" />
                    </Icon>
                    <Action xsi:type="ShowTaskpane">
                      <SourceLocation resid="Taskpane.Url" />
                    </Action>
                  </Control>
                </Group>
              </OfficeTab>
            </ExtensionPoint>

            <ExtensionPoint xsi:type="LaunchEvent">
              <LaunchEvents>
                <LaunchEvent Type="OnMessageSend" FunctionName="onMessageSendHandler" SendMode="SoftBlock" />
              </LaunchEvents>
              <SourceLocation resid="WebViewRuntime.Url" />
            </ExtensionPoint>
          </DesktopFormFactor>
        </Host>
      </Hosts>

      <Resources>
        <bt:Images>
          <bt:Image id="icon-16" DefaultValue="https://outlook-attachment-manager.pages.dev/assets/icon-16-v2.png" />
          <bt:Image id="icon-32" DefaultValue="https://outlook-attachment-manager.pages.dev/assets/icon-32-v2.png" />
          <bt:Image id="icon-80" DefaultValue="https://outlook-attachment-manager.pages.dev/assets/icon-80-v2.png" />
        </bt:Images>
        <bt:Urls>
          <bt:Url id="WebViewRuntime.Url" DefaultValue="https://outlook-attachment-manager.pages.dev/commands" />
          <bt:Url id="JSRuntime.Url" DefaultValue="https://outlook-attachment-manager.pages.dev/launchevent.js" />
          <bt:Url id="Taskpane.Url" DefaultValue="https://outlook-attachment-manager.pages.dev/taskpane" />
        </bt:Urls>
        <bt:ShortStrings>
          <bt:String id="GroupLabel" DefaultValue="Attachments" />
          <bt:String id="ButtonLabel" DefaultValue="Attachment Manager" />
        </bt:ShortStrings>
        <bt:LongStrings>
          <bt:String id="ButtonTooltip" DefaultValue="Rename, reorder, remove or zip this message's attachments; Send Guard settings" />
        </bt:LongStrings>
      </Resources>
    </VersionOverrides>
  </VersionOverrides>
</OfficeApp>
