The "tiapp.xml" file's "AndroidManifest.xml" settings is unable to override the XML elements such as <activity/>, <receiver/>, etc. that are defined in a native module's "timodule.xml" or a native AAR library's embedded "AndroidManifest.xml".
Microsoft's authentication library (aka: MSAL) requires the app developer to override its com.microsoft.identity.client.BrowserTabActivity in the app project's "AndroidManifest.xml" and add an intent-filter to it. This is needed the Chrome web browser app will return the end-user back to the app that requested single-signon.
Steps to Reproduce:
- Create a Titanium Classic "Default Project".
- Insert the android manifest XML settings below into the "tiapp.xml" file.
- Create the follow subfolders under the project: ./platform/android
- Copy this ticket's msal-0.2.2.aar file to the ./platform/android folder.
- Build the app for Android.
- Go to the project's ./build/android directory via Finder/WindowsExplorer.
- Open the "AndroidManifest.xml" file.
- Notice that the <intent-filter/> shown below was not injected into the "AndroidManifest.xml" file. (This is the bug.)
We should change the finalAndroidManifest merge order in the SDK's "_build.js" script here. The order should be:
- this.androidLibraries.forEach(/* finalAndroidManifest.merge(am) */)
- this.modules.forEach(/* finalAndroidManifest.merge(am) */)
Delete the XML setting that you want to override from the "timodule.xml" file or AAR file. Note that you can unzip an AAR file, change its embedded "AndroidMainfest.xml" file, and then re-zip it. Changing the AAR library's extension from ".aar" to ".zip" is an easy way to unzip it.