rhodes 3.3.1 → 3.3.2.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. data/CHANGELOG +9 -2
  2. data/Manifest.txt +20 -0
  3. data/Rakefile +2 -1
  4. data/doc/build.txt +9 -3
  5. data/doc/configuration.txt +5 -1
  6. data/doc/device-caps.txt +112 -27
  7. data/doc/extensions.txt +0 -51
  8. data/doc/generator.txt +6 -0
  9. data/doc/rhom.txt +3 -0
  10. data/doc/simulator.txt +57 -17
  11. data/doc/ui.txt +24 -27
  12. data/installer/RHOELEMENTS-EULA.txt +295 -0
  13. data/installer/Rakefile +75 -49
  14. data/installer/rhostudio-moto.nsi +534 -0
  15. data/installer/rhostudio.nsi +13 -4
  16. data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/barcode.m +3 -0
  17. data/lib/framework/rho/rhoapplication.rb +4 -0
  18. data/lib/framework/rho/rhoevent.rb +2 -3
  19. data/lib/framework/rho/rhoevent_c.rb +2 -2
  20. data/lib/framework/rho/rhofsconnector.rb +24 -2
  21. data/lib/framework/rhodes.rb +1 -1
  22. data/lib/framework/version.rb +1 -1
  23. data/lib/rhodes.rb +1 -1
  24. data/platform/android/Rhodes/AndroidManifest.xml +3 -3
  25. data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +164 -90
  26. data/platform/android/Rhodes/jni/src/signature.cpp +13 -3
  27. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoCryptImpl.java +76 -34
  28. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +3 -4
  29. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +1 -1
  30. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SplashScreen.java +10 -2
  31. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/AnnotationsOverlay.java +0 -3
  32. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/Callout.java +6 -5
  33. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/GoogleMapView.java +0 -1
  34. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/ImageCapture.java +7 -1
  35. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +46 -6
  36. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +29 -1
  37. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientOld.java +2 -0
  38. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/GoogleWebView.java +4 -0
  39. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsOld.java +10 -2
  40. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +3 -2
  41. data/platform/android/build/android.rake +6 -27
  42. data/platform/android/build/androidcommon.rb +1 -1
  43. data/platform/bb/rhodes/src/com/rho/rubyext/GeoLocation.java +26 -0
  44. data/platform/iphone/Classes/AppManager/AppManager.h +1 -0
  45. data/platform/iphone/Classes/AppManager/AppManager.m +70 -12
  46. data/platform/iphone/Classes/Camera/PickImageDelegate.m +1 -1
  47. data/platform/iphone/Classes/Event/Event.m +38 -3
  48. data/platform/iphone/Classes/Rhodes.m +3 -2
  49. data/platform/iphone/Classes/Signature/SignatureDelegate.m +1 -1
  50. data/platform/iphone/Info.plist +1 -1
  51. data/platform/iphone/rbuild/iphone.rake +8 -8
  52. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore +0 -0
  53. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui +0 -0
  54. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtNetwork.framework/Versions/4/QtNetwork +0 -0
  55. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtWebKit.framework/Versions/4/QtWebKit +0 -0
  56. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/phonon.framework/Versions/4/phonon +0 -0
  57. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Info.plist +1 -1
  58. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/MacOS/RhoSimulator +0 -0
  59. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/accessible/libqtaccessiblewidgets.dylib +0 -0
  60. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/bearer/libqcorewlanbearer.dylib +0 -0
  61. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/bearer/libqgenericbearer.dylib +0 -0
  62. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqcncodecs.dylib +0 -0
  63. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqjpcodecs.dylib +0 -0
  64. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqkrcodecs.dylib +0 -0
  65. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqtwcodecs.dylib +0 -0
  66. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/graphicssystems/libqtracegraphicssystem.dylib +0 -0
  67. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqgif.dylib +0 -0
  68. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqico.dylib +0 -0
  69. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqjpeg.dylib +0 -0
  70. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqmng.dylib +0 -0
  71. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqtiff.dylib +0 -0
  72. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/phonon_backend/libphonon_qt7.dylib +0 -0
  73. data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/qmltooling/libqmldbg_tcp.dylib +0 -0
  74. data/platform/osx/bin/RhoSimulator/RhoSimulatorMac.zip +0 -0
  75. data/platform/osx/build/osx.rake +1 -1
  76. data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +1 -1
  77. data/platform/shared/common/RhoConf.cpp +15 -6
  78. data/platform/shared/common/RhoConf.h +6 -1
  79. data/platform/shared/common/RhodesApp.cpp +19 -6
  80. data/platform/shared/common/RhodesApp.h +4 -2
  81. data/platform/shared/common/RhodesAppBase.cpp +18 -10
  82. data/platform/shared/common/RhodesAppBase.h +6 -3
  83. data/platform/shared/common/map/GeocodingMapEngine.h +2 -2
  84. data/platform/shared/logging/RhoLogConf.cpp +14 -8
  85. data/platform/shared/logging/RhoLogConf.h +1 -0
  86. data/platform/shared/net/HttpServer.cpp +15 -3
  87. data/platform/shared/net/HttpServer.h +2 -1
  88. data/platform/shared/qt/curl/curl.pro +1 -1
  89. data/platform/shared/qt/rhodes/QtMainWindow.h +1 -1
  90. data/platform/shared/qt/rhodes/impl/MainWindowImpl.cpp +2 -2
  91. data/platform/shared/qt/rhodes/main.cpp +2 -1
  92. data/platform/shared/ruby/ext/rho/rhoruby.c +1 -0
  93. data/platform/shared/ruby/ext/rho/rhosupport.c +11 -1
  94. data/platform/shared/sync/SyncNotify.cpp +1 -2
  95. data/platform/shared/sync/SyncNotify.h +2 -2
  96. data/platform/shared/sync/SyncThread.cpp +27 -12
  97. data/platform/shared/sync/SyncThread.h +2 -0
  98. data/platform/shared/unzip/unzip.cpp +3 -2
  99. data/platform/win32/RhoSimulator/Microsoft.VC80.CRT.manifest +8 -0
  100. data/platform/win32/RhoSimulator/Microsoft.VC80.OpenMP.manifest +7 -0
  101. data/platform/win32/RhoSimulator/QtCore4.dll +0 -0
  102. data/platform/win32/RhoSimulator/QtGui4.dll +0 -0
  103. data/platform/win32/RhoSimulator/QtNetwork4.dll +0 -0
  104. data/platform/win32/RhoSimulator/QtWebKit4.dll +0 -0
  105. data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
  106. data/platform/win32/RhoSimulator/imageformats/qgif4.dll +0 -0
  107. data/platform/win32/RhoSimulator/imageformats/qico4.dll +0 -0
  108. data/platform/win32/RhoSimulator/imageformats/qjpeg4.dll +0 -0
  109. data/platform/win32/RhoSimulator/imageformats/qmng4.dll +0 -0
  110. data/platform/win32/RhoSimulator/imageformats/qsvg4.dll +0 -0
  111. data/platform/win32/RhoSimulator/imageformats/qtiff4.dll +0 -0
  112. data/platform/win32/RhoSimulator/libeay32.dll +0 -0
  113. data/platform/win32/RhoSimulator/msvcm80.dll +0 -0
  114. data/platform/win32/RhoSimulator/msvcp80.dll +0 -0
  115. data/platform/win32/RhoSimulator/msvcr80.dll +0 -0
  116. data/platform/win32/RhoSimulator/ssleay32.dll +0 -0
  117. data/platform/win32/RhoSimulator/vcomp.dll +0 -0
  118. data/platform/wm/build/rhodes.nsi +316 -0
  119. data/platform/wm/build/wm.rake +57 -10
  120. data/platform/wm/rhodes/Rhodes.cpp +2 -1
  121. data/platform/wm/rhodes/rhodes.vcproj +2 -0
  122. data/platform/wm/tools/wmdc_connect.sln +20 -0
  123. data/platform/wm/tools/wmdc_connect/stdafx.cpp +27 -0
  124. data/platform/wm/tools/wmdc_connect/stdafx.h +35 -0
  125. data/platform/wm/tools/wmdc_connect/wmdc_connect.cpp +119 -0
  126. data/platform/wm/tools/wmdc_connect/wmdc_connect.vcproj +205 -0
  127. data/platform/wp7/RhoRubyExtGen/RhoAlert.cs +73 -0
  128. data/platform/wp7/RhoRubyExtGen/RhoRubyExtGen.csproj +1 -0
  129. data/platform/wp7/RhoRubyExtGen/RhoSyncEngine.cs +8 -8
  130. data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +47 -6
  131. data/platform/wp7/RhoRubyLib/RhoRuby.cs +8 -0
  132. data/platform/wp7/RhoRubyLib/RhoRubyLib.csproj +5 -0
  133. data/platform/wp7/RhoRubyLib/WP_PlatformAdaptationLayer.cs +5 -0
  134. data/platform/wp7/RhoRubyLib/common/RhoParams.cs +2 -1
  135. data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +58 -37
  136. data/platform/wp7/RhoRubyLib/db/DBAdapter.cs +37 -0
  137. data/platform/wp7/RhoRubyLib/db/DBAttrManager.cs +63 -1
  138. data/platform/wp7/RhoRubyLib/db/IDBStorage.cs +2 -0
  139. data/platform/wp7/RhoRubyLib/db/SqliteStorage.cs +27 -0
  140. data/platform/wp7/RhoRubyLib/logging/RhoLogServerSink.cs +2 -2
  141. data/platform/wp7/RhoRubyLib/net/NetRequest.cs +4 -3
  142. data/platform/wp7/RhoRubyLib/rubyext/RhoAlert.cs +160 -0
  143. data/platform/wp7/RhoRubyLib/rubyext/RhoSyncEngine.cs +44 -12
  144. data/platform/wp7/RhoRubyLib/sync/ClientRegister.cs +4 -3
  145. data/platform/wp7/RhoRubyLib/sync/SyncEngine.cs +27 -32
  146. data/platform/wp7/RhoRubyLib/sync/SyncNotify.cs +31 -11
  147. data/platform/wp7/RhoRubyLib/sync/SyncProtocol_3.cs +6 -1
  148. data/platform/wp7/RhoRubyLib/sync/SyncSource.cs +4 -0
  149. data/platform/wp7/RhoRubyLib/sync/SyncThread.cs +21 -15
  150. data/platform/wp7/build/wp.rake +6 -0
  151. data/rakefile.rb +2 -1
  152. data/res/build-tools/Coding4Fun.Phone.Controls.dll +0 -0
  153. data/res/build-tools/wmdc_connect.exe +0 -0
  154. data/res/generators/templates/spec/app/SpecRunner/index.erb +14 -13
  155. data/spec/phone_spec/app/spec/rhom_object_spec.rb +10 -1
  156. data/version +1 -1
  157. metadata +26 -4
