1
1
using System ;
2
2
using ConsentManagementProviderLib . Json ;
3
+ using ConsentManagementProviderLib . Observer ;
3
4
using UnityEngine ;
4
5
5
6
namespace ConsentManagementProviderLib . Android
@@ -58,16 +59,20 @@ AndroidJavaObject onAction(AndroidJavaObject view, AndroidJavaObject actionType)
58
59
void onConsentReady ( string spConsents )
59
60
{
60
61
CmpDebugUtil . Log ( "I've reached the C# onConsentReady with json string: " + spConsents ) ;
61
- try
62
- {
63
- SpConsents consents = JsonUnwrapper . UnwrapSpConsentsAndroid ( spConsents ) ;
64
- _spConsents = consents ;
65
- ConsentMessenger . Broadcast < IOnConsentReady > ( consents ) ;
66
- }
67
- catch ( Exception e )
62
+
63
+ BroadcastEventDispatcher . Execute ( ( ) =>
68
64
{
69
- ConsentMessenger . Broadcast < IOnConsentError > ( e ) ;
70
- }
65
+ try
66
+ {
67
+ SpConsents consents = JsonUnwrapper . UnwrapSpConsentsAndroid ( spConsents ) ;
68
+ _spConsents = consents ;
69
+ ConsentMessenger . Broadcast < IOnConsentReady > ( consents ) ;
70
+ }
71
+ catch ( Exception e )
72
+ {
73
+ ConsentMessenger . Broadcast < IOnConsentError > ( e ) ;
74
+ }
75
+ } ) ;
71
76
}
72
77
73
78
/**
@@ -78,16 +83,20 @@ void onSpFinished(string spConsents)
78
83
CmpDebugUtil . ForceEnableNextCmpLog ( ) ;
79
84
CmpDebugUtil . LogWarning ( $ "I've reached the C# onSpFinished with JSON spConsents={ spConsents } ") ;
80
85
Console . WriteLine ( $ "spConsents= `{ spConsents } ") ;
81
- try
82
- {
83
- SpConsents consents = JsonUnwrapper . UnwrapSpConsentsAndroid ( spConsents ) ;
84
- _spConsents = consents ;
85
- ConsentMessenger . Broadcast < IOnConsentSpFinished > ( consents ) ;
86
- }
87
- catch ( Exception e )
86
+
87
+ BroadcastEventDispatcher . Execute ( ( ) =>
88
88
{
89
- ConsentMessenger . Broadcast < IOnConsentError > ( e ) ;
90
- }
89
+ try
90
+ {
91
+ SpConsents consents = JsonUnwrapper . UnwrapSpConsentsAndroid ( spConsents ) ;
92
+ _spConsents = consents ;
93
+ ConsentMessenger . Broadcast < IOnConsentSpFinished > ( consents ) ;
94
+ }
95
+ catch ( Exception e )
96
+ {
97
+ ConsentMessenger . Broadcast < IOnConsentError > ( e ) ;
98
+ }
99
+ } ) ;
91
100
}
92
101
93
102
void onError ( AndroidJavaObject rawThrowableObject )
0 commit comments