calatrava 0.0.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/Rakefile +7 -1
  2. data/calatrava.gemspec +2 -2
  3. data/features/sample_app.feature +27 -0
  4. data/features/step_definitions/app_steps.rb +3 -0
  5. data/features/support/calatrava_app.rb +31 -0
  6. data/features/support/env.rb +18 -0
  7. data/lib/calatrava/project.rb +5 -2
  8. data/lib/calatrava/tasks/apache.rb +20 -10
  9. data/lib/calatrava/tasks/droid.rb +1 -1
  10. data/lib/calatrava/tasks/web.rb +5 -0
  11. data/lib/calatrava/templates/droid/app/bridge.coffee +21 -120
  12. data/lib/calatrava/templates/droid/calatrava/{src/com/CALATRAVA_TMPL → CALATRAVA_TMPL}/AndroidManifest.xml.calatrava +2 -2
  13. data/lib/calatrava/templates/droid/calatrava/{calatrava-build.xml → CALATRAVA_TMPL/build.xml.calatrava} +1 -1
  14. data/lib/calatrava/templates/droid/calatrava/src/com/CALATRAVA_TMPL/ConversionForm.java.calatrava +4 -4
  15. data/lib/calatrava/templates/droid/calatrava/src/com/CALATRAVA_TMPL/Title.java.calatrava +2 -2
  16. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/bridge/KernelBridge.java +1 -0
  17. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/bridge/PageRegistry.java +13 -1
  18. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/bridge/RegisteredActivity.java +7 -1
  19. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/bridge/RhinoService.java +12 -7
  20. data/lib/calatrava/templates/droid/calatrava/src/com/calatrava/shell/WebViewActivity.java +2 -4
  21. data/lib/calatrava/templates/ios/src/ConversionFormViewController.h +4 -0
  22. data/lib/calatrava/templates/ios/src/ConversionFormViewController.m +36 -3
  23. data/lib/calatrava/templates/ios/src/ConversionFormViewController.xib +144 -20
  24. data/lib/calatrava/templates/kernel/app/calatrava.coffee +171 -3
  25. data/lib/calatrava/templates/kernel/app/converter/controller.converter.coffee +37 -42
  26. data/lib/calatrava/templates/kernel/app/converter/init.converter.coffee +4 -4
  27. data/lib/calatrava/templates/kernel/spec/converter/controller.converter.spec.coffee +6 -6
  28. data/lib/calatrava/templates/kernel/spec/stubView.coffee +18 -2
  29. data/lib/calatrava/templates/package.json +0 -1
  30. data/lib/calatrava/templates/shell/pages/converter/conversionForm.haml +6 -4
  31. data/lib/calatrava/templates/shell/pages/converter/page.conversionForm.coffee +18 -24
  32. data/lib/calatrava/templates/shell/stylesheets/shell.scss +0 -0
  33. data/lib/calatrava/templates/web/app/source/bridge.coffee +61 -93
  34. data/lib/calatrava/version.rb +1 -1
  35. metadata +39 -34
  36. data/lib/calatrava/templates/ios/res/js/bridge.js +0 -249
  37. data/lib/calatrava/templates/shell/shell.scss +0 -1
data/Rakefile CHANGED
@@ -9,7 +9,13 @@ namespace :test do
9
9
  end
10
10
 
11
11
  Cucumber::Rake::Task.new(:features) do |t|
12
- t.cucumber_opts = "features --format pretty"
12
+ t.cucumber_opts = "features --format pretty --tags ~@wip"
13
+ end
14
+
15
+ namespace :features do
16
+ Cucumber::Rake::Task.new(:wip) do |t|
17
+ t.cucumber_opts = "features --format pretty --tags @wip --wip"
18
+ end
13
19
  end
14
20
  end
15
21
 
data/calatrava.gemspec CHANGED
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
6
6
  s.name = "calatrava"
7
7
  s.version = Calatrava::Version
8
8
  s.authors = ["Giles Alexander"]
