motion-prime 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a7abdeb0d07ef7b8ff96929509ca71f4d9735b2
4
- data.tar.gz: 506e027301a4ce09c546ae0a89103813bf708158
3
+ metadata.gz: 73f4e57020b81f82e56d7fe886ddb9373d2c73b0
4
+ data.tar.gz: 4864c4e58bc967c5359813421a016e15d5ce16c8
5
5
  SHA512:
6
- metadata.gz: 4890d0d9e1f0231b41194eef01979d6b6f9314c465e8b4a4e5b9280ee1dc67924c148d746ab8263d7c996cf9eec39ba1c16827e7d4072a22cc162c0e2eead179
7
- data.tar.gz: 114bd8c2ab635bd8ce17a4963965b03428bb71a045fdcec832c4e11d9e23841b386b0b295096d97aa7330a1b4a9e564ad2b702c4ff4f74cf96fac0f2806429c1
6
+ metadata.gz: 25a1b1d3ef76d3d5ddfe3299a52dfcf00d6d8361b334145e4fe91cc389fcfada501f937c1d10067d6a56dcfae8a2fc9950837c61029ad6b06c913f4fc7a4dba9
7
+ data.tar.gz: c8fa03c270d0af8427b3182851c6ee6b0b9919a36d53646273949fdee90d93b21548253772d8697129d7df48b59a70f24492b19dd32a8d8d9ef33fa1031d858b
@@ -1,4 +1,6 @@
1
1
  language: objective-c
2
2
  before_install:
3
- - (ruby --version)
3
+ - (ruby --version)
4
+ gemfile:
5
+ - Gemfile
4
6
  script: ./travis.sh
@@ -1,3 +1,7 @@
1
+ === 1.0.7
2
+ * Bug fixes
3
+ * Only include bubble wrap core (not all modules)
4
+
1
5
  === 1.0.6
2
6
  * Memory leak fixes
3
7
  * Fix pagination of page view section
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- motion-prime (1.0.6)
5
- activesupport
4
+ motion-prime (1.0.7)
5
+ activesupport (~> 3.2.19)
6
6
  afmotion (~> 2.1.0)
7
7
  bubble-wrap (~> 1.6.0)
8
8
  cocoapods
@@ -10,6 +10,7 @@ PATH
10
10
  motion-cocoapods
11
11
  motion-require
12
12
  motion-support (~> 0.2.6)
13
+ rake
13
14
  rm-digest
14
15
  sugarcube (~> 1.6.0)
15
16
  thor
@@ -17,7 +18,7 @@ PATH
17
18
  GEM
18
19
  remote: http://rubygems.org/
19
20
  specs:
20
- activesupport (3.2.17)
21
+ activesupport (3.2.19)
21
22
  i18n (~> 0.6, >= 0.6.4)
22
23
  multi_json (~> 1.0)
23
24
  afmotion (2.1.5)
@@ -26,48 +27,57 @@ GEM
26
27
  bubble-wrap (1.6.0)
27
28
  bubble-wrap-http (= 1.6.0)
28
29
  bubble-wrap-http (1.6.0)
29
- claide (0.5.0)
30
- cocoapods (0.32.1)
30
+ claide (0.7.0)
31
+ cocoapods (0.34.4)
31
32
  activesupport (>= 3.2.15, < 4)
32
- claide (~> 0.5.0)
33
- cocoapods-core (= 0.32.1)
34
- cocoapods-downloader (~> 0.5.0)
35
- cocoapods-try (~> 0.2.0)
33
+ claide (~> 0.7.0)
34
+ cocoapods-core (= 0.34.4)
35
+ cocoapods-downloader (~> 0.7.2)
36
+ cocoapods-plugins (~> 0.3.1)
37
+ cocoapods-trunk (~> 0.3.1)
38
+ cocoapods-try (~> 0.4.1)
36
39
  colored (~> 1.2)
37
40
  escape (~> 0.0.4)
38
41
  json_pure (~> 1.8)
39
- nap (~> 0.7)
42
+ nap (~> 0.8)
40
43
  open4 (~> 1.3)
41
- xcodeproj (~> 0.16.1)
42
- cocoapods-core (0.32.1)
43
- activesupport (>= 3.2.15, < 4)
44
+ xcodeproj (~> 0.19.4)
45
+ cocoapods-core (0.34.4)
46
+ activesupport (>= 3.2.15)
44
47
  fuzzy_match (~> 2.0.4)
45
48
  json_pure (~> 1.8)
