mobile_workflow 0.6.20 → 0.6.21
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 974cb70825d3d8b73af77e17adaedf222d6e67e0b0940c0d7158dac1d3c12c3e
|
4
|
+
data.tar.gz: 35588fbd42ae9dacf7e0e0162df48d7442126c7e874efc14fa1fd440b7989dfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b54532ff2c16360d7ec9b9bdd8e5b0fe22b793a41cad4c090a447c35c11f961949ab948c78afb89063eccc9c6f5622abc8db42812ee096734b9235916f45c537
|
7
|
+
data.tar.gz: 67d3a4b2889644571377b9bd1ef69a56ce5e0bc577e053cdd2f5915c877163632fd4b27354c8182af26e26e729d3de73d9bc47c1b165aee9381ae3d7d097b019
|
@@ -57,27 +57,30 @@ module MobileWorkflow
|
|
57
57
|
|
58
58
|
{type: :button, label: label, url: url, method: method, style: style, onSuccess: on_success}.compact
|
59
59
|
end
|
60
|
-
|
61
|
-
def
|
60
|
+
|
61
|
+
def mw_display_url_button(label:, url:, method: :put, style: :primary, confirm_title: nil, confirm_text: nil, on_success: :reload)
|
62
62
|
validate_on_success!(on_success)
|
63
63
|
validate_button_style!(style)
|
64
64
|
|
65
65
|
{type: :button, label: label, url: url, method: method, style: style, confirmTitle: confirm_title, confirmText: confirm_text, onSuccess: on_success}.compact
|
66
66
|
end
|
67
|
+
alias_method :mw_display_button_for_url, :mw_display_url_button
|
67
68
|
|
68
|
-
def
|
69
|
+
def mw_display_system_url_button(label:, apple_system_url: nil, android_deep_link: nil, style: :primary)
|
69
70
|
validate_button_style!(style)
|
70
71
|
raise 'Invalid android_deep_link' unless android_deep_link.start_with?('http')
|
71
72
|
|
72
73
|
{type: :button, label: label, appleSystemURL: apple_system_url, androidDeepLink: android_deep_link, style: style}.compact
|
73
74
|
end
|
75
|
+
alias_method :mw_display_button_for_system_url, :mw_display_system_url_button
|
74
76
|
|
75
|
-
def
|
77
|
+
def mw_display_modal_workflow_button(label:, modal_workflow_name:, style: :primary, on_success: :none)
|
76
78
|
validate_on_success!(on_success)
|
77
79
|
validate_button_style!(style)
|
78
80
|
|
79
81
|
{type: :button, label: label, modalWorkflow: modal_workflow_name, style: style, onSuccess: on_success}.compact
|
80
82
|
end
|
83
|
+
alias_method :mw_display_button_for_modal_workflow, :mw_display_modal_workflow_button
|
81
84
|
|
82
85
|
private
|
83
86
|
def validate_on_success!(on_success)
|
data/lib/mobile_workflow.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'mobile_workflow'
|
2
|
+
require 'rails'
|
3
|
+
|
4
|
+
module MobileWorkflow
|
5
|
+
class Railtie < Rails::Railtie
|
6
|
+
railtie_name :mobile_workflow
|
7
|
+
|
8
|
+
rake_tasks do
|
9
|
+
path = File.expand_path(__dir__)
|
10
|
+
Dir.glob("#{path}/tasks/**/*.rake").each { |f| load f }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
def each_step(json, type)
|
4
|
+
json['workflows'].map{|w| w["steps"].select {|s| s["type"] == type.to_s}}.flatten.each do |step|
|
5
|
+
yield(step)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def replace_oauth(app_json)
|
10
|
+
client_id = ENV["CLIENT_ID"]
|
11
|
+
client_secret = ENV["CLIENT_SECRET"]
|
12
|
+
redirect_scheme = ENV["SCHEME"]
|
13
|
+
|
14
|
+
each_step(app_json, :networkOAuth2) do |step|
|
15
|
+
step["items"].each do |item|
|
16
|
+
if item["oAuth2ClientId"]
|
17
|
+
item["oAuth2ClientId"] = client_id
|
18
|
+
item["oAuth2ClientSecret"] = client_secret
|
19
|
+
item["oAuth2RedirectScheme"] = redirect_scheme
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def replace_servers(app_json)
|
26
|
+
server_url = ENV["SERVER_URL"]
|
27
|
+
base_url = ENV["PREVIOUS_SERVER_URL"]
|
28
|
+
|
29
|
+
app_json["servers"].each do |server|
|
30
|
+
server["url"] = server_url
|
31
|
+
end
|
32
|
+
|
33
|
+
each_step(app_json, :display) do |step|
|
34
|
+
step["items"].each do |item|
|
35
|
+
["appleSystemURL", "androidDeepLink"].each{|key| item[key] = item[key].gsub(base_url, server_url) }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def env_set(path)
|
41
|
+
app_json = JSON.parse(File.read(app_json_path))
|
42
|
+
replace_oauth(app_json)
|
43
|
+
replace_servers(app_json)
|
44
|
+
File.write(app_json_path, app_json.to_json)
|
45
|
+
end
|
46
|
+
|
47
|
+
namespace :env_set do
|
48
|
+
desc 'Update Android app.json to use new env'
|
49
|
+
task :android do
|
50
|
+
env_set(File.join('app', 'src', 'main', 'res', 'raw', 'app.json'))
|
51
|
+
end
|
52
|
+
|
53
|
+
desc 'Update iOS app.json to use new env'
|
54
|
+
task :ios do
|
55
|
+
project_name = ENV["PROJECT_NAME"]
|
56
|
+
env_set(File.join(project_name, project_name, "Resources", "app.json"))
|
57
|
+
end
|
58
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobile_workflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brooke-Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -137,6 +137,8 @@ files:
|
|
137
137
|
- lib/mobile_workflow/cli/heroku_backend.rb
|
138
138
|
- lib/mobile_workflow/engine.rb
|
139
139
|
- lib/mobile_workflow/open_api_spec/parser.rb
|
140
|
+
- lib/mobile_workflow/railtie.rb
|
141
|
+
- lib/mobile_workflow/tasks/env_set.rake
|
140
142
|
- lib/mobile_workflow/version.rb
|
141
143
|
homepage: https://github.com/futureworkshops/mobile_workflow
|
142
144
|
licenses:
|