@@ -47,6 +47,12 @@ import com.rhomobile.rhodes.Logger;
47
47
 
48
48
  class SignatureView extends SurfaceView implements SurfaceHolder.Callback {
49
49
 
50
+ public int penColor;
51
+ public float penWidth;
52
+ public int bgColor;
53
+
54
+
55
+
50
56
  private class PointSequence {
51
57
  public Vector<PointF> mPoints = new Vector<PointF>();
52
58
  }
@@ -130,9 +136,16 @@ class SignatureView extends SurfaceView implements SurfaceHolder.Callback {
130
136
  }
131
137
 
132
138
  private void doFullRedraw() {
139
+ if (mCanvas == null) {
140
+ return;
141
+ }
142
+
133
143
  Paint paint = new Paint();
134
144
  paint.setAntiAlias(false);
135
- paint.setARGB(255, 255, 255, 255);
145
+ paint.setARGB( 255,
146
+ (bgColor & 0xFF0000) >> 16,
147
+ (bgColor & 0xFF00) >> 8,
148
+ (bgColor & 0xFF));
136
149
 
137
150
  mCanvas.drawRect(0, 0, mCanvas.getWidth(), mCanvas.getHeight(), paint);
138
151
 
@@ -194,6 +207,20 @@ class SignatureView extends SurfaceView implements SurfaceHolder.Callback {
194
207
 
195
208
  }
196
209
 
210
+
211
+ public void setupView(int _penColor, float _penWidth, int _bgColor) {
212
+ penColor = _penColor;
213
+ penWidth = _penWidth;
214
+ bgColor = _bgColor;
215
+ mPaint = new Paint();
216
+ mPaint.setAntiAlias(true);
217
+ mPaint.setColor(0xFF000000 | penColor);
218
+ mPaint.setStyle(Paint.Style.STROKE);
219
+ mPaint.setStrokeJoin(Paint.Join.ROUND);
220
+ mPaint.setStrokeCap(Paint.Cap.ROUND);
221
+ mPaint.setStrokeWidth(penWidth);
222
+ doFullRedraw();
223
+ }
197
224
 
198
225
  public SignatureView(Context context, AttributeSet attrs) {
199
226
  super(context, attrs);
@@ -214,6 +241,7 @@ class SignatureView extends SurfaceView implements SurfaceHolder.Callback {
214
241
  mPaint.setStrokeCap(Paint.Cap.ROUND);
215
242
  mPaint.setStrokeWidth(2);
216
243
 
244
+ bgColor = 0xFFFFFFFF;
217
245
 
218
246
  setFocusable(true); // make sure we get key events
219
247
 
@@ -51,6 +51,8 @@ public class ChromeClientOld extends WebChromeClient {
51
51
  if (newProgress > RhodesActivity.MAX_PROGRESS)
52
52
  newProgress = RhodesActivity.MAX_PROGRESS;
53
53
  mRhodesActivity.getWindow().setFeatureInt(Window.FEATURE_PROGRESS, newProgress);
54
+ } else {
55
+ newProgress = RhodesActivity.MAX_PROGRESS;
54
56
  }
55
57
  super.onProgressChanged(view, newProgress);
56
58
  }
@@ -69,6 +69,10 @@ public class GoogleWebView implements WebView {
69
69
  throw new IllegalStateException(e);
70
70
  }
71
71
  }
72
+
73
+ public void applyWebSettings() {
74
+ mWebSettings.setWebSettings(mWebView);
75
+ }
72
76
 
73
77
  @Override
74
78
  public View getView() {
@@ -26,6 +26,9 @@
26
26
 
27
27
  package com.rhomobile.rhodes.webview;
28
28
 
29
+ import com.rhomobile.rhodes.RhoConf;
30
+
31
+ import android.util.Log;
29
32
  import android.webkit.WebSettings;
30
33
  import android.webkit.WebView;
31
34
 
@@ -37,8 +40,13 @@ public class RhoWebSettingsOld implements RhoWebSettings {
37
40
  webSettings.setSaveFormData(false);
38
41
  webSettings.setJavaScriptEnabled(true);
39
42
  webSettings.setJavaScriptCanOpenWindowsAutomatically(false);
40
- webSettings.setSupportZoom(true);
41
- webSettings.setBuiltInZoomControls(true);
43
+ if (RhoConf.getBool("enable_screen_zoom")) {
44
+ webSettings.setSupportZoom(true);
45
+ webSettings.setBuiltInZoomControls(true);
46
+ } else {
47
+ webSettings.setSupportZoom(false);
48
+ webSettings.setBuiltInZoomControls(false);
49
+ }
42
50
  webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
43
51
  webSettings.setSupportMultipleWindows(false);
44
52
 
@@ -52,6 +52,8 @@ public class RhoWebViewClient extends WebViewClient
52
52
  public void onPageStarted(WebView view, String url, Bitmap favicon) {
53
53
  if (RhodesActivity.ENABLE_LOADING_INDICATION)
54
54
  RhodesActivity.safeGetInstance().getWindow().setFeatureInt(Window.FEATURE_PROGRESS, 0);
55
+ else
56
+ RhodesActivity.safeGetInstance().getWindow().setFeatureInt(Window.FEATURE_PROGRESS, RhodesActivity.MAX_PROGRESS);
55
57
  super.onPageStarted(view, url, favicon);
56
58
  }
57
59
 
@@ -60,8 +62,7 @@ public class RhoWebViewClient extends WebViewClient
60
62
  // Set title
61
63
  String title = view.getTitle();
62
64
  RhodesActivity.safeGetInstance().setTitle(title);
63
- if (RhodesActivity.ENABLE_LOADING_INDICATION)
64
- RhodesActivity.safeGetInstance().getWindow().setFeatureInt(
65
+ RhodesActivity.safeGetInstance().getWindow().setFeatureInt(
65
66
  Window.FEATURE_PROGRESS, RhodesActivity.MAX_PROGRESS);
66
67
 
67
68
  super.onPageFinished(view, url);
@@ -31,33 +31,12 @@ require 'pathname'
31
31
  USE_OWN_STLPORT = false
32
32
  #USE_TRACES = # see androidcommon.h
33
33
 
34
- ANDROID_API_LEVEL_TO_MARKET_VERSION = {}
35
- ANDROID_MARKET_VERSION_TO_API_LEVEL = {}
36
- {
37
- 2 => "1.1",
38
- 3 => "1.5",
39
- 4 => "1.6",
40
- 5 => "2.0",
41
- 6 => "2.0.1",
42
- 7 => "2.1",
43
- 8 => "2.2",
44
- 9 => "2.3.1",
45
- 10 => "2.3.3",
46
- 11 => "3.0",
47
- 12 => "3.1",
48
- 13 => "3.2",
49
- 14 => "4.0"
50
- }.each do |k,v|
51
- ANDROID_API_LEVEL_TO_MARKET_VERSION[k] = v
52
- ANDROID_MARKET_VERSION_TO_API_LEVEL[v] = k
53
- end
54
-
55
34
  def get_market_version(apilevel)
56
- ANDROID_API_LEVEL_TO_MARKET_VERSION[apilevel]
35
+ AndroidTools.get_market_version(apilevel)
57
36
  end
58
37
 
59
38
  def get_api_level(version)
60
- ANDROID_MARKET_VERSION_TO_API_LEVEL[version]
39
+ AndroidTools.get_api_level(version)
61
40
  end
62
41
 
63
42
  JAVA_PACKAGE_NAME = 'com.rhomobile.rhodes'
@@ -1423,7 +1402,7 @@ namespace "build" do
1423
1402
  classpath = $androidjar
1424
1403
  classpath += $path_separator + $gapijar unless $gapijar.nil?
1425
1404
  classpath += $path_separator + $motosol_jar unless $motosol_jar.nil?
1426
- classpath += $path_separator + "#{$tmpdir}/Rhodes"
1405
+ classpath += $path_separator + File.join($tmpdir, 'Rhodes')
1427
1406
  Dir.glob(File.join($extensionsdir, "*.jar")).each do |f|
1428
1407
  classpath += $path_separator + f
1429
1408
  end
@@ -1438,11 +1417,11 @@ namespace "build" do
1438
1417
  puts 'ext_build.files not found - no additional java files'
1439
1418
  end
1440
1419
 
1441
- java_compile($tmpdir+'/Rhodes', classpath, javafilelists)
1420
+ java_compile(File.join($tmpdir, 'Rhodes'), classpath, javafilelists)
1442
1421
 
1443
1422
  files = []
1444
1423
  Dir.glob(File.join($extensionsdir, "*.jar")).each do |f|
1445
- puts Jake.run($jarbin, ["xf", f], File.join($tmpdir, "Rhodes"))
1424
+ puts Jake.run($jarbin, ["xf", f], File.join($tmpdir, 'Rhodes'))
1446
1425
  unless $?.success?
1447
1426
  puts "Error running jar (xf)"
1448
1427
  exit 1
@@ -1911,7 +1890,7 @@ namespace "run" do
1911
1890
  $avdname = $appavdname
1912
1891
  end
1913
1892
 
1914
- createavd = "\"#{$androidbin}\" create avd --name #{$avdname} --target #{$avdtarget} --sdcard 32M "
1893
+ createavd = "\"#{$androidbin}\" create avd --name #{$avdname} --target #{$avdtarget} --sdcard 128M "
1915
1894
  system("echo no | #{createavd}") unless File.directory?( File.join(ENV['HOME'], ".android", "avd", "#{$avdname}.avd" ) )
1916
1895
 
1917
1896
  if $use_google_addon_api
@@ -393,7 +393,7 @@ def java_compile(outpath, classpath, srclists)
393
393
  args = []
394
394
  args << "-g"
395
395
  args << "-d"
396
- args << $tmpdir + '/Rhodes'
396
+ args << outpath
397
397
  args << "-source"
398
398
  args << "1.6"
399
399
  args << "-target"
@@ -37,6 +37,7 @@ import com.rho.net.NetResponse;
37
37
  import com.xruby.runtime.lang.*;
38
38
  import com.xruby.runtime.builtin.ObjectFactory;
39
39
  import com.xruby.runtime.builtin.RubyArray;
40
+ import com.xruby.runtime.builtin.RubyHash;
40
41
  import com.rho.net.NetRequest;
41
42
  import com.rho.RhoAppAdapter;
42
43
  import j2me.lang.MathEx;
@@ -590,6 +591,31 @@ public class GeoLocation extends RhoThread{
590
591
  }
591
592
  }
592
593
  });
594
+
595
+ klass.getSingletonClass().defineMethod("do_geocoding", new RubyVarArgMethod() {
596
+ protected RubyValue run(RubyValue receiver, RubyArray args, RubyBlock block) {
597
+
598
+ if ( args.size() < 2 )
599
+ throw new RubyException(RubyRuntime.ArgumentErrorClass,
600
+ "in GeoLocation.set_view_notification: wrong number of arguments ( " + args.size() + " for " + 2 + " )");
601
+
602
+ try{
603
+ RubyHash hashParams = (RubyHash)(args.get(0) != RubyConstant.QNIL ? args.get(0) : null);
604
+ String url = args.get(1) != RubyConstant.QNIL ? args.get(1).toStr() : "";
605
+ String params = "";
606
+ int nTimeout = 0;
607
+ if ( args.size() > 2 )
608
+ params = args.get(2) != RubyConstant.QNIL ? args.get(2).toStr() : "";
609
+
610
+
611
+ }catch(Exception e)
612
+ {
613
+ LOG.ERROR("do_geocoding failed", e);
614
+ throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
615
+ }
616
+ return RubyConstant.QNIL;
617
+ }
618
+ });
593
619
  }
594
620
 
595
621
  }