9
- s.email = ["gga@thoughtworks.com"]
10
- s.homepage = ""
9
+ s.email = ["giles.alexander@gmail.com"]
10
+ s.homepage = "http://calatrava.github.com"
11
11
  s.summary = %q{Cross-platform mobile apps with native UIs}
12
12
  s.description = %q{A framework to build cross-platform mobile apps with high quality native UIs.}
13
13
 
@@ -0,0 +1,27 @@
1
+ Feature: Sample App
2
+
3
+ In order to get started with Calatrava
4
+ As a new calatrava user
5
+ I want a new Calatrava project to contain a working sample app
6
+
7
+ Scenario: Create a sample project
8
+ When I create an app named "sample"
9
+ And I cd to "sample"
10
+ And I run `bundle install`
11
+ And I run `rake bootstrap`
12
+ Then the exit status should be 0
13
+
14
+ Scenario: Sample app kernel
15
+ When I create an app named "sample"
16
+ And I cd to "sample"
17
+ And I run `bundle install`
18
+ And I run `rake bootstrap`
19
+ And I run `rake kernel:spec`
20
+ Then the exit status should be 0
21
+
22
+ Scenario: Mobile web sample app
23
+ When I create an app named "sample"
24
+ And I cd to "sample"
25
+ And I run `bundle install`
26
+ And I run `rake bootstrap`
27
+ And I start apache
@@ -0,0 +1,3 @@
1
+ When /^I create an app named "([^"]+)"$/, :create_app
2
+ When /^I start apache$/, :start_apache, :on => lambda { current_app }
3
+
@@ -0,0 +1,31 @@
1
+ require 'aruba/api'
2
+ require 'open-uri'
3
+
4
+ class CalatravaApp
5
+
6
+ include Aruba::Api
7
+
8
+ def initialize(name)
9
+ @name = name
10
+ run_simple("calatrava create #{@name}")
11
+ end
12
+
13
+ def start_apache
14
+ cd @name
15
+ run_simple 'rake web:apache:background'
16
+
17
+ not_running_yet = true
18
+ while not_running_yet
19
+ begin
20
+ open('http://localhost:8888') { |_| not_running_yet = false }
21
+ rescue Errno::ECONNREFUSED
22
+ # still not running
23
+ end
24
+ end
25
+
26
+ Kernel.at_exit do
27
+ run_simple 'rake web:apache:stop'
28
+ end
29
+ end
30
+
31
+ end
@@ -3,3 +3,21 @@ require 'aruba/cucumber'
3
3
  ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
4
4
 
