From de9e30534e2c43dfde96b1fd564af725087e2e8a Mon Sep 17 00:00:00 2001 From: MAJigsaw77 <77043862+MAJigsaw77@users.noreply.github.com> Date: Wed, 20 Aug 2025 01:14:37 +0300 Subject: [PATCH] Use `Xml` instead of a string array for the mods provider on `Android`. --- project.hxp | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/project.hxp b/project.hxp index c61830783..a5ab31da8 100644 --- a/project.hxp +++ b/project.hxp @@ -8,6 +8,7 @@ import sys.io.File; import haxe.io.Bytes; import haxe.io.Path; import haxe.ds.Map; +import haxe.xml.Printer; using StringTools; @@ -1057,23 +1058,31 @@ class Project extends HXProject } } - final modsFolderProvider = [ - '', - ' ', - ' ', - ' ', - '' - ]; + final modsFolderProvider:Xml = Xml.createElement('provider'); + modsFolderProvider.set('android:authorities', '$PACKAGE_NAME.docprovider'); + modsFolderProvider.set('android:name', 'funkin.provider.DataFolderProvider'); + modsFolderProvider.set('android:grantUriPermissions', 'true'); + modsFolderProvider.set('android:exported', 'true'); + modsFolderProvider.set('android:permission', 'android.permission.MANAGE_DOCUMENTS'); - final xmlChildren:Null> = config.get('android.application').xmlChildren; + final intentFilter:Xml = Xml.createElement('intent-filter'); - if (xmlChildren != null) + final action:Xml = Xml.createElement('action'); + action.set('android:name', 'android.content.action.DOCUMENTS_PROVIDER'); + intentFilter.addChild(action); + + modsFolderProvider.addChild(intentFilter); + + @:nullSafety(Off) { - config.get('android.application').xmlChildren = xmlChildren.concat(modsFolderProvider); - } - else - { - config.get('android.application').xmlChildren = modsFolderProvider; + if (config.get('android.application').xmlChildren != null) + { + config.get('android.application').xmlChildren.push(Printer.print(modsFolderProvider)); + } + else + { + config.get('android.application').xmlChildren = [Printer.print(modsFolderProvider)]; + } } final extensions:Null> = config.getArrayString('android.extension');