@@ -34,6 +34,7 @@
34
34
 
35
35
  + (AppManager *)instance;
36
36
  + (NSString *) getApplicationsRootPath;
37
+ + (NSString *) getApplicationsUserPath;
37
38
  + (NSString *) getDbPath;
38
39
  + (NSString *) getApplicationsRosterUrl;
39
40
  + (bool) installApplication:(NSString*)appName data:(NSData*)appData;
@@ -43,6 +43,8 @@
43
43
 
44
44
  #import "Rhodes.h"
45
45
 
46
+ #import "common/app_build_configs.h"
47
+
46
48
 
47
49
  #undef DEFAULT_LOGCATEGORY
48
50
  #define DEFAULT_LOGCATEGORY "RhodesApp"
@@ -117,17 +119,20 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
117
119
  * Application folders located undern the root
118
120
  */
119
121
  + (NSString *) getApplicationsRootPath {
120
- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
121
- NSString *documentsDirectory = [paths objectAtIndex:0];
122
+ NSString *documentsDirectory = [NSString stringWithUTF8String:rho_native_rhopath()];
122
123
  return [documentsDirectory stringByAppendingPathComponent:@"apps"];
123
124
  }
124
125
 
125
126
  + (NSString *) getDbPath {
126
- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
127
- NSString *documentsDirectory = [paths objectAtIndex:0];
127
+ NSString *documentsDirectory = [NSString stringWithUTF8String:rho_native_rhouserpath()];
128
128
  return [documentsDirectory stringByAppendingPathComponent:@"db"];
129
129
  }
