rhodes 1.5.4 → 1.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/Manifest.txt +11 -1
  2. data/Rakefile +1 -1
  3. data/lib/extensions/digest/ext/Rakefile +11 -6
  4. data/lib/extensions/digest/ext/build.bat +2 -0
  5. data/lib/extensions/uri/uri.rb +29 -0
  6. data/lib/extensions/uri/uri/common.rb +727 -0
  7. data/lib/extensions/uri/uri/ftp.rb +198 -0
  8. data/lib/extensions/uri/uri/generic.rb +1128 -0
  9. data/lib/extensions/uri/uri/http.rb +100 -0
  10. data/lib/extensions/uri/uri/https.rb +20 -0
  11. data/lib/extensions/uri/uri/ldap.rb +190 -0
  12. data/lib/extensions/uri/uri/ldaps.rb +12 -0
  13. data/lib/extensions/uri/uri/mailto.rb +266 -0
  14. data/lib/framework/rhodes.rb +2 -2
  15. data/lib/framework/rhom/rhom_db_adapter.rb +12 -26
  16. data/lib/framework/rhom/rhom_object_factory.rb +8 -1
  17. data/lib/framework/version.rb +2 -2
  18. data/lib/rhodes.rb +2 -2
  19. data/platform/android/Rhodes/AndroidManifest.xml +2 -2
  20. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +87 -42
  21. data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +58 -7
  22. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +2 -0
  23. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +35 -19
  24. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +4 -0
  25. data/platform/android/build/android.rake +30 -25
  26. data/platform/bb/build/rhodes_build.files +1 -1
  27. data/platform/bb/rhodes/rhodes.jdp +1 -1
  28. data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +1 -1
  29. data/platform/bb/rhodes/src/com/rho/rubyext/Alert.java +300 -0
  30. data/platform/bb/rhodes/src/com/rho/rubyext/GeoLocation.java +42 -5
  31. data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +3 -4
  32. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +33 -107
  33. data/platform/iphone/Classes/RhoRunnerAppDelegate.m +2 -0
  34. data/platform/iphone/Info.plist +1 -1
  35. data/platform/iphone/rbuild/iphone.rake +1 -1
  36. data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +4 -0
  37. data/platform/shared/common/RhoMutexLock.h +8 -1
  38. data/platform/shared/common/RhodesApp.cpp +1 -1
  39. data/platform/shared/db/DBAdapter.cpp +77 -8
  40. data/platform/shared/db/DBAdapter.h +24 -9
  41. data/platform/shared/db/DBResult.cpp +19 -0
  42. data/platform/shared/db/DBResult.h +7 -5
  43. data/platform/shared/net/HttpServer.cpp +2 -0
  44. data/platform/shared/ruby/ext/rho/rhoruby.c +55 -0
  45. data/platform/shared/ruby/ext/rho/rhoruby.h +9 -0
  46. data/platform/shared/ruby/ext/rho/rhosupport.c +13 -4
  47. data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +21 -0
  48. data/platform/shared/ruby/thread_pthread.c +4 -4
  49. data/platform/shared/ruby/thread_win32.c +4 -4
  50. data/platform/shared/rubyJVM/src/com/rho/RhodesApp.java +19 -1
  51. data/platform/shared/rubyJVM/src/com/rho/db/DBAdapter.java +57 -24
  52. data/platform/shared/rubyJVM/src/com/rho/net/NetRequest.java +6 -1
  53. data/platform/shared/rubyJVM/src/com/rho/sync/SyncSource.java +2 -2
  54. data/platform/shared/rubyJVM/src/com/rho/sync/SyncThread.java +5 -5
  55. data/platform/shared/sync/SyncSource.cpp +1 -1
  56. data/platform/shared/sync/SyncThread.cpp +6 -9
  57. data/platform/wm/rhodes/Rhodes.cpp +4 -0
  58. data/rakefile.rb +1 -1
  59. metadata +13 -3
  60. data/platform/bb/rhodes/src/rhomobile/Alert.java +0 -65
