/*
 * COPYRIGHT (c) 2018 All rights reserved by HANWHA LIFE.
 */
package kr.co.zumo.app.lifeplus.view.command;

import android.content.Intent;

import kr.co.zumo.app.lifeplus.model.Model;
import kr.co.zumo.app.lifeplus.view.IView;
import kr.co.zumo.app.lifeplus.view.presenter.Presenter;

/**
 * EmailSendingCommand
 * <pre>
 * </pre>
 *
 * @author 민효동
 * @version 1.0
 * @history 민효동   [2018-10-08]   [최초 작성]
 * @since 2018-10-08
 */
public class EmailSendingCommand extends Command<Model, IView, Presenter> {
  String email;

  public EmailSendingCommand(String email) {
    this.email = email;
  }

  @Override
  public void preExecute(Model model, IView view, Presenter presenter) {

  }

  @Override
  public void execute(Model model, IView view, Presenter presenter) {
    Intent email = new Intent(Intent.ACTION_SEND);
    email.setType("plain/text");
    // email setting 배열로 해놔서 복수 발송 가능
    String[] address = {this.email};
    email.putExtra(Intent.EXTRA_EMAIL, address);
    view.getActivity().startActivity(email);
  }

  @Override
  public void postExecute(Model model, IView view, Presenter presenter) {

  }

  @Override
  public void dispose() {

  }
}
