Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

GH-27: Master based email #105

Merged
merged 28 commits into from
Apr 4, 2018
Merged

GH-27: Master based email #105

merged 28 commits into from
Apr 4, 2018

Conversation

mattleibow
Copy link
Contributor

@mattleibow mattleibow commented Mar 22, 2018

Description of Change

Describe your changes here.

Bugs Fixed

Provide links to issues here. Ensure that a GitHub issue was created for your feature or bug fix before sending PR.

API Changes

public static partial class Email {
    public static Task ComposeAsync();
    public static Task ComposeAsync(string subject, string body, params string[] to);
    public static Task ComposeAsync(EmailMessage message);
}

public class EmailMessage {
    public EmailMessage();
    public EmailMessage(string subject, string body, params string[] to);

    public string Subject { get; set; }
    public string Body { get; set; }
    public EmailBodyFormat BodyFormat { get; set; } // this is only supported on iOS/Android
    public List<string> To { get; set; }
    public List<string> Cc { get; set; }
    public List<string> Bcc { get; set; }
}

public enum EmailBodyFormat {
    PlainText,
    Html
}

Behavioral Changes

Adding the email API.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Updated documentation (see walkthrough)

@moljac moljac added the DO-NOT-MERGE Don't merge it.... don't do it! label Mar 27, 2018
<None Remove="Email\Email.netstandard.cs" />
<None Remove="Email\Email.shared.cs" />
<None Remove="Email\EmailMessage.shared.cs" />
</ItemGroup>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This can be removed.

public static bool IsSendSupported
{
get;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This technically has no explicit value (default to false). Also, this must be internal until we decide to expose it.

public static partial class Email
{
/// Indicating whether Compose Dialog is available
public static bool IsComposeSupported
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This must be internal until we decide to expose it.

string body = null,
string bodymimetype = null,
string[] attachmentspaths = null
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this must be on the previous line.

// Numerous apps can respond to ActionSend
var i = new Intent(Intent.ActionSend, uri);
i.SetData(uri);
i.SetType("plain/text"); // i.SetType("message/rfc822");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This TODO looks like something is to be done? Or is it safe to go?

{
Email.ComposeAsync(
new string[] { "moljac@mailinator.com", "moljac01@mailinator.com" },
new string[] { "moljac02@mailinator.com" },
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe use Xamarin-y or example.org emails?

@@ -0,0 +1 @@

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is this file for?

x:Class="Caboodle.Samples.View.EmailPage"
xmlns:viewmodels="clr-namespace:Caboodle.Samples.ViewModel"
Title="Email"
>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Put this on the same line

namespace Caboodle.Samples.View
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class EmailPage : ContentPage
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is already in the app.xaml.cs

// For testing mailboxes (w/o registration) go to:
// https://www.mailinator.com
tomails = string.Join(",", new string[] { "caboodle@mailinator.com", "caboodle01@mailinator.com" });
ccmails = string.Join(";", new string[] { "caboodle@mailinator.com", "caboodle02@mailinator.com" });
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we should use third party tools - maybe there is a testing tool that just accepts everything - maybe an example.org type of thing?

@moljac moljac added the awaiting-review This PR needs to have a set of eyes on it label Mar 28, 2018
@moljac moljac requested a review from Redth March 28, 2018 08:13
@mattleibow mattleibow added this to New in Triage Mar 28, 2018
@mattleibow mattleibow removed this from New in Triage Mar 28, 2018
@mattleibow mattleibow added this to Backlog in v0.5.0-preview Mar 28, 2018
@mattleibow mattleibow moved this from Backlog to In Progress in v0.5.0-preview Mar 28, 2018
@jamesmontemagno
Copy link
Collaborator

I think this API needs to be looked at. I am not sure if we should really have attachments in V1 at all, seems complicated.

80% use case is....
Email.Send(string subject, string body, string sendto) ?

Thoughts on this.. or maybe just have overloads?

James

@Redth
Copy link
Member

Redth commented Mar 28, 2018

I might be odd but most of my uses cases require attachments. I don't usually want to just send text in an email, I want to attach a file to export.

@mattleibow
Copy link
Contributor Author

@Redth I am just going to get the emails working again, and then I'll add attachments back.

@mattleibow
Copy link
Contributor Author

The attachments logic may be harder than just a simple URI. Android will probably need an implementation of FileProvider and we do need to support sharing internal files or even streams.

We could get inspiration from here:


static void Sync(List<string> recipients, IList<EmailRecipient> nativeRecipients)
{
if (recipients != null)
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we just return if null? cleaner and anti-arrow :)

@@ -2,8 +2,7 @@
{
public static partial class PhoneDialer
{
internal static bool IsSupported =>
throw new NotImplementedInReferenceAssemblyException();
internal static bool IsSupported => false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we be doing this in all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was just going out on a limb here and have the IsSupported bits NOT throw ever so that we can write nicer tests. But I don't really know if we will ever do this or how we should handle this idea.

jamesmontemagno
jamesmontemagno previously approved these changes Apr 2, 2018
@mattleibow mattleibow removed the DO-NOT-MERGE Don't merge it.... don't do it! label Apr 2, 2018
@jamesmontemagno
Copy link
Collaborator

What's left on this? Docs?

@mattleibow
Copy link
Contributor Author

mattleibow commented Apr 3, 2018

Yes, let me add that if we are happy with the API.

@Redth Redth removed the awaiting-review This PR needs to have a set of eyes on it label Apr 4, 2018
@Redth Redth merged commit 4a110c7 into master Apr 4, 2018
@Redth Redth deleted the master_based_email branch April 4, 2018 19:53
@Redth Redth moved this from In Progress to Done in v0.5.0-preview Apr 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants