Skip to content
Open
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
62 changes: 31 additions & 31 deletions platform/iphone/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -37,36 +37,36 @@
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackTranslucent</string>
<key>NSAppleMusicUsageDescription</key>
<string>Set Apple Music description in build settings</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Set Bluetooth Peripheral description in build settings</string>
<key>NSCalendarsUsageDescription</key>
<string>Set Calendars Peripheral description in build settings</string>
<key>NSCameraUsageDescription</key>
<string>Set Camera Usage Description in build settings</string>
<key>NSContactsUsageDescription</key>
<string>Set Contacts Usage Description in build settings</string>
<key>NSHomeKitUsageDescription</key>
<string>Set Home Kit Usage Description in build settings</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Set Location Always Usage Description in build settings</string>
<key>NSLocationUsageDescription</key>
<string>Set Location Usage Description in build settings</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Set Location When In Use Usage description in build settings</string>
<key>NSMicrophoneUsageDescription</key>
<string>Set Microphone Recognition Usage description in build settings</string>
<key>NSMotionUsageDescription</key>
<string>Set Motion Usage description in build settings</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Set Photo Usage description in build settings</string>
<key>NSRemindersUsageDescription</key>
<string>Set Reminders Usage description in build settings</string>
<key>NSSiriUsageDescription</key>
<string>Set Siri Usage description in build settings</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>Set Speech Recognition Usage description in build settings</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Set Photo Library Add Usage description in build settings</string>
<string>@APP_NAME@ does not access your Apple Music library.</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>@APP_NAME@ does not use Bluetooth.</string>
<key>NSCalendarsUsageDescription</key>
<string>@APP_NAME@ does not access your calendar.</string>
<key>NSCameraUsageDescription</key>
<string>@APP_NAME@ does not use your camera.</string>
<key>NSContactsUsageDescription</key>
<string>@APP_NAME@ does not access your contacts.</string>
<key>NSHomeKitUsageDescription</key>
<string>@APP_NAME@ does not use HomeKit.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>@APP_NAME@ does not use your location.</string>
<key>NSLocationUsageDescription</key>
<string>@APP_NAME@ does not use your location.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>@APP_NAME@ does not use your location.</string>
<key>NSMicrophoneUsageDescription</key>
<string>@APP_NAME@ does not use the microphone.</string>
<key>NSMotionUsageDescription</key>
<string>@APP_NAME@ does not use motion data.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>@APP_NAME@ does not read from your photo library.</string>
<key>NSRemindersUsageDescription</key>
<string>@APP_NAME@ does not access reminders.</string>
<key>NSSiriUsageDescription</key>
<string>@APP_NAME@ does not integrate with Siri.</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>@APP_NAME@ does not use speech recognition.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>@APP_NAME@ does not access your photo library.</string>
</dict>
</plist>
30 changes: 29 additions & 1 deletion platform/resources/CoronaPListSupport.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,21 @@ local function getDelegates(tmpDir)
return delegates
end

-- Replace the "@APP_NAME@" token in every string in the Info.plist with the app's name.
-- The iOS template ships default NS*UsageDescription strings that use it, and it works in
-- build.settings strings too since this runs after those have been merged in.
local function substituteAppName( value, appName )
if type(value) == "string" then
-- escape "%" in the replacement so gsub doesn't treat it as a capture reference
return (value:gsub("@APP_NAME@", (appName:gsub("%%", "%%%%"))))
elseif type(value) == "table" then
for k, v in pairs(value) do
value[k] = substituteAppName(v, appName)
end
end
return value
end

local function inArray(array, item)
for key, value in pairs(array) do
if value == item then return key end
Expand Down Expand Up @@ -217,7 +232,9 @@ function CoronaPListSupport.modifyPlist( options )
-- We process app Info.plists effectively twice, once when the templates are built and once when
-- the app itself is built. The meta Info.plist has the place holders prefixed with "TEMPLATE_"
-- so when we see that we replace it with the normal placeholders.
if infoPlist.CFBundleVersion == "@TEMPLATE_BUNDLE_VERSION@" then
local isTemplateBuild = (infoPlist.CFBundleVersion == "@TEMPLATE_BUNDLE_VERSION@")

if isTemplateBuild then
infoPlist.CFBundleVersion = "@BUNDLE_VERSION@"
infoPlist.CFBundleShortVersionString = "@BUNDLE_SHORT_VERSION_STRING@"
else
Expand Down Expand Up @@ -468,6 +485,17 @@ function CoronaPListSupport.modifyPlist( options )
end
end

-- Done last so that strings coming from build.settings can use "@APP_NAME@" as well. Skipped
-- when building the templates themselves, where the app's name isn't known yet.
if not isTemplateBuild then
local appName = options.bundledisplayname or options.bundlename or infoPlist.CFBundleDisplayName or infoPlist.CFBundleName
if type(appName) ~= "string" or appName == "" or appName:match("[%$@]") then
-- no name, or an unexpanded ${PRODUCT_NAME}/@PLACEHOLDER@ from the template
appName = "This app"
end
substituteAppName( infoPlist, appName )
end

if debugBuildProcess and debugBuildProcess ~= 0 then
print("Final Info.plist: " .. json.encode(infoPlist, { indent = true }))
end
Expand Down