# 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 "Deploy a new Mono Weather version to the Google Play"
  lane :deployMonoWeather do
    gradle(
        task: "clean bundle",
        flavor: "MonoWeather",
        build_type: "Release",
        )
    upload_to_play_store(
        aab: "app/build/outputs/bundle/monoWeatherRelease/app-monoWeather-release.aab",
        json_key: "google-play-key.json",
        package_name: "com.appttude.h_mal.monoWeather")
  end

  desc "Deploy a new Atlas Weather version to the Google Play"
  lane :deployAtlasWeather do
    gradle(
        task: "clean bundle",
        flavor: "AtlasWeather",
        build_type: "Release",
        )
    upload_to_play_store(
        aab: "app/build/outputs/bundle/atlasWeatherRelease/app-atlas-release.aab",
        json_key: "google-play-key.json",
        package_name: "com.appttude.h_mal.atlas_weather")
  end

  desc "Capture screenshots on MonoWeather"
    lane :screenGrabMonoWeather do
      build_android_app(
        task: 'assemble',
        build_type: 'Debug',
        flavor: 'MonoWeather',
      )
      build_android_app(
        task: 'assemble',
        build_type: 'AndroidTest',
        flavor: 'MonoWeather',
      )
      screengrab(
        app_package_name: "com.appttude.h_mal.monoWeather",
        locales: ["en-UK"],
        app_apk_path: "app/build/outputs/apk/monoWeather/debug/app-monoWeather-debug.apk",
        tests_apk_path: "app/build/outputs/apk/androidTest/monoWeather/debug/app-monoWeather-debug-androidTest.apk",
        test_instrumentation_runner: "com.appttude.h_mal.atlas_weather.application.TestRunner",
        use_tests_in_packages: "com.appttude.h_mal.atlas_weather.snapshot"
      )
  end

    desc "Capture screenshots on AtlasWeather"
      lane :screenGrabAtlasWeather do
        build_android_app(
          task: 'assemble',
          build_type: 'Debug',
          flavor: 'AtlasWeather',
        )
        build_android_app(
          task: 'assemble',
          build_type: 'AndroidTest',
          flavor: 'AtlasWeather',
        )
        screengrab(
          app_package_name: "com.appttude.h_mal.atlas_weather",
          locales: ["en-UK"],
          app_apk_path: "app/build/outputs/apk/atlasWeather/debug/app-atlasWeather-debug.apk",
          tests_apk_path: "app/build/outputs/apk/androidTest/atlasWeather/debug/app-atlasWeather-debug-androidTest.apk",
          test_instrumentation_runner: "com.appttude.h_mal.atlas_weather.application.TestRunner",
          use_tests_in_packages: "com.appttude.h_mal.atlas_weather.snapshot"
        )
    end
end