Dala.Setup.Ios (dala v0.0.8)

Copy Markdown View Source

iOS Bluetooth/WiFi setup automation for Dala.

This module provides automated setup for iOS Bluetooth and WiFi functionality by configuring the Xcode project with required files, frameworks, and Info.plist entries.

Usage

From the command line (via Mix task):

mix dala.setup_ios_bluetooth
mix dala.setup_ios_bluetooth --check

From Elixir code:

Dala.Setup.IOS.setup_bluetooth()
Dala.Setup.IOS.setup_bluetooth("/path/to/ios/directory")
Dala.Setup.IOS.check("/path/to/ios/directory")

What it does

  1. Finds the Xcode project or workspace in the ios/ directory
  2. Adds Bluetooth files to the Xcode project:
    • DalaBluetoothManager.h
    • DalaBluetoothManager.m
    • DalaBluetoothCInterface.m
    • DalaBluetooth.swift
  3. Links CoreBluetooth.framework
  4. Adds required keys to Info.plist:
    • NSBluetoothAlwaysUsageDescription
    • NSBluetoothPeripheralUsageDescription
    • NSLocalNetworkUsageDescription
    • NSBonjourServices
    • UIBackgroundModes (bluetooth-central)
  5. Patches AppDelegate to call DalaBluetoothBridge.ensureLinked()
  6. Verifies the setup

Prerequisites

  • Xcode project must exist in the ios/ directory
  • Ruby is preferred (for pbxproj modification); sed fallback if unavailable
  • plutil or PlistBuddy must be available (for Info.plist modification)

Summary

Functions

Check if Bluetooth files are present in the ios/ directory.

Verify the current iOS Bluetooth/WiFi setup without making changes.

Find the Xcode project or workspace in the given directory.

Print setup instructions without running the script.

Run the iOS Bluetooth/WiFi setup.

Check if an Xcode project exists in the given directory.

Types

result()

@type result() :: {:ok, String.t()} | {:error, String.t()}

Functions

bluetooth_files_present?(ios_dir \\ nil)

@spec bluetooth_files_present?(String.t() | nil) :: boolean()

Check if Bluetooth files are present in the ios/ directory.

check(ios_dir \\ nil)

@spec check(String.t() | nil) :: result()

Verify the current iOS Bluetooth/WiFi setup without making changes.

Returns {:ok, message} if all checks pass, {:error, reason} otherwise.

find_xcode_project(ios_dir \\ nil)

@spec find_xcode_project(String.t() | nil) :: {:ok, String.t()} | {:error, String.t()}

Find the Xcode project or workspace in the given directory.

setup_bluetooth(ios_dir \\ nil)

@spec setup_bluetooth(String.t() | nil) :: result()

Run the iOS Bluetooth/WiFi setup.

Returns {:ok, message} on success, {:error, reason} on failure.

xcode_project_exists?(ios_dir \\ nil)

@spec xcode_project_exists?(String.t() | nil) :: boolean()

Check if an Xcode project exists in the given directory.