rhodes 1.5.2 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/CHANGELOG +4 -0
  2. data/Manifest.txt +4 -3
  3. data/bin/upgrade-rhodes-app +1 -0
  4. data/lib/framework/rhodes.rb +2 -2
  5. data/lib/framework/rhom/rhom_object_factory.rb +16 -7
  6. data/lib/framework/version.rb +2 -2
  7. data/lib/rhodes.rb +2 -2
  8. data/platform/android/Rhodes/AndroidManifest.xml +2 -2
  9. data/platform/android/Rhodes/jni/include/jni/com_rhomobile_rhodes_Rhodes.h +14 -4
  10. data/platform/android/Rhodes/jni/src/rhodes.cpp +7 -0
  11. data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +7 -2
  12. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +6 -6
  13. data/platform/android/Rhodes/src/com/rhomobile/rhodes/{MainView.java → mainview/MainView.java} +1 -1
  14. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +286 -0
  15. data/platform/android/Rhodes/src/com/rhomobile/rhodes/{TabbedMainView.java → mainview/TabbedMainView.java} +5 -1
  16. data/platform/android/build/RhodesSRC_build.files +3 -3
  17. data/platform/android/build/android.rake +1 -0
  18. data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +22 -4
  19. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +1 -1
  20. data/platform/bb/rhodes/src/rhomobile/camera/CameraScreen.java +15 -3
  21. data/platform/iphone/Classes/WebViewController.m +21 -7
  22. data/platform/iphone/Info.plist +1 -1
  23. data/platform/iphone/rbuild/iphone.rake +36 -28
  24. data/platform/osx/Rhodes Launcher/launch.rb +21 -14
  25. data/platform/shared/common/RhodesApp.cpp +7 -0
  26. data/platform/shared/common/RhodesApp.h +1 -0
  27. data/platform/shared/ruby/wince/io_wce.c +2 -0
  28. data/platform/shared/rubyJVM/src/com/rho/RhoRuby.java +2 -1
  29. data/platform/shared/rubyJVM/src/com/rho/sync/SyncEngine.java +3 -3
  30. data/platform/shared/sync/SyncEngine.cpp +6 -5
  31. data/res/build-tools/cygwin1.dll +0 -0
  32. data/res/build-tools/cygz.dll +0 -0
  33. data/spec/framework_spec/app/spec/rhom_object_spec.rb +54 -75
  34. metadata +6 -5
  35. data/platform/android/Rhodes/src/com/rhomobile/rhodes/SimpleMainView.java +0 -67
Binary file
Binary file
@@ -26,7 +26,7 @@ describe "Rhom::RhomObject" do
26
26
  before do
27
27
  SyncEngine.stub!(:dosync).and_return(true)
28
28
  end
29
-
29
+
30
30
  #it "should set source_id attributes" do
31
31
  #Account.get_source_id.should == "2"
32
32
  #Case.get_source_id.should == "1"
@@ -71,7 +71,7 @@ describe "Rhom::RhomObject" do
71
71
  it "should have correct number of attributes" do
72
72
  @account = Account.find(:all).first
73
73
 
74
- @account.vars.size.should == 38
74
+ @account.vars.size.should == 17
75
75
  end
76
76
 
77
77
  it "should get count of objects" do
@@ -184,6 +184,57 @@ describe "Rhom::RhomObject" do
184
184
  end
185
185
  ids.uniq.length.should == 10
186
186
  end
187
+
188
+ it "should create a record, then update" do
189
+ vars = {"name"=>"some new record", "industry"=>"electronics"}
190
+ @account1 = Account.new(vars)
191
+ new_id = @account1.object
192
+ @account1.save
193
+ @account2 = Account.find(new_id)
194
+ @account2.object.should =="{#{@account1.object}}"
195
+ @account2.name.should == vars['name']
196
+ @account2.industry.should == vars['industry']
197
+
198
+ update_attributes = {"industry"=>"electronics2"}
199
+ @account2.update_attributes(update_attributes)
200
+
201
+ @account3 = Account.find(new_id)
202
+ @account3.object.should =="{#{@account1.object}}"
203
+ @account3.name.should == vars['name']
204
+ @account3.industry.should == update_attributes['industry']
205
+
206
+ records = Rhom::RhomDbAdapter::select_from_table('changed_values','*', 'update_type' => 'create')
207
+ records.length.should == 2
208
+
209
+ records = Rhom::RhomDbAdapter::select_from_table('changed_values','*', 'update_type' => 'update')
210
+ records.length.should == 0
211
+ end
212
+
213
+ it "should create a record, then update 2" do
214
+ vars = {"name"=>"some new record"}
215
+ @account1 = Account.new(vars)
216
+ new_id = @account1.object
217
+ @account1.save
218
+
219
+ @account2 = Account.find(new_id)
220
+ @account2.object.should =="{#{@account1.object}}"
221
+ @account2.name.should == vars['name']
222
+
223
+ update_attributes = {"industry"=>"electronics2"}
224
+ @account2.industry = update_attributes['industry']
225
+ @account2.save
226
+
227
+ @account3 = Account.find(new_id)
228
+ @account3.object.should =="{#{@account1.object}}"
229
+ @account3.name.should == vars['name']
230
+ @account3.industry.should == update_attributes['industry']
231
+
232
+ records = Rhom::RhomDbAdapter::select_from_table('changed_values','*', 'update_type' => 'create')
233
+ records.length.should == 2
234
+
235
+ records = Rhom::RhomDbAdapter::select_from_table('changed_values','*', 'update_type' => 'update')
236
+ records.length.should == 0
237
+ end
187
238
 
