motion-prime 0.9.2 → 0.9.3

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NmQ3ZGM2Yzk1NGVmZDhiMDVkZWMxMTkyNmU0MjJlODE0ODBkMTJmNg==
4
+ NjQ0MTllNzk1MTE2ODViNTZjMDE0NzFhMTU2Nzk1ZjI1Njg3MDhjZQ==
5
5
  data.tar.gz: !binary |-
6
- YWJhYTVhYmE5OWEzYmQ3M2ExZDA3NjhlMTNjN2RiYzcyYTRjMmNiNg==
6
+ NzQ0YTk2NjA2NWUxOGE5N2NjMjFkZTA2YjJlZTlhNzVkMDQ0M2I2ZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OGRlNTdiYWIxNTU3MzZkNmE0ODRiZjJmNTY2MGVjZGI0NDUxYzRjNDIwNThk
10
- ZGE5YjE4NTIzYzJkMDI2OTcxMjJkOWU2MmYwOGU1NDZmZjk3YWZjMGYwZTI3
11
- YzkyMjM0MGI5YzhiMDZjNDMzMDQ0ODAwOWQwYjdmZmE0OTFmNjg=
9
+ MGY3OWE1OTNkNGVjMWQ4NjFiNjgzOGNjMjhiNTQ5ZTUwODEyNmMwMGVlNGIz
10
+ NTg2OTM3ZmMyNzcxMDE2YTNkNDJhNTg1MGEzNjE1YjAwNTNlMzljMzdlNjM2
11
+ ZTU2NzZlZWNkYmIzZWUxMjMwODg2MWQ1OWYxZjIyOTA2ZjdiNmY=
12
12
  data.tar.gz: !binary |-
13
- YzEwMTg1MDk2OTc0MjIyNDVmOWJjZTU2MGE2NWM2OTc2OGFlNzc2YjhmOWEw
14
- ZDcyMWYxZDhmMTA0NDNhYTBkZGRjNmM5NDQ0ZTUwNDY5Mzk0ZGU1NjRkZGJk
15
- ODA5NjU1MDhkMzYyMWM4NWU4NGEzY2QxYTNlMWRiNDk5NTk0MWY=
13
+ Y2QxNWVhMGRkZTBlMTE2YWM5NzU4MjJhNjMwNGI0ODAwYWVmNTU3NzY2NTU3
14
+ YzM2NzJmZGU3ODczYjQ1ZGJlNzllNDgzYmE1OGQ3NjQzY2IyZDdiMjBmOGYx
15
+ MDg1YTVmOWM1MGUyMGMwNTkwYTQ4ZmU2N2JhYzIyNjcyOTUyZjI=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ === 0.9.3
2
+ * Small refactor required for working prime_awesome
3
+
1
4
  === 0.9.2
2
5
  * Updated scaffold and added deleting items.
3
6
  * Ability to reload base section.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- motion-prime (0.9.2)
4
+ motion-prime (0.9.3)
5
5
  activesupport
6
6
  afmotion (~> 2.0.0)
7
7
  bubble-wrap (~> 1.5.0)
data/files/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gem 'motion-cocoapods', '~> 1.4.0'
4
- gem 'motion-prime', '0.9.2'
4
+ gem 'motion-prime', '0.9.3'
5
5
 
6
6
  # add reside menu for sidebar support
7
7
  # gem 'prime_reside_menu', '~> 0.1.4'
@@ -28,6 +28,26 @@ module MotionPrime
28
28
  end
29
29
 
30
30
  def attributed_string(options)
31
+ attributes, paragrah_style = extract_attributed_string_options(options)
32
+
33
+ prepared_text = NSMutableAttributedString.alloc.initWithString(options[:text].to_s, attributes: attributes)
34
+ underline_range = options[:underline]
35
+ fragment_color = options[:fragment_color]
36
+ if paragrah_style && (underline_range || fragment_color) && options.fetch(:number_of_lines, 1) == 1
37
+ Prime.logger.debug "If attributed text has paragraph style and underline - you must set number of lines != 1"
38
+ end
39
+
40
+ if underline_range
41
+ underline_range = [0, options[:text].length] if underline_range === true
42
+ prepared_text.addAttributes({NSUnderlineStyleAttributeName => NSUnderlineStyleSingle}, range: underline_range)
43
+ end
44
+ if fragment_color
45
+ prepared_text.addAttributes({NSForegroundColorAttributeName => fragment_color[:color].uicolor}, range: fragment_color[:range])
46
+ end
47
+ prepared_text
48
+ end
49
+
50
+ def extract_attributed_string_options(options)
31
51
  attributes = {}
32
52
  line_height = options[:line_height]
33
53
  line_spacing = options[:line_spacing]
@@ -51,25 +71,9 @@ module MotionPrime
51
71
  end
52
72
  attributes[NSParagraphStyleAttributeName] = paragrah_style
53
73
  end
54
-
55
74
  attributes[NSForegroundColorAttributeName] = options[:text_color].uicolor if options[:text_color]
56
75
  attributes[NSFontAttributeName] = options[:font].uifont if options[:font]
57
-
58
- prepared_text = NSMutableAttributedString.alloc.initWithString(options[:text].to_s, attributes: attributes)
59
- underline_range = options[:underline]
60
- fragment_color = options[:fragment_color]
61
- if paragrah_style && (underline_range || fragment_color) && options.fetch(:number_of_lines, 1) == 1
62
- Prime.logger.debug "If attributed text has paragraph style and underline - you must set number of lines != 1"
63
- end
64
-
65
- if underline_range
66
- underline_range = [0, options[:text].length] if underline_range === true
67
- prepared_text.addAttributes({NSUnderlineStyleAttributeName => NSUnderlineStyleSingle}, range: underline_range)
68
- end
69
- if fragment_color
70
- prepared_text.addAttributes({NSForegroundColorAttributeName => fragment_color[:color].uicolor}, range: fragment_color[:range])
71
- end
72
- prepared_text
76
+ [attributes, paragrah_style]
73
77
  end
74
78
  end
75
79
  end
@@ -52,7 +52,8 @@ module MotionPrime
52
52
 
53
53
  UIGraphicsPushContext(context)
54
54
  options = draw_options
55
- if options[:is_html] || options[:line_spacing] || options[:line_height] || options[:underline]
55
+ if options[:is_html] || options[:line_spacing] ||
56
+ options[:line_height] || options[:underline] || options[:force_attributed]
56
57
  prepared_text = options[:is_html] ? html_string(options) : attributed_string(options)
57
58
 
58
59
  CGContextSaveGState(context)
@@ -1,3 +1,3 @@
1
1
  module MotionPrime
2
- VERSION = "0.9.2"
2
+ VERSION = "0.9.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-prime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iskander Haziev