46
- nap (~> 0.5)
47
- cocoapods-downloader (0.5.0)
48
- cocoapods-try (0.2.0)
49
+ nap (~> 0.8.0)
50
+ cocoapods-downloader (0.7.2)
51
+ cocoapods-plugins (0.3.1)
52
+ nap
53
+ cocoapods-trunk (0.3.1)
54
+ json_pure (~> 1.8)
55
+ nap (>= 0.8)
56
+ netrc (= 0.7.8)
57
+ cocoapods-try (0.4.1)
49
58
  colored (1.2)
50
59
  escape (0.0.4)
51
60
  fuzzy_match (2.0.4)
52
- i18n (0.6.9)
61
+ i18n (0.6.11)
53
62
  json_pure (1.8.1)
54
- methadone (1.5.1)
63
+ methadone (1.7.0)
55
64
  bundler
56
- motion-cocoapods (1.4.1)
65
+ motion-cocoapods (1.4.2)
57
66
  cocoapods (>= 0.32.1)
58
67
  motion-redgreen (0.1.0)
59
68
  motion-require (0.2.0)
60
69
  motion-stump (0.3.2)
61
70
  motion-support (0.2.6)
62
71
  motion-require (>= 0.0.6)
63
- multi_json (1.9.3)
64
- nap (0.7.0)
65
- open4 (1.3.3)
66
- rake (10.3.1)
72
+ multi_json (1.10.1)
73
+ nap (0.8.0)
74
+ netrc (0.7.8)
75
+ open4 (1.3.4)
76
+ rake (10.3.2)
67
77
  rm-digest (0.0.2)
68
78
  sugarcube (1.6.3)
69
79
  thor (0.19.1)
70
- xcodeproj (0.16.1)
80
+ xcodeproj (0.19.4)
71
81
  activesupport (~> 3.0)
72
82
  colored (~> 1.2)
73
83
 
@@ -79,4 +89,3 @@ DEPENDENCIES
79
89
  motion-prime!
80
90
  motion-redgreen
81
91
  motion-stump
82
- rake
data/bin/prime CHANGED
@@ -7,7 +7,7 @@ class App
7
7
  include Methadone::Main
8
8
  include Methadone::CLILogging
9
9
  include Methadone::SH
10
-
10
+
11
11
  main do |command, *opts|
12
12
  case command.to_sym
13
13
  when :new then create_base(*opts)
@@ -52,7 +52,7 @@ class App
52
52
  info "Command: pod setup"
53
53
  sh "cd ./#{name}; pod setup"
54
54
  info "Command: rake pod:install"
55
- sh "cd ./#{name}; rake pod:install"
55
+ sh "cd ./#{name}; bundle exec rake pod:install"
56
56
  end
57
57
 
58
58
  def self.generate(resource, name)
@@ -1,7 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gem 'motion-cocoapods', '~> 1.4.1'
4
- gem 'motion-prime', '1.0.6'
4
+ gem 'motion-prime', '1.0.7'
5
5
 
6
6
  # add reside menu for sidebar support
7
7
  # gem 'prime_reside_menu', '~> 0.1.4'
@@ -2,8 +2,10 @@ require 'motion-require'
2
2
  require 'motion-support'
3
3
  require 'motion-support/core_ext/hash'
4
4
  require 'sugarcube-common'
5
- require 'bubble-wrap'
5
+
6
+ require 'bubble-wrap/core'
6
7
  require 'bubble-wrap/reactor'
8
+
7
9
  require 'rm-digest'
8
10
  require 'afmotion'
9
11
  require File.expand_path('../../motion-prime/env.rb', __FILE__)
@@ -17,7 +19,7 @@ Motion::Project::App.setup do |app|
17
19
 
18
20
  app.pods do
19
21
  pod 'NanoStore', '~> 2.7.7'
20
- pod 'SDWebImage'
22
+ pod 'SDWebImage', '~> 3.7.1'
21
23
  pod 'SVPullToRefresh', git: 'https://github.com/droidlabs/SVPullToRefresh.git'
22
24
  pod 'MBAlertView'
23
25
  pod 'MBProgressHUD', '~> 0.8'
@@ -16,11 +16,11 @@ Gem::Specification.new do |spec|
16
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
17
  spec.require_paths = ["lib"]
18
18
 
19
- spec.add_development_dependency "rake"
20
19
  spec.add_development_dependency("motion-stump")
21
20
  spec.add_development_dependency("motion-redgreen")
22
21
 
23
22
  spec.add_dependency "cocoapods"
23
+ spec.add_dependency "rake"
24
24
  spec.add_dependency "motion-cocoapods"
25
25
  spec.add_dependency "motion-require"
26
26
  spec.add_dependency "motion-support", '~> 0.2.6'
