Skip to content
This repository has been archived by the owner on Nov 19, 2018. It is now read-only.

Commit

Permalink
Fixed issue with password fields
Browse files Browse the repository at this point in the history
Fixes #433
  • Loading branch information
KrauseFx committed Feb 12, 2016
1 parent 2e9ad07 commit 68741f6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/snapshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
require 'snapshot/options'
require 'snapshot/update'
require 'snapshot/fixes/simulator_zoom_fix'
require 'snapshot/fixes/hardware_keyboard_fix'

require 'fastlane_core'

Expand Down
16 changes: 16 additions & 0 deletions lib/snapshot/fixes/hardware_keyboard_fix.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module Snapshot
module Fixes
# Having "Connect Hardware Keyboard" enabled causes issues with entering text in secure textfields
# Fixes https://github.com/fastlane/snapshot/issues/433

class HardwareKeyboardFix
def self.patch
Snapshot.kill_simulator # First we need to kill the simulator

UI.verbose "Patching simulator to work with secure text fields"

Helper.backticks("defaults write com.apple.iphonesimulator ConnectHardwareKeyboard 0", print: $verbose)
end
end
end
end
7 changes: 2 additions & 5 deletions lib/snapshot/fixes/simulator_zoom_fix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@ module Fixes

class SimulatorZoomFix
def self.patch
# First we need to kill the simulator
Snapshot.kill_simulator
Snapshot.kill_simulator # First we need to kill the simulator

UI.message "Patching '#{config_path}' to scale simulator to 100%"

FastlaneCore::Simulator.all.each do |simulator|
simulator_name = simulator.name.tr("\s", "-")
key = "SimulatorWindowLastScale-com.apple.CoreSimulator.SimDeviceType.#{simulator_name}"

command = "defaults write '#{config_path}' '#{key}' '1.0'"
puts command.yellow if $debug
`#{command}`
Helper.backticks("defaults write '#{config_path}' '#{key}' '1.0'", print: $verbose)
end
end

Expand Down
1 change: 1 addition & 0 deletions lib/snapshot/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def launch(language, device_type, launch_arguments)
File.write("/tmp/snapshot-launch_arguments.txt", launch_arguments.last)

Fixes::SimulatorZoomFix.patch
Fixes::HardwareKeyboardFix.patch

Snapshot.kill_simulator # because of https://github.com/fastlane/snapshot/issues/337
`xcrun simctl shutdown booted &> /dev/null`
Expand Down

0 comments on commit 68741f6

Please sign in to comment.