Closed shnktt closed 9 months ago
@shnktt Would you mind sharing a screenshot of your Integration Manager with the settings.
The AppLovinSettings.Instance.UserTrackingUsageLocalizationEnable
setting gets updated for our old terms flow. The new flow uses a different settings.
@santoshbagadi Thank you for your reply. Here's a screenshot of my Integration Manager.
This project was updated from version 5.11.2
, where the Consent Flow was turned on, to the current version 6.1.2
.
The exported Xcode project does not contain AppLovinMAXResources
.
Thank you for sharing the info. I see the issue. We'll fix it in the next release of our plugin.
In the meantime, you may update the MaxPostProcessBuildiOS.ShouldRemoveLocalization
method to the following to fix the issue
private static bool ShouldRemoveLocalization(string localizedUserTrackingDescription)
{
if (string.IsNullOrEmpty(localizedUserTrackingDescription)) return true;
var settings = AppLovinSettings.Instance;
var internalSettings = AppLovinInternalSettings.Instance;
return (!internalSettings.ConsentFlowEnabled || !internalSettings.UserTrackingUsageLocalizationEnabled)
&& (!settings.ConsentFlowEnabled || !settings.UserTrackingUsageLocalizationEnabled);
}
Thank you for providing the solution! I'm looking forward to the next release of the plugin.
We've released version 6.2.0 of our plugin that fixes this issue.
@santoshbagadi
The current implementation removes all localization files that other plugins have created. I'm using my own implementation of issuing consent and so the following code deletes my files.
private static void LocalizeUserTrackingDescriptionIfNeeded(string localizedUserTrackingDescription, string localeCode, string buildPath, PBXProject project, string targetGuid)
{
// Use the legacy resources directory name if the build is being appended (the "Resources" directory already exists if it is an incremental build).
var resourcesDirectoryName = Directory.Exists(Path.Combine(buildPath, LegacyResourcesDirectoryName)) ? LegacyResourcesDirectoryName : AppLovinMaxResourcesDirectoryName;
var resourcesDirectoryPath = Path.Combine(buildPath, resourcesDirectoryName);
var localeSpecificDirectoryName = localeCode + ".lproj";
var localeSpecificDirectoryPath = Path.Combine(resourcesDirectoryPath, localeSpecificDirectoryName);
var infoPlistStringsFilePath = Path.Combine(localeSpecificDirectoryPath, "InfoPlist.strings");
// Check if localization has been disabled between builds, and remove them as needed.
if (ShouldRemoveLocalization(localizedUserTrackingDescription))
{
if (!File.Exists(infoPlistStringsFilePath)) return;
File.Delete(infoPlistStringsFilePath);
return;
}
// Create intermediate directories as needed.
if (!Directory.Exists(resourcesDirectoryPath))
{
Directory.CreateDirectory(resourcesDirectoryPath);
}
if (!Directory.Exists(localeSpecificDirectoryPath))
{
Directory.CreateDirectory(localeSpecificDirectoryPath);
}
var localizedDescriptionLine = "\"NSUserTrackingUsageDescription\" = \"" + localizedUserTrackingDescription + "\";\n";
// File already exists, update it in case the value changed between builds.
if (File.Exists(infoPlistStringsFilePath))
{
var output = new List<string>();
var lines = File.ReadAllLines(infoPlistStringsFilePath);
var keyUpdated = false;
foreach (var line in lines)
{
if (line.Contains("NSUserTrackingUsageDescription"))
{
output.Add(localizedDescriptionLine);
keyUpdated = true;
}
else
{
output.Add(line);
}
}
if (!keyUpdated)
{
output.Add(localizedDescriptionLine);
}
File.WriteAllText(infoPlistStringsFilePath, string.Join("\n", output.ToArray()) + "\n");
}
// File doesn't exist, create one.
else
{
File.WriteAllText(infoPlistStringsFilePath, "/* Localized versions of Info.plist keys - Generated by AL MAX plugin */\n" + localizedDescriptionLine);
}
var localeSpecificDirectoryRelativePath = Path.Combine(resourcesDirectoryName, localeSpecificDirectoryName);
var guid = project.AddFolderReference(localeSpecificDirectoryRelativePath, localeSpecificDirectoryRelativePath);
project.AddFileToBuild(targetGuid, guid);
}
private static bool ShouldRemoveLocalization(string localizedUserTrackingDescription)
{
if (string.IsNullOrEmpty(localizedUserTrackingDescription)) return true;
var settings = AppLovinSettings.Instance;
var internalSettings = AppLovinInternalSettings.Instance;
return (!internalSettings.ConsentFlowEnabled || !internalSettings.UserTrackingUsageLocalizationEnabled)
&& (!settings.ConsentFlowEnabled || !settings.UserTrackingUsageLocalizationEnabled);
}
I can't do anything but edit the your plugin file.
[PostProcessBuildAttribute(int.MaxValue - 1)]
public static void MaxPostProcessPbxProject(BuildTarget buildTarget, string buildPath)
{
......
You'll have to come up with another solution.
MAX Plugin Version
6.1.2
Unity Version
2021.2.12f1
Device/Platform Info
iOS platform
Current Behavior
Despite enabling the 'Localize User Tracking Usage Description' option in the Integration Manager, the Xcode project is exported without localization.
Expected Behavior
When the 'Localize User Tracking Usage Description' is enabled, the Xcode project should be exported with appropriate localization settings applied.
How to Reproduce
Additional Info
In
MaxPostProcessBuildiOS.cs
, theShouldRemoveLocalization
method returns true. It appears there is no instance whereAppLovinSettings.Instance.UserTrackingUsageLocalizationEnabled
is set to true, leading to this issue.