@@ -30,5 +30,5 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency "methadone"
31
31
  spec.add_dependency "rm-digest"
32
32
  spec.add_dependency "thor"
33
- spec.add_dependency "activesupport"
33
+ spec.add_dependency "activesupport", "~> 3.2.19"
34
34
  end
@@ -16,6 +16,7 @@ class ApiClient
16
16
  params.merge!(credentials: config.http_auth.to_hash)
17
17
  end
18
18
  if config.sign_request?
19
+ params.delete(:sign)
19
20
  signature = RmDigest::MD5.hexdigest(
20
21
  config.signature_secret + params.keys.map(&:to_s).sort.join
21
22
  )
@@ -72,14 +73,14 @@ class ApiClient
72
73
 
73
74
  def request!(method, path, data, files = nil, options = {}, &block)
74
75
  use_callback = block_given?
75
- path = path_with_base(path, config.api_namespace)
76
+ path_with_base = path_with_base(path, config.api_namespace)
76
77
  client_method = files.present? ? :"multipart_#{method}" : method
77
- AFMotion::Client.shared.send client_method, path, data do |response, form_data, progress|
78
+ AFMotion::Client.shared.send client_method, path_with_base, data do |response, form_data, progress|
78
79
  if form_data && files.present?
79
80
  append_files_to_data(files, form_data)
80
81
  elsif progress
81
82
  # handle progress
82
- elsif !response.success? && allow_queue?(method, path, options)
83
+ elsif !response.success? && allow_queue?(method, path_with_base, options)
83
84
  queue(method: method, path: path, params: data)
84
85
  elsif response.operation.response.nil?
85
86
  block.call if use_callback
@@ -123,7 +124,9 @@ class ApiClient
123
124
  end
124
125
 
125
126
  def queue(item)
126
- queue_list = MotionPrime::JSON.parse(user_defaults['api_client_queue']) || []
127
+ queue_json = user_defaults['api_client_queue']
128
+ queue_list = MotionPrime::JSON.parse(queues) if queue_list.present?
129
+ queue_list ||= []
127
130
  queue_list.push(item)
128
131
  user_defaults['api_client_queue'] = MotionPrime::JSON.generate(queue_list)
129
132
  end
@@ -154,8 +157,9 @@ class ApiClient
154
157
  end
155
158
 
156
159
  def process_queue
157
- queue_list = user_defaults['api_client_queue']
158
- user_defaults['api_client_queue'] = []
160
+ queue_json = user_defaults['api_client_queue']
161
+ queue_list = MotionPrime::JSON.parse(queue_json) if queue_json.present?
162
+ user_defaults['api_client_queue'] = nil
159
163
  Array.wrap(queue_list).each do |item|
160
164
  request(item[:method], item[:path], item[:params].clone.symbolize_keys)
161
165
  end
@@ -24,6 +24,7 @@ module MotionPrime
24
24
  @options = options
25
25
  @screen = options[:screen]
26
26
  @section = options[:section]
27
+ @_has_section = @section.present?
27
28
 
28
29
  @view_class = options[:view_class] || 'UIView'
29
30
  @name = options[:name]
@@ -49,6 +50,8 @@ module MotionPrime
49
50
  end
50
51
  Prime.logger.dealloc_message :element, self, self.name
51
52
  super
53
+ rescue # "undefined `super` method" bug fix
54
+ Prime.logger.debug "Undefined `super` in `base_element`"
52
55
  end
53
56
 
54
57
  def add_target(target = nil, action = 'on_click:', event = :touch)
@@ -94,7 +97,9 @@ module MotionPrime
94
97
  compute_style_options(raw_options)
95
98
  raw_options = Styles.for(styles).deep_merge(raw_options)
96
99
  @computed_options = raw_options
