-
Notifications
You must be signed in to change notification settings - Fork 0
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
Interface with new webAPI #24
base: master
Are you sure you want to change the base?
Conversation
9909e76
to
0856613
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good but not 💯 🥇
@@ -1,15 +1,17 @@ | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using Diplomatic.Utils; | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary newline 👎
public partial class Templates : ContentPage | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline before new block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No
Diplomatic/Views/Templates.xaml.cs
Outdated
@@ -18,8 +19,10 @@ public Templates() | |||
{ | |||
return; //ItemSelected is called on deselection, which results in SelectedItem being set to null | |||
} | |||
var next = new TextFields(); | |||
next.BindingContext = new TextFieldViewModel((Template)e.SelectedItem); | |||
var next = new TextFields |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newliner 🥈
Diplomatic/Views/TextFields.xaml.cs
Outdated
string query = string.Join("&", queryParams.ToArray()); | ||
string final = "https://qri7p78aml.execute-api.eu-west-2.amazonaws.com/dev/" + template.Name.ToLower() + "?" + query; | ||
var endpoint = new Uri(Uri.EscapeUriString(final)); | ||
var next = new Result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newliner 🥉
Diplomatic/Views/TextFields.xaml.cs
Outdated
{ | ||
BindingContext = new ResultViewModel(endpoint, Filename) | ||
}; | ||
await Navigation.PushAsync(next); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥉 Newliner
Diplomatic/Models/Field.cs
Outdated
@@ -10,6 +10,8 @@ public class Field | |||
public string Name { get; } | |||
[JsonIgnore] | |||
public string Value { get; set; } | |||
[JsonIgnore] | |||
virtual public bool IsValid => !string.IsNullOrEmpty(Value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be virtual
. 🥈
0856613
to
1d445b0
Compare
Diplomatic/Models/Signature.cs
Outdated
[JsonProperty("id")] | ||
public string Id { get; set; } | ||
public Uri ImageUri { | ||
get { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newlines bro 🥉
@@ -22,7 +23,12 @@ public WebTemplateProvider() | |||
using (var reader = new StreamReader(response.GetResponseStream())) | |||
{ | |||
string content = reader.ReadToEnd(); | |||
templates = JsonConvert.DeserializeObject<List<Template>>(content); | |||
Dictionary<string, Template> rawTemplates = JsonConvert.DeserializeObject<Dictionary<string, Template>>(content); | |||
foreach (KeyValuePair<string, Template> entry in rawTemplates) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline bro :4th_place_medal:
public class TemplatePickerViewModel | ||
{ | ||
public Template[] TemplateList { get; set; } | ||
public Template[] Templates { get; set; } | ||
public TemplatePickerViewModel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline
@@ -1,5 +1,6 @@ | |||
namespace Diplomatic.ViewModels | |||
{ | |||
using Models; | |||
public class TextFieldViewModel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline
Diplomatic/Views/MainPage.xaml.cs
Outdated
namespace Diplomatic.Views | ||
{ | ||
using ViewModels; | ||
public partial class MainPage : ContentPage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline :11st_place_medal:
Diplomatic/Views/MainPage.xaml.cs
Outdated
{ | ||
var next = new Templates(); | ||
next.BindingContext = new TemplatePickerViewModel(); | ||
// We do not need to submit any info to the page here yet | ||
await Navigation.PushAsync(next); | ||
} | ||
|
||
void OnShow ( object sender, EventArgs e) | ||
private void OnShow ( object sender, EventArgs e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No space before first function parameter.
Diplomatic/Views/Signatures.xaml.cs
Outdated
var queryParams = new List<string> { }; | ||
foreach (var field in template.Fields) | ||
foreach (Field field in template.Fields) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline before this line
Diplomatic/Views/Signatures.xaml.cs
Outdated
{ | ||
queryParams.Add($"{field.Name.ToLower()}={field.Value}"); | ||
} | ||
var query = string.Join("&", queryParams.ToArray()); | ||
string final = "https://qri7p78aml.execute-api.eu-west-2.amazonaws.com/dev/" + template.TemplateName.ToLower() + "?" + query; | ||
queryParams.Add($"signature={template.Signature.Id}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And after the block <3
string final = "https://qri7p78aml.execute-api.eu-west-2.amazonaws.com/dev/" + template.TemplateName.ToLower() + "?" + query; | ||
queryParams.Add($"signature={template.Signature.Id}"); | ||
string query = string.Join("&", queryParams.ToArray()); | ||
string final = "https://qri7p78aml.execute-api.eu-west-2.amazonaws.com/dev/" + template.Name.ToLower() + "?" + query; | ||
var endpoint = new Uri(Uri.EscapeUriString(final)); | ||
var next = new Result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This starts a block, so a newline before it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initializers aren't real blocks to me 👀
Diplomatic/Views/TextFields.xaml.cs
Outdated
{ | ||
BindingContext = new SignaturePickerViewModel(selectedTemplate) | ||
}; | ||
await Navigation.PushAsync(next); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline.
Diplomatic/Views/TextFields.xaml.cs
Outdated
await Navigation.PushAsync(next); | ||
Template template = ((TextFieldViewModel)BindingContext).SelectedTemplate; | ||
var queryParams = new List<string> { }; | ||
foreach (Field field in template.Fields) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newliner before and after ❤️
Diplomatic/Views/TextFields.xaml.cs
Outdated
{ | ||
BindingContext = new ResultViewModel(endpoint) | ||
}; | ||
await Navigation.PushAsync(next); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Come on man... :22nd_place_medal:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix it
1e404fa
to
9e52de4
Compare
Interface for saving images has been added - Implemented on iOS - Permissions have been set for iOS Views: Result has gotten two buttons Save button now has an action, which should run a code-behind function for saving NOTE: the name of the image saved in the codebehind should be changed
It now works on android! Filename sent in is "Navn" for now. This needs to change
Images now have names (Only available on an ANDROID near you)! Also Stuff looks clean now
9e52de4
to
d7bed33
Compare
Resolved scaling issue (Might have to refactor this into a decent scale later) Aligned signatures to the left.
72673d6
to
2425d7c
Compare
Changes 🎈
Signatures are now fetched from the web API instead of from local storage! I've deleted a LOT of leftover resources and code from the old implementation and fixed the failing tests.
Types of changes
What types of changes does your code introduce? Mark boxes that apply with an
x
.Checklist ✔️
Mark boxes that apply with an
x
. These can also be filled out after the pull request is created.