-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate from IPostGenerateGradleAndroidProject->AndroidProjectFilesModifier #301
base: master
Are you sure you want to change the base?
Conversation
} | ||
public class AndroidNotificationPostProcessor : AndroidProjectFilesModifier | ||
{ | ||
private static readonly string NotificationProguardPath = "unityLibrary/proguard-unity-notifications.txt"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not we're creating new proguard for notifications, since we don't allow updating existing proguard-unity, since it's not incremental friendly way
var receiverkNotificationManager = new Receiver(); | ||
receiverkNotificationManager.Attributes.Name.Set("com.unity.androidnotifications.UnityNotificationManager"); | ||
receiverkNotificationManager.Attributes.Exported.Set(false); | ||
manifest.Application.ReceiverList.AddElement(receiverkNotificationManager); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rytis can you comment on this one, is it's correct way to add receiver element ?
I was hoping for manifest.Application.ReceiverList.AddReceiver/Add(string name)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is correct. If you'd add a helper API, it should be added to the Application: manifest.Application.AddReceiver()
. One concern would be that Receiver has a lot of fields. Do you think Name and Exported fields would be the most commonly used? Otherwise I don't think the helper method is very helpful
if ((settings.ExactAlarm & AndroidExactSchedulingOption.AddRequestIgnoreBatteryOptimizationsPermission) != 0) | ||
{ | ||
// TODO: Missing AddUsesPermissionSdk23 function | ||
var batterOptimizations = manifest.AddUsesPermission("android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rytis-buz would it makese sense to have AddUsesPermissionSdk23 function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
{ | ||
// TODO: PropertyStringArray missing Add function? | ||
var original = new List<string>(projectFiles.UnityLibraryBuildGradle.Android.DefaultConfig.ConsumerProguardFiles.Get()); | ||
original.Add(Path.GetFileName(NotificationProguardPath)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rytis-buz would it make sense to have projectFiles.UnityLibraryBuildGradle.Android.DefaultConfig.ConsumerProguardFiles.Add(string value) to append to array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it can be added
var receiverkNotificationManager = new Receiver(); | ||
receiverkNotificationManager.Attributes.Name.Set("com.unity.androidnotifications.UnityNotificationManager"); | ||
receiverkNotificationManager.Attributes.Exported.Set(false); | ||
manifest.Application.ReceiverList.AddElement(receiverkNotificationManager); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is correct. If you'd add a helper API, it should be added to the Application: manifest.Application.AddReceiver()
. One concern would be that Receiver has a lot of fields. Do you think Name and Exported fields would be the most commonly used? Otherwise I don't think the helper method is very helpful
if ((settings.ExactAlarm & AndroidExactSchedulingOption.AddRequestIgnoreBatteryOptimizationsPermission) != 0) | ||
{ | ||
// TODO: Missing AddUsesPermissionSdk23 function | ||
var batterOptimizations = manifest.AddUsesPermission("android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
{ | ||
// TODO: PropertyStringArray missing Add function? | ||
var original = new List<string>(projectFiles.UnityLibraryBuildGradle.Android.DefaultConfig.ConsumerProguardFiles.Get()); | ||
original.Add(Path.GetFileName(NotificationProguardPath)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it can be added
No description provided.