188
239
  it "should destroy a record" do
189
240
  count = Account.find(:all).size
@@ -323,80 +374,7 @@ describe "Rhom::RhomObject" do
323
374
 
324
375
  @acct.foobar.should be_nil
325
376
  end
326
- =begin
327
- it "should respond to ask" do
328
- question = 'Rhodes'
329
- Account.ask(question)
330
- res = Rhom::RhomDbAdapter::select_from_table('changed_values','*', 'update_type' => 'ask')
331
- res.length.should == 1
332
-
333
- res[0]['attrib'].should == 'question'
334
- res[0]['value'].should == question
335
- end
336
-
337
- it "should respond to ask with last question only" do
338
- question = 'Rhodes'
339
- Account.ask(question)
340
- res = Rhom::RhomDbAdapter::select_from_table('changed_values','*', 'update_type' => 'ask')
341
- res.length.should == 1
342
-
343
- res[0]['attrib'].should == 'question'
344
- res[0]['value'].should == question
345
-
346
- question = 'Ruby on Rails'
347
- question_encoded = 'Ruby%20on%20Rails'
348
- Account.ask(question)
349
- res = Rhom::RhomDbAdapter::select_from_table('changed_values','*', 'update_type' => 'ask')
350
- res.length.should == 1
351
-
352
- res[0]['attrib'].should == 'question'
353
- res[0]['value'].should == question_encoded
354
- end
355
-
356
- it "should encode ask params" do
357
- question = 'where am i?'
358
- question_encoded = 'where%20am%20i%3F'
359
- Account.ask(question)
360
- @res = Rhom::RhomDbAdapter::select_from_table('changed_values','*', 'update_type' => 'ask')
361
- @res.length.should == 1
362
-
363
- @res[0]['attrib'].should == 'question'
364
- @res[0]['value'].should == question_encoded
365
- end
366
377
 
367
- it "should store all ask db operations as query" do
368
- question = 'where am i?'
369
- question_encoded = 'where%20am%20i%3F'
370
- Question.ask(question)
371
-
372
- @question = Question.find(:first)
373
- @question.update_attributes({"question"=>"i am here"})
374
-
375
- @res = Rhom::RhomDbAdapter::select_from_table('object_values','*', {'source_id' => @question.get_source_id.to_i()})
376
- @res.length.should == 1
377
- @res[0]['attrib'].should == 'question'
378
- @res[0]['value'].should == 'i am here'
379
-
380
- ['create','update','delete'].each do |u_type|
381
- @res = Rhom::RhomDbAdapter::select_from_table('changed_values','*', {'update_type' =>u_type, 'source_id' => @question.get_source_id.to_i()})
382
- @res.length.should == 0
383
- end
384
- end
385
-
386
- it "should delete ask records without delete sync operation" do
387
- question = 'where am i?'
388
- question_encoded = 'where%20am%20i%3F'
389
- Question.ask(question)
390
-
391
- @question = Question.find(:first)
392
- @question.destroy
393
-
394
- ['query','create','update','delete'].each do |u_type|
395
- @res = Rhom::RhomDbAdapter::select_from_table('changed_values','*', {'update_type' =>u_type, 'source_id' => 400})
396
- @res.length.should == 0
397
- end
398
- end
399
- =end
400
378
  it "should find with conditions" do
401
379
  @accts = Account.find(:all, :conditions => {'industry' => 'Technology'})
402
380
  @accts.length.should == 2
