-
-
Notifications
You must be signed in to change notification settings - Fork 261
/
Copy pathInstallationServiceExtensions.cs
48 lines (41 loc) · 1.66 KB
/
InstallationServiceExtensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System.Threading.Tasks;
using Parse.Abstractions.Infrastructure;
namespace Parse;
public static class InstallationServiceExtensions
{
/// <summary>
/// Constructs a <see cref="ParseQuery{ParseInstallation}"/> for ParseInstallations.
/// </summary>
/// <remarks>
/// Only the following types of queries are allowed for installations:
///
/// <code>
/// query.GetAsync(objectId)
/// query.WhereEqualTo(key, value)
/// query.WhereMatchesKeyInQuery<TOther>(key, keyInQuery, otherQuery)
/// </code>
///
/// You can add additional query conditions, but one of the above must appear as a top-level <c>AND</c>
/// clause in the query.
/// </remarks>
public static ParseQuery<ParseInstallation> GetInstallationQuery(this IServiceHub serviceHub)
{
return new ParseQuery<ParseInstallation>(serviceHub);
}
#pragma warning disable CS1030 // #warning directive
#warning Consider making the following method asynchronous.
/// <summary>
/// Gets the ParseInstallation representing this app on this device.
/// </summary>
public static async Task<ParseInstallation> GetCurrentInstallation(this IServiceHub serviceHub)
#pragma warning restore CS1030 // #warning directive
{
ParseInstallation parseInstallation = await serviceHub.CurrentInstallationController.GetAsync(serviceHub);
// TODO (hallucinogen): this will absolutely break on Unity, but how should we resolve this?
return parseInstallation;
}
internal static void ClearInMemoryInstallation(this IServiceHub serviceHub)
{
serviceHub.CurrentInstallationController.ClearFromMemory();
}
}