97
- normalize_options(@computed_options, section.try(:elements_eval_object), %w[
100
+ return unless @_has_section
101
+ NSLog('ERRROR') unless section
102
+ normalize_options(@computed_options, section.send(:elements_eval_object), %w[
98
103
  font font_name font_size text placeholder title_label
99
104
  padding padding_left padding_right padding_top padding_bottom
100
105
  left right min_width min_outer_width max_width max_outer_width width
@@ -80,19 +80,26 @@ module MotionPrime
80
80
  return if @loading || image_data || !computed_options[:url]
81
81
  @loading = true
82
82
 
83
- ref_key = allocate_strong_references
83
+ refs = strong_references
84
84
  BW::Reactor.schedule do
85
+ return unless refs.all?(&:weakref_alive?)
85
86
  manager = SDWebImageManager.sharedManager
86
87
  manager.downloadWithURL(computed_options[:url],
87
88
  options: 0,
88
89
  progress: lambda{ |r_size, e_size| },
89
90
  completed: lambda{ |image, error, type, finished|
90
- if !image || allocated_references_released?
91
+ if !image || !refs.all?(&:weakref_alive?)
91
92
  @loading = false
92
- release_strong_references(ref_key)
93
93
  return
94
94
  end
95
95
 
96
+ if Prime.env.development? && false
97
+ image_cache = SDImageCache.sharedImageCache
98
+ image_cache.clearMemory
99
+ image_cache.clearDisk
100
+ image_cache.cleanDisk
101
+ end
102
+
96
103
  if computed_options[:post_process].present?
97
104
  image = computed_options[:post_process][:method].to_proc.call(computed_options[:post_process][:target], image)
98
105
  end
@@ -104,7 +111,6 @@ module MotionPrime
104
111
  self.view.performSelectorOnMainThread :setNeedsDisplay, withObject: nil, waitUntilDone: true
105
112
  end
106
113
  @loading = false
107
- release_strong_references(ref_key)
108
114
  }
109
115
  )
110
116
  end
@@ -11,24 +11,20 @@ module MotionPrime
11
11
  raise "You must set default image for `#{name}`" unless computed_options[:default]
12
12
 
13
13
  view.setImage(computed_options[:default].uiimage)
14
- ref_key = allocate_strong_references
14
+ refs = strong_references
15
15
  BW::Reactor.schedule do
16
16
  manager = SDWebImageManager.sharedManager
17
17
  manager.downloadWithURL(computed_options[:url],
18
18
  options: 0,
19
19
  progress: lambda{ |r_size, e_size| },
20
20
  completed: lambda{ |image, error, type, finished|
21
- unless image
22
- release_strong_references(ref_key)
23
- return
24
- end
21
+ return if !image || !refs.all?(&:weakref_alive?)
25
22
 
26
23
  if computed_options[:post_process].present?
27
24
  image = computed_options[:post_process][:method].to_proc.call(computed_options[:post_process][:target], image)
28
25
  end
29
26
 
30
27
  self.performSelectorOnMainThread :set_image, withObject: image, waitUntilDone: true
31
- release_strong_references(ref_key)
32
28
  }
33
29
  )
34
30
  end
@@ -24,8 +24,7 @@ module MotionPrime
24
24
  # @return [Prime::Model] model
25
25
  def save!
26
26
  _bags.values.each do |bag|
27
- bag.store = self.store
28
- bag.save
27
+ bag.save# unless bag.store
29
28
  end
30
29
  super
31
30
  rescue StoreError => e
@@ -131,9 +131,11 @@ module MotionPrime
131
131
 
132
132
  def save!
133
133
  self.store ||= MotionPrime::Store.shared_store
134
+ self.store.save_interval = savedObjects.count + unsavedObjects.count
134
135
  error_ptr = Pointer.new(:id)
135
136
  result = self.saveAndReturnError(error_ptr)
136
137
  raise StoreError, error_ptr[0].description if error_ptr[0]
138
+ self.store.save_interval = 1
137
139
  result
138
140
  end
139
141
 
@@ -254,7 +254,6 @@ module MotionPrime
254
254
  if should_save
255
255
  models_to_save = bags_options.inject([]) { |result, (key, bag_options)| result + bag_options[:save] }
256
256
  models_to_delete = bags_options.inject([]) { |result, (key, bag_options)| result + bag_options[:delete] }
257
- self.store.save_interval = [models_to_save.count, 1].max
258
257
 
259
258
  models_to_save.each(&:save)
260
259
  models_to_delete.each(&:delete)
@@ -270,8 +269,6 @@ module MotionPrime
270
269
  end
271
270
 
272
271
  save if should_save && (bags_changed || has_changed?)
273
-
274
- self.store.save_interval = 1
275
272
  end
276
273
 
277
274
  def fetch_has_many_with_attributes(key, data, sync_options = {})
@@ -12,6 +12,9 @@ module MotionPrime
12
12
  def self.parse(str_data, &block)
13
13
  return nil unless str_data
14
14
  data = str_data.respond_to?(:to_data) ? str_data.to_data : str_data
15
+ if data.respond_to?(:dataUsingEncoding)
16
+ data = data.dataUsingEncoding(NSUTF8StringEncoding)
17
+ end
15
18
  opts = NSJSONReadingMutableContainers | NSJSONReadingMutableLeaves | NSJSONReadingAllowFragments
16
19
  error = Pointer.new(:id)
17
20
  obj = NSJSONSerialization.JSONObjectWithData(data, options: opts, error: error)
@@ -112,27 +112,28 @@ module Prime
112
112
  # TODO: we do we need to keep screen ref too?
113
113
  queue_id = @preloader_queue.count
114
114
 
115
- allocate_strong_references(queue_id)
116
-
117
115
  @preloader_queue[queue_id] = {
118
116
  state: :in_progress,
119
117
  target_index: service.sum_index(index, load_count-1),
120
118
  from_index: index
121
119
  }
122
120
 
121
+ cell_refs = data.map &:weak_ref
122
+ refs = strong_references
123
123
  BW::Reactor.schedule(queue_id) do |queue_id|
124
124
  result = load_count.times do |offset|
125
- if @preloader_queue[queue_id][:state] == :cancelled
126
- release_strong_references(queue_id)
127
- break
128
- end
129
- if allocated_references_released?
125
+ break if @preloader_queue[queue_id][:state] == :cancelled
126
+ unless refs.all?(&:weakref_alive?)
130
127
  @preloader_queue[queue_id][:state] = :dealloc
131
- release_strong_references(queue_id)
132
128
  break
133
129
  end
134
130
 
131
+
132
+ cell_refs_by_group = flat_data? ? cell_refs : cell_refs[index.section]
133
+ cell_ref = cell_refs_by_group[index.row]
134
+ return unless cell_ref.weakref_alive?
135
135
  if section = preload_section_by_index(index)
136
+ return unless section == cell_ref.strong_ref
136
137
  on_cell_section_preloaded(section, index)
137
138
  end
138
139
 
@@ -147,7 +148,6 @@ module Prime
147
148
  @preloader_queue[queue_id][:state] = :completed
148
149
  on_queue_preloaded(queue_id, index)
149
150
  end
150
- release_strong_references(queue_id)
151
151
  end
152
152
  queue_id
153
153
  end
@@ -63,7 +63,7 @@ module MotionPrime
63
63
 
64
64
  def display
65
65
  @pending_display = false
66
- container_view.setNeedsDisplay
66
+ container_view.try(:setNeedsDisplay)
67
67
  end
68
68
 
69
69
  def cell
@@ -34,7 +34,9 @@ class MPButton < UIButton
34
34
  end
35
35
 
36
36
  def apply_padding?
37
- super && !@custom_title_inset_drawn
37
+ # TODO: we should run super method here, but for some reason it doesn't work in RM 2.32
38
+ ![padding_top, padding_left, padding_right, padding_bottom].all?(&:zero?) &&
39
+ !@custom_title_inset_drawn
38
40
  end
39
41
 
40
42
  def drawRect(rect)
@@ -1,3 +1,3 @@
1
1
  module MotionPrime
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.7"
3
3
  end
data/travis.sh CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env sh
2
-
2
+ sudo chown -R travis ~/Library/RubyMotion
3
+ mkdir -p ~/Library/RubyMotion/build
3
4
  sudo motion update
4
- sudo gem install bundler
5
- sudo bundle install
6
- #sudo pod setup
7
- sudo bundle exec rake pod:install
8
- sudo bundle exec rake clean &&
9
- sudo bundle exec rake spec output=colorized
5
+ bundle install
6
+ pod repo update --silent
7
+ bundle exec rake pod:install
8
+ bundle exec rake clean
9
+ bundle exec rake spec output=colorized
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: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iskander Haziev
@@ -9,10 +9,10 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-28 00:00:00.000000000 Z
12
+ date: 2014-10-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rake
15
+ name: motion-stump
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - ">="
@@ -26,7 +26,7 @@ dependencies:
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
- name: motion-stump
29
+ name: motion-redgreen
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
@@ -40,13 +40,13 @@ dependencies:
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: motion-redgreen
43
+ name: cocoapods
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
- type: :development
49
+ type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
@@ -54,7 +54,7 @@ dependencies:
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
- name: cocoapods
57
+ name: rake
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ">="
@@ -197,16 +197,16 @@ dependencies:
197
197
  name: activesupport
198
198
  requirement: !ruby/object:Gem::Requirement
199
199
  requirements:
200
- - - ">="
200
+ - - "~>"
201
201
  - !ruby/object:Gem::Version
202
- version: '0'
202
+ version: 3.2.19
203
203
  type: :runtime
204
204
  prerelease: false
205
205
  version_requirements: !ruby/object:Gem::Requirement
206
206
  requirements:
207
- - - ">="
207
+ - - "~>"
208
208
  - !ruby/object:Gem::Version
209
- version: '0'
209
+ version: 3.2.19
210
210
  description: RubyMotion apps development framework
211
211
  email:
212
212
  - gvalmon@gmail.com