Swatto / motion-inappmail

Wrapper for MFMailComposeViewController for RubyMotion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

motion-inAppMail Gem Version Code Climate

This code is now part of BubbleWrap

Please don't make issues and pul requests here (this repo still exist for the past of the project)


A simple wrapper to use MFMailComposeViewController in a simple rubish way :

InAppMail.compose(self,
    {
        to: ["contact@example.com","contact2@example.com"],
        cc: ["foo@bar.com"],
        cci: ["bar@foo.com"],
        subject: "Hi everyone !",
        message: {
            html: true,
            body: "<h1>Hi from my super iOS app !</h1>"
        }
    }) do |callback|
    if callback.sent?
        p "Email sent"
    elsif callback.canceled?
        p "Email canceled"
    elsif callback.saved?
        p "Email saved in draft"
    elsif callback.failed?
        p "Error : #{callback.error}"
    end
end

Usage

  • The first params is the view or the view controller. It's needed to push it as a modal (needed).
  • The second params is the options of your mail (secondary).
  • The third is your callback block (secondary).

About

Wrapper for MFMailComposeViewController for RubyMotion


Languages

Language:Ruby 100.0%