130
130
 
131
+ + (NSString *) getApplicationsUserPath {
132
+ return [NSString stringWithUTF8String:rho_native_rhouserpath()];
133
+ }
134
+
135
+
131
136
  + (NSString *) getApplicationsRosterUrl {
132
137
  return @"http://dev.rhomobile.com/vlad/";
133
138
  }
@@ -207,9 +212,10 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
207
212
 
208
213
  NSString *bundleRoot = [[NSBundle mainBundle] resourcePath];
209
214
  NSString *rhoRoot = [NSString stringWithUTF8String:rho_native_rhopath()];
215
+ NSString *rhoUserRoot = [NSString stringWithUTF8String:rho_native_rhouserpath()];
210
216
 
211
217
  NSString *filePathNew = [bundleRoot stringByAppendingPathComponent:@"name"];
212
- NSString *filePathOld = [rhoRoot stringByAppendingPathComponent:@"name"];
218
+ NSString *filePathOld = [rhoUserRoot stringByAppendingPathComponent:@"name"];
213
219
  //#ifndef RHO_DONT_COPY_ON_START
214
220
  BOOL hasOldName = [fileManager fileExistsAtPath:filePathOld];
215
221
  //#endif
@@ -222,7 +228,7 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
222
228
  contentChanged = YES;
