@@ -130,17 +130,17 @@ private void OnSendCatalogueEvent(EventSpec spec, Dictionary<string, VisualEleme
130130 ImmutableAudience . Track ( typed ) ;
131131 return Json . Serialize ( new Dictionary < string , object >
132132 {
133- [ "event" ] = spec . Name ,
134- [ "overload" ] = "typed" ,
133+ [ SampleAppUi . LogPayloadKeys . Event ] = spec . Name ,
134+ [ SampleAppUi . LogPayloadKeys . Overload ] = SampleAppUi . LogPayloadKeys . OverloadValues . Typed ,
135135 [ MessageFields . Properties ] = typed . ToProperties ( ) ,
136136 } , 2 ) ;
137137 }
138138
139139 ImmutableAudience . Track ( spec . Name , props . Count > 0 ? props : null ) ;
140140 return Json . Serialize ( new Dictionary < string , object >
141141 {
142- [ "event" ] = spec . Name ,
143- [ "overload" ] = "string" ,
142+ [ SampleAppUi . LogPayloadKeys . Event ] = spec . Name ,
143+ [ SampleAppUi . LogPayloadKeys . Overload ] = SampleAppUi . LogPayloadKeys . OverloadValues . String ,
144144 [ MessageFields . Properties ] = props ,
145145 } , 2 ) ;
146146 } ) ;
@@ -154,7 +154,7 @@ private void OnSendCustomEvent() => RunAndLog(SampleAppUi.LogLabels.Track, () =>
154154 var f = CaptureCustomEventForm ( ) ;
155155 var props = string . IsNullOrEmpty ( f . RawProps ) ? null : JsonReader . DeserializeObject ( f . RawProps ) ;
156156 ImmutableAudience . Track ( f . Name , props ) ;
157- var echo = new Dictionary < string , object > { [ "event" ] = f . Name } ;
157+ var echo = new Dictionary < string , object > { [ SampleAppUi . LogPayloadKeys . Event ] = f . Name } ;
158158 if ( props != null ) echo [ MessageFields . Properties ] = props ;
159159 return Json . Serialize ( echo , 2 ) ;
160160 } ) ;
@@ -171,14 +171,14 @@ private void OnSetConsent(ConsentLevel level) => RunAndLog(SampleAppUi.LogLabels
171171 if ( ! level . CanIdentify ( ) ) ResetIdentityMirror ( ) ;
172172 var payload = new Dictionary < string , object >
173173 {
174- [ "from" ] = previous . ToLowercaseString ( ) ,
175- [ "to" ] = level . ToLowercaseString ( ) ,
174+ [ SampleAppUi . LogPayloadKeys . From ] = previous . ToLowercaseString ( ) ,
175+ [ SampleAppUi . LogPayloadKeys . To ] = level . ToLowercaseString ( ) ,
176176 } ;
177177 var effects = new List < string > ( ) ;
178178 if ( previous == ConsentLevel . None && level != ConsentLevel . None ) effects . Add ( SampleAppUi . Messages . QueueStartedSessionCreated ) ;
179179 if ( level == ConsentLevel . None ) effects . Add ( SampleAppUi . Messages . QueuePurgedAnonymousIdCleared ) ;
180180 if ( ! level . CanIdentify ( ) && previous . CanIdentify ( ) ) effects . Add ( SampleAppUi . Messages . UserIdCleared ) ;
181- if ( effects . Count > 0 ) payload [ "effects" ] = effects ;
181+ if ( effects . Count > 0 ) payload [ SampleAppUi . LogPayloadKeys . Effects ] = effects ;
182182 OnSdkStateChanged ( ) ;
183183 return Json . Serialize ( payload , 2 ) ;
184184 } ) ;
@@ -198,9 +198,9 @@ private void OnIdentify() => RunAndLog(SampleAppUi.LogLabels.Identify, () =>
198198 OnSdkStateChanged ( ) ;
199199 var payload = new Dictionary < string , object >
200200 {
201- [ "id" ] = f . Id ,
202- [ MessageFields . IdentityType ] = f . Type ,
203- [ "accepted" ] = accepted ,
201+ [ SampleAppUi . LogPayloadKeys . Id ] = f . Id ,
202+ [ MessageFields . IdentityType ] = f . Type ,
203+ [ SampleAppUi . LogPayloadKeys . Accepted ] = accepted ,
204204 } ;
205205 if ( traits != null ) payload [ MessageFields . Traits ] = traits ;
206206 return Json . Serialize ( payload , 2 ) ;
@@ -233,9 +233,9 @@ private void OnAlias() => RunAndLog(SampleAppUi.LogLabels.Alias, () =>
233233 }
234234 return Json . Serialize ( new Dictionary < string , object >
235235 {
236- [ "from" ] = new Dictionary < string , object > { [ "id" ] = f . FromId , [ MessageFields . IdentityType ] = f . FromType } ,
237- [ "to" ] = new Dictionary < string , object > { [ "id" ] = f . ToId , [ MessageFields . IdentityType ] = f . ToType } ,
238- [ "accepted" ] = accepted ,
236+ [ SampleAppUi . LogPayloadKeys . From ] = new Dictionary < string , object > { [ SampleAppUi . LogPayloadKeys . Id ] = f . FromId , [ MessageFields . IdentityType ] = f . FromType } ,
237+ [ SampleAppUi . LogPayloadKeys . To ] = new Dictionary < string , object > { [ SampleAppUi . LogPayloadKeys . Id ] = f . ToId , [ MessageFields . IdentityType ] = f . ToType } ,
238+ [ SampleAppUi . LogPayloadKeys . Accepted ] = accepted ,
239239 } , 2 ) ;
240240 } ) ;
241241
@@ -246,8 +246,8 @@ private void OnAlias() => RunAndLog(SampleAppUi.LogLabels.Alias, () =>
246246 private void OnSdkError ( AudienceError err ) =>
247247 AppendLog ( SampleAppUi . LogLabels . OnError , Json . Serialize ( new Dictionary < string , object >
248248 {
249- [ "code" ] = err . Code . ToString ( ) ,
250- [ "message" ] = err . Message ,
249+ [ SampleAppUi . LogPayloadKeys . Code ] = err . Code . ToString ( ) ,
250+ [ SampleAppUi . LogPayloadKeys . Message ] = err . Message ,
251251 } , 2 ) , LogLevel . Err , LogSource . Sdk ) ;
252252
253253 // SDK Log.Writer adapter. May fire from any thread; AppendLog handles
@@ -334,17 +334,17 @@ private static Dictionary<string, object> BuildConfigEcho(AudienceConfig config)
334334 {
335335 var echo = new Dictionary < string , object >
336336 {
337- [ "consent" ] = config . Consent . ToString ( ) ,
338- [ "debug" ] = config . Debug ,
339- [ "flushIntervalSeconds" ] = config . FlushIntervalSeconds ,
340- [ "flushSize" ] = config . FlushSize ,
341- [ "packageVersion" ] = config . PackageVersion ,
342- [ "shutdownFlushTimeoutMs" ] = config . ShutdownFlushTimeoutMs ,
337+ [ SampleAppUi . LogPayloadKeys . Consent ] = config . Consent . ToString ( ) ,
338+ [ SampleAppUi . LogPayloadKeys . Debug ] = config . Debug ,
339+ [ SampleAppUi . LogPayloadKeys . FlushIntervalSeconds ] = config . FlushIntervalSeconds ,
340+ [ SampleAppUi . LogPayloadKeys . FlushSize ] = config . FlushSize ,
341+ [ SampleAppUi . LogPayloadKeys . PackageVersion ] = config . PackageVersion ,
342+ [ SampleAppUi . LogPayloadKeys . ShutdownFlushTimeoutMs ] = config . ShutdownFlushTimeoutMs ,
343343 } ;
344344 if ( ! string . IsNullOrEmpty ( config . PublishableKey ) )
345- echo [ "publishableKey" ] = RedactPublishableKey ( config . PublishableKey ) ;
345+ echo [ SampleAppUi . LogPayloadKeys . PublishableKey ] = RedactPublishableKey ( config . PublishableKey ) ;
346346 if ( ! string . IsNullOrEmpty ( config . PersistentDataPath ) )
347- echo [ "persistentDataPath" ] = config . PersistentDataPath ;
347+ echo [ SampleAppUi . LogPayloadKeys . PersistentDataPath ] = config . PersistentDataPath ;
348348 return echo ;
349349 }
350350
0 commit comments