@@ -136,6 +136,7 @@ public class NetRequest
136
136
  try{
137
137
  closeConnection();
138
138
  m_connection = RhoClassFactory.getNetworkAccess().connect(strUrl, m_bIgnoreSuffixOnSim);
139
+ LOG.INFO("connection done");
139
140
 
140
141
  if ( oSession != null )
141
142
  {
@@ -146,10 +147,11 @@ public class NetRequest
146
147
  }
147
148
 
148
149
  m_connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
149
- m_connection.setRequestProperty("Connection", "keep-alive");
150
+ //m_connection.setRequestProperty("Connection", "keep-alive");
150
151
  //m_connection.setRequestProperty("Accept", "application/x-www-form-urlencoded,application/json,text/html");
151
152
 
152
153
  writeHeaders(headers);
154
+ LOG.INFO("writeHeaders done");
153
155
  if ( strBody != null && strBody.length() > 0 )
154
156
  {
155
157
  m_connection.setRequestMethod(strMethod);
@@ -158,7 +160,10 @@ public class NetRequest
158
160
  }else
159
161
  m_connection.setRequestMethod(strMethod);
160
162
 
163
+ LOG.INFO("write body done");
164
+
161
165
  is = m_connection.openInputStream();
166
+ LOG.INFO("openInputStream done");
162
167
  code = m_connection.getResponseCode();
163
168
 
164
169
  LOG.INFO("getResponseCode : " + code);
@@ -677,9 +677,9 @@ class SyncSource
677
677
  m_nAttribCounter = 0;
678
678
  for( ; !oJsonObjList.isEnd() && getSync().isContinueSync(); oJsonObjList.next() )
679
679
  {
680
- if ( getDB().isUnlockDB() )//|| m_nAttribCounter >= 200 )
680
+ if ( getDB().isUIWaitDB() )//|| m_nAttribCounter >= 200 )
681
681
  {
682
- if ( getDB().isUnlockDB() )
682
+ if ( getDB().isUIWaitDB() )
683
683
  LOG.INFO( "Commit transaction because of UI request." );
684
684
 
685
685
  getDB().endTransaction();
@@ -517,7 +517,7 @@ public class SyncThread extends RhoThread
517
517
  protected RubyValue run(RubyValue receiver, RubyBlock block) {
518
518
  try{
519
519
  DBAdapter db = getDBAdapter();
520
- db.setUnlockDB(true);
520
+ db.setUIWaitDB(true);
521
521
  db.Lock();
522
522
  }catch(Exception e)
523
523
  {
@@ -575,7 +575,7 @@ public class SyncThread extends RhoThread
575
575
  DBAdapter db = getDBAdapter();
576
576
 
577
577
  try{
578
- db.setUnlockDB(true);
578
+ db.setUIWaitDB(true);
579
579
  return getSyncEngine().isLoggedIn() ?
580
580
  ObjectFactory.createInteger(1) : ObjectFactory.createInteger(0);
581
581
  }catch(Exception e)
@@ -584,7 +584,7 @@ public class SyncThread extends RhoThread
584
584
  throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
585
585
  }finally
586
586
  {
587
- db.setUnlockDB(false);
587
+ db.setUIWaitDB(false);
588
588
  }
589
589
 
590
590
  }
@@ -598,7 +598,7 @@ public class SyncThread extends RhoThread
598
598
  try{
599
599
  stopSync();
600
600
 
601
- db.setUnlockDB(true);
601
+ db.setUIWaitDB(true);
602
602
  getSyncEngine().logout();
603
603
  }catch(Exception e)
604
604
  {
@@ -606,7 +606,7 @@ public class SyncThread extends RhoThread
606
606
  throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
607
607
  }finally
608
608
  {
609
- db.setUnlockDB(false);
609
+ db.setUIWaitDB(false);
610
610
  }
611
611
 
612
612
  return RubyConstant.QNIL;
@@ -569,7 +569,7 @@ void CSyncSource::processServerData_Ver1(CJSONArrayIterator& oJsonArr)
569
569
  CJSONArrayIterator oJsonObjList(oJsonSource, "ol");
570
570
  for( ; !oJsonObjList.isEnd() && getSync().isContinueSync(); oJsonObjList.next() )
571
571
  {
572
- if ( getDB().isUnlockDB() )
572
+ if ( getDB().isUIWaitDB() )
573
573
  {
574
574
  LOG(INFO) + "Commit transaction because of UI request.";
575
575
  getDB().endTransaction();
@@ -295,21 +295,14 @@ void rho_sync_login(const char *name, const char *password, const char* callback
295
295
 
296
296
  int rho_sync_logged_in()
297
297
  {
298
- rho::db::CDBAdapter& db = CSyncThread::getDBAdapter();
299
- db.setUnlockDB(true);
300
298
  int nRes = CSyncThread::getSyncEngine().isLoggedIn() ? 1 : 0;
301
- db.setUnlockDB(false);
302
299
  return nRes;
303
300
  }
304
301
 
305
302
  void rho_sync_logout()
306
303
  {
307
304
  rho_sync_stop();
308
-
309
- rho::db::CDBAdapter& db = CSyncThread::getDBAdapter();
310
- db.setUnlockDB(true);
311
305
  CSyncThread::getSyncEngine().logout();
312
- db.setUnlockDB(false);
313
306
  }
314
307
 
315
308
  void rho_sync_set_notification(int source_id, const char *url, char* params)
@@ -349,13 +342,18 @@ int rho_sync_closeDB()
349
342
  int rho_db_startUITransaction()
350
343
  {
351
344
  rho::db::CDBAdapter& db = rho::sync::CSyncThread::getDBAdapter();
352
- db.setUnlockDB(true);
353
345
  db.startTransaction();
354
346
 
355
347
  //TODO: get error code from DBException
356
348
  return 0;
357
349
  }
358
350
 
351
+ int rho_db_is_ui_waitfordb()
352
+ {
353
+ rho::db::CDBAdapter& db = rho::sync::CSyncThread::getDBAdapter();
354
+ return db.isUIWaitDB() ? 1 :0;
355
+ }
356
+
359
357
  int rho_db_commitUITransaction()
360
358
  {
361
359
  CSyncThread::getDBAdapter().endTransaction();
@@ -389,7 +387,6 @@ unsigned long rho_sync_get_attrs(int nSrcID)
389
387
  void rho_sync_lock()
390
388
  {
391
389
  rho::db::CDBAdapter& db = rho::sync::CSyncThread::getDBAdapter();
392
- db.setUnlockDB(true);
393
390
  db.Lock();
394
391
  }
395
392
 
@@ -34,6 +34,7 @@ HREGNOTIFY g_hNotify = NULL;
34
34
  #endif
35
35
 
36
36
  //BOOL EnumRhodesWindowsProc(HWND hwnd,LPARAM lParam);
37
+ extern "C" void rho_clientregister_create(const char* szDevicePin);
37
38
 
38
39
  class CRhodesModule : public CAtlExeModuleT< CRhodesModule >
39
40
  {
@@ -108,6 +109,7 @@ public :
108
109
  rho_logconf_Init(m_strRootPath.c_str());
109
110
  LOG(INFO) + "Rhodes started";
110
111
 
112
+ ::SetThreadPriority(GetCurrentThread(),10);
111
113
  // Create the main application window
112
114
  m_appWindow.Create(NULL, CWindow::rcDefault, TEXT("Rhodes"), WS_VISIBLE);
113
115
  if (NULL == m_appWindow.m_hWnd)
@@ -136,6 +138,8 @@ public :
136
138
  0,
137
139
  NULL,
138
140
  &g_hNotify);
141
+ #else
142
+ // rho_clientregister_create("win32_client");
139
143
  #endif
140
144
  return S_OK;
141
145
  }
@@ -127,7 +127,7 @@ def add_linker_library(libraryname)
127
127
  tmpdir = $startdir + "/platform/iphone/build/rhorunner.build/#{$configuration}-" +
128
128
  ( simulator ? "iphonesimulator" : "iphoneos") + "/rhorunner.build"
129
129
  end
130
- $ldflags << "#{tmpdir}/#{libraryname}\n" unless $ldflags.nil?
130
+ $ldflags << "#{tmpdir}/lib#{libraryname}.a\n" unless $ldflags.nil?
131
131
  end
132
132
 
133
133
  def set_linker_flags
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 5
8
- - 4
9
- version: 1.5.4
8
+ - 5
9
+ version: 1.5.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Rhomobile
@@ -139,6 +139,7 @@ files:
139
139
  - lib/extensions/digest/digest/hmac.rb
140
140
  - lib/extensions/digest/digest.rb
141
141
  - lib/extensions/digest/ext/build
142
+ - lib/extensions/digest/ext/build.bat
142
143
  - lib/extensions/digest/ext/defs.h
143
144
  - lib/extensions/digest/ext/depend
144
145
  - lib/extensions/digest/ext/digest.c
@@ -263,6 +264,15 @@ files:
263
264
  - lib/extensions/rholang/rhoerror_ru.rb
264
265
  - lib/extensions/rholang/rhomsg_ru.rb
265
266
  - lib/extensions/set/set.rb
267
+ - lib/extensions/uri/uri/common.rb
268
+ - lib/extensions/uri/uri/ftp.rb
269
+ - lib/extensions/uri/uri/generic.rb
270
+ - lib/extensions/uri/uri/http.rb
271
+ - lib/extensions/uri/uri/https.rb
272
+ - lib/extensions/uri/uri/ldap.rb
273
+ - lib/extensions/uri/uri/ldaps.rb
274
+ - lib/extensions/uri/uri/mailto.rb
275
+ - lib/extensions/uri/uri.rb
266
276
  - lib/framework/bsearch.rb
267
277
  - lib/framework/builtinME.rb
268
278
  - lib/framework/date/format.rb
@@ -616,11 +626,11 @@ files:
616
626
  - platform/bb/rhodes/src/com/rho/net/TCPSocket.java
617
627
  - platform/bb/rhodes/src/com/rho/RhoMainScreen.java
618
628
  - platform/bb/rhodes/src/com/rho/RhoRubyHelper.java
629
+ - platform/bb/rhodes/src/com/rho/rubyext/Alert.java
619
630
  - platform/bb/rhodes/src/com/rho/rubyext/GeoLocation.java
620
631
  - platform/bb/rhodes/src/com/rho/rubyext/System.java
621
632
  - platform/bb/rhodes/src/com/rho/rubyext/XMLParser.java
622
633
  - platform/bb/rhodes/src/com/rho/Version.java
623
- - platform/bb/rhodes/src/rhomobile/Alert.java
624
634
  - platform/bb/rhodes/src/rhomobile/camera/Camera.java
625
635
  - platform/bb/rhodes/src/rhomobile/camera/CameraFilesListener.java
626
636
  - platform/bb/rhodes/src/rhomobile/camera/CameraScreen.java
@@ -1,65 +0,0 @@
1
- package rhomobile;
2
-
3
- import com.xruby.runtime.builtin.RubyArray;
4
- import com.xruby.runtime.lang.RubyBasic;
5
- import com.xruby.runtime.lang.RubyBlock;
6
- import com.xruby.runtime.lang.RubyClass;
7
- import com.xruby.runtime.lang.RubyConstant;
8
- import com.xruby.runtime.lang.RubyException;
9
- import com.xruby.runtime.lang.RubyOneArgMethod;
10
- import com.xruby.runtime.lang.RubyRuntime;
11
- import com.xruby.runtime.lang.RubyValue;
12
- import com.xruby.runtime.lang.RubyVarArgMethod;
13
-
14
- public class Alert extends RubyBasic {
15
-
16
- public Alert(RubyClass arg0) {
17
- super(arg0);
18
- }
19
-
20
- public static RubyValue show_popup(RubyValue arg0) {
21
- String message = arg0.toString();
22
- RhodesApplication.getInstance().showPopup(message);
23
- return RubyConstant.QNIL;
24
- }
25
-
26
- public static RubyValue vibrate(RubyArray args) {
27
- String duration = "2500";
28
- if ((args != null) && (args.size() > 0))
29
- duration = args.get(0).toString();
30
- RhodesApplication.getInstance().vibrate(duration);
31
- return RubyConstant.QNIL;
32
- }
33
-
34
- public static RubyValue play_file(RubyArray args) {
35
- if ((args != null) && (args.size() > 0)) {
36
- String file_name = args.get(0).toString();
37
- String media_type = null;
38
- if ((args.size() > 1) && (args.get(1) != RubyConstant.QNIL))
39
- media_type = args.get(1).toString();
40
- RhodesApplication.getInstance().play_file(file_name,media_type);
41
- } else {
42
- throw new RubyException(RubyRuntime.ArgumentErrorClass, "in WebView.play: wrong number of arguments");
43
- }
44
- return RubyConstant.QNIL;
45
- }
46
-
47
- public static void initMethods(RubyClass klass) {
48
- klass.getSingletonClass().defineMethod("show_popup", new RubyOneArgMethod() {
49
- protected RubyValue run(RubyValue receiver, RubyValue arg0, RubyBlock block) {
50
- return Alert.show_popup(arg0);
51
- }
52
- });
53
- klass.getSingletonClass().defineMethod("vibrate", new RubyVarArgMethod() {
54
- protected RubyValue run(RubyValue receiver, RubyArray args, RubyBlock block) {
55
- return Alert.vibrate(args);
56
- }
57
- });
58
- klass.getSingletonClass().defineMethod("play_file", new RubyVarArgMethod() {
59
- protected RubyValue run(RubyValue receiver, RubyArray args, RubyBlock block) {
60
- return Alert.play_file(args);
61
- }
62
- });
63
- }
64
-
65
- }