@@ -62,21 +62,34 @@ void onConsentReady(string spConsents)
62
62
_spConsents = consents ;
63
63
ConsentMessenger . Broadcast < IOnConsentReady > ( consents ) ;
64
64
}
65
-
65
+
66
+ /**
67
+ * It is invoked when the interaction with native WebView is done, consent sent, JSON received and CMP is ready to close the WebView
68
+ */
66
69
void onSpFinished ( string spConsents )
67
70
{
68
- CmpDebugUtil . Log ( "I've reached the C# onSpFinished" ) ;
69
- SpConsents consents = JsonUnwrapper . UnwrapSpConsentsAndroid ( spConsents ) ;
70
- _spConsents = consents ;
71
- ConsentMessenger . Broadcast < IOnConsentSpFinished > ( consents ) ;
72
- }
71
+ CmpDebugUtil . ForceEnableNextCmpLog ( ) ;
72
+ CmpDebugUtil . LogWarning ( $ "I've reached the C# onSpFinished with JSON spConsents={ spConsents } ") ;
73
73
74
+ try
75
+ {
76
+ SpConsents consents = JsonUnwrapper . UnwrapSpConsentsAndroid ( spConsents ) ;
77
+ _spConsents = consents ;
78
+ ConsentMessenger . Broadcast < IOnConsentSpFinished > ( consents ) ;
79
+ }
80
+ catch ( Exception e )
81
+ {
82
+ ConsentMessenger . Broadcast < IOnConsentError > ( e ) ;
83
+ }
84
+ }
74
85
75
86
void onError ( AndroidJavaObject rawThrowableObject )
76
87
{
77
- CmpDebugUtil . Log ( "I've reached the C# onError : " + rawThrowableObject . ToString ( ) ) ;
88
+ CmpDebugUtil . ForceEnableNextCmpLog ( ) ;
89
+ CmpDebugUtil . LogError ( "I've reached the C# onError : " + rawThrowableObject . ToString ( ) ) ;
78
90
Exception exception = CmpJavaToUnityUtils . ConvertThrowableToError ( rawThrowableObject ) ;
79
- CmpDebugUtil . Log ( "Exception converted successfully : " + exception . ToString ( ) ) ;
91
+ CmpDebugUtil . ForceEnableNextCmpLog ( ) ;
92
+ CmpDebugUtil . LogError ( "Exception converted successfully : " + exception . ToString ( ) ) ;
80
93
ConsentMessenger . Broadcast < IOnConsentError > ( exception ) ;
81
94
}
82
95
0 commit comments