# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
#     https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
#     https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
update_fastlane

default_platform(:android)

platform :android do
#  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: "clean 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: "clean assembleRelease")
#    upload_to_play_store
#  end

    desc "Build Debug and Test apps for localized screenshots"
    lane :build_apps do
        gradle(
            task: 'clean'
        )
        build_android_app(
            task: 'assemble',
            build_type: 'Debug'
        )
        build_android_app(
            task: 'assemble',
            build_type: 'AndroidTest'
        )
    end

    desc "Take localized screenshots for phones"
    lane :screenshots_phone do
        capture_android_screenshots(
            device_type: 'phone'
        )
    end

    desc "Take localized screenshots for small tablets"
    lane :screenshots_sevenInch do
        capture_android_screenshots(
            device_type: 'sevenInch'
        )
    end

    desc "Take localized screenshots for large tablets"
    lane :screenshots_tenInch do
        capture_android_screenshots(
            device_type: 'tenInch'
        )
    end

    desc "Import localized changelogs and descriptions from poeditor.json into android metadata"
    lane :import_poeditor do
        sh(
            command: 'node metadata/android/poeditor2fastlane.js'
        )
    end

    desc "Fetch GitHub and POEditor contributors and render a CONTRIBUTORS.md file"
    lane :fetch_contributors do
        Dir.chdir("../") do
            sh 'node pull-contributors.js'
        end
    end
end
