Skip to content

Commit f34ce16

Browse files
committed
Add ability to specify the following through buildozer.spec
- Media Usage Description - Local Area Network Usage Description - Camera Usage Description - ViewControllerBasedStatusBarAppearance - Custom extensions for app.
1 parent fc3c5d3 commit f34ce16

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

buildozer/default.spec

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,22 @@ ios.codesign.allowed = false
401401
# (str) The development team to use for signing the release version
402402
#ios.codesign.development_team.release = <hexstring>
403403

404+
# (str) Justification text to be provided for being able to select media
405+
#ios.media_usage_description = "<APP> needs to access your media in order to <Do X and Y and Z> "
406+
407+
# (str) Justification text to be provided for being able to use local network
408+
#ios.local_network_usage_description = "<App> needs permissions to <Do X and Y and Z> in your Local Area Network"
409+
410+
# (str) Camera Usage justification string.
411+
#ios.camera_usage_description = "<App> uses Camera to do <X and Y and Z>"
412+
413+
414+
# (bool) Allow StatusBar to be controlled by API
415+
# ios.viewcontroller_based_statusbar_appearance = False
416+
417+
# (str) A Xml String specifying a extension type.
418+
#ios.app_extensions = [["7zip", "zip"], ["public.zip-archive"], "org.kivy.myappextensionfile", "<MyCustom> Extension File", "${MACOSX_BUNDLE_ICON_FILE}", "http://mysite.com/myapp/extensions.html"],
419+
404420
# (str) URL pointing to .ipa file to be installed
405421
# This option should be defined along with `display_image_url` and `full_size_image_url` options.
406422
#ios.manifest.app_url =

buildozer/targets/ios.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,48 @@ def build_package(self):
263263
'displayImageURL': display_image_url,
264264
'fullSizeImageURL': full_size_image_url,
265265
}
266+
# Permissions and their Justification Descriptions
267+
local_network_usage_description = self.buildozer.config.getdefault(
268+
"app", "ios.local_network_usage_description", None)
269+
media_usage_description = self.buildozer.config.getdefault(
270+
"app", "ios.media_usage_description", None)
271+
camera_usage_description = self.buildozer.config.getdefault(
272+
"app", "ios.camera_usage_description", None)
273+
viewcontroller_based_statusbar_appearance = self.buildozer.config.getdefault(
274+
"app", "ios.viewcontroller_based_statusbar_appearance", None)
275+
276+
# types
277+
custom_ext_types = self.buildozer.config.getdefault("app", "ios.app_extensions", None)
278+
279+
if media_usage_description:
280+
plist['NSAppleMusicUsageDescription'] = media_usage_description
281+
if local_network_usage_description:
282+
plist['NSLocalNetworkUsageDescription'] = local_network_usage_description
283+
if camera_usage_description:
284+
plist['NSCameraUsageDescription'] = camera_usage_description
285+
if viewcontroller_based_statusbar_appearance:
286+
plist['UIViewControllerBasedStatusBarAppearance'] = viewcontroller_based_statusbar_appearance
287+
if custom_ext_types:
288+
import ast
289+
custom_ext_types = ast.literal_eval(custom_ext_types)
290+
plist["UTExportedTypeDeclarations"] = []
291+
plist["CFBundleDocumentTypes"] = []
292+
for ext in custom_ext_types:
293+
plist["UTExportedTypeDeclarations"].append({
294+
'UTTypeConformsTo': ext[1],
295+
'UTTypeIdentifier': ext[2],
296+
'UTTypeDescription': ext[3],
297+
'UTTypeIconFile': ext[4],
298+
'UTTypeReferenceURL': ext[5],
299+
'UTTypeTagSpecification': {'public.filename-extension': ext[0]}, })
300+
plist["CFBundleDocumentTypes"].append({
301+
"CFBundleTypeName": ext[3],
302+
"CFBundleTypeIconFile": ext[4],
303+
"CFBundleTypeRole": "Editor",
304+
"LSHandlerRank": "Owner",
305+
"LSItemContentTypes": [ext[2]], })
306+
plist["LSSupportsOpeningDocumentsInPlace"] = "NO"
307+
plist["UISupportsDocumentBrowser"] = "NO"
266308

267309
# ok, write the modified plist.
268310
self.dump_plist_to_file(plist, plist_rfn)

0 commit comments

Comments
 (0)