Skip to content

Interface with new webAPI#24

Open
MaxJohansen wants to merge 6 commits intomasterfrom
feature/signatures
Open

Interface with new webAPI#24
MaxJohansen wants to merge 6 commits intomasterfrom
feature/signatures

Conversation

@MaxJohansen
Copy link
Copy Markdown
Contributor

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.

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist ✔️

Mark boxes that apply with an x. These can also be filled out after the pull request is created.

  • I have read the coding convention guidelines and my code follows these.
  • Unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Copy link
Copy Markdown
Contributor

@jonjohansen jonjohansen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good but not 💯 🥇

using System.Linq;
using Diplomatic.Utils;


Copy link
Copy Markdown
Contributor

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
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline before new block?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No

}
var next = new TextFields();
next.BindingContext = new TextFieldViewModel((Template)e.SelectedItem);
var next = new TextFields
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newliner 🥈

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newliner 🥉

{
BindingContext = new ResultViewModel(endpoint, Filename)
};
await Navigation.PushAsync(next);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥉 Newliner

[JsonIgnore]
public string Value { get; set; }
[JsonIgnore]
virtual public bool IsValid => !string.IsNullOrEmpty(Value);
Copy link
Copy Markdown
Contributor

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. 🥈

@MaxJohansen MaxJohansen force-pushed the feature/signatures branch from 0856613 to 1d445b0 Compare July 5, 2018 07:16
[JsonProperty("id")]
public string Id { get; set; }
public Uri ImageUri {
get {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newlines bro 🥉

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)
Copy link
Copy Markdown
Contributor

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 Template[] TemplateList { get; set; }
public Template[] Templates { get; set; }
public TemplatePickerViewModel()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline

namespace Diplomatic.ViewModels
{
using Models;
public class TextFieldViewModel
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline

namespace Diplomatic.Views
{
using ViewModels;
public partial class MainPage : ContentPage
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline :11st_place_medal:

}

void OnShow ( object sender, EventArgs e)
private void OnShow ( object sender, EventArgs e)
Copy link
Copy Markdown
Contributor

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.

template.Signature = (Signature)e.SelectedItem;
var queryParams = new List<string> { };
foreach (var field in template.Fields)
foreach (Field field in template.Fields)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline before this line

}
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}");
Copy link
Copy Markdown
Contributor

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 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
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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 👀

{
BindingContext = new SignaturePickerViewModel(selectedTemplate)
};
await Navigation.PushAsync(next);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline.

await Navigation.PushAsync(next);
Template template = ((TextFieldViewModel)BindingContext).SelectedTemplate;
var queryParams = new List<string> { };
foreach (Field field in template.Fields)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newliner before and after ❤️

{
BindingContext = new ResultViewModel(endpoint)
};
await Navigation.PushAsync(next);
Copy link
Copy Markdown
Contributor

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:

Copy link
Copy Markdown
Contributor

@IsakSundeSingh IsakSundeSingh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix it

@MaxJohansen MaxJohansen force-pushed the feature/signatures branch 4 times, most recently from 1e404fa to 9e52de4 Compare July 5, 2018 07:49
MaxJohansen and others added 3 commits July 5, 2018 09:50
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
@MaxJohansen MaxJohansen force-pushed the feature/signatures branch from 9e52de4 to d7bed33 Compare July 5, 2018 07:55
Resolved scaling issue (Might have to refactor this into a decent scale later)
Aligned signatures to the left.
@jonjohansen jonjohansen force-pushed the feature/signatures branch from 72673d6 to 2425d7c Compare July 5, 2018 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants