@@ -15,6 +15,7 @@ import com.facebook.FacebookException
15
15
import com.facebook.LoggingBehavior
16
16
import com.facebook.appevents.eventdeactivation.EventDeactivationManager.processDeprecatedParameters
17
17
import com.facebook.appevents.integrity.IntegrityManager
18
+ import com.facebook.appevents.integrity.ProtectedModeManager.protectedModeIsApplied
18
19
import com.facebook.appevents.integrity.RedactedEventsManager
19
20
import com.facebook.appevents.integrity.SensitiveParamsManager.processFilterSensitiveParams
20
21
import com.facebook.appevents.internal.AppEventUtility.bytesToHex
@@ -43,27 +44,27 @@ class AppEvent : Serializable {
43
44
44
45
@Throws(JSONException ::class , FacebookException ::class )
45
46
constructor (
46
- contextName: String ,
47
- eventName: String ,
48
- valueToSum: Double? ,
49
- parameters: Bundle ? ,
50
- isImplicitlyLogged: Boolean ,
51
- isInBackground: Boolean ,
52
- currentSessionId: UUID ?
47
+ contextName: String ,
48
+ eventName: String ,
49
+ valueToSum: Double? ,
50
+ parameters: Bundle ? ,
51
+ isImplicitlyLogged: Boolean ,
52
+ isInBackground: Boolean ,
53
+ currentSessionId: UUID ?
53
54
) {
54
55
isImplicit = isImplicitlyLogged
55
56
inBackground = isInBackground
56
57
name = eventName
57
58
jsonObject =
58
- getJSONObjectForAppEvent(contextName, eventName, valueToSum, parameters, currentSessionId)
59
+ getJSONObjectForAppEvent(contextName, eventName, valueToSum, parameters, currentSessionId)
59
60
checksum = calculateChecksum()
60
61
}
61
62
62
63
private constructor (
63
- jsonString: String ,
64
- isImplicit: Boolean ,
65
- inBackground: Boolean ,
66
- checksum: String?
64
+ jsonString: String ,
65
+ isImplicit: Boolean ,
66
+ inBackground: Boolean ,
67
+ checksum: String?
67
68
) {
68
69
jsonObject = JSONObject (jsonString)
69
70
this .isImplicit = isImplicit
@@ -79,10 +80,10 @@ class AppEvent : Serializable {
79
80
// for old events we don't have a checksum
80
81
val isChecksumValid: Boolean
81
82
get() =
82
- if (checksum == null ) {
83
- // for old events we don't have a checksum
84
- true
85
- } else calculateChecksum() == checksum
83
+ if (checksum == null ) {
84
+ // for old events we don't have a checksum
85
+ true
86
+ } else calculateChecksum() == checksum
86
87
87
88
private fun getJSONObjectForAppEvent (
88
89
contextName : String ,
@@ -134,26 +135,28 @@ class AppEvent : Serializable {
134
135
val value = parameters[key]
135
136
if (value !is String && value !is Number ) {
136
137
throw FacebookException (
137
- String .format(
138
- " Parameter value '%s' for key '%s' should be a string" + " or a numeric type." ,
139
- value,
140
- key))
138
+ String .format(
139
+ " Parameter value '%s' for key '%s' should be a string" + " or a numeric type." ,
140
+ value,
141
+ key))
141
142
}
142
143
paramMap[key] = value.toString()
143
144
}
144
- processFilterSensitiveParams(paramMap as MutableMap <String , String ?>, name)
145
+ if (! protectedModeIsApplied(parameters)) {
146
+ processFilterSensitiveParams(paramMap as MutableMap <String , String ?>, name)
147
+ }
145
148
IntegrityManager .processParameters(paramMap)
146
149
processParameters(paramMap as MutableMap <String , String ?>, name)
147
150
processDeprecatedParameters(paramMap as MutableMap <String , String ?>, name)
148
151
return paramMap
149
152
}
150
-
153
+
151
154
internal class SerializationProxyV2
152
155
constructor (
153
- private val jsonString: String ,
154
- private val isImplicit: Boolean ,
155
- private val inBackground: Boolean ,
156
- private val checksum: String?
156
+ private val jsonString: String ,
157
+ private val isImplicit: Boolean ,
158
+ private val inBackground: Boolean ,
159
+ private val checksum: String?
157
160
) : Serializable {
158
161
@Throws(JSONException ::class , ObjectStreamException ::class )
159
162
private fun readResolve (): Any {
@@ -172,10 +175,10 @@ class AppEvent : Serializable {
172
175
173
176
override fun toString (): String {
174
177
return String .format(
175
- " \" %s\" , implicit: %b, json: %s" ,
176
- jsonObject.optString(" _eventName" ),
177
- isImplicit,
178
- jsonObject.toString())
178
+ " \" %s\" , implicit: %b, json: %s" ,
179
+ jsonObject.optString(" _eventName" ),
180
+ isImplicit,
181
+ jsonObject.toString())
179
182
}
180
183
181
184
private fun calculateChecksum (): String {
@@ -215,11 +218,11 @@ class AppEvent : Serializable {
215
218
identifier = " <None Provided>"
216
219
}
217
220
throw FacebookException (
218
- String .format(
219
- Locale .ROOT ,
220
- " Identifier '%s' must be less than %d characters" ,
221
- identifier,
222
- MAX_IDENTIFIER_LENGTH ))
221
+ String .format(
222
+ Locale .ROOT ,
223
+ " Identifier '%s' must be less than %d characters" ,
224
+ identifier,
225
+ MAX_IDENTIFIER_LENGTH ))
223
226
}
224
227
var alreadyValidated: Boolean
225
228
synchronized(validatedIdentifiers) {
@@ -230,11 +233,11 @@ class AppEvent : Serializable {
230
233
synchronized(validatedIdentifiers) { validatedIdentifiers.add(identifier) }
231
234
} else {
232
235
throw FacebookException (
233
- String .format(
234
- " Skipping event named '%s' due to illegal name - must be " +
235
- " under 40 chars and alphanumeric, _, - or space, and " +
236
- " not start with a space or hyphen." ,
237
- identifier))
236
+ String .format(
237
+ " Skipping event named '%s' due to illegal name - must be " +
238
+ " under 40 chars and alphanumeric, _, - or space, and " +
239
+ " not start with a space or hyphen." ,
240
+ identifier))
238
241
}
239
242
}
240
243
}
0 commit comments