223
229
  else {
224
230
  filePathNew = [bundleRoot stringByAppendingPathComponent:@"hash"];
225
- filePathOld = [rhoRoot stringByAppendingPathComponent:@"hash"];
231
+ filePathOld = [rhoUserRoot stringByAppendingPathComponent:@"hash"];
226
232
 
227
233
  contentChanged = ![self isContentsEqual:fileManager first:filePathNew second:filePathOld];
228
234
 
@@ -271,13 +277,21 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
271
277
  }
272
278
 
273
279
  NSError *error;
280
+
281
+ NSString *appsDocDir = [rhoUserRoot stringByAppendingPathComponent:@"apps"];
282
+ [fileManager createDirectoryAtPath:rhoRoot withIntermediateDirectories:YES attributes:nil error:&error];
283
+ [fileManager createDirectoryAtPath:appsDocDir withIntermediateDirectories:YES attributes:nil error:&error];
284
+
274
285
  // Create symlink to "lib"
275
286
  NSString *src = [bundleRoot stringByAppendingPathComponent:@"lib"];
276
287
  NSLog(@"src: %@", src);
277
288
  NSString *dst = [rhoRoot stringByAppendingPathComponent:@"lib"];
278
289
  NSLog(@"dst: %@", dst);
279
290
  [fileManager removeItemAtPath:dst error:&error];
