Skip to content
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

Added Paratext Registration Info form #1260

Merged
merged 26 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4331a34
Added paratext registration information web view
tjcouch-sil Oct 18, 2024
c4f8c4e
Changed tailwind.scss to tailwind.css to match new file name
tjcouch-sil Oct 21, 2024
ca52c7d
Squashed 'extensions/' changes from d8899c00ef..86d95e9054
tjcouch-sil Oct 22, 2024
68a030e
Merge commit 'ca52c7d601f00742bd0b65de189e6f29087d31a0' into 971-para…
tjcouch-sil Oct 22, 2024
540392b
Squashed 'extensions/src/hello-someone/' changes from c9ab690536..89e…
tjcouch-sil Oct 22, 2024
b9f8993
Merge commit '540392b6f7f37a9e3e54ff2325f1dc92d21b1631' into 971-para…
tjcouch-sil Oct 22, 2024
9450584
Squashed 'extensions/src/hello-world/' changes from c9ab690536..89e4d…
tjcouch-sil Oct 22, 2024
ba4ae48
Merge commit '945058447a004859e8ee81e734dc8f52883aa4b3' into 971-para…
tjcouch-sil Oct 22, 2024
be6d109
Squashed 'extensions/src/legacy-comment-manager/' changes from c9ab69…
tjcouch-sil Oct 22, 2024
a373b54
Merge commit 'be6d1091ba2dcc5a4dc8b5df6d8a57cad6ecea22' into 971-para…
tjcouch-sil Oct 22, 2024
f0838c3
Squashed 'extensions/src/platform-scripture/' changes from c9ab690536…
tjcouch-sil Oct 22, 2024
ab92736
Merge commit 'f0838c3161254e1a1584840bd0358d276f1bc025' into 971-para…
tjcouch-sil Oct 22, 2024
fc0f2b0
Squashed 'extensions/src/platform-scripture-editor/' changes from c9a…
tjcouch-sil Oct 22, 2024
bab91cb
Merge commit 'fc0f2b081199a4b3ada47c16781dafe2f6e6986f' into 971-para…
tjcouch-sil Oct 22, 2024
5e4261f
Squashed 'extensions/src/quick-verse/' changes from c9ab690536..89e4d…
tjcouch-sil Oct 22, 2024
34fc65f
Merge commit '5e4261f37f2766173a758b648db3ef1cd797ba4f' into 971-para…
tjcouch-sil Oct 22, 2024
71f8fc9
Added getting and setting registration and set up dialog to work prop…
tjcouch-sil Oct 28, 2024
defb76a
Localized ui and small ui adjustments
tjcouch-sil Nov 1, 2024
219a980
Merge remote-tracking branch 'origin/main' into 971-paratext-registra…
tjcouch-sil Nov 1, 2024
96141c6
Removed additional info from request errors, misc tweaks
tjcouch-sil Nov 1, 2024
74d822b
Squashed 'extensions/src/paratext-registration/' content from commit …
tjcouch-sil Nov 1, 2024
8b6bda9
Merge commit '74d822b43dfb7bc241bb56712b6e72676541e45e' as 'extension…
tjcouch-sil Nov 1, 2024
d2bec2c
Moved paratext registration to its own extension
tjcouch-sil Nov 1, 2024
2b8437a
Validated email on frontend and various other small upgrades
tjcouch-sil Nov 4, 2024
77651db
Fixed not restarting in portable, rpc requests not retrying
tjcouch-sil Nov 5, 2024
61dd887
Moved request id generation inside the retry
tjcouch-sil Nov 6, 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
1 change: 1 addition & 0 deletions assets/localization/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"%about_versionLabel_format%": "Version: {version}",
"%about_licenseLabel_format%": "License: {license}",
"%insertNote%": "Insert Note",
"%general_error_title%": "Error",
"%mainMenu_about%": "About Platform.Bible",
"%mainMenu_downloadSlashInstallResources%": "Download/Install Resources",
"%mainMenu_downloadSlashUpdateProject%": "Download/Update Project",
Expand Down
93 changes: 93 additions & 0 deletions c-sharp/JsonUtils/RegistrationDataConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using Paratext.Data.Users;

namespace Paranext.DataProvider.JsonUtils;

