Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature/remove-intents-extension] Remove Extension Build Flag (Intents) #1307

Merged
merged 3 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/BUILD_CUSTOMIZATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ Removes the following from the app:
Removes the following from the app:
- the `NSAppTransportSecurity` dictionary from the app's `Info.plist`
- including the `NSAllowsArbitraryLoads` key that's needed to allow plain/unsecured HTTP connections
-
### `REMOVE_EXTENSION_INTENTS`

Removes the Intents extension binary from the IPA after building the app with fastlane
7 changes: 7 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -824,5 +824,12 @@ end
}
}
)



if appBuildFlags.include? "REMOVE_EXTENSION_INTENTS"
sh "../removeExtension.sh \"../" + ipaName.gsub("/", "_") + "\" \"ownCloud Intents\""
end

end
end
84 changes: 84 additions & 0 deletions removeExtension.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#! /bin/bash

# Copyright (C) 2023, ownCloud GmbH.
#
# This code is covered by the GNU Public License Version 3.
#
# For distribution utilizing Apple mechanisms please see https://owncloud.org/contribute/iOS-license-exception/
# You should have received a copy of this license along with this program. If not, see <http://www.gnu.org/licenses/gpl-3.0.en.html>.

VERSION="1.0.0"

#Define output formats
BOLD="$(tput bold)"
WARN="$(tput setaf 1)"
SUCCESS="$(tput setaf 2)"
INFO="$(tput setaf 3)"
NC="$(tput sgr0)" # No Color

usage()
{
echo "Usage: $0 \"Path to IPA\" \"Target Name\""
echo "Version: ${VERSION}"
echo ""
exit 1
}


#Check if all required parameters exist
if [ $# -lt 2 ]; then
usage
fi

echo
echo "${BOLD}${SUCCESS}Remove Extension Tool${NC}"
echo "Version ${VERSION}"
echo

# Extract the file name from the path
IPA_FILE=$1
APPTEMP="apptemp"
APPPATH="$APPTEMP/ownCloud.app"


# Delete previous temporal app folder if exist
if [ -d "$APPTEMP" ]; then
rm -rf "$APPTEMP"
fi

# Create temp directory
mkdir $APPTEMP

export PATH=$PATH:/usr/libexec

# Unzip ipa
echo "${SUCCESS}Unzipping ipa…${NC}"
echo ""

unzip -q "$IPA_FILE" -d "$APPTEMP" || { echo "${WARN}Failed to unzip ipa file${NC}"; exit 1; }

if [ ! -d "$APPPATH" ]; then
APPPATH="$APPTEMP/Payload/ownCloud.app"
fi

EXTENSIONPATH="$APPPATH/PlugIns/$2.appex"

echo "${SUCCESS}Remove $EXTENSIONPATH ${NC}"

# Remove the extension
rm -rf "$EXTENSIONPATH"

# Delete input IPA file
rm -rf "$IPA_FILE"

# Generate new Payload
echo ""
echo "${SUCCESS}Packing new ipa…${NC}"
pushd "$APPTEMP"
zip -q -r "../$IPA_FILE" *
popd

# Delete previous temporal app folder if exist
if [ -d "$APPTEMP" ]; then
rm -rf "$APPTEMP"
fi