291
+
280
292
  [fileManager createSymbolicLinkAtPath:dst withDestinationPath:src error:&error];
293
+ //[self copyFromMainBundle:fileManager fromPath:src toPath:dst remove:YES];
294
+
281
295
 
282
296
  NSString *dirs[] = {@"apps"};
283
297
  for (int i = 0, lim = sizeof(dirs)/sizeof(dirs[0]); i < lim; ++i) {
@@ -323,7 +337,7 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
323
337
  remove = NO;
324
338
  NSString *src = [bundleRoot stringByAppendingPathComponent:copy_dirs[i]];
325
339
  NSLog(@"copy src: %@", src);
326
- NSString *dst = [rhoRoot stringByAppendingPathComponent:copy_dirs[i]];
340
+ NSString *dst = [rhoUserRoot stringByAppendingPathComponent:copy_dirs[i]];
327
341
  NSLog(@"copy dst: %@", dst);
328
342
  [self copyFromMainBundle:fileManager fromPath:src toPath:dst remove:remove];
329
343
  }
@@ -332,7 +346,7 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
332
346
  for (int i = 0, lim = sizeof(items)/sizeof(items[0]); i < lim; ++i) {
333
347
  NSString *src = [bundleRoot stringByAppendingPathComponent:items[i]];
334
348
  NSLog(@"copy src: %@", src);
335
- NSString *dst = [rhoRoot stringByAppendingPathComponent:items[i]];
349
+ NSString *dst = [rhoUserRoot stringByAppendingPathComponent:items[i]];
336
350
  NSLog(@"copy dst: %@", dst);
337
351
  [fileManager removeItemAtPath:dst error:&error];
338
352
  [fileManager copyItemAtPath:src toPath:dst error:&error];
@@ -353,8 +367,8 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
353
367
  #endif
354
368
  }
