From 391955d8790ee987afb54f1fb0a699a405c20e1b Mon Sep 17 00:00:00 2001 From: Michael Neale Date: Thu, 10 Jul 2025 09:37:29 +1000 Subject: [PATCH 1/6] working on macos --- bitchat.xcodeproj/project.pbxproj | 90 +++++++++++++++---------------- bitchat/Info.plist | 20 ------- project.yml | 40 +++++++------- 3 files changed, 65 insertions(+), 85 deletions(-) diff --git a/bitchat.xcodeproj/project.pbxproj b/bitchat.xcodeproj/project.pbxproj index 9ee9abe3..ce5111bb 100644 --- a/bitchat.xcodeproj/project.pbxproj +++ b/bitchat.xcodeproj/project.pbxproj @@ -17,7 +17,6 @@ 2E71E320EA921498C57E023B /* BitchatMessageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FA8FF26ABDC1C642A8C7AE5 /* BitchatMessageTests.swift */; }; 31D147471B9F4E2815352DDA /* LinkPreviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AC141774F6671FCDC347DC7 /* LinkPreviewView.swift */; }; 4274B6016F755946FBF2513E /* MessageRetentionService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67A85BFDDE65B4CD8BDF6DDB /* MessageRetentionService.swift */; }; - 46E1E1013CC18AB66105DB27 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 95F16C3A4A5621C74461D8D3 /* LaunchScreen.storyboard */; }; 4B747085D07A1BCE0F5BA612 /* BinaryProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2136C3E22D02D4A8DBE7EAB /* BinaryProtocol.swift */; }; 4E778E5A414571ACAC2A0F01 /* MessageRetentionService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67A85BFDDE65B4CD8BDF6DDB /* MessageRetentionService.swift */; }; 5D95F2BFBE257A1225998389 /* BatteryOptimizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED176FF3B274E35C2D827894 /* BatteryOptimizer.swift */; }; @@ -353,24 +352,24 @@ LastUpgradeCheck = 1430; TargetAttributes = { 0576A29205865664C0937536 = { - DevelopmentTeam = L3N5LHJD5Y; - ProvisioningStyle = Automatic; + DevelopmentTeam = W2L75AE9HQ; + ProvisioningStyle = Manual; }; 47FF23248747DD7CB666CB91 = { - DevelopmentTeam = L3N5LHJD5Y; - ProvisioningStyle = Automatic; + DevelopmentTeam = W2L75AE9HQ; + ProvisioningStyle = Manual; }; 57CA17A36A2532A6CFF367BB = { - DevelopmentTeam = L3N5LHJD5Y; - ProvisioningStyle = Automatic; + DevelopmentTeam = W2L75AE9HQ; + ProvisioningStyle = Manual; }; 6CB97DF2EA57234CB3E563B8 = { - DevelopmentTeam = L3N5LHJD5Y; - ProvisioningStyle = Automatic; + DevelopmentTeam = W2L75AE9HQ; + ProvisioningStyle = Manual; }; AF077EA0474EDEDE2C72716C = { - DevelopmentTeam = L3N5LHJD5Y; - ProvisioningStyle = Automatic; + DevelopmentTeam = W2L75AE9HQ; + ProvisioningStyle = Manual; }; }; }; @@ -403,7 +402,6 @@ buildActionMask = 2147483647; files = ( 7DD72D928FF9DD3CA81B46B0 /* Assets.xcassets in Resources */, - 46E1E1013CC18AB66105DB27 /* LaunchScreen.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -526,8 +524,8 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGNING_ALLOWED = YES; CODE_SIGNING_REQUIRED = YES; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = L3N5LHJD5Y; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = W2L75AE9HQ; INFOPLIST_FILE = bitchatTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -535,7 +533,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat.tests; + PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat.tests; SDKROOT = iphoneos; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -549,8 +547,8 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGNING_ALLOWED = YES; CODE_SIGNING_REQUIRED = YES; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = L3N5LHJD5Y; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = W2L75AE9HQ; INFOPLIST_FILE = bitchatTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -558,7 +556,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat.tests; + PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat.tests; SDKROOT = iphoneos; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -572,9 +570,9 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGNING_ALLOWED = YES; CODE_SIGNING_REQUIRED = YES; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = L3N5LHJD5Y; + DEVELOPMENT_TEAM = W2L75AE9HQ; INFOPLIST_FILE = bitchatTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -582,7 +580,7 @@ "@loader_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat.tests; + PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat.tests; SDKROOT = macosx; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/bitchat.app/Contents/MacOS/bitchat"; @@ -596,8 +594,8 @@ CODE_SIGNING_REQUIRED = YES; CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION = YES; CODE_SIGN_ENTITLEMENTS = bitchatShareExtension/bitchatShareExtension.entitlements; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = L3N5LHJD5Y; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = W2L75AE9HQ; INFOPLIST_FILE = bitchatShareExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -605,7 +603,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat.ShareExtension; + PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat.ShareExtension; SDKROOT = iphoneos; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -621,8 +619,8 @@ CODE_SIGNING_REQUIRED = YES; CODE_SIGN_ENTITLEMENTS = bitchat/bitchat.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = L3N5LHJD5Y; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = W2L75AE9HQ; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = bitchat/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; @@ -630,7 +628,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat; + PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat; PRODUCT_NAME = bitchat; SDKROOT = iphoneos; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES; @@ -645,9 +643,9 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGNING_ALLOWED = YES; CODE_SIGNING_REQUIRED = YES; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = L3N5LHJD5Y; + DEVELOPMENT_TEAM = W2L75AE9HQ; INFOPLIST_FILE = bitchatTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -655,7 +653,7 @@ "@loader_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat.tests; + PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat.tests; SDKROOT = macosx; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/bitchat.app/Contents/MacOS/bitchat"; @@ -671,8 +669,8 @@ CODE_SIGNING_REQUIRED = YES; CODE_SIGN_ENTITLEMENTS = bitchat/bitchat.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = L3N5LHJD5Y; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = W2L75AE9HQ; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = bitchat/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; @@ -680,7 +678,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat; + PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat; PRODUCT_NAME = bitchat; SDKROOT = iphoneos; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES; @@ -694,12 +692,12 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; - CODE_SIGNING_ALLOWED = YES; - CODE_SIGNING_REQUIRED = YES; + CODE_SIGNING_ALLOWED = NO; + CODE_SIGNING_REQUIRED = NO; CODE_SIGN_ENTITLEMENTS = bitchat/bitchat.entitlements; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = L3N5LHJD5Y; + DEVELOPMENT_TEAM = W2L75AE9HQ; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = bitchat/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -707,7 +705,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat; + PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat; PRODUCT_NAME = bitchat; SDKROOT = macosx; SWIFT_VERSION = 5.0; @@ -777,12 +775,12 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; - CODE_SIGNING_ALLOWED = YES; - CODE_SIGNING_REQUIRED = YES; + CODE_SIGNING_ALLOWED = NO; + CODE_SIGNING_REQUIRED = NO; CODE_SIGN_ENTITLEMENTS = bitchat/bitchat.entitlements; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = L3N5LHJD5Y; + DEVELOPMENT_TEAM = W2L75AE9HQ; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = bitchat/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -790,7 +788,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat; + PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat; PRODUCT_NAME = bitchat; SDKROOT = macosx; SWIFT_VERSION = 5.0; @@ -869,8 +867,8 @@ CODE_SIGNING_REQUIRED = YES; CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION = YES; CODE_SIGN_ENTITLEMENTS = bitchatShareExtension/bitchatShareExtension.entitlements; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = L3N5LHJD5Y; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = W2L75AE9HQ; INFOPLIST_FILE = bitchatShareExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -878,7 +876,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat.ShareExtension; + PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat.ShareExtension; SDKROOT = iphoneos; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; diff --git a/bitchat/Info.plist b/bitchat/Info.plist index 567f2c3c..17cdfb12 100644 --- a/bitchat/Info.plist +++ b/bitchat/Info.plist @@ -35,25 +35,5 @@ bitchat uses Bluetooth to create a secure mesh network for chatting with nearby users. NSBluetoothPeripheralUsageDescription bitchat uses Bluetooth to discover and connect with other bitchat users nearby. - UIBackgroundModes - - bluetooth-central - bluetooth-peripheral - - UILaunchStoryboardName - LaunchScreen - UIRequiresFullScreen - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - diff --git a/project.yml b/project.yml index ea3c24a1..10c288a7 100644 --- a/project.yml +++ b/project.yml @@ -1,6 +1,6 @@ name: bitchat options: - bundleIdPrefix: chat.bitchat + bundleIdPrefix: com.local.bitchat deploymentTarget: iOS: 16.0 macOS: 13.0 @@ -43,17 +43,17 @@ targets: - CFBundleURLSchemes: - bitchat settings: - PRODUCT_BUNDLE_IDENTIFIER: chat.bitchat + PRODUCT_BUNDLE_IDENTIFIER: com.local.bitchat PRODUCT_NAME: bitchat INFOPLIST_FILE: bitchat/Info.plist ENABLE_PREVIEWS: YES SWIFT_VERSION: 5.0 IPHONEOS_DEPLOYMENT_TARGET: 16.0 SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD: YES - CODE_SIGN_STYLE: Automatic + CODE_SIGN_STYLE: Manual CODE_SIGNING_REQUIRED: YES CODE_SIGNING_ALLOWED: YES - DEVELOPMENT_TEAM: L3N5LHJD5Y + DEVELOPMENT_TEAM: W2L75AE9HQ ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS: YES CODE_SIGN_ENTITLEMENTS: bitchat/bitchat.entitlements @@ -65,7 +65,9 @@ targets: type: application platform: macOS sources: - - bitchat + - path: bitchat + excludes: + - "LaunchScreen.storyboard" resources: - bitchat/Assets.xcassets info: @@ -81,16 +83,16 @@ targets: - CFBundleURLSchemes: - bitchat settings: - PRODUCT_BUNDLE_IDENTIFIER: chat.bitchat + PRODUCT_BUNDLE_IDENTIFIER: com.local.bitchat PRODUCT_NAME: bitchat INFOPLIST_FILE: bitchat/Info.plist ENABLE_PREVIEWS: YES SWIFT_VERSION: 5.0 MACOSX_DEPLOYMENT_TARGET: 13.0 - CODE_SIGN_STYLE: Automatic - CODE_SIGNING_REQUIRED: YES - CODE_SIGNING_ALLOWED: YES - DEVELOPMENT_TEAM: L3N5LHJD5Y + CODE_SIGN_STYLE: Manual + CODE_SIGNING_REQUIRED: NO + CODE_SIGNING_ALLOWED: NO + DEVELOPMENT_TEAM: W2L75AE9HQ ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS: YES CODE_SIGN_ENTITLEMENTS: bitchat/bitchat.entitlements @@ -115,14 +117,14 @@ targets: NSExtensionActivationSupportsWebURLWithMaxCount: 1 NSExtensionActivationSupportsImageWithMaxCount: 1 settings: - PRODUCT_BUNDLE_IDENTIFIER: chat.bitchat.ShareExtension + PRODUCT_BUNDLE_IDENTIFIER: com.local.bitchat.ShareExtension INFOPLIST_FILE: bitchatShareExtension/Info.plist SWIFT_VERSION: 5.0 IPHONEOS_DEPLOYMENT_TARGET: 16.0 - CODE_SIGN_STYLE: Automatic + CODE_SIGN_STYLE: Manual CODE_SIGNING_REQUIRED: YES CODE_SIGNING_ALLOWED: YES - DEVELOPMENT_TEAM: L3N5LHJD5Y + DEVELOPMENT_TEAM: W2L75AE9HQ CODE_SIGN_ENTITLEMENTS: bitchatShareExtension/bitchatShareExtension.entitlements CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION: YES @@ -134,16 +136,16 @@ targets: dependencies: - target: bitchat_iOS settings: - PRODUCT_BUNDLE_IDENTIFIER: chat.bitchat.tests + PRODUCT_BUNDLE_IDENTIFIER: com.local.bitchat.tests INFOPLIST_FILE: bitchatTests/Info.plist SWIFT_VERSION: 5.0 IPHONEOS_DEPLOYMENT_TARGET: 16.0 TEST_HOST: $(BUILT_PRODUCTS_DIR)/bitchat.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/bitchat BUNDLE_LOADER: $(TEST_HOST) - CODE_SIGN_STYLE: Automatic + CODE_SIGN_STYLE: Manual CODE_SIGNING_REQUIRED: YES CODE_SIGNING_ALLOWED: YES - DEVELOPMENT_TEAM: L3N5LHJD5Y + DEVELOPMENT_TEAM: W2L75AE9HQ bitchatTests_macOS: type: bundle.unit-test @@ -153,16 +155,16 @@ targets: dependencies: - target: bitchat_macOS settings: - PRODUCT_BUNDLE_IDENTIFIER: chat.bitchat.tests + PRODUCT_BUNDLE_IDENTIFIER: com.local.bitchat.tests INFOPLIST_FILE: bitchatTests/Info.plist SWIFT_VERSION: 5.0 MACOSX_DEPLOYMENT_TARGET: 13.0 TEST_HOST: $(BUILT_PRODUCTS_DIR)/bitchat.app/Contents/MacOS/bitchat BUNDLE_LOADER: $(TEST_HOST) - CODE_SIGN_STYLE: Automatic + CODE_SIGN_STYLE: Manual CODE_SIGNING_REQUIRED: YES CODE_SIGNING_ALLOWED: YES - DEVELOPMENT_TEAM: L3N5LHJD5Y + DEVELOPMENT_TEAM: W2L75AE9HQ schemes: bitchat (iOS): From 857affa46da7851237077379196811a31c57d333 Mon Sep 17 00:00:00 2001 From: Michael Neale Date: Thu, 10 Jul 2025 10:00:28 +1000 Subject: [PATCH 2/6] running on macos --- BUILD_MACOS.md | 60 ++++++++++++++++++++++ Justfile | 132 +++++++++++++++++++++++++++++++++++++++++++++++++ project.yml | 40 +++++++-------- 3 files changed, 211 insertions(+), 21 deletions(-) create mode 100644 BUILD_MACOS.md create mode 100644 Justfile diff --git a/BUILD_MACOS.md b/BUILD_MACOS.md new file mode 100644 index 00000000..dae122a8 --- /dev/null +++ b/BUILD_MACOS.md @@ -0,0 +1,60 @@ +# BitChat macOS Build + +This Justfile provides easy commands to build and run BitChat natively on macOS while preserving the original project configuration. + +## Quick Start + +```bash +# Build and run the app +just run + +# Or see all available commands +just +``` + +## Commands + +- `just run` - Build and run the macOS app +- `just build` - Build the macOS app only +- `just clean` - Clean build artifacts and restore original files +- `just check` - Check prerequisites (XcodeGen, Xcode, etc.) +- `just info` - Show app information and requirements + +## How It Works + +The Justfile temporarily modifies `project.yml` to: +- Use your local development team ID (replaces `L3N5LHJD5Y`) +- Change bundle identifier to avoid conflicts (`chat.bitchat` → `com.local.bitchat`) +- Disable code signing for local development (`Automatic` → `Manual`) +- Exclude iOS-specific files from macOS build (`LaunchScreen.storyboard`) + +**Original files are always preserved** - modifications are only applied during builds and automatically cleaned up. The project files remain exactly as they are on the main branch. + +## Requirements + +- macOS 13.0+ (Ventura) +- Xcode (from App Store) +- XcodeGen (`brew install xcodegen`) +- Bluetooth LE capable Mac +- Physical device (Bluetooth doesn't work in simulator) + +## App Features + +- **Native macOS SwiftUI app** - not a Catalyst port +- **Bluetooth LE mesh networking** - no internet required +- **End-to-end encryption** - X25519 + AES-256-GCM +- **Store-and-forward messaging** - works with offline peers +- **Channel-based group chats** - IRC-style commands +- **Private messaging** with delivery receipts +- **Emergency wipe** - triple-tap logo to clear all data + +## Usage + +Once running: +- Set your nickname and start discovering nearby peers +- Use `/join #channel` for group chats +- Use `/msg @user` for private messages +- Use `/who` to see connected peers +- Triple-tap the logo for emergency data wipe + +The app creates a decentralized mesh network over Bluetooth LE that can span significant distances through multi-hop message relay. diff --git a/Justfile b/Justfile new file mode 100644 index 00000000..b4533092 --- /dev/null +++ b/Justfile @@ -0,0 +1,132 @@ +# BitChat macOS Build Justfile +# Handles temporary modifications needed to build and run on macOS + +# Default recipe - shows available commands +default: + @echo "BitChat macOS Build Commands:" + @echo " just run - Build and run the macOS app" + @echo " just build - Build the macOS app only" + @echo " just clean - Clean build artifacts and restore original files" + @echo " just check - Check prerequisites" + @echo "" + @echo "Original files are preserved - modifications are temporary for builds only" + +# Check prerequisites +check: + @echo "Checking prerequisites..." + @command -v xcodegen >/dev/null 2>&1 || (echo "❌ XcodeGen not found. Install with: brew install xcodegen" && exit 1) + @command -v xcodebuild >/dev/null 2>&1 || (echo "❌ Xcode not found. Install Xcode from App Store" && exit 1) + @security find-identity -v -p codesigning | grep -q "Developer ID" || (echo "⚠️ No Developer ID found - code signing may fail" && exit 0) + @echo "✅ All prerequisites met" + +# Backup original files +backup: + @echo "Backing up original project configuration..." + @cp project.yml project.yml.backup 2>/dev/null || true + +# Restore original files +restore: + @echo "Restoring original project configuration..." + @if [ -f project.yml.backup ]; then mv project.yml.backup project.yml; fi + +# Apply macOS-specific modifications +patch-for-macos: backup + #!/usr/bin/env bash + set -euo pipefail + echo "Applying macOS-specific patches..." + # Get current development team + DEV_TEAM=$(security find-identity -v -p codesigning | grep "Developer ID" | head -1 | sed 's/.*(\(.*\)).*/\1/' || echo "") + if [ -z "$DEV_TEAM" ]; then + echo "⚠️ No Developer ID found, using your team ID" + DEV_TEAM="W2L75AE9HQ" + fi + echo "Using development team: $DEV_TEAM" + # Replace original development team with current one + sed -i '' "s/L3N5LHJD5Y/$DEV_TEAM/g" project.yml + # Change bundle ID to avoid conflicts + sed -i '' 's/chat\.bitchat/com.local.bitchat/g' project.yml + # Disable code signing for development + sed -i '' 's/CODE_SIGN_STYLE: Automatic/CODE_SIGN_STYLE: Manual/g' project.yml + # Add no-signing flags after each CODE_SIGN_STYLE: Manual line + sed -i '' '/CODE_SIGN_STYLE: Manual/a\ + CODE_SIGNING_REQUIRED: NO\ + CODE_SIGNING_ALLOWED: NO' project.yml + # Fix macOS target to exclude LaunchScreen.storyboard + sed -i '' '/bitchat_macOS:/,/resources:/ { + s|sources: *$|sources:\ + - path: bitchat\ + excludes:\ + - "LaunchScreen.storyboard"| + }' project.yml + +# Generate Xcode project with patches +generate: patch-for-macos + @echo "Generating Xcode project..." + @xcodegen generate + +# Build the macOS app +build: check generate + @echo "Building BitChat for macOS..." + @xcodebuild -project bitchat.xcodeproj -scheme "bitchat (macOS)" -configuration Debug build + +# Run the macOS app +run: build + @echo "Launching BitChat..." + @APP_PATH=$$(find ~/Library/Developer/Xcode/DerivedData -name "bitchat.app" -path "*/Debug/*" | head -1); \ + if [ -n "$$APP_PATH" ]; then \ + echo "Found app at: $$APP_PATH"; \ + open "$$APP_PATH"; \ + else \ + echo "❌ Could not find built app"; \ + exit 1; \ + fi + +# Clean build artifacts and restore original files +clean: restore + @echo "Cleaning build artifacts..." + @rm -rf ~/Library/Developer/Xcode/DerivedData/bitchat-* 2>/dev/null || true + @rm -rf bitchat.xcodeproj 2>/dev/null || true + @echo "✅ Cleaned and restored original files" + +# Quick run without cleaning (for development) +dev-run: check + @echo "Quick development build..." + @if [ ! -f project.yml.backup ]; then just patch-for-macos; fi + @xcodegen generate + @xcodebuild -project bitchat.xcodeproj -scheme "bitchat (macOS)" -configuration Debug build + @APP_PATH=$$(find ~/Library/Developer/Xcode/DerivedData -name "bitchat.app" -path "*/Debug/*" | head -1); \ + if [ -n "$$APP_PATH" ]; then \ + open "$$APP_PATH"; \ + else \ + echo "❌ Could not find built app"; \ + fi + +# Show app info +info: + @echo "BitChat - Decentralized Mesh Messaging" + @echo "======================================" + @echo "• Native macOS SwiftUI app" + @echo "• Bluetooth LE mesh networking" + @echo "• End-to-end encryption" + @echo "• No internet required" + @echo "• Works offline with nearby devices" + @echo "" + @echo "Requirements:" + @echo "• macOS 13.0+ (Ventura)" + @echo "• Bluetooth LE capable Mac" + @echo "• Physical device (no simulator support)" + @echo "" + @echo "Usage:" + @echo "• Set nickname and start chatting" + @echo "• Use /join #channel for group chats" + @echo "• Use /msg @user for private messages" + @echo "• Triple-tap logo for emergency wipe" + +# Force clean everything (nuclear option) +nuke: + @echo "🧨 Nuclear clean - removing all build artifacts and backups..." + @rm -rf ~/Library/Developer/Xcode/DerivedData/bitchat-* 2>/dev/null || true + @rm -rf bitchat.xcodeproj 2>/dev/null || true + @rm -f project.yml.backup 2>/dev/null || true + @git checkout -- project.yml 2>/dev/null || echo "⚠️ Not a git repo or no changes to restore" + @echo "✅ Nuclear clean complete" diff --git a/project.yml b/project.yml index 10c288a7..ea3c24a1 100644 --- a/project.yml +++ b/project.yml @@ -1,6 +1,6 @@ name: bitchat options: - bundleIdPrefix: com.local.bitchat + bundleIdPrefix: chat.bitchat deploymentTarget: iOS: 16.0 macOS: 13.0 @@ -43,17 +43,17 @@ targets: - CFBundleURLSchemes: - bitchat settings: - PRODUCT_BUNDLE_IDENTIFIER: com.local.bitchat + PRODUCT_BUNDLE_IDENTIFIER: chat.bitchat PRODUCT_NAME: bitchat INFOPLIST_FILE: bitchat/Info.plist ENABLE_PREVIEWS: YES SWIFT_VERSION: 5.0 IPHONEOS_DEPLOYMENT_TARGET: 16.0 SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD: YES - CODE_SIGN_STYLE: Manual + CODE_SIGN_STYLE: Automatic CODE_SIGNING_REQUIRED: YES CODE_SIGNING_ALLOWED: YES - DEVELOPMENT_TEAM: W2L75AE9HQ + DEVELOPMENT_TEAM: L3N5LHJD5Y ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS: YES CODE_SIGN_ENTITLEMENTS: bitchat/bitchat.entitlements @@ -65,9 +65,7 @@ targets: type: application platform: macOS sources: - - path: bitchat - excludes: - - "LaunchScreen.storyboard" + - bitchat resources: - bitchat/Assets.xcassets info: @@ -83,16 +81,16 @@ targets: - CFBundleURLSchemes: - bitchat settings: - PRODUCT_BUNDLE_IDENTIFIER: com.local.bitchat + PRODUCT_BUNDLE_IDENTIFIER: chat.bitchat PRODUCT_NAME: bitchat INFOPLIST_FILE: bitchat/Info.plist ENABLE_PREVIEWS: YES SWIFT_VERSION: 5.0 MACOSX_DEPLOYMENT_TARGET: 13.0 - CODE_SIGN_STYLE: Manual - CODE_SIGNING_REQUIRED: NO - CODE_SIGNING_ALLOWED: NO - DEVELOPMENT_TEAM: W2L75AE9HQ + CODE_SIGN_STYLE: Automatic + CODE_SIGNING_REQUIRED: YES + CODE_SIGNING_ALLOWED: YES + DEVELOPMENT_TEAM: L3N5LHJD5Y ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS: YES CODE_SIGN_ENTITLEMENTS: bitchat/bitchat.entitlements @@ -117,14 +115,14 @@ targets: NSExtensionActivationSupportsWebURLWithMaxCount: 1 NSExtensionActivationSupportsImageWithMaxCount: 1 settings: - PRODUCT_BUNDLE_IDENTIFIER: com.local.bitchat.ShareExtension + PRODUCT_BUNDLE_IDENTIFIER: chat.bitchat.ShareExtension INFOPLIST_FILE: bitchatShareExtension/Info.plist SWIFT_VERSION: 5.0 IPHONEOS_DEPLOYMENT_TARGET: 16.0 - CODE_SIGN_STYLE: Manual + CODE_SIGN_STYLE: Automatic CODE_SIGNING_REQUIRED: YES CODE_SIGNING_ALLOWED: YES - DEVELOPMENT_TEAM: W2L75AE9HQ + DEVELOPMENT_TEAM: L3N5LHJD5Y CODE_SIGN_ENTITLEMENTS: bitchatShareExtension/bitchatShareExtension.entitlements CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION: YES @@ -136,16 +134,16 @@ targets: dependencies: - target: bitchat_iOS settings: - PRODUCT_BUNDLE_IDENTIFIER: com.local.bitchat.tests + PRODUCT_BUNDLE_IDENTIFIER: chat.bitchat.tests INFOPLIST_FILE: bitchatTests/Info.plist SWIFT_VERSION: 5.0 IPHONEOS_DEPLOYMENT_TARGET: 16.0 TEST_HOST: $(BUILT_PRODUCTS_DIR)/bitchat.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/bitchat BUNDLE_LOADER: $(TEST_HOST) - CODE_SIGN_STYLE: Manual + CODE_SIGN_STYLE: Automatic CODE_SIGNING_REQUIRED: YES CODE_SIGNING_ALLOWED: YES - DEVELOPMENT_TEAM: W2L75AE9HQ + DEVELOPMENT_TEAM: L3N5LHJD5Y bitchatTests_macOS: type: bundle.unit-test @@ -155,16 +153,16 @@ targets: dependencies: - target: bitchat_macOS settings: - PRODUCT_BUNDLE_IDENTIFIER: com.local.bitchat.tests + PRODUCT_BUNDLE_IDENTIFIER: chat.bitchat.tests INFOPLIST_FILE: bitchatTests/Info.plist SWIFT_VERSION: 5.0 MACOSX_DEPLOYMENT_TARGET: 13.0 TEST_HOST: $(BUILT_PRODUCTS_DIR)/bitchat.app/Contents/MacOS/bitchat BUNDLE_LOADER: $(TEST_HOST) - CODE_SIGN_STYLE: Manual + CODE_SIGN_STYLE: Automatic CODE_SIGNING_REQUIRED: YES CODE_SIGNING_ALLOWED: YES - DEVELOPMENT_TEAM: W2L75AE9HQ + DEVELOPMENT_TEAM: L3N5LHJD5Y schemes: bitchat (iOS): From 93c38b9543e4759b869e0dac203c6bebf51bed5c Mon Sep 17 00:00:00 2001 From: Michael Neale Date: Thu, 10 Jul 2025 10:04:05 +1000 Subject: [PATCH 3/6] restoring --- bitchat.xcodeproj/project.pbxproj | 90 ++++++++++++++++--------------- bitchat/Info.plist | 20 +++++++ 2 files changed, 66 insertions(+), 44 deletions(-) diff --git a/bitchat.xcodeproj/project.pbxproj b/bitchat.xcodeproj/project.pbxproj index ce5111bb..9ee9abe3 100644 --- a/bitchat.xcodeproj/project.pbxproj +++ b/bitchat.xcodeproj/project.pbxproj @@ -17,6 +17,7 @@ 2E71E320EA921498C57E023B /* BitchatMessageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FA8FF26ABDC1C642A8C7AE5 /* BitchatMessageTests.swift */; }; 31D147471B9F4E2815352DDA /* LinkPreviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AC141774F6671FCDC347DC7 /* LinkPreviewView.swift */; }; 4274B6016F755946FBF2513E /* MessageRetentionService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67A85BFDDE65B4CD8BDF6DDB /* MessageRetentionService.swift */; }; + 46E1E1013CC18AB66105DB27 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 95F16C3A4A5621C74461D8D3 /* LaunchScreen.storyboard */; }; 4B747085D07A1BCE0F5BA612 /* BinaryProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2136C3E22D02D4A8DBE7EAB /* BinaryProtocol.swift */; }; 4E778E5A414571ACAC2A0F01 /* MessageRetentionService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67A85BFDDE65B4CD8BDF6DDB /* MessageRetentionService.swift */; }; 5D95F2BFBE257A1225998389 /* BatteryOptimizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED176FF3B274E35C2D827894 /* BatteryOptimizer.swift */; }; @@ -352,24 +353,24 @@ LastUpgradeCheck = 1430; TargetAttributes = { 0576A29205865664C0937536 = { - DevelopmentTeam = W2L75AE9HQ; - ProvisioningStyle = Manual; + DevelopmentTeam = L3N5LHJD5Y; + ProvisioningStyle = Automatic; }; 47FF23248747DD7CB666CB91 = { - DevelopmentTeam = W2L75AE9HQ; - ProvisioningStyle = Manual; + DevelopmentTeam = L3N5LHJD5Y; + ProvisioningStyle = Automatic; }; 57CA17A36A2532A6CFF367BB = { - DevelopmentTeam = W2L75AE9HQ; - ProvisioningStyle = Manual; + DevelopmentTeam = L3N5LHJD5Y; + ProvisioningStyle = Automatic; }; 6CB97DF2EA57234CB3E563B8 = { - DevelopmentTeam = W2L75AE9HQ; - ProvisioningStyle = Manual; + DevelopmentTeam = L3N5LHJD5Y; + ProvisioningStyle = Automatic; }; AF077EA0474EDEDE2C72716C = { - DevelopmentTeam = W2L75AE9HQ; - ProvisioningStyle = Manual; + DevelopmentTeam = L3N5LHJD5Y; + ProvisioningStyle = Automatic; }; }; }; @@ -402,6 +403,7 @@ buildActionMask = 2147483647; files = ( 7DD72D928FF9DD3CA81B46B0 /* Assets.xcassets in Resources */, + 46E1E1013CC18AB66105DB27 /* LaunchScreen.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -524,8 +526,8 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGNING_ALLOWED = YES; CODE_SIGNING_REQUIRED = YES; - CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = W2L75AE9HQ; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = L3N5LHJD5Y; INFOPLIST_FILE = bitchatTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -533,7 +535,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat.tests; + PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat.tests; SDKROOT = iphoneos; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -547,8 +549,8 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGNING_ALLOWED = YES; CODE_SIGNING_REQUIRED = YES; - CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = W2L75AE9HQ; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = L3N5LHJD5Y; INFOPLIST_FILE = bitchatTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -556,7 +558,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat.tests; + PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat.tests; SDKROOT = iphoneos; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -570,9 +572,9 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGNING_ALLOWED = YES; CODE_SIGNING_REQUIRED = YES; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = W2L75AE9HQ; + DEVELOPMENT_TEAM = L3N5LHJD5Y; INFOPLIST_FILE = bitchatTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -580,7 +582,7 @@ "@loader_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat.tests; + PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat.tests; SDKROOT = macosx; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/bitchat.app/Contents/MacOS/bitchat"; @@ -594,8 +596,8 @@ CODE_SIGNING_REQUIRED = YES; CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION = YES; CODE_SIGN_ENTITLEMENTS = bitchatShareExtension/bitchatShareExtension.entitlements; - CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = W2L75AE9HQ; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = L3N5LHJD5Y; INFOPLIST_FILE = bitchatShareExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -603,7 +605,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat.ShareExtension; + PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat.ShareExtension; SDKROOT = iphoneos; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -619,8 +621,8 @@ CODE_SIGNING_REQUIRED = YES; CODE_SIGN_ENTITLEMENTS = bitchat/bitchat.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; - CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = W2L75AE9HQ; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = L3N5LHJD5Y; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = bitchat/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; @@ -628,7 +630,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat; + PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat; PRODUCT_NAME = bitchat; SDKROOT = iphoneos; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES; @@ -643,9 +645,9 @@ BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGNING_ALLOWED = YES; CODE_SIGNING_REQUIRED = YES; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = W2L75AE9HQ; + DEVELOPMENT_TEAM = L3N5LHJD5Y; INFOPLIST_FILE = bitchatTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -653,7 +655,7 @@ "@loader_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat.tests; + PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat.tests; SDKROOT = macosx; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/bitchat.app/Contents/MacOS/bitchat"; @@ -669,8 +671,8 @@ CODE_SIGNING_REQUIRED = YES; CODE_SIGN_ENTITLEMENTS = bitchat/bitchat.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; - CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = W2L75AE9HQ; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = L3N5LHJD5Y; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = bitchat/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; @@ -678,7 +680,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat; + PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat; PRODUCT_NAME = bitchat; SDKROOT = iphoneos; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES; @@ -692,12 +694,12 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; - CODE_SIGNING_ALLOWED = NO; - CODE_SIGNING_REQUIRED = NO; + CODE_SIGNING_ALLOWED = YES; + CODE_SIGNING_REQUIRED = YES; CODE_SIGN_ENTITLEMENTS = bitchat/bitchat.entitlements; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = W2L75AE9HQ; + DEVELOPMENT_TEAM = L3N5LHJD5Y; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = bitchat/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -705,7 +707,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat; + PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat; PRODUCT_NAME = bitchat; SDKROOT = macosx; SWIFT_VERSION = 5.0; @@ -775,12 +777,12 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; - CODE_SIGNING_ALLOWED = NO; - CODE_SIGNING_REQUIRED = NO; + CODE_SIGNING_ALLOWED = YES; + CODE_SIGNING_REQUIRED = YES; CODE_SIGN_ENTITLEMENTS = bitchat/bitchat.entitlements; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = W2L75AE9HQ; + DEVELOPMENT_TEAM = L3N5LHJD5Y; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = bitchat/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -788,7 +790,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat; + PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat; PRODUCT_NAME = bitchat; SDKROOT = macosx; SWIFT_VERSION = 5.0; @@ -867,8 +869,8 @@ CODE_SIGNING_REQUIRED = YES; CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION = YES; CODE_SIGN_ENTITLEMENTS = bitchatShareExtension/bitchatShareExtension.entitlements; - CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = W2L75AE9HQ; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = L3N5LHJD5Y; INFOPLIST_FILE = bitchatShareExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -876,7 +878,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.local.bitchat.ShareExtension; + PRODUCT_BUNDLE_IDENTIFIER = chat.bitchat.ShareExtension; SDKROOT = iphoneos; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; diff --git a/bitchat/Info.plist b/bitchat/Info.plist index 17cdfb12..567f2c3c 100644 --- a/bitchat/Info.plist +++ b/bitchat/Info.plist @@ -35,5 +35,25 @@ bitchat uses Bluetooth to create a secure mesh network for chatting with nearby users. NSBluetoothPeripheralUsageDescription bitchat uses Bluetooth to discover and connect with other bitchat users nearby. + UIBackgroundModes + + bluetooth-central + bluetooth-peripheral + + UILaunchStoryboardName + LaunchScreen + UIRequiresFullScreen + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + From 6774306c274f9165073704a20ed7382de4a593c6 Mon Sep 17 00:00:00 2001 From: Michael Neale Date: Thu, 10 Jul 2025 11:04:31 +1000 Subject: [PATCH 4/6] checkpoint --- Justfile | 40 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/Justfile b/Justfile index b4533092..c83462e5 100644 --- a/Justfile +++ b/Justfile @@ -28,36 +28,14 @@ backup: restore: @echo "Restoring original project configuration..." @if [ -f project.yml.backup ]; then mv project.yml.backup project.yml; fi + @# Restore iOS-specific files + @if [ -f bitchat/LaunchScreen.storyboard.ios ]; then mv bitchat/LaunchScreen.storyboard.ios bitchat/LaunchScreen.storyboard; fi # Apply macOS-specific modifications patch-for-macos: backup - #!/usr/bin/env bash - set -euo pipefail - echo "Applying macOS-specific patches..." - # Get current development team - DEV_TEAM=$(security find-identity -v -p codesigning | grep "Developer ID" | head -1 | sed 's/.*(\(.*\)).*/\1/' || echo "") - if [ -z "$DEV_TEAM" ]; then - echo "⚠️ No Developer ID found, using your team ID" - DEV_TEAM="W2L75AE9HQ" - fi - echo "Using development team: $DEV_TEAM" - # Replace original development team with current one - sed -i '' "s/L3N5LHJD5Y/$DEV_TEAM/g" project.yml - # Change bundle ID to avoid conflicts - sed -i '' 's/chat\.bitchat/com.local.bitchat/g' project.yml - # Disable code signing for development - sed -i '' 's/CODE_SIGN_STYLE: Automatic/CODE_SIGN_STYLE: Manual/g' project.yml - # Add no-signing flags after each CODE_SIGN_STYLE: Manual line - sed -i '' '/CODE_SIGN_STYLE: Manual/a\ - CODE_SIGNING_REQUIRED: NO\ - CODE_SIGNING_ALLOWED: NO' project.yml - # Fix macOS target to exclude LaunchScreen.storyboard - sed -i '' '/bitchat_macOS:/,/resources:/ { - s|sources: *$|sources:\ - - path: bitchat\ - excludes:\ - - "LaunchScreen.storyboard"| - }' project.yml + @echo "Temporarily hiding iOS-specific files for macOS build..." + @# Move iOS-specific files out of the way temporarily + @if [ -f bitchat/LaunchScreen.storyboard ]; then mv bitchat/LaunchScreen.storyboard bitchat/LaunchScreen.storyboard.ios; fi # Generate Xcode project with patches generate: patch-for-macos @@ -67,7 +45,7 @@ generate: patch-for-macos # Build the macOS app build: check generate @echo "Building BitChat for macOS..." - @xcodebuild -project bitchat.xcodeproj -scheme "bitchat (macOS)" -configuration Debug build + @xcodebuild -project bitchat.xcodeproj -scheme "bitchat (macOS)" -configuration Debug CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" build # Run the macOS app run: build @@ -86,6 +64,7 @@ clean: restore @echo "Cleaning build artifacts..." @rm -rf ~/Library/Developer/Xcode/DerivedData/bitchat-* 2>/dev/null || true @rm -rf bitchat.xcodeproj 2>/dev/null || true + @rm -f project-macos.yml 2>/dev/null || true @echo "✅ Cleaned and restored original files" # Quick run without cleaning (for development) @@ -93,7 +72,7 @@ dev-run: check @echo "Quick development build..." @if [ ! -f project.yml.backup ]; then just patch-for-macos; fi @xcodegen generate - @xcodebuild -project bitchat.xcodeproj -scheme "bitchat (macOS)" -configuration Debug build + @xcodebuild -project bitchat.xcodeproj -scheme "bitchat (macOS)" -configuration Debug CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" build @APP_PATH=$$(find ~/Library/Developer/Xcode/DerivedData -name "bitchat.app" -path "*/Debug/*" | head -1); \ if [ -n "$$APP_PATH" ]; then \ open "$$APP_PATH"; \ @@ -128,5 +107,8 @@ nuke: @rm -rf ~/Library/Developer/Xcode/DerivedData/bitchat-* 2>/dev/null || true @rm -rf bitchat.xcodeproj 2>/dev/null || true @rm -f project.yml.backup 2>/dev/null || true + @rm -f project-macos.yml 2>/dev/null || true + @# Restore iOS-specific files if they were moved + @if [ -f bitchat/LaunchScreen.storyboard.ios ]; then mv bitchat/LaunchScreen.storyboard.ios bitchat/LaunchScreen.storyboard; fi @git checkout -- project.yml 2>/dev/null || echo "⚠️ Not a git repo or no changes to restore" @echo "✅ Nuclear clean complete" From f76d5c340be911ee03b75a6fbfefcf43e9f20c00 Mon Sep 17 00:00:00 2001 From: Michael Neale Date: Thu, 10 Jul 2025 11:17:08 +1000 Subject: [PATCH 5/6] progress --- Justfile | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/Justfile b/Justfile index c83462e5..26ad3817 100644 --- a/Justfile +++ b/Justfile @@ -23,6 +23,9 @@ check: backup: @echo "Backing up original project configuration..." @cp project.yml project.yml.backup 2>/dev/null || true + @# Backup other files that get modified by xcodegen + @if [ -f bitchat.xcodeproj/project.pbxproj ]; then cp bitchat.xcodeproj/project.pbxproj bitchat.xcodeproj/project.pbxproj.backup; fi + @if [ -f bitchat/Info.plist ]; then cp bitchat/Info.plist bitchat/Info.plist.backup; fi # Restore original files restore: @@ -30,6 +33,10 @@ restore: @if [ -f project.yml.backup ]; then mv project.yml.backup project.yml; fi @# Restore iOS-specific files @if [ -f bitchat/LaunchScreen.storyboard.ios ]; then mv bitchat/LaunchScreen.storyboard.ios bitchat/LaunchScreen.storyboard; fi + @# Use git to restore all modified files except Justfile + @git checkout -- project.yml bitchat.xcodeproj/project.pbxproj bitchat/Info.plist 2>/dev/null || echo "⚠️ Could not restore some files with git" + @# Remove any backup files + @rm -f bitchat.xcodeproj/project.pbxproj.backup bitchat/Info.plist.backup 2>/dev/null || true # Apply macOS-specific modifications patch-for-macos: backup @@ -50,20 +57,18 @@ build: check generate # Run the macOS app run: build @echo "Launching BitChat..." - @APP_PATH=$$(find ~/Library/Developer/Xcode/DerivedData -name "bitchat.app" -path "*/Debug/*" | head -1); \ - if [ -n "$$APP_PATH" ]; then \ - echo "Found app at: $$APP_PATH"; \ - open "$$APP_PATH"; \ - else \ - echo "❌ Could not find built app"; \ - exit 1; \ - fi + @find ~/Library/Developer/Xcode/DerivedData -name "bitchat.app" -path "*/Debug/*" | head -1 | xargs -I {} open "{}" # Clean build artifacts and restore original files clean: restore @echo "Cleaning build artifacts..." @rm -rf ~/Library/Developer/Xcode/DerivedData/bitchat-* 2>/dev/null || true - @rm -rf bitchat.xcodeproj 2>/dev/null || true + @# Only remove the generated project if we have a backup, otherwise use git + @if [ -f bitchat.xcodeproj/project.pbxproj.backup ]; then \ + rm -rf bitchat.xcodeproj; \ + else \ + git checkout -- bitchat.xcodeproj/project.pbxproj 2>/dev/null || echo "⚠️ Could not restore project.pbxproj"; \ + fi @rm -f project-macos.yml 2>/dev/null || true @echo "✅ Cleaned and restored original files" @@ -73,12 +78,7 @@ dev-run: check @if [ ! -f project.yml.backup ]; then just patch-for-macos; fi @xcodegen generate @xcodebuild -project bitchat.xcodeproj -scheme "bitchat (macOS)" -configuration Debug CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" build - @APP_PATH=$$(find ~/Library/Developer/Xcode/DerivedData -name "bitchat.app" -path "*/Debug/*" | head -1); \ - if [ -n "$$APP_PATH" ]; then \ - open "$$APP_PATH"; \ - else \ - echo "❌ Could not find built app"; \ - fi + @find ~/Library/Developer/Xcode/DerivedData -name "bitchat.app" -path "*/Debug/*" | head -1 | xargs -I {} open "{}" # Show app info info: @@ -108,7 +108,9 @@ nuke: @rm -rf bitchat.xcodeproj 2>/dev/null || true @rm -f project.yml.backup 2>/dev/null || true @rm -f project-macos.yml 2>/dev/null || true + @rm -f bitchat.xcodeproj/project.pbxproj.backup 2>/dev/null || true + @rm -f bitchat/Info.plist.backup 2>/dev/null || true @# Restore iOS-specific files if they were moved @if [ -f bitchat/LaunchScreen.storyboard.ios ]; then mv bitchat/LaunchScreen.storyboard.ios bitchat/LaunchScreen.storyboard; fi - @git checkout -- project.yml 2>/dev/null || echo "⚠️ Not a git repo or no changes to restore" + @git checkout -- project.yml bitchat.xcodeproj/project.pbxproj bitchat/Info.plist 2>/dev/null || echo "⚠️ Not a git repo or no changes to restore" @echo "✅ Nuclear clean complete" From d9ad5c123b8cf1a7bb59bdf573739b98b03ad8f6 Mon Sep 17 00:00:00 2001 From: Michael Neale Date: Thu, 10 Jul 2025 11:22:21 +1000 Subject: [PATCH 6/6] macos readme notes --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 7c3cc89b..5f7ebe3c 100644 --- a/README.md +++ b/README.md @@ -157,3 +157,8 @@ The protocol is designed to be platform-agnostic. An Android client can be built - Bluetooth LE APIs - Same packet structure and encryption - Compatible service/characteristic UUIDs + +## MacOS + +Want to try this on macos: `just run` will set it up and run from source. +Run `just clean` afterwards to restore things to original state for mobile app building and development.