# Customize this file, documentation can be found here:
# https://docs.fastlane.tools/actions/
# All available actions: https://docs.fastlane.tools/actions
# can also be listed using the `fastlane actions` command

# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`

# If you want to automatically update fastlane if a new version is available:
# update_fastlane

# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version("1.46.1")

default_platform(:android)

platform(:android) do
  before_all do
    # ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
  end

  desc("Runs all the tests")
  lane(:test) do
    gradle(task: "test")
  end

  desc("Submit a new Beta Build to Crashlytics Beta")
  lane(:beta) do
    gradle(task: "assembleRelease")
    crashlytics

    # sh "your_script.sh"
    # You can also use other beta testing services here
  end

  desc("Deploy a new version to the Google Play")
  lane(:deploy) do
    gradle(task: "assembleRelease")
    supply
  end

  desc("Assemble the debug app and tests APKs")
  lane(:assemble) do
    gradle(task: "assemble assembleAndroidTest", gradle_path: '../gradlew')
  end

  desc("Build debug and test APK for screenshots")
  lane(:build_and_screengrab) do
    gradle(task: "assembleDebug assembleAndroidTest")
    capture_android_screenshots
  end

  # You can define as many lanes as you want

  after_all do |lane|
    # This block is called, only if the executed lane was successful

    # slack(
    #   message: "Successfully deployed new App Update."
    # )
  end

  error do |lane, exception|
    # slack(
    #   message: exception.message,
    #   success: false
    # )
  end
end

# More information about multiple platforms in fastlane: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
# All available actions: https://docs.fastlane.tools/actions

# fastlane reports which actions are used. No personal data is recorded.
# Learn more at https://docs.fastlane.tools/#metrics
