motion-flow 0.1.2 → 0.1.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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a68248896b4d964406c7baf1afe2aac5f0319ac
4
- data.tar.gz: 75c2c915a81908523cf70f4ae3e5c950f2d4bdcc
3
+ metadata.gz: 59473ce2df050d9206bdb1bba82321e031e7158d
4
+ data.tar.gz: 75e2bd1a9e79d6612e4a95984bd5daa779f7ca2a
5
5
  SHA512:
6
- metadata.gz: 86c17fa8ef46467090982c2bf52fda7217bdd3aadf8d0596bd749077b9e05fee04619295c14184251d9deae277e96a18b767f9e5e943bc329aa488e987681955
7
- data.tar.gz: a8a98edb7e23791759f42e0804a77d1a821a26ddf8774b1e76322ff06ec59a0643ccf57eed75d4897f6ac8b8c122114346d84a9dd5e2a50e4080bbe388b41ffe
6
+ metadata.gz: ccece4daf3120a6de42e3524165eecb9b67bd7b76aed9363d96a3aaf0be7575cbda9716a9937cf4333f30501e498d9305b86f5e480facdd1dc10c068e8d4a2a2
7
+ data.tar.gz: 21e0cbdff4b45e0cf235650803bffbc72a911cf6cfda032efa16dd7a96bb5efba9cd30f64496c37d59b323070d6576637876517c43c1a09ce6a16557e409e304
Binary file
@@ -1,42 +1,23 @@
1
- # See {Digest::Base Digest::Base} to see the methods implemented in subclasses:
2
- # - {Digest::MD5 Digest::MD5}
3
- # - {Digest::SHA1 Digest::SHA1}
4
- # - {Digest::SHA224 Digest::SHA224}
5
- # - {Digest::SHA256 Digest::SHA256}
6
- # - {Digest::SHA384 Digest::SHA384}
7
- # - {Digest::SHA512 Digest::SHA512}
8
1
  module Digest
9
2
  class Base
10
- # @example
11
- # digest = Digest::MD5.new
12
3
  def initialize(algo)
13
4
  @digest = Java::Security::MessageDigest.getInstance(algo)
14
5
  end
15
6
 
16
- # @example
17
- # digest.update('hello')
18
7
  def update(str)
19
8
  @digest.update(str.chars.map { |x| x.ord })
20
9
  self
21
10
  end
22
11
 
23
- # @example
24
- # digest.reset
25
12
  def reset
26
13
  @digest.reset
27
14
  self
28
15
  end
29
16
 
30
- # @example
31
- # digest.digest
32
- # #=> '5d41402abc4b2a76b9719d911017c592'
33
17
  def digest
34
18
  @digest.digest.map { |x| String.format('%02x', x) }.join
35
19
  end
36
20
 
37
- # @example
38
- # Digest::MD5.digest('hello')
39
- # #=> '5d41402abc4b2a76b9719d911017c592'
40
21
  def self.digest(str)
41
22
  self.new.update(str).digest
42
23
  end
@@ -1,7 +1,7 @@
1
1
  class JSON
2
- def self.load(str)
2
+ def self.load(string)
3
3
  error_ptr = Pointer.new(:id)
4
- obj = NSJSONSerialization.JSONObjectWithData(str.to_data, options:0, error:error_ptr)
4
+ obj = NSJSONSerialization.JSONObjectWithData(string.to_data, options:0, error:error_ptr)
5
5
  if obj == nil
6
6
  raise error_ptr[0].description
7
7
  end
@@ -1,66 +1,20 @@
1
- # @attr [Float] latitude Populated by the location monitoring service
2
- # @attr [Float] latitude Populated by the location monitoring service
3
- # @attr [Float] longitude Populated by the location monitoring service
4
- # @attr [Float] altitude Populated by the location monitoring service
5
- # @attr [Time] time Populated by the location monitoring service
6
- # @attr [Float] speed Populated by the location monitoring service
7
- # @attr [Float] accuracy Populated by the location monitoring service
8
- #
9
- # @attr [String] name Populated after reverse geocoding a string
10
- # @attr [String] address Populated after reverse geocoding a string
11
- # @attr [String] localiton Populated after reverse geocoding a string
12
- # @attr [String] postal_code Populated after reverse geocoding a string
13
- # @attr [String] sub_area Populated after reverse geocoding a string
14
- # @attr [String] area Populated after reverse geocoding a string
15
- # @attr [String] country Populated after reverse geocoding a string
16
1
  class Location
