diff --git a/.gitignore b/.gitignore index 2f188c6..30189fb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,71 +1,30 @@ -# ---> Swift -# Xcode -# -# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore +# macOS / OS X system files +.DS_Store +.AppleDouble +.LSOverride +._* -## User settings +# Xcode User Data & Derived Data xcuserdata/ +*.xcuserdata +DerivedData/ +*.xcworkspace/xcuserdata/ -## Obj-C/Swift specific +# Build Outputs & Package Archives +build/ +*.dmg +*.xcarchive +ExportOptions.plist + +# App Packaging & Symbols +*.ipa +*.dSYM +*.dSYM.zip *.hmap -## App packaging -*.ipa -*.dSYM.zip -*.dSYM - -## Playgrounds -timeline.xctimeline -playground.xcworkspace - # Swift Package Manager -# -# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. -# Packages/ -# Package.pins -# Package.resolved -# *.xcodeproj -# -# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata -# hence it is not needed unless you have added a package configuration file to your project -# .swiftpm - .build/ -# CocoaPods -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control -# -# Pods/ -# -# Add this line if you want to avoid checking in source code from the Xcode workspace -# *.xcworkspace - -# Carthage -# -# Add this line if you want to avoid checking in source code from Carthage dependencies. -# Carthage/Checkouts - -Carthage/Build/ - -# fastlane -# -# It is recommended to not store the screenshots in the git repo. -# Instead, use fastlane to re-generate the screenshots whenever they are needed. -# For more information about the recommended setup visit: -# https://docs.fastlane.tools/best-practices/source-control/#source-control - -fastlane/report.xml -fastlane/Preview.html -fastlane/screenshots/**/*.png -fastlane/test_output - -# ---> Xcode -## User settings -xcuserdata/ - -# Misc - -*.DS_Store +# Playground Timelines +timeline.xctimeline +playground.xcworkspace diff --git a/TetheringHider.xcodeproj/project.pbxproj b/TetheringHider.xcodeproj/project.pbxproj index 6583a61..a38070d 100644 --- a/TetheringHider.xcodeproj/project.pbxproj +++ b/TetheringHider.xcodeproj/project.pbxproj @@ -241,7 +241,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 0.1-beta; PRODUCT_BUNDLE_IDENTIFIER = com.tetheringhider.app; PRODUCT_NAME = TetheringHider; SDKROOT = macosx; @@ -269,7 +269,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 0.1-beta; PRODUCT_BUNDLE_IDENTIFIER = com.tetheringhider.app; PRODUCT_NAME = TetheringHider; SDKROOT = macosx; diff --git a/TetheringHider/TetheringHiderApp.swift b/TetheringHider/TetheringHiderApp.swift index ed58dc0..1307da9 100644 --- a/TetheringHider/TetheringHiderApp.swift +++ b/TetheringHider/TetheringHiderApp.swift @@ -133,6 +133,7 @@ final class StatusBarController: NSObject, NSMenuDelegate { } @objc private func aboutAction() { + let versionString = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "0.1-beta" let creditsString = String(localized: "Bypasses mobile carrier hotspot tethering detection by adjusting outgoing IPv4 TTL to 65, IPv6 Hop Limit to 65, and flushing system DNS caches.\n\nDesigned for macOS.") var options: [NSApplication.AboutPanelOptionKey: Any] = [ .credits: NSAttributedString( @@ -143,7 +144,7 @@ final class StatusBarController: NSObject, NSMenuDelegate { ] ), .applicationName: "Tethering Hider", - .version: "1.0.0" + .version: versionString ] if let appIcon = NSImage(named: NSImage.applicationIconName) ?? NSApplication.shared.applicationIconImage { diff --git a/build_dmg.sh b/build_dmg.sh new file mode 100755 index 0000000..99d0b9d --- /dev/null +++ b/build_dmg.sh @@ -0,0 +1,82 @@ +#!/bin/bash +set -e + +APP_NAME="TetheringHider" +BUILD_DIR="build" + +echo "🔍 Obteniendo automáticamente la versión del proyecto desde Xcode..." +VERSION=$(xcodebuild -project "${APP_NAME}.xcodeproj" -scheme "${APP_NAME}" -configuration Release -showBuildSettings 2>/dev/null | grep -m1 "MARKETING_VERSION" | awk -F '=' '{print $2}' | xargs) + +if [ -z "${VERSION}" ]; then + echo "⚠️ No se pudo obtener MARKETING_VERSION automáticamente de Xcode." + exit 1 +fi + +ARCHIVE_PATH="${BUILD_DIR}/${APP_NAME}.xcarchive" +EXPORT_PATH="${BUILD_DIR}/Exported" +EXPORT_OPTIONS_PLIST="ExportOptions.plist" +DMG_DIR="${BUILD_DIR}/dmg" +DMG_NAME="${APP_NAME}-${VERSION}.dmg" + +echo "📌 Versión de la app detectada: ${VERSION}" + +echo "📦 1. Creando ExportOptions.plist para exportación de macOS..." +cat << 'EOF' > "${EXPORT_OPTIONS_PLIST}" + + + + + method + mac-application + destination + export + + +EOF + +echo "📦 2. Ejecutando Product > Archive (${APP_NAME}.xcarchive)..." +rm -rf "${BUILD_DIR}" +xcodebuild -project "${APP_NAME}.xcodeproj" \ + -scheme "${APP_NAME}" \ + -configuration Release \ + -archivePath "${ARCHIVE_PATH}" \ + archive + +echo "📦 3. Exportando aplicación distribuible..." +if ! xcodebuild -exportArchive \ + -archivePath "${ARCHIVE_PATH}" \ + -exportOptionsPlist "${EXPORT_OPTIONS_PLIST}" \ + -exportPath "${EXPORT_PATH}" 2>/dev/null; then + echo "ℹ️ Copiando binario distribuible directamente desde el paquete .xcarchive..." + mkdir -p "${EXPORT_PATH}" + cp -R "${ARCHIVE_PATH}/Products/Applications/${APP_NAME}.app" "${EXPORT_PATH}/" +fi + +APP_PATH="${EXPORT_PATH}/${APP_NAME}.app" + +if [ ! -d "${APP_PATH}" ]; then + echo "❌ Error: No se encontró la aplicación exportada en ${APP_PATH}" + exit 1 +fi + +echo "📦 4. Preparando estructura para el archivo DMG..." +rm -rf "${DMG_DIR}" "${DMG_NAME}" +mkdir -p "${DMG_DIR}" + +# Copiar la app exportada a la carpeta del DMG +cp -R "${APP_PATH}" "${DMG_DIR}/" + +# Crear enlace simbólico a /Applications +ln -s /Applications "${DMG_DIR}/Applications" + +echo "💿 5. Creando imagen de disco DMG: ${DMG_NAME}..." +hdiutil create -volname "${APP_NAME} ${VERSION}" \ + -srcfolder "${DMG_DIR}" \ + -ov \ + -format UDZO \ + "${DMG_NAME}" + +# Limpieza de temporales +rm -rf "${DMG_DIR}" "${EXPORT_OPTIONS_PLIST}" + +echo "✅ ¡DMG distribuible v${VERSION} creado exitosamente en: ${DMG_NAME}!"