@@ -72,13 +72,15 @@ public static void OnPostprocessBuild (BuildTarget buildTarget, string path)
7272 tempProject . ReadFromString ( File . ReadAllText ( projectPath ) ) ;
7373 string targetId = GetMainTargetGUID ( tempProject ) ;
7474
75- var capabilityManager = new ProjectCapabilityManager ( projectPath , "dev.entitlements" , null , targetId ) ;
76-
7775 if ( path . Contains ( "FirebaseMessaging" ) ) {
78- MakeChangesForMessaging ( capabilityManager ) ;
79- }
80- if ( path . Contains ( "FirebaseAuth" ) ) {
81- MakeChangesForAuth ( capabilityManager ) ;
76+ var capabilityManager = new ProjectCapabilityManager ( projectPath , "dev.entitlements" , null , targetId ) ;
77+ capabilityManager . AddPushNotifications ( true ) ;
78+ capabilityManager . AddBackgroundModes ( BackgroundModesOptions . RemoteNotifications ) ;
79+ capabilityManager . WriteToFile ( ) ;
80+ } else if ( path . Contains ( "FirebaseAuth" ) ) {
81+ var capabilityManager = new ProjectCapabilityManager ( projectPath , "dev.entitlements" , null , targetId ) ;
82+ capabilityManager . AddPushNotifications ( true ) ;
83+ capabilityManager . WriteToFile ( ) ;
8284 }
8385 // Bitcode is being deprecated by xcode, but Unity defaults to it on, so turn it off.
8486 tempProject . SetBuildProperty ( targetId , "ENABLE_BITCODE" , "NO" ) ;
@@ -87,19 +89,6 @@ public static void OnPostprocessBuild (BuildTarget buildTarget, string path)
8789 File . WriteAllText ( projectPath , tempProject . WriteToString ( ) ) ;
8890 }
8991
90- static void MakeChangesForMessaging ( ProjectCapabilityManager capabilityManager ) {
91- Debug . Log ( "Messaging testapp detected." ) ;
92- capabilityManager . AddPushNotifications ( true ) ;
93- capabilityManager . AddBackgroundModes ( BackgroundModesOptions . RemoteNotifications ) ;
94- Debug . Log ( "Finished making messaging-specific changes." ) ;
95- }
96-
97- static void MakeChangesForAuth ( ProjectCapabilityManager capabilityManager ) {
98- Debug . Log ( "Auth testapp detected." ) ;
99- capabilityManager . AddPushNotifications ( true ) ;
100- Debug . Log ( "Finished making auth-specific changes." ) ;
101- }
102-
10392 static string GetMainTargetGUID ( object pbxProjectObj ) {
10493 var pbxProject = ( PBXProject ) pbxProjectObj ;
10594 // In 2019.3 Unity changed this API without an automated update path via the api-updater.
0 commit comments