17
-
18
2
  attr_accessor :latitude, :longitude, :altitude, :time, :speed, :accuracy
19
3
  attr_accessor :name, :address, :locality, :postal_code, :sub_area, :area, :country
20
4
 
21
- # Checks if the location service is accessible
22
- # @example
23
- # Location.monitor_enabled? # => true or false
24
5
  def self.monitor_enabled?
25
6
  Location::Monitor.enabled?
26
7
  end
27
8
 
28
- # Starts monitoring for location updates.
29
- #
30
- # @param [Hash] options
31
- # @option options [Fixnum] :distance_filter The distance in meters from the
32
- # previous location that should trigger a monitor update.
33
- #
34
- # @return [Monitor]
35
- #
36
- # @example
37
- # monitor = Location.monitor do |location, err|
38
- # if location
39
- # puts location.latitude, location.longitude
40
- # else
41
- # puts err
42
- # end
43
- # end
44
9
  def self.monitor(options={}, &block)
45
10
  options[:distance_filter] ||= 0
46
11
  Location::Monitor.new(options, block)
47
12
  end
48
13
 
49
- # Checks if the geocoder service is accessible
50
- # @return [Boolean]
51
14
  def self.geocode_enabled?
52
15
  Location::Geocoder.enabled?
53
16
  end
54
17
 
55
- # Reverse geocode a string
56
- # @example
57
- # Location.geocode('apple inc') do |location, err|
58
- # if location
59
- # puts location.address
60
- # else
61
- # puts err
62
- # end
63
- # end
64
18
  def self.geocode(str, &block)
65
19
  Location::Geocoder.new(str, block)
66
20
  end
data/flow/net/actions.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  module Net
2
2
  class Request
3
- # @!visibility private
4
3
  module Actions
5
4
  [:get, :post, :put, :delete, :patch, :options, :head].each do |http_method|
6
5
  define_method(http_method) do |base_url, *options, callback|
@@ -1,5 +1,4 @@
1
1
  module Net
2
- # @!visibility private
3
2
  class Authorization
4
3
  def initialize(options = {})
5
4
  @options = options
@@ -72,7 +72,6 @@ module Net
72
72
 
73
73
  def build_ns_url_session_configuration
74
74
  config = NSURLSessionConfiguration.defaultSessionConfiguration
75
- config.allowsCellularAccess = false
76
75
  config.setHTTPAdditionalHeaders(configuration[:headers])
77
76
  config.timeoutIntervalForRequest = configuration[:connect_timeout]
78
77
  config.timeoutIntervalForResource = configuration[:read_timeout]
data/flow/net/config.rb CHANGED
@@ -1,18 +1,10 @@
1
1
  module Net
2
2
  module Config
3
- # @!visibility private
4
3
  USER_AGENT = "Flow - https://github.com/HipByte/flow"
5
4
 
6
5
  class << self
7
- # User agent string to be used in all requests
8
- # @return [String]
9
6
  attr_accessor :user_agent
10
- # Time in seconds to wait for a connection to be made. Default is 30 seconds.
11
- # @return [Fixnum]
12
7
  attr_accessor :connect_timeout
13
- # Time in seconds to wait for a resource to finnish downloading. Default
14
- # is 7 days.
15
- # @return [Fixnum]
16
8
  attr_accessor :read_timeout
17
9
 
18
10
  def user_agent
@@ -1,5 +1,4 @@
1
1
  module Net
2
- # @!visibility private
3
2
  class Expectation
4
3
  attr_reader :response
5
4
  attr_reader :url
data/flow/net/header.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  module Net
2
- # @!visibility private
3
2
  class Header
