Skip to content

Commit d84fbf4

Browse files
authored
fix Type of conditional expression cannot be determined (#174)
1 parent d9e74cb commit d84fbf4

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

Mixpanel/Controller.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ internal class Controller : MonoBehaviour
2424

2525
private static int _retryCount = 0;
2626
private static DateTime _retryTime;
27-
27+
2828
#region Singleton
29-
29+
3030
private static Controller _instance;
3131

3232
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
@@ -118,11 +118,11 @@ private void CheckForMixpanelImplemented()
118118
implementedScore += MixpanelStorage.HasIdendified ? 1 : 0;
119119
implementedScore += MixpanelStorage.HasAliased ? 1 : 0;
120120
implementedScore += MixpanelStorage.HasUsedPeople ? 1 : 0;
121-
121+
122122
if (implementedScore >= 3) {
123123
MixpanelStorage.HasImplemented = true;
124124

125-
StartCoroutine(SendHttpEvent("SDK Implemented", "metrics-1", MixpanelSettings.Instance.Token,
125+
StartCoroutine(SendHttpEvent("SDK Implemented", "metrics-1", MixpanelSettings.Instance.Token,
126126
$",\"Tracked\":{MixpanelStorage.HasTracked.ToString().ToLower()}" +
127127
$",\"Identified\":{MixpanelStorage.HasIdendified.ToString().ToLower()}" +
128128
$",\"Aliased\":{MixpanelStorage.HasAliased.ToString().ToLower()}" +
@@ -145,13 +145,13 @@ internal void DoFlush(Action<bool> onFlushComplete = null)
145145
{
146146
int coroutinesCount = 2; // Number of coroutines to wait for
147147
bool overallSuccess = true;
148-
149-
Action<bool> onComplete = onFlushComplete != null ? success =>
150-
{
148+
149+
Action<bool> onComplete = onFlushComplete != null ?
150+
new Action<bool>(success => {
151151
overallSuccess &= success;
152152
CheckCompletion(onFlushComplete, ref coroutinesCount, overallSuccess);
153-
}
154-
: null;
153+
})
154+
: (Action<bool>)null;
155155
StartCoroutine(SendData(MixpanelStorage.FlushType.EVENTS, onComplete));
156156
StartCoroutine(SendData(MixpanelStorage.FlushType.PEOPLE, onComplete));
157157
}
@@ -199,10 +199,10 @@ private IEnumerator SendData(MixpanelStorage.FlushType flushType, Action<bool> o
199199
}
200200
}
201201
}
202-
202+
203203
onComplete?.Invoke(true);
204204
}
205-
205+
206206
private void CheckCompletion(Action<bool> onFlushComplete, ref int coroutinesCount, bool overallSuccess)
207207
{
208208
// Decrease the counter
@@ -217,27 +217,27 @@ private void CheckCompletion(Action<bool> onFlushComplete, ref int coroutinesCou
217217

218218
private IEnumerator SendHttpEvent(string eventName, string apiToken, string distinctId, string properties, bool updatePeople)
219219
{
220-
string body = "{\"event\":\"" + eventName + "\",\"properties\":{\"token\":\"" +
221-
apiToken + "\",\"DevX\":true,\"mp_lib\":\"unity\"," +
220+
string body = "{\"event\":\"" + eventName + "\",\"properties\":{\"token\":\"" +
221+
apiToken + "\",\"DevX\":true,\"mp_lib\":\"unity\"," +
222222
"\"$lib_version\":\"" + Mixpanel.MixpanelUnityVersion + "\"," +
223223
"\"Project Token\":\"" + distinctId + "\",\"distinct_id\":\"" + distinctId + "\"" + properties + "}}";
224224
string payload = Convert.ToBase64String(Encoding.UTF8.GetBytes(body));
225225
WWWForm form = new WWWForm();
226226
form.AddField("data", payload);
227-
227+
228228
using (UnityWebRequest request = UnityWebRequest.Post(Config.TrackUrl, form)) {
229229
yield return request.SendWebRequest();
230230
}
231231

232232
if (updatePeople) {
233-
body = "{\"$add\":" + "{\"" + eventName +
234-
"\":1}," +
233+
body = "{\"$add\":" + "{\"" + eventName +
234+
"\":1}," +
235235
"\"$token\":\"" + apiToken + "\"," +
236236
"\"$distinct_id\":\"" + distinctId + "\"}";
237237
payload = Convert.ToBase64String(Encoding.UTF8.GetBytes(body));
238238
form = new WWWForm();
239239
form.AddField("data", payload);
240-
240+
241241
using (UnityWebRequest request = UnityWebRequest.Post(Config.EngageUrl, form)) {
242242
yield return request.SendWebRequest();
243243
}
@@ -386,7 +386,7 @@ internal static void DoTrack(string eventName, Value properties)
386386
properties["time"] = Util.CurrentTimeInMilliseconds();
387387

388388
Value data = new Value();
389-
389+
390390
data["event"] = eventName;
391391
data["properties"] = properties;
392392
data["$mp_metadata"] = Metadata.GetEventMetadata();

0 commit comments

Comments
 (0)