Skip to content

feat: Fully support .NET Standard on various platforms #372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
999c82c
Merge branch 'feature/fix-currentinstallation-caching' into develop
TobiasPott Aug 29, 2019
428d630
Merge branch 'master' into develop
TobiasPott Aug 29, 2019
d6a2683
Organize file structure and add Parse.Core project for future use.
TheFanatr Mar 21, 2020
bbc07ab
Organize file structure further, and extract certain configuration it…
TheFanatr Mar 23, 2020
6b1e1a8
Make sure that temporary cache is cleared when the host application i…
TheFanatr Mar 24, 2020
fc1d958
Undo simplification of IParseCorePlugins and implementation in order …
TheFanatr Mar 24, 2020
fa91f73
Move IParseCorePlugins and implementation to management-related names…
TheFanatr Mar 24, 2020
69be94d
Introduce new ServiceHub-based infrastructure elements and use them i…
TheFanatr Apr 6, 2020
23e86ea
Complete refactored usage of dependency injection via merged plugin c…
TheFanatr Apr 9, 2020
645b19f
Fix all bugs according to tests.
TheFanatr Apr 9, 2020
b4ede59
Added theoretical support for concurrent users.
TheFanatr Apr 29, 2020
fea1dee
Change main project folder and namespace structure again, and clean u…
TheFanatr Apr 29, 2020
a9a93e3
Add late initialized IMutableServiceHub implementation, use IServiceH…
TheFanatr May 4, 2020
f1e3068
Update README.md, add and document SignUpAsync IServiceHub extension …
TheFanatr May 4, 2020
a746e2e
Rename IStorageController and related items to derivative names of IC…
TheFanatr May 4, 2020
f58c248
Rename ConcurrentUserStorageController to VirtualCacheController, and…
TheFanatr May 5, 2020
5729f9b
Update exception messages, rename ConcurrentUserStorageController to …
TheFanatr May 5, 2020
3f1154f
Update README.md.
TheFanatr May 5, 2020
d77ffe5
Update SignUpAsync IServiceHub extension method logic, and make Parse…
TheFanatr May 5, 2020
44398fe
Merge branch 'master' into master
TobiasPott Jun 26, 2020
7831e75
Merge branch 'master' into develop
TobiasPott Jun 28, 2020
fe205ed
Updated code sample formatting for readability.
TobiasPott Jun 28, 2020
1e2a51b
Added link.xml hint for iOS platform to the Unity3D section
TobiasPott Jun 28, 2020
0b503c2
Merge branch 'feature/update-readme-and-configuration-hints' into dev…
TobiasPott Jun 28, 2020
bc53c70
Merge branch 'master' into develop
TobiasPott Jun 29, 2020
07fb388
Removed -develop suffix of package id
TobiasPott Jun 29, 2020
760dbe5
Refactor and rename numerous items, add Facebook authentication via F…
TheFanatr Sep 4, 2020
b77c105
Merge remote-tracking branch 'upstream/master', add modifications, an…
TheFanatr Sep 4, 2020
0320b87
Use web utilities for BuildQueryString instead of ParseClient.
TheFanatr Sep 4, 2020
437af13
Merge branch 'master' of https://github.com/TheFanatr/Parse-SDK-dotNET
TheFanatr Sep 4, 2020
75d4164
Merge remote-tracking branch 'origin/master' into develop.
TheFanatr Sep 4, 2020
1ac7f0a
Merge branch 'master' into merge-develop
mtrezza May 20, 2024
bb7bdaa
Update release.config.js
mtrezza May 24, 2024
4c0f5b1
Update release.config.js
mtrezza May 24, 2024
d621fe1
Merge remote-tracking branch 'upstream/master'
mtrezza May 24, 2024
72ed465
Merge remote-tracking branch 'upstream/master'
mtrezza May 24, 2024
cdbd5e5
Merge remote-tracking branch 'upstream/master'
mtrezza May 24, 2024
03bc5a4
Merge branch 'master' into merge-develop
mtrezza May 24, 2024
7df7036
Merge branch 'master' into merge-develop
mtrezza May 24, 2024
ed44e25
Merge branch 'master' into merge-develop
mtrezza Jul 16, 2024
39e87e8
Merge branch 'master' into merge-develop
mtrezza Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Parse.Tests/ConfigTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void TestCurrentConfig()
public void TestToJSON()
{
IDictionary<string, object> expectedJson = new Dictionary<string, object> { { "params", new Dictionary<string, object> { { "testKey", "testValue" } } } };
Assert.AreEqual(JsonConvert.SerializeObject((Client.GetCurrentConfiguration() as IJsonConvertible).ConvertToJSON()), JsonConvert.SerializeObject(expectedJson));
Assert.AreEqual(JsonConvert.SerializeObject((Client.GetCurrentConfiguration() as IJsonConvertible).ConvertToJson()), JsonConvert.SerializeObject(expectedJson));
}

