Enables one or more optional Dala features by patching mix.exs, manifest
files, and generating any required source files.
Usage
mix dala.enable FEATURE [FEATURE ...]Multiple features can be enabled in a single command:
mix dala.enable camera photo_library
mix dala.enable camera photo_library file_sharing liveviewFeatures
liveview
Enables LiveView mode — the Dala app runs a local Phoenix endpoint and displays it in a native WebView. Web developers can ship a mobile app with zero native UI code.
What it does:
- Generates
lib/<app>/dala_screen.ex— aDala.Screenthat opens a WebView athttp://127.0.0.1:PORT/ - Injects the
DalaHookLiveView hook intoassets/js/app.js - Injects a hidden
<div id="dala-bridge" phx-hook="DalaHook">intoroot.html.heex— this is required for the hook to mount - Updates
dala.exswithliveview_portsoDala.Platform.LiveView.local_url/1works
Why the hidden div is required
Phoenix LiveView hooks only execute when a DOM element carrying
phx-hook="DalaHook" exists in the rendered page. Registering DalaHook in
app.js is necessary but not sufficient — without a matching DOM element the
hook never mounts and window.dala is never replaced with the LiveView-backed
version. Messages would silently route through the native NIF bridge instead
of the LiveView WebSocket, so handle_event/3 would never fire.
See DalaDev.Enable module doc and guides/liveview.md for the full
two-bridge architecture explanation.
After running:
- Add
MyApp.DalaScreento your supervision tree (or callDala.Screen.start_root(MyApp.DalaScreen)from yourDala.App.on_start/0) - Ensure Phoenix is running on the port set in
dala.exs(default: 4000)
camera
Adds camera permission declarations to platform manifests.
- iOS: adds
NSCameraUsageDescriptiontoios/*/Info.plist - Android: adds
<uses-permission android:name="android.permission.CAMERA"/>toandroid/app/src/main/AndroidManifest.xml
photo_library
- iOS: adds
NSPhotoLibraryAddUsageDescriptionto Info.plist - Android: no manifest change needed (API 29+)
file_sharing
- iOS: adds
UIFileSharingEnabledandLSSupportsOpeningDocumentsInPlaceto Info.plist - Android: adds
<provider android:name="FileProvider">with paths config
location
- iOS: adds
NSLocationWhenInUseUsageDescriptionto Info.plist - Android: adds
ACCESS_FINE_LOCATIONpermission
notifications
- iOS: runtime only — no plist key needed
- Android: adds
POST_NOTIFICATIONSpermission (API 33+)