355
369
 
356
- rho_logconf_Init(rho_native_rhopath(), "");
357
- rho_rhodesapp_create(rho_native_rhopath());
370
+ rho_logconf_Init_with_separate_user_path(rho_native_rhopath(), "", rho_native_rhouserpath());
371
+ rho_rhodesapp_create_with_separate_user_path(rho_native_rhopath(), rho_native_rhouserpath());
358
372
  RAWLOG_INFO("Rhodes started");
359
373
  }
360
374
 
@@ -391,8 +405,9 @@ BOOL isPathIsSymLink(NSFileManager *fileManager, NSString* path) {
391
405
 
392
406
  @end
393
407
 
394
- const char* rho_native_rhopath()
395
- {
408
+
409
+
410
+ const char* getUserPath() {
396
411
  static bool loaded = FALSE;
397
412
  static char root[FILENAME_MAX];
398
413
  if (!loaded){
@@ -407,6 +422,49 @@ const char* rho_native_rhopath()
407
422
  return root;
408
423
  }
409
424
 
425
+
426
+
427
+ const char* rho_native_rhopath()
428
+ {
429
+ BOOL all_in_doc = NO;
430
+ const char* svalue = get_app_build_config_item("iphone_all_in_doc_folder");
431
+ if (svalue != NULL) {
432
+ all_in_doc = svalue[0] != '0';
433
+ }
434
+
435
+ if (all_in_doc) {
436
+ return getUserPath();
437
+ }
438
+
439
+ static bool loaded = FALSE;
440
+ static char root[FILENAME_MAX];
441
+ if (!loaded){
442
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
443
+ NSString *documentsDirectory = //[paths objectAtIndex:0];
444
+ [ [paths objectAtIndex:0] stringByAppendingString:@"/Private Documents/"];
445
+ [documentsDirectory getFileSystemRepresentation:root maxLength:sizeof(root)];
446
+
447
+ loaded = TRUE;
448
+ }
449
+
450
+ return root;
451
+ }
452
+
453
+ const char* rho_native_rhouserpath()
454
+ {
455
+ BOOL use_doc = YES;
456
+ const char* svalue = get_app_build_config_item("iphone_use_doc_folder");
457
+ if (svalue != NULL) {
458
+ use_doc = svalue[0] != '0';
459
+ }
460
+
461
+ if (!use_doc) {
462
+ return rho_native_rhopath();
463
+ }
464
+
465
+ return getUserPath();
466
+ }
467
+
410
468
  VALUE rho_sys_get_locale()
411
469
  {
412
470
  NSString *preferredLang = [[NSLocale preferredLanguages] objectAtIndex:0];
@@ -112,7 +112,7 @@
112
112
  @synthesize settings;
113
113
 
114
114
  - (void)useImage:(UIImage*)theImage {
115
- NSString *folder = [[AppManager getApplicationsRootPath] stringByAppendingPathComponent:@"/../db/db-files"];
115
+ NSString *folder = [[AppManager getDbPath] stringByAppendingPathComponent:@"/db-files"];
116
116
 
117
117
 
118
118
  UIImage* img = theImage;
@@ -288,13 +288,42 @@ VALUE event_fetch(VALUE rParams)
288
288
  VALUE end_date = rb_hash_aref(rParams, rb_str_new2(RUBY_EV_END_DATE));
289
289
  int include_repeating = rho_ruby_get_bool(rb_hash_aref(rParams, rb_str_new2(RUBY_FETCH_include_repeating)));
290
290
 
291
+ EKEventStore *eventStore = [[Rhodes sharedInstance] eventStore];
292
+
293
+
291
294
  NSDate *start = dateFromRuby(start_date);
292
295
  NSDate *finish = dateFromRuby(end_date);
293
296
 
294
- EKEventStore *eventStore = [[Rhodes sharedInstance] eventStore];
295
- NSPredicate *pred = [eventStore predicateForEventsWithStartDate:start endDate:finish calendars:nil];
296
- NSArray *events = [eventStore eventsMatchingPredicate:pred];
297
+ // use Dictionary for remove dublicates produced by eventscovered more one year segment
298
+ NSMutableDictionary *eventsDict = [NSMutableDictionary dictionaryWithCapacity:1024];
297
299
 
300
+ NSDate* currentStart = [NSDate dateWithTimeInterval:0 sinceDate:start];
301
+
302
+ int seconds_in_year = 60*60*24*365;
303
+
304
+ // enumerate events by one year segment because iOS do not support predicate longer than 4 year !
305
+ while ([currentStart compare:finish] == NSOrderedAscending) {
306
+
307
+ NSDate* currentFinish = [NSDate dateWithTimeInterval:seconds_in_year sinceDate:currentStart];
308
+
309
+ if ([currentFinish compare:finish] == NSOrderedDescending) {
310
+ currentFinish = [NSDate dateWithTimeInterval:0 sinceDate:finish];
311
+ }
312
+ NSPredicate *predicate = [eventStore predicateForEventsWithStartDate:currentStart endDate:currentFinish calendars:nil];
313
+ [eventStore enumerateEventsMatchingPredicate:predicate
314
+ usingBlock:^(EKEvent *event, BOOL *stop) {
315
+
316
+ if (event) {
317
+ [eventsDict setObject:event forKey:event.eventIdentifier];
318
+ }
319
+
320
+ }];
321
+ currentStart = [NSDate dateWithTimeInterval:(seconds_in_year + 1) sinceDate:currentStart];
322
+
323
+ }
324
+
325
+ NSArray *events = [eventsDict allValues];
326
+
298
327
  VALUE ret = rho_ruby_create_array();
299
328
 
300
329
  for (int i = 0, lim = [events count]; i != lim; ++i) {
@@ -333,6 +362,12 @@ const char* event_save(VALUE rEvent)
333
362
  EKEvent *event = eventFromRuby(eventStore, rEvent);
334
363
 
335
364
  NSError *err;
365
+
366
+ // Workaround for iOS 5.0 bug - event can not have the same start and end dates !!!
367
+ if ([event.endDate isEqualToDate:event.startDate]) {
368
+ event.endDate = [event.startDate dateByAddingTimeInterval:1.0]; // add one second
369
+ }
370
+
336
371
  BOOL saved = [eventStore saveEvent:event span:EKSpanFutureEvents error:&err];
337
372
 
338
373
  if (saved) {