4
3
  SHORTHANDS = {
5
4
  content_type: 'Content-Type',
data/flow/net/net.rb CHANGED
@@ -1,39 +1,13 @@
1
1
  module Net
2
2
  class << self
3
-
4
- # Creates a session with common configuration
5
- # @example
6
- # session = Net.build('https://httpbin.org') do
7
- # header(:content_type, :json)
8
- # end
9
- # session.get("/users") do |response|
10
- # end
11
- # session.get("/posts") do |response|
12
- # end
13
3
  def build(base_url, &block)
14
4
  Session.build(base_url, &block)
15
5
  end
16
6
 
17
- # Track the reachability of a hostname
18
- # @example
19
- # # this block will be called each time network status is updated
20
- # reachability = Net.reachable?("www.google.fr") do |reachable|
21
- # if reachable
22
- # ###
23
- # end
24
- # end
25
- # # stop network reachability tracking
26
- # reachability.stop
27
7
  def reachable?(hostname = 'www.google.com', &block)
28
8
  Reachability.new(hostname, &block)
29
9
  end
30
10
 
31
- # Stub an url to return the desired Response object
32
- # @example
33
- # Net.stub('www.example.com').and_return(Response.new(body:"example"))
34
- # Net.get("www.example.com") do |response|
35
- # response.body # example
36
- # end
37
11
  def stub(base_url)
38
12
  expectation = Expectation.all.find{ |e| e.base_url == base_url }
39
13
  if expectation.nil?
@@ -43,75 +17,6 @@ module Net
43
17
  expectation
44
18
  end
45
19
 
46
- # @!method get(base_url, options)
47
- # @param [String] base_url The url to request
48
- # @param [Hash] options
49
- # @option options [Hash] headers
50
- # @option options [String] body
51
- # @option options [Fixnum] connection_timeout
52
- # @option options [Fixnum] read_timeout
53
- # @yield [response]
54
- # @yieldparam [Response] response
55
-
56
- # @!method post(base_url, options)
57
- # @param [String] base_url The url to request
58
- # @param [Hash] options
59
- # @option options [Hash] headers
60
- # @option options [String] body
61
- # @option options [Fixnum] connection_timeout
62
- # @option options [Fixnum] read_timeout
63
- # @yield [response]
64
- # @yieldparam [Response] response
65
-
66
- # @!method put(base_url, options)
67
- # @param [String] base_url The url to request
68
- # @param [Hash] options
69
- # @option options [Hash] headers
70
- # @option options [String] body
71
- # @option options [Fixnum] connection_timeout
72
- # @option options [Fixnum] read_timeout
73
- # @yield [response]
74
- # @yieldparam [Response] response
75
-
76
- # @!method delete(base_url, options)
77
- # @param [String] base_url The url to request
78
- # @param [Hash] options
79
- # @option options [Hash] headers
80
- # @option options [String] body
81
- # @option options [Fixnum] connection_timeout
82
- # @option options [Fixnum] read_timeout
83
- # @yield [response]
84
- # @yieldparam [Response] response
85
-
86
- # @!method patch(base_url, options)
87
- # @param [String] base_url The url to request
88
- # @param [Hash] options
89
- # @option options [Hash] headers
90
- # @option options [String] body
91
- # @option options [Fixnum] connection_timeout
92
- # @option options [Fixnum] read_timeout
93
- # @yield [response]
94
- # @yieldparam [Response] response
95
-
96
- # @!method options(base_url, options)
97
- # @param [String] base_url The url to request
98
- # @param [Hash] options
99
- # @option options [Hash] headers
100
- # @option options [String] body
101
- # @option options [Fixnum] connection_timeout
102
- # @option options [Fixnum] read_timeout
103
- # @yield [response]
104
- # @yieldparam [Response] response
105
-
106
- # @!method head(base_url, options)
107
- # @param [String] base_url The url to request
108
- # @param [Hash] options
109
- # @option options [Hash] headers
110
- # @option options [String] body
111
- # @option options [Fixnum] connection_timeout
112
- # @option options [Fixnum] read_timeout
113
- # @yield [response]
114
- # @yieldparam [Response] response
115
20
  [:get, :post, :put, :delete, :patch, :options, :head].each do |http_medhod|
116
21
  define_method(http_medhod) do |base_url, *options, &callback|
117
22
  Request.send(http_medhod, base_url, options.shift || {}, callback)
data/flow/net/response.rb CHANGED
@@ -1,56 +1,29 @@
1
1
  module Net
2
2
  class Response
3
- # @!visibility private
4
3
  attr_accessor :options, :mock
5
4
 
6
- # @!visibility private
7
5
  def initialize(options = {})
8
6
  @options = options
9
7
  @headers = options[:headers]
10
8
  @mock = false
11
9
  end
12
10
 
13
- # Returns the HTTP status code of the response
14
- # @return [Fixnum]
15
- # @example
16
- # response.status_code
17
- # #=> 200
18
11
  def status
19
12
  options[:status_code]
20
13
  end
21
14
 
22
- # Returns the HTTP status message of the response according to RFC 2616
23
- # @return [String]
24
- # @example
25
- # response.status_message
26
- # #=> "OK"
27
15
  def status_message
28
16
  options[:status_message]
29
17
  end
30
18
 
31
- # Returns the mime type of the response
32
- # @return [String]
33
- # @example
34
- # repsonse.status_message
35
- # #=> "OK"
36
19
  def mime_type
37
20
  options[:mime_type]
38
21
  end
39
22
 
40
- # Returns body of the response
41
- # @return [String]
42
- # @example
43
- # response.body
44
- # #=> "Hello World"
45
23
  def body
46
24
  options.fetch(:body, "")
47
25
  end
48
26
 
49
- # Returns a hash containing key/value pairs of headers
50
- # @return [Hash]
51
- # @example
52
- # response.headers
53
- # #=> { 'Content-Type' => 'application/json' }
54
27
  def headers
55
28
  @headers
56
29
  end
data/flow/net/session.rb CHANGED
@@ -21,31 +21,16 @@ module Net
21
21
  end
22
22
  end
23
23
 
24
- # Sets a key/value pair header to be used in all requests in this session
25
- # @param [String] field
26
- # @param [String] value
27
- # @example
28
- # session.header("Content-Type", "application/json")
29
24
  def header(field, value)
30
25
  @headers << Header.new(field, value)
31
26
  end
32
27
 
33
- # Returns a hash containing key/value pairs of headers
34
- # @return [Hash]
35
- # @example
36
- # response.headers
37
- # #=> { 'Content-Type' => 'application/json' }
38
28
  def headers
39
29
  hash = {}
40
30
  @headers.map {|header| hash[header.field] = header.value}
41
31
  hash
42
32
  end
43
33
 
44
- # Sets the Basic authentication data to be used in all requests
45
- # @param [Hash] options
46
- # @option options [String] user
47
- # @option options [String] password
48
- # @option options [String] token
49
34
  def authorize(options)
50
35
  @authorization = Authorization.new(options)
51
36
  end
@@ -1,6 +1,5 @@
1
1
  module Net
2
2
  class Request
3
- # @!visibility private
4
3
  module Stubbable
5
4
  def stub!(&callback)
6
5
  if response = Expectation.response_for(self)
data/flow/task/task.rb CHANGED
@@ -1,73 +1,21 @@
1
1
  class Task
2
- class Timer
3
- # Cancel a scheduled block
4
- # @!method stop
5
- end
6
-
7
- class Queue
8
- # Run a block on a serial queue. Blocks will be run on the thread associated
9
- # to the queue in sequential order. The first block will have to finish
10
- # before the second block can run.
11
- # @!method schedule
12
- # @example
13
- # q = Task.queue
14
-
15
- # Wait for all scheduled blocks to finish on a serial queue
16
- # @!method wait
17
- # @example
18
- # q = Task.queue
19
- # q.wait
20
- end
21
-
22
- # Schedule a block at every given interval (in seconds)
23
- # @return [Timer]
24
- # @example
25
- # timer = Task.every 2.5 do
26
- # # ...
27
- # end
28
2
  def self.every(interval, &block)
29
3
  Task::Timer.new(interval, true, block)
30
4
  end
31
5
 
32
- # Schedule a block after a given interval (in seconds)
33
- # @example
34
- # timer = Task.after 0.5 do
35
- # # ...
36
- # end
37
6
  def self.after(delay, &block)
38
7
  Task::Timer.new(delay, false, block)
39
8
  end
40
9
 
41
- # Run a block on the main thread
42
- # @example
43
- # Task.main do
44
- # # ...
45
- # end
46
10
  def self.main(&block)
47
11
  Task::Queue.schedule_on_main(block)
48
12
  end
49
13
 
50
- # Run a block concurrently in the background
51
- # Blocks will be distributed among a pool of threads and may be executed in parallel.
52
- # @example
53
- # Task.background do
54
- # # ...
55
- # end
56
14
  def self.background(&block)
57
15
  Task::Queue.schedule_on_background(block)
58
16
  end
59
17
 
60
- # Create a serial queue
61
- # A <code>Task::Queue</code> object keeps a reference to a single thread.
62
- # @return [Queue]]
63
- # @example
64
- # q = Task.queue
65
18
  def self.queue
66
19
  Task::Queue.new
67
20
  end
68
-
69
- # Check is the method has been called from the main thread
70
- # @!method self.main?
71
- # @example
72
- # Task.main?
73
21
  end
data/flow/ui/alert.rb CHANGED
@@ -1,10 +1,4 @@
1
1
  module UI
2
- # @param [Hash] options
3
- # @option options [String] title The title of the alert
4
- # @option options [String] message The message of the alert
5
- # @option options [String] cancel The title for the Cancel button
6
- # @option options [String] default The title of the 'default' button, usually
7
- # the 'ok' button.
8
2
  def self.alert(opt={}, &block)
9
3
  alert = UI::Alert.new
10
4
  alert.title = (opt[:title] or raise ":title needed")
Binary file
Binary file
@@ -8,7 +8,6 @@ module UI
8
8
  if init
9
9
  @screen = screen
10
10
  on(:view_did_load) { @screen.before_on_load }
11
- on(:view_did_load) { @screen.before_on_load }
12
11
  on(:view_will_appear) { @screen.before_on_show }
13
12
  on(:view_did_appear) { @screen.on_show }
14
13
  end
data/flow/ui/color.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  module UI
2
- # @return [Color]
3
2
  def self.Color(color)
4
3
  if UI::Color._native?(color)
5
4
  UI::Color.new(color)
@@ -26,13 +25,6 @@ module UI
26
25
  end
27
26
  end
28
27
 
29
-
30
- # Represents a color. Can be initialized in several ways:
31
- # - With a hex number:
32
- # UI::Color.hex("#d2603c")
33
- # - With RGB values:
34
- # UI::Color.rgb(123, 200, 78)
35
- # - Using one of the preset colors
36
28
  class Color
37
29
  attr_reader :proxy
38
30
  def initialize(proxy)
data/flow/ui/eventable.rb CHANGED
@@ -11,7 +11,7 @@ module UI
11
11
  end
12
12
 
13
13
  def trigger(event, *args)
14
- # if no listner found we will do nothing
14
+ # if no listener found we will do nothing
15
15
  return unless registered_event = __events__.fetch(event, nil)
16
16
 
17
17
  case registered_event
data/flow/ui/font.rb CHANGED
@@ -1,9 +1,4 @@
1
1
  module UI
2
- # @param [Hash] font
3
- # @option font [String] name
4
- # @option font [Fixnum] size
5
- # @option font [Symbol] trait :normal, :bold, :italic, :bold_italic
6
- # @return [Font]
7
2
  def self.Font(font)
8
3
  case font
9
4
  when UI::Font
@@ -24,19 +19,10 @@ module UI
24
19
  class Font
25
20
  attr_reader :proxy
26
21
 
27
- # @!method initialize(obj, size, trait=nil)
28
- # @param [String] name
29
- # @param [Fixnum] size
30
- # @param [Symbol] trait :normal, :bold, :italic, :bold_italic
31
-
32
- # Returns wether the font is italic
33
- # @return [Boolean]
34
22
  def italic?
35
23
  trait == :italic or trait == :bold_italic
36
24
  end
37
25
 
38
- # Returns wether the font is bold
39
- # @return [Boolean]
40
26
  def bold?
41
27
  trait == :bold or trait == :bold_italic
42
28
  end
data/flow/ui/list_row.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  module UI
2
- # @!visibility hidden
3
2
  class ListRow < UI::View
4
3
  def initialize
5
4
  super
data/lib/android.rb CHANGED
@@ -6,7 +6,7 @@ require 'motion/project/template/android'
6
6
  Motion::Project::App.setup do |app|
7
7
  app.api_version = '23' unless Motion::Project::Config.starter?
8
8
  app.build_dir = 'build/android'
9
- app.assets_dirs = ['resources']
9
+ app.assets_dirs << 'resources'
10
10
  app.resources_dirs = []
11
11
 
12
12
  FLOW_COMPONENTS.each do |comp|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-flow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - HipByte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-23 00:00:00.000000000 Z
11
+ date: 2016-07-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  motion-flow allows you to write cross-platform
@@ -1128,4 +1128,3 @@ signing_key:
1128
1128
  specification_version: 4
1129
1129
  summary: Cross-platform app framework for RubyMotion
1130
1130
  test_files: []
1131
- has_rdoc: