rhodes 1.5.4 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +11 -1
- data/Rakefile +1 -1
- data/lib/extensions/digest/ext/Rakefile +11 -6
- data/lib/extensions/digest/ext/build.bat +2 -0
- data/lib/extensions/uri/uri.rb +29 -0
- data/lib/extensions/uri/uri/common.rb +727 -0
- data/lib/extensions/uri/uri/ftp.rb +198 -0
- data/lib/extensions/uri/uri/generic.rb +1128 -0
- data/lib/extensions/uri/uri/http.rb +100 -0
- data/lib/extensions/uri/uri/https.rb +20 -0
- data/lib/extensions/uri/uri/ldap.rb +190 -0
- data/lib/extensions/uri/uri/ldaps.rb +12 -0
- data/lib/extensions/uri/uri/mailto.rb +266 -0
- data/lib/framework/rhodes.rb +2 -2
- data/lib/framework/rhom/rhom_db_adapter.rb +12 -26
- data/lib/framework/rhom/rhom_object_factory.rb +8 -1
- data/lib/framework/version.rb +2 -2
- data/lib/rhodes.rb +2 -2
- data/platform/android/Rhodes/AndroidManifest.xml +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +87 -42
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +58 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +2 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +35 -19
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +4 -0
- data/platform/android/build/android.rake +30 -25
- data/platform/bb/build/rhodes_build.files +1 -1
- data/platform/bb/rhodes/rhodes.jdp +1 -1
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +1 -1
- data/platform/bb/rhodes/src/com/rho/rubyext/Alert.java +300 -0
- data/platform/bb/rhodes/src/com/rho/rubyext/GeoLocation.java +42 -5
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +3 -4
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +33 -107
- data/platform/iphone/Classes/RhoRunnerAppDelegate.m +2 -0
- data/platform/iphone/Info.plist +1 -1
- data/platform/iphone/rbuild/iphone.rake +1 -1
- data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +4 -0
- data/platform/shared/common/RhoMutexLock.h +8 -1
- data/platform/shared/common/RhodesApp.cpp +1 -1
- data/platform/shared/db/DBAdapter.cpp +77 -8
- data/platform/shared/db/DBAdapter.h +24 -9
- data/platform/shared/db/DBResult.cpp +19 -0
- data/platform/shared/db/DBResult.h +7 -5
- data/platform/shared/net/HttpServer.cpp +2 -0
- data/platform/shared/ruby/ext/rho/rhoruby.c +55 -0
- data/platform/shared/ruby/ext/rho/rhoruby.h +9 -0
- data/platform/shared/ruby/ext/rho/rhosupport.c +13 -4
- data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +21 -0
- data/platform/shared/ruby/thread_pthread.c +4 -4
- data/platform/shared/ruby/thread_win32.c +4 -4
- data/platform/shared/rubyJVM/src/com/rho/RhodesApp.java +19 -1
- data/platform/shared/rubyJVM/src/com/rho/db/DBAdapter.java +57 -24
- data/platform/shared/rubyJVM/src/com/rho/net/NetRequest.java +6 -1
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncSource.java +2 -2
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncThread.java +5 -5
- data/platform/shared/sync/SyncSource.cpp +1 -1
- data/platform/shared/sync/SyncThread.cpp +6 -9
- data/platform/wm/rhodes/Rhodes.cpp +4 -0
- data/rakefile.rb +1 -1
- metadata +13 -3
- data/platform/bb/rhodes/src/rhomobile/Alert.java +0 -65
data/lib/framework/rhodes.rb
CHANGED
@@ -23,7 +23,6 @@ module Rhom
|
|
23
23
|
class RhomDbAdapter
|
24
24
|
|
25
25
|
@@database = nil
|
26
|
-
@@inside_transaction = false
|
27
26
|
|
28
27
|
class << self
|
29
28
|
|
@@ -44,10 +43,13 @@ module Rhom
|
|
44
43
|
end
|
45
44
|
return true
|
46
45
|
end
|
47
|
-
|
46
|
+
|
47
|
+
def is_ui_waitfordb
|
48
|
+
@@database.is_ui_waitfordb
|
49
|
+
end
|
50
|
+
|
48
51
|
def start_transaction
|
49
52
|
begin
|
50
|
-
@@inside_transaction = true
|
51
53
|
@@database.start_transaction
|
52
54
|
rescue Exception => e
|
53
55
|
puts "exception when start_transaction"
|
@@ -56,7 +58,6 @@ module Rhom
|
|
56
58
|
|
57
59
|
def commit
|
58
60
|
begin
|
59
|
-
@@inside_transaction = false
|
60
61
|
@@database.commit
|
61
62
|
rescue Exception => e
|
62
63
|
puts "exception when commit transaction"
|
@@ -65,7 +66,6 @@ module Rhom
|
|
65
66
|
|
66
67
|
def rollback
|
67
68
|
begin
|
68
|
-
@@inside_transaction = false
|
69
69
|
@@database.rollback
|
70
70
|
rescue Exception => e
|
71
71
|
puts "exception when rollback transaction"
|
@@ -82,19 +82,12 @@ module Rhom
|
|
82
82
|
# Make sure we lock the sync engine's mutex
|
83
83
|
# before we perform a database transaction.
|
84
84
|
# This prevents concurrency issues.
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
# make sure we unlock even if there's an error!
|
92
|
-
if @@inside_transaction
|
93
|
-
raise
|
94
|
-
else
|
95
|
-
SyncEngine.unlock_sync_mutex
|
96
|
-
end
|
97
|
-
end
|
85
|
+
begin
|
86
|
+
result = @@database.execute( sql, args )
|
87
|
+
rescue Exception => e
|
88
|
+
#puts "exception when running query: #{e}"
|
89
|
+
#raise
|
90
|
+
end
|
98
91
|
end
|
99
92
|
#puts "result is: #{result.inspect}"
|
100
93
|
result
|
@@ -231,14 +224,7 @@ module Rhom
|
|
231
224
|
|
232
225
|
# deletes all rows from a given table by recreating db-file and save all other tables
|
233
226
|
def destroy_table(table)
|
234
|
-
|
235
|
-
SyncEngine.lock_sync_mutex unless @@inside_transaction
|
236
|
-
@@database.destroy_table table
|
237
|
-
SyncEngine.unlock_sync_mutex unless @@inside_transaction
|
238
|
-
rescue Exception => e
|
239
|
-
SyncEngine.unlock_sync_mutex
|
240
|
-
raise
|
241
|
-
end
|
227
|
+
@@database.destroy_table table
|
242
228
|
end
|
243
229
|
|
244
230
|
# updates values (hash) in a given table which satisfy condition (hash)
|
@@ -116,7 +116,14 @@ module Rhom
|
|
116
116
|
|
117
117
|
sql << "attrib=" + ::Rhom::RhomDbAdapter.get_value_for_sql_stmt(attrib_name)
|
118
118
|
sql << " AND source_id=" + srcid_value
|
119
|
-
sql << " AND " + (val_func.length > 0 ? val_func + "(value)" : "value") + ' '
|
119
|
+
sql << " AND " + (val_func.length > 0 ? val_func + "(value)" : "value") + ' '
|
120
|
+
|
121
|
+
if val_op == 'IN' or val_op == 'in'
|
122
|
+
svalue = ::Rhom::RhomDbAdapter.get_value_for_sql_stmt(value)
|
123
|
+
sql << val_op + ' ( ' + svalue[1,svalue.length()-2] + ' )'
|
124
|
+
else
|
125
|
+
sql << val_op + ' ' + ::Rhom::RhomDbAdapter.get_value_for_sql_stmt(value)
|
126
|
+
end
|
120
127
|
|
121
128
|
sql
|
122
129
|
end
|
data/lib/framework/version.rb
CHANGED
data/lib/rhodes.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
2
2
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
3
3
|
package="com.rhomobile.rhodes"
|
4
|
-
android:versionCode="
|
5
|
-
android:versionName="1.5.
|
4
|
+
android:versionCode="24"
|
5
|
+
android:versionName="1.5.5">
|
6
6
|
<uses-sdk android:minSdkVersion="3" />
|
7
7
|
<application android:icon="@drawable/icon"
|
8
8
|
android:multiprocess="true"
|
@@ -42,6 +42,7 @@ import android.content.Context;
|
|
42
42
|
import android.content.DialogInterface;
|
43
43
|
import android.content.pm.ActivityInfo;
|
44
44
|
import android.content.res.Configuration;
|
45
|
+
import android.graphics.Bitmap;
|
45
46
|
import android.net.ConnectivityManager;
|
46
47
|
import android.net.NetworkInfo;
|
47
48
|
import android.net.Uri;
|
@@ -59,6 +60,7 @@ import android.view.View;
|
|
59
60
|
import android.view.Window;
|
60
61
|
import android.view.WindowManager;
|
61
62
|
import android.view.ViewGroup.LayoutParams;
|
63
|
+
import android.webkit.WebChromeClient;
|
62
64
|
import android.webkit.WebSettings;
|
63
65
|
import android.webkit.WebView;
|
64
66
|
import android.webkit.WebViewClient;
|
@@ -78,6 +80,8 @@ public class Rhodes extends Activity {
|
|
78
80
|
public static int WINDOW_FLAGS = WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
79
81
|
public static int WINDOW_MASK = WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
80
82
|
|
83
|
+
private static int MAX_PROGRESS = 10000;
|
84
|
+
|
81
85
|
private long uiThreadId;
|
82
86
|
public long getUiThreadId() {
|
83
87
|
return uiThreadId;
|
@@ -96,7 +100,8 @@ public class Rhodes extends Activity {
|
|
96
100
|
private SplashScreen splashScreen = null;
|
97
101
|
|
98
102
|
private Hashtable<String, UriHandler> uriHandlers = new Hashtable<String, UriHandler>();
|
99
|
-
|
103
|
+
private Boolean contentChanged = null;
|
104
|
+
|
100
105
|
private String sdCardError = "Application can not access the SD card while it's mounted. Please unmount the device and stop the adb server before launching the app.";
|
101
106
|
|
102
107
|
private String rootPath = null;
|
@@ -183,38 +188,53 @@ public class Rhodes extends Activity {
|
|
183
188
|
*/
|
184
189
|
}
|
185
190
|
|
186
|
-
|
191
|
+
public boolean isNameChanged() {
|
187
192
|
try {
|
188
|
-
//String phRootPath = phoneMemoryRootPath();
|
189
|
-
String sdRootPath = sdcardRootPath();
|
190
|
-
|
191
|
-
boolean nameChanged = false;
|
192
|
-
boolean contentChanged = true;
|
193
|
-
|
194
193
|
FileSource as = new AssetsSource(getResources().getAssets());
|
195
194
|
FileSource fs = new FileSource();
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
195
|
+
return !Utils.isContentsEquals(as, "name", fs, new File(getRootPath(), "name").getPath());
|
196
|
+
}
|
197
|
+
catch (IOException e) {
|
198
|
+
return true;
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
public boolean isBundleChanged() {
|
203
|
+
if (contentChanged == null) {
|
204
|
+
try {
|
205
|
+
String rp = getRootPath();
|
206
|
+
|
207
|
+
FileSource as = new AssetsSource(getResources().getAssets());
|
208
|
+
FileSource fs = new FileSource();
|
209
|
+
|
210
|
+
if (isNameChanged())
|
211
|
+
contentChanged = new Boolean(true);
|
212
|
+
else
|
213
|
+
contentChanged = new Boolean(!Utils.isContentsEquals(as, "hash", fs, new File(rp, "hash").getPath()));
|
214
|
+
}
|
215
|
+
catch (IOException e) {
|
216
|
+
contentChanged = new Boolean(true);
|
217
|
+
}
|
218
|
+
}
|
219
|
+
return contentChanged.booleanValue();
|
220
|
+
}
|
221
|
+
|
222
|
+
private void copyFilesFromBundle() {
|
223
|
+
try {
|
224
|
+
if (isBundleChanged()) {
|
225
|
+
Logger.D(TAG, "Copying required files from bundle");
|
226
|
+
|
227
|
+
boolean nameChanged = isNameChanged();
|
205
228
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
phrf.mkdirs();
|
210
|
-
phrf = null;
|
211
|
-
*/
|
229
|
+
String rp = getRootPath();
|
230
|
+
|
231
|
+
FileSource as = new AssetsSource(getResources().getAssets());
|
212
232
|
|
213
233
|
String items[] = {"apps", "lib", "db", "hash", "name"};
|
214
234
|
for (int i = 0; i != items.length; ++i) {
|
215
235
|
String item = items[i];
|
216
236
|
//File phf = new File(phRootPath, item);
|
217
|
-
File sdf = new File(
|
237
|
+
File sdf = new File(rp, item);
|
218
238
|
Logger.D(TAG, "Copy '" + item + "' to '" + sdf + "'");
|
219
239
|
Utils.copyRecursively(as, item, sdf, nameChanged);
|
220
240
|
/*
|
@@ -230,6 +250,7 @@ public class Rhodes extends Activity {
|
|
230
250
|
dbfiles.mkdirs();
|
231
251
|
dbfiles = null;
|
232
252
|
|
253
|
+
contentChanged = new Boolean(true);
|
233
254
|
Logger.D(TAG, "All files copied");
|
234
255
|
}
|
235
256
|
else
|
@@ -253,13 +274,6 @@ public class Rhodes extends Activity {
|
|
253
274
|
public WebView createWebView() {
|
254
275
|
WebView w = new WebView(this);
|
255
276
|
|
256
|
-
try {
|
257
|
-
w.loadUrl("file:///android_asset/apps/app/loading.html");
|
258
|
-
}
|
259
|
-
catch (Exception e) {
|
260
|
-
// Ignore
|
261
|
-
}
|
262
|
-
|
263
277
|
WebSettings webSettings = w.getSettings();
|
264
278
|
webSettings.setSavePassword(false);
|
265
279
|
webSettings.setSaveFormData(false);
|
@@ -274,19 +288,44 @@ public class Rhodes extends Activity {
|
|
274
288
|
w.setHorizontalScrollBarEnabled(true);
|
275
289
|
|
276
290
|
w.setWebViewClient(new WebViewClient() {
|
291
|
+
|
292
|
+
private boolean splashHidden = false;
|
277
293
|
|
278
294
|
@Override
|
279
295
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
280
296
|
return handleUrlLoading(url);
|
281
297
|
}
|
282
298
|
|
299
|
+
@Override
|
300
|
+
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
301
|
+
getWindow().setFeatureInt(Window.FEATURE_PROGRESS, 0);
|
302
|
+
super.onPageStarted(view, url, favicon);
|
303
|
+
}
|
304
|
+
|
283
305
|
@Override
|
284
306
|
public void onPageFinished(WebView view, String url) {
|
285
|
-
if (url.startsWith("http://"))
|
307
|
+
if (!splashHidden && url.startsWith("http://")) {
|
286
308
|
hideSplashScreen();
|
309
|
+
splashHidden = true;
|
310
|
+
}
|
311
|
+
getWindow().setFeatureInt(Window.FEATURE_PROGRESS, MAX_PROGRESS);
|
312
|
+
super.onPageFinished(view, url);
|
287
313
|
}
|
288
314
|
|
289
315
|
});
|
316
|
+
|
317
|
+
w.setWebChromeClient(new WebChromeClient() {
|
318
|
+
@Override
|
319
|
+
public void onProgressChanged(WebView view, int newProgress) {
|
320
|
+
newProgress *= 100;
|
321
|
+
if (newProgress < 0)
|
322
|
+
newProgress = 0;
|
323
|
+
if (newProgress > MAX_PROGRESS)
|
324
|
+
newProgress = MAX_PROGRESS;
|
325
|
+
getWindow().setFeatureInt(Window.FEATURE_PROGRESS, newProgress);
|
326
|
+
super.onProgressChanged(view, newProgress);
|
327
|
+
}
|
328
|
+
});
|
290
329
|
|
291
330
|
return w;
|
292
331
|
}
|
@@ -355,8 +394,8 @@ public class Rhodes extends Activity {
|
|
355
394
|
}
|
356
395
|
}
|
357
396
|
|
358
|
-
private void showSplashScreen(
|
359
|
-
splashScreen = new SplashScreen(this,
|
397
|
+
private void showSplashScreen() {
|
398
|
+
splashScreen = new SplashScreen(this, "apps/app/loading.png");
|
360
399
|
splashScreen.start(outerFrame);
|
361
400
|
}
|
362
401
|
|
@@ -380,7 +419,9 @@ public class Rhodes extends Activity {
|
|
380
419
|
return;
|
381
420
|
}
|
382
421
|
|
383
|
-
|
422
|
+
Thread ct = Thread.currentThread();
|
423
|
+
ct.setPriority(Thread.MAX_PRIORITY);
|
424
|
+
uiThreadId = ct.getId();
|
384
425
|
RhodesInstance.setInstance(this);
|
385
426
|
|
386
427
|
initRootPath();
|
@@ -412,19 +453,19 @@ public class Rhodes extends Activity {
|
|
412
453
|
this.setContentView(outerFrame, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
|
413
454
|
|
414
455
|
Logger.I("Rhodes", "Loading...");
|
456
|
+
showSplashScreen();
|
457
|
+
|
458
|
+
// Increase WebView rendering priority
|
459
|
+
WebView w = new WebView(this);
|
460
|
+
WebSettings webSettings = w.getSettings();
|
461
|
+
webSettings.setRenderPriority(WebSettings.RenderPriority.HIGH);
|
415
462
|
|
463
|
+
// Get screen width/height
|
416
464
|
WindowManager wm = (WindowManager)getSystemService(Context.WINDOW_SERVICE);
|
417
465
|
Display d = wm.getDefaultDisplay();
|
418
466
|
screenHeight = d.getHeight();
|
419
467
|
screenWidth = d.getWidth();
|
420
468
|
|
421
|
-
try {
|
422
|
-
showSplashScreen("apps/app/loading.png");
|
423
|
-
}
|
424
|
-
catch (Exception e) {
|
425
|
-
setMainView(new SimpleMainView());
|
426
|
-
}
|
427
|
-
|
428
469
|
// TODO: detect camera availability
|
429
470
|
isCameraAvailable = true;
|
430
471
|
|
@@ -645,6 +686,10 @@ public class Rhodes extends Activity {
|
|
645
686
|
Process.killProcess(Process.myPid());
|
646
687
|
}
|
647
688
|
|
689
|
+
public static void exit() {
|
690
|
+
RhodesInstance.getInstance().stopSelf();
|
691
|
+
}
|
692
|
+
|
648
693
|
static {
|
649
694
|
// Load native implementation of rhodes
|
650
695
|
System.loadLibrary("rhodes");
|
@@ -7,23 +7,74 @@ import android.content.Context;
|
|
7
7
|
import android.content.res.AssetManager;
|
8
8
|
import android.graphics.Bitmap;
|
9
9
|
import android.graphics.BitmapFactory;
|
10
|
+
import android.view.View;
|
10
11
|
import android.view.ViewGroup;
|
12
|
+
import android.webkit.WebView;
|
11
13
|
import android.widget.ImageView;
|
12
14
|
|
13
15
|
public class SplashScreen {
|
14
16
|
|
15
|
-
private
|
17
|
+
private static final String INSTALLING_PAGE = "apps/app/installing.html";
|
18
|
+
private static final String LOADING_PAGE = "apps/app/loading.html";
|
19
|
+
|
20
|
+
private View view;
|
16
21
|
|
17
22
|
private native void nativeStart();
|
18
23
|
private native void nativeHide();
|
19
24
|
|
20
|
-
public SplashScreen(Context ctx, String file)
|
21
|
-
view = new ImageView(ctx);
|
25
|
+
public SplashScreen(Context ctx, String file) {
|
22
26
|
AssetManager am = ctx.getResources().getAssets();
|
23
|
-
|
24
|
-
Bitmap bitmap =
|
25
|
-
|
26
|
-
|
27
|
+
|
28
|
+
Bitmap bitmap = null;
|
29
|
+
if (file != null) {
|
30
|
+
try {
|
31
|
+
InputStream is = am.open(file);
|
32
|
+
bitmap = BitmapFactory.decodeStream(is);
|
33
|
+
is.close();
|
34
|
+
}
|
35
|
+
catch (IOException e) {}
|
36
|
+
}
|
37
|
+
if (bitmap != null) {
|
38
|
+
ImageView v = new ImageView(ctx);
|
39
|
+
v.setImageBitmap(bitmap);
|
40
|
+
v.setId(Rhodes.RHO_SPLASH_VIEW);
|
41
|
+
view = v;
|
42
|
+
}
|
43
|
+
else {
|
44
|
+
Rhodes r = RhodesInstance.getInstance();
|
45
|
+
WebView v = r.createWebView();
|
46
|
+
|
47
|
+
boolean bc = r.isBundleChanged();
|
48
|
+
String page = bc ? INSTALLING_PAGE : LOADING_PAGE;
|
49
|
+
|
50
|
+
boolean hasNeededPage;
|
51
|
+
try {
|
52
|
+
InputStream is1 = am.open(page);
|
53
|
+
if (is1 != null)
|
54
|
+
is1.close();
|
55
|
+
hasNeededPage = true;
|
56
|
+
}
|
57
|
+
catch (IOException e1) {
|
58
|
+
hasNeededPage = false;
|
59
|
+
}
|
60
|
+
|
61
|
+
if (hasNeededPage) {
|
62
|
+
v.loadUrl("file:///android_asset/" + page);
|
63
|
+
}
|
64
|
+
else {
|
65
|
+
StringBuffer p = new StringBuffer();
|
66
|
+
p.append("<html><title>");
|
67
|
+
p.append(bc ? "Installing" : "Loading");
|
68
|
+
p.append("</title><body>");
|
69
|
+
p.append(bc ? "Installing" : "Loading");
|
70
|
+
p.append("...</body></html>");
|
71
|
+
v.loadData(p.toString(), "text/html", "utf-8");
|
72
|
+
}
|
73
|
+
|
74
|
+
v.setId(Rhodes.RHO_SPLASH_VIEW);
|
75
|
+
|
76
|
+
view = v;
|
77
|
+
}
|
27
78
|
}
|
28
79
|
|
29
80
|
public void start(ViewGroup outer) {
|