motion-accessibility 3.1.2 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9e09c344aa20f1d812ed46fd3a737c7703d9331
4
- data.tar.gz: e9bf48a8832655f62938bb281ecb41854f10a183
3
+ metadata.gz: a3c5e86aa213db7c2fd972a7ff933c598c1d13ab
4
+ data.tar.gz: 351e311e66ba955b088b00f57531596b34a4de24
5
5
  SHA512:
6
- metadata.gz: f7c58c21479dcb6d23bbf5d26118acf35f0f348411da9e03fba6dc21b9f38fab5f1069f500cbf8b8d5ab4357881061d05b1f939d410d83d21c3dc1b53ccffb1f
7
- data.tar.gz: 8319e8c75f10eafa6581b79a94acd54762cef75d9a86bd066a72a96e2055a9b98616c34cb9009d469e3e4615025c2a855ab0b1be892482306cddb54460f46486
6
+ metadata.gz: 7cf56622bced4da490ebf993c2cefda986a264e12e184e32890fa804b7d590885cef146325dd584816cea8b8b733215ff9ae17d299cacea22142705aa975fd99
7
+ data.tar.gz: 2a7e906f62f146a542cb502cc64ec498a3b706f15bf8ad26bfebdea2a722f10ad5b03bd5b979484b44f4179f91ca0ffa76f96a464b1dcd3118c1c2c737be1d6a
data/README.md CHANGED
@@ -236,7 +236,7 @@ end
236
236
  end
237
237
  ```
238
238
 
239
- ### Accessibility vs. Usability
239
+ #### Accessibility vs. Usability
240
240
 
241
241
  A difference exists between accessibility and usability, though often the two
242
242
  get lumped together under the umbrella of the former. Accessibility refers to
@@ -326,7 +326,9 @@ def accessibility_traits
326
326
  super.accessibility_traits|:image.accessibility_trait|:link.accessibility_trait
327
327
  end
328
328
  end
329
- ``uur, to set it in an instance of a view you can do this.
329
+ ```
330
+
331
+ Or, to set it in an instance of a view you can do this.
330
332
 
331
333
  ```
332
334
  view=UIView.alloc.init
@@ -764,6 +766,30 @@ just call the `speech_attribute` method on the following symbols.
764
766
  - `:language`
765
767
  - `:pitch`
766
768
 
769
+ ### The Apple Watch
770
+
771
+ Currently limited support for the APple Watch exists. For one thing, nobody can
772
+ get one yet. For another, RubyMotion does not yet allow running specs on an
773
+ Apple Watch extension. Currently the gem provides wrappers for the Watchkit
774
+ methods. Note that Watchkit only provides the setters, not the getters, since
775
+ you cannot retrieve values from the running extension.
776
+
777
+ #### `accessibility_label`
778
+ The accessibility label.
779
+ #### `accessibility_hint`
780
+ The accessibility hint.
781
+ #### accessibility_traits
782
+ The accessibility traits. Takes the same arguments as the standard method.
783
+ #### accessibility_value
784
+ The accessibility value.
785
+ #### `is_accessibility_element`
786
+ Determines if VoiceOver should interact with the element.
787
+ #### `accessibility_image_regions`
788
+
789
+ Unique to WatchKit, this method accepts an array of Accessibility::Image_Region
790
+ objects. Each of these objects consists of a `label` and a `frame` to define
791
+ the accessible parts of an image.
792
+
767
793
  ## contributing
768
794
 
769
795
 
@@ -61,6 +61,14 @@ Element_Attributes = {
61
61
  :focused? => :accessibilityElementIsFocused
62
62
  }
63
63
 
64
+ Watch_Attributes = {
65
+ :accessibility_label= => :setAccessibilityLabel,
66
+ :accessibility_hint= => :setAccessibilityHint,
67
+ :accessibility_value= => :setAccessibilityValue,
68
+ :is_accessibility_element= => :setIsAccessibilityElement,
69
+ :accessibility_image_regions => :setAccessibilityImageRegions
70
+ }
71
+
64
72
  Traits = {
65
73
  none: UIAccessibilityTraitNone,
66
74
  button: UIAccessibilityTraitButton,
@@ -0,0 +1,54 @@
1
+ return unless defined? WKInterfaceObject
2
+
3
+ class WKInterfaceObject
4
+
5
+ def inspect
6
+ self.accessibility_label
7
+ end
8
+
9
+ Accessibility::Watch_Attributes.each do |ruby,ios|
10
+ if ruby=~/=$/
11
+ define_method(ruby) {|value| self.send(ios,value)}
12
+ elsif(ruby=~/^is_|\?$/)
13
+ define_method(ruby) do
14
+ result=self.send(ios)
15
+ result=true if result==1
16
+ result=false if result==0
17
+ result
18
+ end
19
+ else
20
+ define_method(ruby) {self.send(ios)}
21
+ end
22
+ end
23
+
24
+ def accessibility_traits=(traits)
25
+ self.accessibility_traits=traits
26
+ end
27
+
28
+ if self.respond_to?(:method_added)
29
+ alias :method_added_accessibility_Watch :method_added
30
+ end
31
+
32
+ def self.method_added(name)
33
+ if self.respond_to?(:method_added_accessibility)
34
+ method_added_accessibility_Watch(name)
35
+ end
36
+ return if name=~/=$/
37
+ attributes=Accessibility::Watch_Attributes
38
+ return unless attributes.flatten.grep(%r{name.to_sym})
39
+ if attributes.has_key?(name)
40
+ ruby=name
41
+ ios=attributes[name]
42
+ define_method(ios) {self.send(ruby)}
43
+ else
44
+ ios=name
45
+ ruby=attributes.rassoc(name).first
46
+ define_method(ruby) { self.send(ios)}
47
+ end
48
+ end
49
+
50
+ end
51
+
52
+
53
+ Accessibility::Image_Region=UIAccessibilityImageRegion if defined?(UIAccessibilityImageRegion)
54
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-accessibility
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.2
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Seraphin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-12 00:00:00.000000000 Z
11
+ date: 2015-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -47,6 +47,7 @@ files:
47
47
  - lib/project/status.rb
48
48
  - lib/project/test.rb
49
49
  - lib/project/test_log.rb
50
+ - lib/project/watch.rb
50
51
  homepage: https://github.com/austinseraphin/motion-accessibility
51
52
  licenses:
52
53
  - MIT