[TestMethod]
Expand Down
8 changes: 4 additions & 4 deletions Parse.Tests/UserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ public Task TestLink()
hub.ObjectController = mockObjectController.Object;
hub.CurrentUserController = new Mock<IParseCurrentUserController> { }.Object;

return user.LinkWithAsync("parse", new Dictionary<string, object> { }, CancellationToken.None).ContinueWith(task =>
return user.LinkToServiceAsync("parse", new Dictionary<string, object> { }, CancellationToken.None).ContinueWith(task =>
{
Assert.IsFalse(task.IsFaulted);
Assert.IsFalse(task.IsCanceled);
Expand Down Expand Up @@ -656,7 +656,7 @@ public Task TestUnlink()
hub.ObjectController = mockObjectController.Object;
hub.CurrentUserController = mockCurrentUserController.Object;

return user.UnlinkFromAsync("parse", CancellationToken.None).ContinueWith(task =>
return user.UnlinkFromServiceAsync("parse", CancellationToken.None).ContinueWith(task =>
{
Assert.IsFalse(task.IsFaulted);
Assert.IsFalse(task.IsCanceled);
Expand Down Expand Up @@ -710,7 +710,7 @@ public Task TestUnlinkNonCurrentUser()
hub.ObjectController = mockObjectController.Object;
hub.CurrentUserController = mockCurrentUserController.Object;

return user.UnlinkFromAsync("parse", CancellationToken.None).ContinueWith(task =>
return user.UnlinkFromServiceAsync("parse", CancellationToken.None).ContinueWith(task =>
{
Assert.IsFalse(task.IsFaulted);
Assert.IsFalse(task.IsCanceled);
Expand Down Expand Up @@ -747,7 +747,7 @@ public Task TestLogInWith()

hub.UserController = mockController.Object;

return client.LogInWithAsync("parse", new Dictionary<string, object> { }, CancellationToken.None).ContinueWith(task =>
return client.AuthenticateWithServiceAsync("parse", new Dictionary<string, object> { }, CancellationToken.None).ContinueWith(task =>
{
Assert.IsFalse(task.IsFaulted);
Assert.IsFalse(task.IsCanceled);
Expand Down
2 changes: 1 addition & 1 deletion Parse/Abstractions/Infrastructure/IJsonConvertible.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public interface IJsonConvertible
/// Converts the object to a data structure that can be converted to JSON.
/// </summary>
/// <returns>An object to be JSONified.</returns>
IDictionary<string, object> ConvertToJSON();
IDictionary<string, object> ConvertToJson();
}
}
11 changes: 11 additions & 0 deletions Parse/Abstractions/Infrastructure/IServiceHubBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#nullable enable

namespace Parse.Abstractions.Infrastructure
{
// ALTERNATE NAME: IServiceHubRebuilder, IServiceHubConstructor, IServiceHubBuilder, IServiceHubStacker, ISericeHubCreator, IClient, IDataContainmentHub, IResourceContainmentHub, IDataContainer, IServiceHubComposer

public interface IServiceHubBuilder
{
public IServiceHub BuildHub(IMutableServiceHub? serviceHub = default, IServiceHub? extension = default, params IServiceHubMutator[] mutators);
}
}
12 changes: 11 additions & 1 deletion Parse/Abstractions/Infrastructure/IServiceHubCloner.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
namespace Parse.Abstractions.Infrastructure
{
/// <summary>
/// Generates an <see cref="IServiceHub"/> as a clone of another. This clone could be mutated.
/// </summary>
public interface IServiceHubCloner
{
public IServiceHub BuildHub(in IServiceHub reference, IServiceHubComposer composer, params IServiceHubMutator[] requestedMutators);
/// <summary>
/// Clones <paramref name="hub"/>, via the <paramref name="builder"/> if needed, and should execute the <paramref name="mutators"/>. The clone could be observed in a mutated state versus <paramref name="hub"/>.
/// </summary>
/// <param name="hub">The hub to use as a reference or combination extension to new hub.</param>
/// <param name="builder">The builder which could be used to create the clone.</param>
/// <param name="mutators">Additional mutators to execute on the cloned hub.</param>
/// <returns>A service hub which could be both based on <paramref name="hub"/>, and observed in a mutated state versus <paramref name="hub"/>.</returns>
public IServiceHub CloneHub(in IServiceHub hub, IServiceHubBuilder builder, params IServiceHubMutator[] mutators);
}
}
9 changes: 0 additions & 9 deletions Parse/Abstractions/Infrastructure/IServiceHubComposer.cs

This file was deleted.

16 changes: 12 additions & 4 deletions Parse/Abstractions/Infrastructure/IServiceHubMutator.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Collections.Generic;

namespace Parse.Abstractions.Infrastructure
{
// IServiceHubComposer, IServiceHubMutator, IServiceHubConfigurator, IClientConfigurator, IServiceConfigurationLayer

/// <summary>
/// A class which makes a deliberate mutation to a service.
/// A definition of a deliberate mutation to a service hub.
/// </summary>
public interface IServiceHubMutator
{
Expand All @@ -12,11 +14,17 @@ public interface IServiceHubMutator
/// </summary>
bool Valid { get; }

//IServiceHubMutator[] Mutators => new[] { this };

// customHub, mutableHub, slice, target
// combinedHub, stackedHub, overallHub, resultantHub, composedHub

/// <summary>
/// A method which mutates an <see cref="IMutableServiceHub"/> implementation instance.
/// </summary>
/// <param name="target">The target <see cref="IMutableServiceHub"/> implementation instance</param>
/// <param name="composedHub">A hub which the <paramref name="target"/> is composed onto that should be used when <see cref="Mutate(ref IMutableServiceHub, in IServiceHub)"/> needs to access services.</param>
void Mutate(ref IMutableServiceHub target, in IServiceHub composedHub);
/// <param name="mutableHub">The target <see cref="IMutableServiceHub"/> implementation instance</param>
/// <param name="consumableHub">A hub which the <paramref name="mutableHub"/> is combined onto that should be used when <see cref="Mutate(ref IMutableServiceHub, in IServiceHub)"/> needs to access services.</param>
/// <param name="futureMutators">The mutators that will be executed after this one.</param>
void Mutate(ref IMutableServiceHub mutableHub, in IServiceHub consumableHub, Stack<IServiceHubMutator> futureMutators);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Parse.Abstractions.Platform.Authentication
{
/// <summary>
/// An authenticator service for the Parse SDK.
/// </summary>
public interface IParseAuthenticationProvider
{
/// <summary>
Expand Down Expand Up @@ -33,6 +36,6 @@ public interface IParseAuthenticationProvider
/// Provides a unique name for the type of authentication the provider does.
/// For example, the FacebookAuthenticationProvider would return "facebook".
/// </summary>
string AuthType { get; }
string Name { get; }
}
}
10 changes: 3 additions & 7 deletions Parse/Infrastructure/AbsoluteCacheLocationMutator.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.Collections.Generic;

using Parse.Abstractions.Infrastructure;

namespace Parse.Infrastructure
Expand All @@ -12,17 +14,11 @@ public class AbsoluteCacheLocationMutator : IServiceHubMutator
/// </summary>
public string CustomAbsoluteCacheFilePath { get; set; }

/// <summary>
/// <inheritdoc/>
/// </summary>
public bool Valid => CustomAbsoluteCacheFilePath is { };

/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="target"><inheritdoc/></param>
/// <param name="composedHub"><inheritdoc/></param>
public void Mutate(ref IMutableServiceHub target, in IServiceHub composedHub)
public void Mutate(ref IMutableServiceHub target, in IServiceHub composedHub, Stack<IServiceHubMutator> futureMutators)
{
if ((target as IServiceHub).CacheController is IDiskFileCacheController { } diskFileCacheController)
{
Expand Down
22 changes: 18 additions & 4 deletions Parse/Infrastructure/ConcurrentUserServiceHubCloner.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
using System.Collections.Generic;
using System.Linq;
using Parse.Abstractions.Infrastructure;
using Parse.Platform.Users;

namespace Parse.Infrastructure
{
/// <summary>
/// Makes it so that <see cref="ParseClient"/> clones can be made each with a reset <see cref="IServiceHub.CurrentUserController"/>, but otherwise identical services unless modified.
/// </summary>
public class ConcurrentUserServiceHubCloner : IServiceHubCloner, IServiceHubMutator
{
/// <inheritdoc/>
public bool Valid { get; } = true;

public IServiceHub BuildHub(in IServiceHub reference, IServiceHubComposer composer, params IServiceHubMutator[] requestedMutators) => composer.BuildHub(default, reference, requestedMutators.Concat(new[] { this }).ToArray());
/// <summary>
/// Mutators which need to be executed on each new hub for a user.
/// </summary>
public List<IServiceHubMutator> BoundMutators { get; set; } = new List<IServiceHubMutator> { };

public void Mutate(ref IMutableServiceHub target, in IServiceHub composedHub)
/// <inheritdoc/>
public IServiceHub CloneHub(in IServiceHub hub, IServiceHubBuilder builder, params IServiceHubMutator[] mutators) => builder.BuildHub(default, hub, mutators.Concat(new[] { this }).ToArray());

/// <inheritdoc/>
public void Mutate(ref IMutableServiceHub mutableHub, in IServiceHub consumableHub, Stack<IServiceHubMutator> futureMutators)
{
target.Cloner = this;
target.CurrentUserController = new ParseCurrentUserController(new TransientCacheController { }, composedHub.ClassController, composedHub.Decoder);
mutableHub.Cloner = this;
mutableHub.CurrentUserController = new ParseCurrentUserController(new TransientCacheController { }, consumableHub.ClassController, consumableHub.Decoder);

BoundMutators.ForEach(mutator => futureMutators.Push(mutator));
}
}
}
2 changes: 1 addition & 1 deletion Parse/Infrastructure/Data/ParseDataEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public abstract class ParseDataEncoder
["base64"] = Convert.ToBase64String(bytes)
},
ParseObject { } entity => EncodeObject(entity),
IJsonConvertible { } jsonConvertible => jsonConvertible.ConvertToJSON(),
IJsonConvertible { } jsonConvertible => jsonConvertible.ConvertToJson(),
{ } when Conversion.As<IDictionary<string, object>>(value) is { } dictionary => dictionary.ToDictionary(pair => pair.Key, pair => Encode(pair.Value, serviceHub)),
{ } when Conversion.As<IList<object>>(value) is { } list => EncodeList(list, serviceHub),

Expand Down
26 changes: 26 additions & 0 deletions Parse/Infrastructure/FacebookAuthenticationMutator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;

using Parse.Abstractions.Infrastructure;
using Parse.Infrastructure.Utilities;

namespace Parse.Infrastructure
{
/// <summary>
/// Enables Facebook authentication on the service hub.
/// </summary>
public class FacebookAuthenticationMutator : IServiceHubMutator
{
/// <inheritdoc/>
public bool Valid => Caller is { Length: > 0 };

/// <summary>
/// The identifier to make API calls to Facebook with. This is in the Facebook Developer Dashboard as some variant of "Application ID" or "API Key".
/// </summary>
public string Caller { get; set; }

/// <inheritdoc/>
public void Mutate(ref IMutableServiceHub mutableHub, in IServiceHub consumableHub, Stack<IServiceHubMutator> futureMutators) => mutableHub.InitializeFacebookAuthenticationProvider(Caller);
}
}
11 changes: 7 additions & 4 deletions Parse/Infrastructure/MetadataMutator.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.Collections.Generic;

using Parse.Abstractions.Infrastructure;

namespace Parse.Infrastructure
Expand All @@ -13,10 +15,11 @@ public class MetadataMutator : MetadataController, IServiceHubMutator
public bool Valid => this is { EnvironmentData: { OSVersion: { }, Platform: { }, TimeZone: { } }, HostManifestData: { Identifier: { }, Name: { }, ShortVersion: { }, Version: { } } };

/// <summary>
/// Sets the <paramref name="target"/> to the <see cref="MetadataMutator"/> instance.
/// Sets the <paramref name="mutableHub"/>'s <see cref="IServiceHub.MetadataController"/> to the <see cref="MetadataMutator"/> instance.
/// </summary>
/// <param name="target">The <see cref="IMutableServiceHub"/> to compose the information onto.</param>
/// <param name="referenceHub">Thhe <see cref="IServiceHub"/> to use if a default service instance is required.</param>
public void Mutate(ref IMutableServiceHub target, in IServiceHub referenceHub) => target.MetadataController = this;
/// <param name="mutableHub">The <see cref="IMutableServiceHub"/> to compose the information onto.</param>
/// <param name="consumableHub">The <see cref="IServiceHub"/> to use if a default service instance is required.</param>
/// <param name="futureMutators">The mutators that will be executed after this one.</param>
public void Mutate(ref IMutableServiceHub mutableHub, in IServiceHub consumableHub, Stack<IServiceHubMutator> futureMutators) => mutableHub.MetadataController = this;
}
}
10 changes: 3 additions & 7 deletions Parse/Infrastructure/RelativeCacheLocationMutator.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.Collections.Generic;

using Parse.Abstractions.Infrastructure;

namespace Parse.Infrastructure
Expand All @@ -12,17 +14,11 @@ public class RelativeCacheLocationMutator : IServiceHubMutator
/// </summary>
public IRelativeCacheLocationGenerator RelativeCacheLocationGenerator { get; set; }

/// <summary>
/// <inheritdoc/>
/// </summary>
public bool Valid => RelativeCacheLocationGenerator is { };

/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="target"><inheritdoc/></param>
/// <param name="referenceHub"><inheritdoc/></param>
public void Mutate(ref IMutableServiceHub target, in IServiceHub referenceHub) => target.CacheController = (target as IServiceHub).CacheController switch
public void Mutate(ref IMutableServiceHub target, in IServiceHub referenceHub, Stack<IServiceHubMutator> futureMutators) => target.CacheController = (target as IServiceHub).CacheController switch
{
null => new CacheController { RelativeCacheFilePath = RelativeCacheLocationGenerator.GetRelativeCacheFilePath(referenceHub) },
IDiskFileCacheController { } controller => (Controller: controller, controller.RelativeCacheFilePath = RelativeCacheLocationGenerator.GetRelativeCacheFilePath(referenceHub)).Controller,
Expand Down
Loading
Loading