@@ -659,4 +637,5 @@ describe "Rhom::RhomObject" do
659
637
  @accts[0].industry.should == @expected[0][:industry]
660
638
  end
661
639
  end
640
+
662
641
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 5
8
- - 2
9
- version: 1.5.2
8
+ - 3
9
+ version: 1.5.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Rhomobile
@@ -394,7 +394,9 @@ files:
394
394
  - platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java
395
395
  - platform/android/Rhodes/src/com/rhomobile/rhodes/HttpLog.java
396
396
  - platform/android/Rhodes/src/com/rhomobile/rhodes/Logger.java
397
- - platform/android/Rhodes/src/com/rhomobile/rhodes/MainView.java
397
+ - platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java
398
+ - platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java
399
+ - platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java
398
400
  - platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/Annotation.java
399
401
  - platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/AnnotationsOverlay.java
400
402
  - platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java
@@ -409,13 +411,11 @@ files:
409
411
  - platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesInstance.java
410
412
  - platform/android/Rhodes/src/com/rhomobile/rhodes/RhoLogConf.java
411
413
  - platform/android/Rhodes/src/com/rhomobile/rhodes/RingtoneManager.java
412
- - platform/android/Rhodes/src/com/rhomobile/rhodes/SimpleMainView.java
413
414
  - platform/android/Rhodes/src/com/rhomobile/rhodes/socket/RhoSockAddr.java
414
415
  - platform/android/Rhodes/src/com/rhomobile/rhodes/socket/RhoSocket.java
415
416
  - platform/android/Rhodes/src/com/rhomobile/rhodes/socket/RhoSocketImpl.java
416
417
  - platform/android/Rhodes/src/com/rhomobile/rhodes/socket/SSLImpl.java
417
418
  - platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java
418
- - platform/android/Rhodes/src/com/rhomobile/rhodes/TabbedMainView.java
419
419
  - platform/android/Rhodes/src/com/rhomobile/rhodes/ui/AboutDialog.java
420
420
  - platform/android/Rhodes/src/com/rhomobile/rhodes/ui/LogOptionsDialog.java
421
421
  - platform/android/Rhodes/src/com/rhomobile/rhodes/ui/LogViewDialog.java
@@ -3365,6 +3365,7 @@ files:
3365
3365
  - README.textile
3366
3366
  - res/build-tools/build_inf.js
3367
3367
  - res/build-tools/cygwin1.dll
3368
+ - res/build-tools/cygz.dll
3368
3369
  - res/build-tools/db/syncdb.schema
3369
3370
  - res/build-tools/db/syncdb.triggers
3370
3371
  - res/build-tools/insertRhoBundle2pkg.rb
@@ -1,67 +0,0 @@
1
- /*
2
- ============================================================================
3
- Author : Dmitry Moskalchuk
4
- Version : 1.5
5
- Copyright : Copyright (C) 2008 Rhomobile. All rights reserved.
6
-
7
- This program is free software: you can redistribute it and/or modify
8
- it under the terms of the GNU General Public License as published by
9
- the Free Software Foundation, either version 3 of the License, or
10
- (at your option) any later version.
11
-
12
- This program is distributed in the hope that it will be useful,
13
- but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- GNU General Public License for more details.
16
-
17
- You should have received a copy of the GNU General Public License
18
- along with this program. If not, see <http://www.gnu.org/licenses/>.
19
- ============================================================================
20
- */
21
- package com.rhomobile.rhodes;
22
-
23
- import android.view.View;
24
- import android.webkit.WebView;
25
-
26
- public class SimpleMainView implements MainView {
27
-
28
- private WebView webView;
29
-
30
- public View getView() {
31
- return webView;
32
- }
33
-
34
- public SimpleMainView() {
35
- webView = RhodesInstance.getInstance().createWebView();
36
- webView.setId(Rhodes.RHO_MAIN_VIEW);
37
- }
38
-
39
- public void back(int index) {
40
- webView.goBack();
41
- }
42
-
43
- public void forward(int index) {
44
- webView.goForward();
45
- }
46
-
47
- public void navigate(String url, int index) {
48
- webView.loadUrl(url);
49
- }
50
-
51
- public void reload(int index) {
52
- webView.reload();
53
- }
54
-
55
- public String currentLocation(int index) {
56
- return webView.getUrl();
57
- }
58
-
59
- public void switchTab(int index) {
60
- // Nothing
61
- }
62
-
63
- public int activeTab() {
64
- return 0;
65
- }
66
-
67
- }