public class RegistrationDataConverter : JsonConverter<RegistrationData>
{
private const string NAME = "name";
private const string CODE = "code";
private const string EMAIL = "email";
private const string SUPPORTER_NAME = "supporterName";

public override RegistrationData Read(
ref Utf8JsonReader reader,
Type typeToConvert,
JsonSerializerOptions options
)
{
string name = "";
string code = "";
string email = "";
string supporterName = "";

string? lastPropertyName = null;
// The starting token is consumed before we get the reader
int onObjectLevel = 1;
while (onObjectLevel > 0 && reader.Read())
{
switch (reader.TokenType)
{
case JsonTokenType.StartObject:
case JsonTokenType.StartArray:
onObjectLevel++;
break;
case JsonTokenType.EndObject:
case JsonTokenType.EndArray:
onObjectLevel--;
break;
case JsonTokenType.PropertyName:
lastPropertyName = reader.GetString();
break;
case JsonTokenType.True:
case JsonTokenType.False:
lastPropertyName = null;
break;
case JsonTokenType.Number:
lastPropertyName = null;
break;
case JsonTokenType.String:
switch (lastPropertyName)
{
case NAME:
name = reader.GetString() ?? "";
break;
case CODE:
code = reader.GetString() ?? "";
break;
case EMAIL:
email = reader.GetString() ?? "";
break;
case SUPPORTER_NAME:
supporterName = reader.GetString() ?? "";
break;
}
lastPropertyName = null;
break;
}
}

return new RegistrationData
{
Name = name,
Code = code,
Email = email,
SupporterName = supporterName,
};
}

public override void Write(
Utf8JsonWriter writer,
RegistrationData value,
JsonSerializerOptions options
)
{
writer.WriteStartObject();
writer.WriteString(NAME, value.Name);
writer.WriteString(CODE, value.Code);
writer.WriteString(EMAIL, value.Email);
writer.WriteString(SUPPORTER_NAME, value.SupporterName);
writer.WriteEndObject();
}
}
1 change: 1 addition & 0 deletions c-sharp/JsonUtils/SerializationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static JsonSerializerOptions CreateSerializationOptions()
};
options.Converters.Add(new CommentConverter());
options.Converters.Add(new VerseRefConverter());
options.Converters.Add(new RegistrationDataConverter());
return options;
}

Expand Down
25 changes: 24 additions & 1 deletion c-sharp/PapiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,11 @@ await _webSocket.CloseAsync(
}

/// <summary>
/// Send a request to the server
/// Send a request to the server expecting a returned value
/// </summary>
/// <param name="requestType">Type of request intended for the server</param>
/// <param name="requestContents">Objects to send as parameters to the request</param>
/// <returns>The request response's resulting value</returns>
public virtual async Task<T?> SendRequestAsync<T>(
string requestType,
IReadOnlyList<object?>? requestContents
Expand All @@ -164,6 +165,28 @@ await _webSocket.CloseAsync(
);
}

/// <summary>
/// Send a request to the server expecting no returned value (as if the request is pointing to a void method)
/// </summary>
/// <param name="requestType">Type of request intended for the server</param>
/// <param name="requestContents">Objects to send as parameters to the request</param>
public virtual async Task SendRequestAsync(
string requestType,
IReadOnlyList<object?>? requestContents
)
{
ObjectDisposedException.ThrowIf(_isDisposed, this);

if (_localMethods.TryGetValue(requestType, out Delegate? handler) && handler != null)
handler.DynamicInvoke(requestContents?.ToArray());
else
await _jsonRpc.InvokeWithCancellationAsync(
requestType,
requestContents,
_cancellationToken
);
}

/// <summary>
/// Register a request handler with the server.
/// </summary>
Expand Down
5 changes: 4 additions & 1 deletion c-sharp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Paranext.DataProvider.NetworkObjects;
using Paranext.DataProvider.Projects;
using Paranext.DataProvider.Services;
using Paranext.DataProvider.Users;
using Paratext.Data;
using PtxUtils;

Expand Down Expand Up @@ -31,9 +32,11 @@ public static async Task Main()

var paratextFactory = new ParatextProjectDataProviderFactory(papi, paratextProjects);
var checkRunner = new CheckRunner(papi);
var paratextRegistrationService = new ParatextRegistrationService(papi);
await Task.WhenAll(
paratextFactory.InitializeAsync(),
checkRunner.RegisterDataProviderAsync()
checkRunner.RegisterDataProviderAsync(),
paratextRegistrationService.InitializeAsync()
);

// Things that only run in our "noisy dev mode" go here
Expand Down
Loading
Loading