Sha256: 4417de99605d79f59171a1b64ac773cd63d4d08dd5a415e283eee8227942444d

Contents?: true

Size: 938 Bytes

Versions: 3

Compression:

Stored size: 938 Bytes

Contents

module Appium
  module Core
    module Device
      module AppState
        STATUS = [
          :not_installed,                   # 0
          :not_running,                     # 1
          :running_in_background_suspended, # 2
          :running_in_background,           # 3
          :running_in_foreground            # 4
        ].freeze

        def self.add_methods
          ::Appium::Core::Device.add_endpoint_method(:app_state) do
            def app_state(app_id)
              # required: [['appId'], ['bundleId']]
              response = execute :app_state, {}, appId: app_id

              case response
              when 0, 1, 2, 3, 4
                ::Appium::Core::Device::AppState::STATUS[response]
              else
                ::Appium::Logger.debug("Unexpected status in app_state: #{response}")
                response
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
appium_lib_core-1.7.2 lib/appium_lib_core/device/app_state.rb
appium_lib_core-1.7.1 lib/appium_lib_core/device/app_state.rb
appium_lib_core-1.7.0 lib/appium_lib_core/device/app_state.rb