5
5
  ENV['RUBYLIB'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../lib')}#{File::PATH_SEPARATOR}#{ENV['RUBYLIB']}"
6
+
7
+ Before do
8
+ @aruba_timeout_seconds = 20
9
+ end
10
+
11
+ class CalatravaWorld
12
+
13
+ def create_app(name)
14
+ @app = CalatravaApp.new(name)
15
+ end
16
+
17
+ def current_app
18
+ @app
19
+ end
20
+
21
+ end
22
+
23
+ World { CalatravaWorld.new }
@@ -95,11 +95,14 @@ module Calatrava
95
95
  FileUtils.cp(item, target_item) if File.file? item
96
96
  end
97
97
  Dir.chdir "#{@name}" do
98
+ Dir.chdir "#{@name}" do
99
+ FileUtils.mv "build.xml", "../build.xml"
100
+ FileUtils.mv "AndroidManifest.xml", "../AndroidManifest.xml"
101
+ end
102
+ FileUtils.rm_rf "#{@name}"
98
103
  Dir.chdir "src/com/#{@name}" do
99
104
  FileUtils.mv "Title.java", "#{@title}.java"
100
- FileUtils.mv "AndroidManifest.xml", "../../../AndroidManifest.xml"
101
105
  end
102
- FileUtils.mv "calatrava-build.xml", "build.xml"
103
106
  end
104
107
 
105
108
  FileUtils.rm_rf "calatrava"
@@ -16,26 +16,36 @@ else
16
16
  LOAD_LOG_MODULE = true
17
17
  end
18
18
 
19
- def httpd(command)
20
- exec %Q|#{HTTPD} -d #{APACHE_DIR} -f conf/httpd.conf -e DEBUG -k #{command} -DNO_DETACH -DFOREGROUND|
19
+ def httpd(command, opts = {})
20
+ cmd = %Q{#{HTTPD} -d #{APACHE_DIR} -f conf/httpd.conf -e DEBUG -k #{command} -DNO_DETACH -DFOREGROUND}
21
+ puts cmd
22
+ if opts[:background]
23
+ fork do
24
+ exec cmd
25
+ end
26
+ else
27
+ exec cmd
28
+ end
21
29
  end
22
30
 
23
31
  def configure_apache
24
32
  cp config_path("httpd.conf"), File.join(APACHE_DIR, 'conf')
25
33
  end
26
34
 
27
- def launch_apache
28
- puts
29
- puts "\t\t" + "*"*40
30
- puts "\t\t" + "*** STARTING APACHE ON PORT 8888 ***"
31
- puts "\t\t" + "*"*40
32
- puts
35
+ def launch_apache(opts = {})
36
+ if !opts[:background]
37
+ puts
38
+ puts "\t\t" + "*"*40
39
+ puts "\t\t" + "*** STARTING APACHE ON PORT 8888 ***"
40
+ puts "\t\t" + "*"*40
41
+ puts
42
+ end
33
43
 
34
- httpd :start
44
+ httpd :start, opts
35
45
  end
36
46
 
37
47
  def stop_apache
38
- httpd :stop
48
+ httpd 'graceful-stop'
39
49
  end
40
50
 
41
51
  def reload_apache
@@ -69,7 +69,7 @@ namespace :droid do
69
69
 
70
70
  desc "Deploy app to device/emulator"
71
71
  task :deploy => :publish do
72
- sh "adb uninstall com.#{Calatrava::Project.current.name} ; adb install -r artifacts/#{ENV['CALATRAVA_ENV']}/#{Calatrava::Project.current.name}-debug.apk"
72
+ sh "adb install -r artifacts/#{ENV['CALATRAVA_ENV']}/#{Calatrava::Project.current.name}-debug.apk"
73
73
  end
74
74
 
75
75
  desc "Clean droid public directory"
@@ -61,6 +61,11 @@ namespace :web do
61
61
  launch_apache
62
62
  end
63
63
 
64
+ task :background => [:build, 'web/apache/public', APACHE_LOGS_DIR] do
65
+ configure_apache
66
+ launch_apache :background => true
67
+ end
68
+
64
69
  desc "Reload the apache configuration"
65
70
  task :reload do
66
71
  reload_apache
@@ -1,130 +1,31 @@
1
- tw ?= {}
2
- tw.bridge = tw.bridge ? {}
1
+ calatrava ?= {}
2
+ calatrava.bridge = calatrava.bridge ? {}
3
3
 
4
- generateRandomString = () ->
5
- str = ''
6
- for i in [1...32]
7
- r = Math.floor(Math.random() * 16)
8
- str = str + r.toString(16)
9
- str.toUpperCase()
4
+ calatrava.bridge.runtime = (() ->
5
+ pages = {}
10
6
 
11
- tw.bridge.dispatchEvent = (page, event) ->
12
- extraArgs = _.toArray(arguments).slice(1);
13
- tw.bridge.pages.pageNamed(page).dispatch.apply(tw.bridge.pages.pageNamed(page), extraArgs)
7
+ changePage: (target) -> pageRegistry.changePage(target)
14
8
 
15
- class tw.bridge.Page
16
- constructor: (@pageName) ->
17
- @handlerRegistry = {}
9
+ registerProxyForPage: (proxyId, pageName) ->
10
+ pages[proxyId] = pageName
11
+ pageRegistry.registerProxyForPage(pageName, proxyId)
18
12
 
19
- bind: (event, handler) ->
20
- @handlerRegistry[event] = handler
21
- # Register that an event handler has been installed?
13
+ log: (message) -> androidRuntime.log(message)
14
+ attachProxyEventHandler: (proxyId, event) ->
15
+ startTimerWithTimeout: (timerId, timeout) -> pageRegistry.startTimer(timeout, timerId)
16
+ openUrl: (url) -> pageRegistry.openUrl(url)
22
17
 
23
- dispatch: (event) ->
24
- args = _.toArray(arguments).slice(1)
25
- if @handlerRegistry[event]?
26
- @handlerRegistry[event].apply(this, args)
18
+ valueOfProxyField: (proxyId, field, getId) ->
19
+ value = String(pageRegistry.getValueForField(pages[proxyId], field))
20
+ calatrava.inbound.fieldRead(proxyId, getId, value)
27
21
 
28
- get: (field) ->
29
- String(pageRegistry.getValueForField(@pageName, field))
22
+ renderProxy: (viewObject, proxyId) ->
23
+ pageRegistry.renderPage(pages[proxyId], JSON.stringify(viewObject))
30
24
 
31
- render: (viewObject) ->
32
- viewObject = JSON.stringify(viewObject)
33
- pageRegistry.renderPage(@pageName, viewObject)
34
-
35
-
36
- tw.bridge.changePage = (target) ->
37
- pageRegistry.changePage(target)
38
- target
39
-
40
- tw.bridge.pages = (() ->
41
- pagesByName = {}
42
-
43
- pageNamed: (pageName) ->
44
- if (!pagesByName[pageName])
45
- pagesByName[pageName] = new tw.bridge.Page(pageName)
46
- pagesByName[pageName]
47
- )()
48
-
49
- tw.bridge.widgets = (()->
50
- callbacks = {}
51
- display: (name, options, callback) ->
52
- pageRegistry.displayWidget(name, JSON.stringify(options))
53
- callbacks[name] = callback
54
-
55
- invokeCallback: (name) ->
56
- args = _.toArray(arguments).slice(1)
57
- callbacks[name].apply(this, args)
58
- )()
59
-
60
- tw.bridge.dialog = (()->
61
- display : (name) ->
62
- pageRegistry.displayDialog(name)
63
- )()
64
-
65
- tw.bridge.request = (reqOptions) ->
66
- tw.bridge.requests.issue reqOptions
67
-
68
- tw.bridge.requests = (() ->
69
- successHandlers = {}
70
- failureHandlers = {}
71
-
72
- issue: (options) ->
73
- requestId = generateRandomString()
74
- if options.body
75
- bodyStr = options.body
76
- else
77
- bodyStr = ""
78
- if (bodyStr.constructor != String)
79
- bodyStr = JSON.stringify(body)
80
-
81
- if options.customHeaders
82
- headers = JSON.stringify(options.customHeaders)
83
- else
84
- headers = ""
85
-
86
- successHandlers[requestId] = options.success
87
- failureHandlers[requestId] = options.failure
88
- ajaxRequestManagerRegistry.makeRequest(requestId,
25
+ issueRequest: (options) ->
26
+ ajaxRequestManagerRegistry.makeRequest(options.requestId,
89
27
  options.url,
90
28
  options.method,
91
- bodyStr,
92
- headers)
93
-
94
- successfulResponse: (reqId, response) ->
95
- successHandlers[reqId](response)
96
- @clearHandlers(reqId)
97
-
98
- failureResponse: (reqId, errorCode, response) ->
99
- failureHandlers[reqId](errorCode, response)
100
- @clearHandlers(reqId)
101
-
102
- clearHandlers: (reqId) ->
103
- successHandlers[reqId] = null
104
- failureHandlers[reqId] = null
105
- )()
106
-
107
- tw.bridge.alert = (message) ->
108
- pageRegistry.alert(message)
109
-
110
- tw.bridge.openUrl = (url) ->
111
- pageRegistry.openUrl(url)
112
-
113
- tw.bridge.trackEvent = (pageName, channel, eventName, variables, properties) ->
114
- pageRegistry.track(pageName, channel, eventName, variables, properties)
115
-
116
- tw.bridge.timers = (() ->
117
- callbacks = {}
118
-
119
- start: (timeout, callback) ->
120
- timerId = generateRandomString()
121
- callbacks[timerId] = callback
122
- pageRegistry.startTimer(timeout, timerId)
123
- timerId
124
-
125
- fireTimer: (timerId) ->
126
- callbacks[timerId]() if callbacks[timerId]
127
-
128
- clearTimer: (timerId) ->
129
- delete callbacks[timerId]
29
+ options.body,
30
+ options.headers)
130
31
  )()
@@ -1,10 +1,10 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
- package="com.{{ project_name }}"
3
+ package="com.{{ project_slug }}"
4
4
  android:versionCode="1"
5
5
  android:versionName="1.0">
6
6
  <application android:label="@string/app_name" >
7
- <activity android:name="com.{{ project_name }}.{{ project_title }}"
7
+ <activity android:name="com.{{ project_slug }}.{{ project_title }}"
8
8
  android:label="@string/app_name">
9
9
  <intent-filter>
10
10
  <action android:name="android.intent.action.MAIN" />
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <!-- A standard Android ant build file, with changes to support calatrava.
3
3
  It incorporates ivy to manage dependencies. -->
4
- <project name="test" default="help">
4
+ <project name="{{ project_slug }}" default="help">
5
5
 
6
6
  <!-- The local.properties file is created and updated by the 'android' tool.
7
7
  It contains the path to the SDK. It should *NOT* be checked into
@@ -1,4 +1,4 @@
1
- package com.{{ project_name }};
1
+ package com.{{ project_slug }};
2
2
 
3
3
  import com.calatrava.CalatravaPage;
4
4
  import com.calatrava.shell.WebViewActivity;
@@ -17,11 +17,11 @@ public class ConversionForm extends WebViewActivity
17
17
 
18
18
  @Override
19
19
  protected List<String> getEvents() {
20
- return Arrays.asList("selectedInCurrency", "selectedOutCurrency");
20
+ return Arrays.asList("selectedInCurrency", "selectedOutCurrency", "convert");
21
21
  }
22
22
 
23
23
  @Override
24
24
  protected List<String> getFields() {
25
- return new ArrayList<String>();
25
+ return Arrays.asList("in_amount", "in_currency", "out_amount", "out_currency");
26
26
  }
27
- }
27
+ }
@@ -1,4 +1,4 @@
1
- package com.{{ project_name }};
1
+ package com.{{ project_slug }};
2
2
 
3
3
  import android.app.Activity;
4
4
  import android.os.Bundle;
@@ -14,7 +14,7 @@ public class {{ project_title }} extends Activity
14
14
  super.onCreate(savedInstanceState);
15
15
  setContentView(R.layout.main);
16
16
 
17
- Launcher.launchKernel("com.test", this, getApplication(), new Runnable() {
17
+ Launcher.launchKernel("com.{{ project_slug }}", this, getApplication(), new Runnable() {
18
18
  public void run() {
19
19
  Launcher.launchFlow("example.converter.start");
20
20
  }
@@ -17,6 +17,7 @@ public class KernelBridge {
17
17
  //load bridge
18
18
  loadLibrary("hybrid/scripts/env.js");
19
19
  loadLibrary("hybrid/scripts/bridge.js");
20
+ loadLibrary("hybrid/scripts/calatrava.js");
20
21
  }
21
22
 
22
23
  public void loadLibrary(String libraryName) throws IOException {
@@ -31,6 +31,7 @@ public class PageRegistry {
31
31
  private RhinoService rhino;
32
32
  private Map<String, Class<?>> pageFactories = new HashMap<String, Class<?>>();
33
33
  private Map<String, RegisteredPage> registeredPages = new HashMap<String, RegisteredPage>();
34
+ private Map<String, String> proxyByPage = new HashMap<String, String>();
34
35
 
35
36
  public static PageRegistry sharedRegistry() {
36
37
  return sharedRegistry;
@@ -84,6 +85,11 @@ public class PageRegistry {
84
85
  }
85
86
  }
86
87
  }
88
+
89
+ public void registerProxyForPage(String pageName, String proxyId) {
90
+ Log.d(TAG, "Attaching proxy '" + proxyId + "' to name '" + pageName + "'");
91
+ proxyByPage.put(pageName, proxyId);
92
+ }
87
93
 
88
94
  public void changePage(String target) {
89
95
  Log.d(TAG, "changePage('" + target + "')");
@@ -92,6 +98,12 @@ public class PageRegistry {
92
98
  appContext.startActivity(new Intent(appContext, activityClass));
93
99
  }
94
100
 
101
+ public void triggerEvent(String pageName, String event, String... extraArgs) {
102
+ String proxy = proxyByPage.get(pageName);
103
+ Log.d(TAG, "Dispatching to proxy '" + proxy + "'");
104
+ rhino.triggerEvent(proxy, event, extraArgs);
105
+ }
106
+
95
107
  public void displayWidget(String name, String options) {
96
108
  appContext.sendBroadcast(new Intent("com.calatrava.widget").putExtra("name", name).putExtra("options", options));
97
109
  }
@@ -120,7 +132,7 @@ public class PageRegistry {
120
132
  public void run() {
121
133
  timer.cancel();
122
134
  timer.purge();
123
- rhino.callJsFunction("tw.bridge.timers.fireTimer", new String[] {timerId});
135
+ rhino.callJsFunction("calatrava.inbound.fireTimer", new String[] {timerId});
124
136
  }
125
137
  }, 1000 * timeout);
126
138
  }
@@ -73,13 +73,19 @@ public abstract class RegisteredActivity extends Activity {
73
73
  super.onDestroy();
74
74
  unbindService(connection);
75
75
  }
76
+
77
+ public void triggerEvent(String event, String... extraArgs) {
78
+ PageRegistry.sharedRegistry().triggerEvent(getPageName(), event, extraArgs);
79
+ }
76
80
 
77
81
  public void invokeWidgetCallback(String...args) {
78
- rhino.callJsFunction("tw.bridge.widgets.invokeCallback", args);
82
+ rhino.callJsFunction("calatrava.inbound.invokeCallback", args);
79
83
  }
80
84
 
81
85
  protected abstract void onRhinoConnected(RhinoService rhino);
82
86
 
87
+ protected abstract String getPageName();
88
+
83
89
  public abstract String getFieldValue(String field);
84
90
 
85
91
  public abstract void render(final String json);
@@ -42,6 +42,7 @@ public class RhinoService extends Service {
42
42
 
43
43
  Object wrappedRegistry = Context.javaToJS(PageRegistry.sharedRegistry(), mScope);
44
44
  ScriptableObject.putProperty(mScope, "pageRegistry", wrappedRegistry);
45
+ ScriptableObject.putProperty(mScope, "androidRuntime", this);
45
46
 
46
47
  Object wrappedAjaxRequestManagerRegistry = Context.javaToJS(AjaxRequestManager.sharedManager(), mScope);
47
48
  ScriptableObject.putProperty(mScope, "ajaxRequestManagerRegistry", wrappedAjaxRequestManagerRegistry);
@@ -75,8 +76,8 @@ public class RhinoService extends Service {
75
76
  evaller.load(source, name);
76
77
  }
77
78
 
78
- public void triggerEvent(String page, String eventId, String[] extraArgs) {
79
- evaller.triggerEvent(page, eventId, extraArgs);
79
+ public void triggerEvent(String proxy, String eventId, String[] extraArgs) {
80
+ evaller.triggerEvent(proxy, eventId, extraArgs);
80
81
  }
81
82
 
82
83
  public void invokeSuccessCallback(String requestId, String response) {
@@ -87,6 +88,10 @@ public class RhinoService extends Service {
87
88
  evaller.ajaxFailureResponse(requestId, statusCode, responseBody);
88
89
  }
89
90
 
91
+ public void log(String message) {
92
+ Log.d(TAG, message);
93
+ }
94
+
90
95
  public void callJsFunction(String function) {
91
96
  evaller.callJsFunction(function);
92
97
  }
@@ -149,15 +154,15 @@ public class RhinoService extends Service {
149
154
  dispatchJs(js);
150
155
  }
151
156
 
152
- public void triggerEvent(String page, String eventId, String[] extraArgs) {
157
+ public void triggerEvent(String proxy, String eventId, String[] extraArgs) {
153
158
  StringBuilder sb = new StringBuilder("");
154
159
  for (String arg : extraArgs) {
155
160
  sb.append(", '");
156
161
  sb.append(arg);
157
162
  sb.append("'");
158
163
  }
159
- String js = "tw.bridge.dispatchEvent('{0}', '{1}'{2});"
160
- .replace("{0}", page)
164
+ String js = "calatrava.inbound.dispatchEvent('{0}', '{1}'{2});"
165
+ .replace("{0}", proxy)
161
166
  .replace("{1}", eventId)
162
167
  .replace("{2}", sb.toString());
163
168
 
@@ -167,14 +172,14 @@ public class RhinoService extends Service {
167
172
  }
168
173
 
169
174
  public void ajaxSuccessfulResponse(String requestId, String json) {
170
- String js = "tw.bridge.requests.successfulResponse('{0}', '{1}');"
175
+ String js = "calatrava.inbound.successfulResponse('{0}', '{1}');"
171
176
  .replace("{0}", requestId)
172
177
  .replace("{1}", json);
173
178
  dispatchJs(js);
174
179
  }
175
180
 
176
181
  public void ajaxFailureResponse(String requestId, int statusCode, String responseBody) {
177
- String js = "tw.bridge.requests.failureResponse('{0}', {1}, '{2}');"
182
+ String js = "calatrava.inbound.failureResponse('{0}', {1}, '{2}');"
178
183
  .replace("{0}", requestId)
179
184
  .replace("{1}", Integer.toString(statusCode))
180
185
  .replace("{2}", responseBody);
@@ -112,8 +112,6 @@ public abstract class WebViewActivity extends RegisteredActivity {
112
112
  });
113
113
  }
114
114
 
115
- protected abstract String getPageName();
116
-
117
115
  protected abstract List<String> getEvents();
118
116
 
119
117
  protected abstract List<String> getFields();
@@ -159,7 +157,7 @@ public abstract class WebViewActivity extends RegisteredActivity {
159
157
  }
160
158
 
161
159
  private void pageHasOpened() {
162
- rhino.triggerEvent(getPageName(), "pageOpened", new String[] {});
160
+ triggerEvent("pageOpened", new String[] {});
163
161
  }
164
162
 
165
163
  private void onPageLoadCompleted() {
@@ -230,7 +228,7 @@ public abstract class WebViewActivity extends RegisteredActivity {
230
228
  } else {
231
229
  Log.d(TAG, "extraArgs were null!");
232
230
  }
233
- rhino.triggerEvent(pageName, event, extraArgs);
231
+ triggerEvent(event, extraArgs);
234
232
  }
235
233
 
236
234
  public void onRenderComplete(Object ignored) {
@@ -10,6 +10,10 @@
10
10
 
11
11
  @interface ConversionFormViewController : BaseUIViewController<UIPickerViewDataSource, UIPickerViewDelegate>
12
12
 
13
+ @property (retain, nonatomic) IBOutlet UITextField *inAmount;
14
+ @property (retain, nonatomic) IBOutlet UITextField *outAmount;
15
+
16
+ - (IBAction)convert:(id)sender;
13
17
  - (void)render:(NSDictionary *)jsViewObject;
14
18
 
15
19