rhodes 2.2.4.beta.1 → 2.2.5.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +10 -0
- data/Rakefile +119 -3
- data/lib/build/jake.rb +15 -1
- data/lib/framework/dateME.rb +6 -1
- data/lib/framework/rho/render.rb +18 -15
- data/lib/framework/rho/rho.rb +105 -43
- data/lib/framework/rho/rhoapplication.rb +1 -1
- data/lib/framework/rho/rhocontact.rb +41 -13
- data/lib/framework/rho/rhocontroller.rb +10 -1
- data/lib/framework/rho/rhoevent_c.rb +6 -1
- data/lib/framework/rho/rhosupport.rb +1 -1
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rholang/rhomsg_de.rb +1 -1
- data/lib/framework/rholang/rhomsg_es.rb +1 -1
- data/lib/framework/rholang/rhomsg_it.rb +28 -0
- data/lib/framework/rhom/rhom.rb +6 -0
- data/lib/framework/rhom/rhom_model.rb +14 -7
- data/lib/framework/rhom/rhom_object_factory.rb +121 -56
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/AndroidManifest.full.xml +62 -0
- data/platform/android/Rhodes/AndroidManifest.xml +3 -34
- data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +17 -2
- data/platform/android/Rhodes/jni/src/alert.cpp +16 -0
- data/platform/android/Rhodes/jni/src/callbacks.cpp +27 -3
- data/platform/android/Rhodes/jni/src/nativebar.cpp +3 -0
- data/platform/android/Rhodes/jni/src/nativeview.cpp +131 -1
- data/platform/android/Rhodes/jni/src/phonebook.cpp +102 -41
- data/platform/android/Rhodes/jni/src/rhodes.cpp +113 -32
- data/platform/android/Rhodes/jni/src/ringtones.cpp +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +9 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +184 -49
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +49 -25
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +104 -57
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +36 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +24 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +7 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +185 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +54 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Contact.java +107 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +72 -24
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorOld.java +22 -21
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Phonebook.java +91 -11
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/PerformOnUiThread.java +10 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientNew.java +11 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsNew.java +10 -0
- data/platform/android/build/android.rake +50 -9
- data/platform/android/build/librhocommon_build.files +1 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Parser.java +3 -2
- data/platform/bb/Hsqldb/src/org/hsqldb/SchemaManager.java +3 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Session.java +7 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Tokenizer.java +2 -2
- data/platform/bb/RubyVM/RubyVM.jdp +1 -0
- data/platform/bb/RubyVM/src/com/rho/AppBuildConfig.java +22 -0
- data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +5 -0
- data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +51 -4
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +21 -10
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +82 -33
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +59 -6
- data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyFloat_Methods.java +5 -0
- data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyString_Methods.java +19 -7
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/ArrayPacker.java +1 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyFloat.java +5 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyString.java +55 -11
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyTime.java +18 -2
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyKernelModule.java +8 -5
- data/platform/bb/RubyVM/src/j2me/lang/CharacterMe.java +1 -1
- data/platform/bb/RubyVM/src/j2me/util/StringParser.java +2 -0
- data/platform/bb/build/RubyVM_build.files +1 -0
- data/platform/bb/build/bb.rake +21 -2
- data/platform/bb/rhodes/platform/4.7/com/rho/RhoMainScreen.java +3 -3
- data/platform/bb/rhodes/platform/common/com/rho/RhoMainScreen.java +1 -1
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +1 -2
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +15 -16
- data/platform/bb/rhodes/src/com/rho/rubyext/RhoCalendar.java +4 -0
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +58 -0
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +90 -4
- data/platform/iphone/Classes/AppManager/AppManager.m +43 -5
- data/platform/iphone/Classes/Event/Event.h +2 -0
- data/platform/iphone/Classes/Event/Event.m +12 -1
- data/platform/iphone/Classes/GeoLocation/LocationController.m +9 -3
- data/platform/iphone/Classes/MapView/MapViewController.m +20 -9
- data/platform/iphone/Classes/NativeBar.m +27 -0
- data/platform/iphone/Classes/Phonebook/phonebook.m +17 -0
- data/platform/iphone/Classes/RhoAlert.m +61 -1
- data/platform/iphone/Classes/RhoMainView.h +1 -0
- data/platform/iphone/Classes/Rhodes.h +2 -0
- data/platform/iphone/Classes/Rhodes.m +108 -1
- data/platform/iphone/Classes/SimpleMainView.h +4 -0
- data/platform/iphone/Classes/SimpleMainView.m +30 -3
- data/platform/iphone/Classes/SplashViewController.m +3 -1
- data/platform/iphone/Classes/TabbedMainView.h +2 -0
- data/platform/iphone/Classes/TabbedMainView.m +63 -11
- data/platform/iphone/Classes/rho/net/NetRequestImpl.m +26 -0
- data/platform/iphone/Info.plist +12 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +8 -0
- data/platform/iphone/rbuild/iphone.rake +181 -25
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +5 -5
- data/platform/shared/common/IRhoThreadImpl.h +1 -1
- data/platform/shared/common/PosixThreadImpl.cpp +5 -3
- data/platform/shared/common/PosixThreadImpl.h +1 -1
- data/platform/shared/common/RhoFilePath.h +11 -0
- data/platform/shared/common/RhoNativeViewManager.h +17 -0
- data/platform/shared/common/RhoThread.h +1 -1
- data/platform/shared/common/RhodesApp.cpp +29 -8
- data/platform/shared/common/ThreadQueue.cpp +5 -3
- data/platform/shared/common/ThreadQueue.h +2 -1
- data/platform/shared/common/app_build_configs.c +25 -0
- data/platform/shared/common/app_build_configs.h +11 -0
- data/platform/shared/net/AsyncHttp.cpp +5 -5
- data/platform/shared/net/CURLNetRequest.cpp +25 -7
- data/platform/shared/net/CURLNetRequest.h +2 -1
- data/platform/shared/net/HttpServer.cpp +28 -0
- data/platform/shared/ruby/ext/nativebar/nativebar.i +3 -0
- data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +26 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +6 -0
- data/platform/shared/ruby/ext/rho/rhoruby.h +1 -0
- data/platform/shared/ruby/ext/rho/rhosupport.c +15 -2
- data/platform/shared/ruby/ext/syncengine/syncengine.i +14 -2
- data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +97 -2
- data/platform/shared/ruby/ext/system/system.i +13 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +104 -1
- data/platform/shared/rubyext/RhoAppAdapter.cpp +7 -0
- data/platform/shared/sync/SyncEngine.cpp +43 -3
- data/platform/shared/sync/SyncEngine.h +13 -0
- data/platform/shared/sync/SyncNotify.cpp +41 -23
- data/platform/shared/sync/SyncNotify.h +18 -4
- data/platform/shared/sync/SyncSource.cpp +52 -14
- data/platform/shared/sync/SyncSource.h +1 -0
- data/platform/shared/sync/SyncThread.cpp +29 -9
- data/platform/shared/sync/SyncThread.h +4 -2
- data/platform/wm/RhoLib/RhoLib.vcproj +8 -0
- data/platform/wm/build/build_inf.js +15 -9
- data/platform/wm/build/wm.rake +10 -5
- data/platform/wm/rhodes/Alert.cpp +10 -0
- data/platform/wm/rhodes/Alert.h +3 -3
- data/platform/wm/rhodes/MainWindow.cpp +171 -26
- data/platform/wm/rhodes/MainWindow.h +23 -1
- data/platform/wm/rhodes/MetaHandler.cpp +192 -0
- data/platform/wm/rhodes/MetaHandler.h +31 -0
- data/platform/wm/rhodes/RhoNativeViewManager.cpp +126 -0
- data/platform/wm/rhodes/RhoNativeViewManagerWM.h +20 -0
- data/platform/wm/rhodes/Rhodes.cpp +91 -2
- data/platform/wm/rhodes/Rhodes.rc +15 -6
- data/platform/wm/rhodes/SyncStatusDlg.cpp +32 -0
- data/platform/wm/rhodes/SyncStatusDlg.h +29 -0
- data/platform/wm/rhodes/resource.h +5 -2
- data/platform/wm/rhodes/rho/common/RhoThreadImpl.cpp +3 -1
- data/platform/wm/rhodes/rho/common/RhoThreadImpl.h +1 -1
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +146 -14
- data/platform/wm/rhodes/rhodes.vcproj +28 -0
- data/rakefile.rb +119 -3
- data/res/build-tools/iphonesim/README +58 -0
- data/res/build-tools/iphonesim/Source/iPhoneSimulator.h +43 -0
- data/res/build-tools/iphonesim/Source/iPhoneSimulator.m +224 -0
- data/res/build-tools/iphonesim/Source/main.m +52 -0
- data/res/build-tools/iphonesim/Source/nsprintf.h +3 -0
- data/res/build-tools/iphonesim/Source/nsprintf.m +42 -0
- data/res/build-tools/iphonesim/build/Release/iphonesim +0 -0
- data/res/build-tools/iphonesim/iPhoneSimulatorRemoteClient/iPhoneSimulatorRemoteClient.h +124 -0
- data/res/build-tools/iphonesim/iphonesim.xcodeproj/project.pbxproj +261 -0
- data/res/build-tools/iphonesim/iphonesim_Prefix.pch +7 -0
- data/res/generators/rhogen.rb +5 -0
- data/res/generators/templates/application/app/layout.erb +7 -13
- data/res/generators/templates/application/app/loading.png +0 -0
- data/res/generators/templates/application/build.yml +3 -0
- data/res/generators/templates/application/icon/icon114.png +0 -0
- data/res/generators/templates/application/icon/icon57.png +0 -0
- data/res/generators/templates/application/icon/icon72.png +0 -0
- data/res/generators/templates/application/public/css/iphone.css +96 -0
- data/res/generators/templates/application/public/images/backButton.png +0 -0
- data/res/generators/templates/application/public/jqtouch/jqtouch.js +2 -1
- data/res/generators/templates/application/rhoconfig.txt +2 -0
- data/rhodes.gemspec +1 -1
- data/spec/phone_spec/app/spec/array_pack_spec.rb +108 -0
- data/spec/phone_spec/app/spec/bulksync_spec.rb +1 -0
- data/spec/phone_spec/app/spec/date_spec.rb +27 -0
- data/spec/phone_spec/app/spec/fixtures/classes.rb +91 -0
- data/spec/phone_spec/app/spec/lstrip_spec.rb +57 -0
- data/spec/phone_spec/app/spec/rho_spec.rb +50 -19
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +78 -0
- data/spec/phone_spec/app/spec/rstrip_spec.rb +51 -0
- data/spec/phone_spec/app/spec/strip_spec.rb +50 -0
- data/spec/phone_spec/app/spec/syncengine_spec.rb +46 -3
- data/spec/phone_spec/app/spec_runner.rb +6 -0
- metadata +34 -4
@@ -5,6 +5,7 @@ import j2me.util.StringParser;
|
|
5
5
|
|
6
6
|
import java.io.IOException;
|
7
7
|
import java.io.InputStream;
|
8
|
+
import java.util.Date;
|
8
9
|
import java.util.Enumeration;
|
9
10
|
import java.util.Hashtable;
|
10
11
|
import java.util.Vector;
|
@@ -13,6 +14,7 @@ import javax.microedition.io.HttpConnection;
|
|
13
14
|
|
14
15
|
import net.rim.blackberry.api.browser.Browser;
|
15
16
|
import net.rim.blackberry.api.browser.BrowserSession;
|
17
|
+
import net.rim.blackberry.api.invoke.Invoke;
|
16
18
|
import net.rim.device.api.browser.field.RenderingOptions;
|
17
19
|
import net.rim.device.api.io.http.HttpHeaders;
|
18
20
|
import net.rim.device.api.system.Application;
|
@@ -37,6 +39,7 @@ import net.rim.device.api.ui.component.LabelField;
|
|
37
39
|
import net.rim.device.api.ui.Manager;
|
38
40
|
import net.rim.device.api.math.Fixed32;
|
39
41
|
//import net.rim.device.api.system.EventInjector.KeyCodeEvent;
|
42
|
+
import net.rim.blackberry.api.invoke.MessageArguments;
|
40
43
|
|
41
44
|
import com.rho.*;
|
42
45
|
//import com.rho.db.DBAdapter;
|
@@ -329,6 +332,7 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
|
|
329
332
|
{
|
330
333
|
MenuItem item = menu.getItem(i);
|
331
334
|
String label = item.toString();
|
335
|
+
//LOG.INFO("*******openLink: " + label);
|
332
336
|
|
333
337
|
if( label.equalsIgnoreCase(m_strGetLink)
|
334
338
|
||label.startsWith(m_strEmailMenu) || label.startsWith(m_strCallMenu))
|
@@ -337,6 +341,15 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
|
|
337
341
|
return true;
|
338
342
|
}
|
339
343
|
}
|
344
|
+
/*
|
345
|
+
String strMenuItems = "";
|
346
|
+
for(int i=0; i<size; i++)
|
347
|
+
{
|
348
|
+
MenuItem item = menu.getItem(i);
|
349
|
+
strMenuItems += item.toString() + ";";
|
350
|
+
}
|
351
|
+
|
352
|
+
LOG.ERROR("Cannot find link menu item in menu: " + strMenuItems );*/
|
340
353
|
}finally
|
341
354
|
{
|
342
355
|
m_bOpenLink = false;
|
@@ -375,6 +388,8 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
|
|
375
388
|
{
|
376
389
|
_mainScreen.invalidate();
|
377
390
|
}
|
391
|
+
|
392
|
+
static String m_strSecurityToken = "";
|
378
393
|
/***************************************************************************
|
379
394
|
* Main.
|
380
395
|
**************************************************************************/
|
@@ -383,6 +398,14 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
|
|
383
398
|
LOG.INFO_EVENT("main start");
|
384
399
|
|
385
400
|
try{
|
401
|
+
if ( args != null )
|
402
|
+
{
|
403
|
+
for( int i = 0; i < args.length; i++)
|
404
|
+
{
|
405
|
+
if ( args[i].startsWith("security_token=") )
|
406
|
+
m_strSecurityToken = args[i].substring(15);
|
407
|
+
}
|
408
|
+
}
|
386
409
|
_instance = new RhodesApplication();
|
387
410
|
LOG.INFO_EVENT( "RhodesApplication created" );
|
388
411
|
|
@@ -574,6 +597,8 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
|
|
574
597
|
public void deactivate() {
|
575
598
|
LOG.TRACE("Rhodes deactivate ***--------------------------***");
|
576
599
|
|
600
|
+
RhoRuby.rho_ruby_deactivateApp();
|
601
|
+
|
577
602
|
// SyncEngine.stop(null);
|
578
603
|
GeoLocation.stop();
|
579
604
|
RingtoneManager.stop();
|
@@ -708,8 +733,8 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
|
|
708
733
|
return super.navigationClick(status, time);
|
709
734
|
}
|
710
735
|
|
711
|
-
protected
|
712
|
-
openLink();
|
736
|
+
protected boolean onTouchUnclick() {
|
737
|
+
return openLink();
|
713
738
|
}
|
714
739
|
|
715
740
|
private Vector menuItems = new Vector();
|
@@ -918,7 +943,11 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
|
|
918
943
|
try {
|
919
944
|
RubyProgram obj = new xruby.version.main();
|
920
945
|
String pngname = "/apps/app/loading.png";
|
921
|
-
|
946
|
+
String pngbbname = "/apps/app/loading.bb.png";
|
947
|
+
is = obj.getClass().getResourceAsStream(pngbbname);
|
948
|
+
if (is == null) {
|
949
|
+
is = obj.getClass().getResourceAsStream(pngname);
|
950
|
+
}
|
922
951
|
if ( is != null )
|
923
952
|
{
|
924
953
|
int size = is.available();
|
@@ -1018,6 +1047,14 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
|
|
1018
1047
|
|
1019
1048
|
RhoLogger.InitRhoLog();
|
1020
1049
|
|
1050
|
+
if ( AppBuildConfig.getItem("security_token") != null &&
|
1051
|
+
AppBuildConfig.getItem("security_token").compareTo(m_strSecurityToken) != 0)
|
1052
|
+
{
|
1053
|
+
LOG.INFO("This is hidden app and can be started only with security key.");
|
1054
|
+
System.exit(0);
|
1055
|
+
return;
|
1056
|
+
}
|
1057
|
+
|
1021
1058
|
LOG.INFO(" STARTING RHODES: ***----------------------------------*** " );
|
1022
1059
|
|
1023
1060
|
RhodesApp.Create(RhoConf.getInstance().getRhoRootPath());
|
@@ -1407,6 +1444,40 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
|
|
1407
1444
|
m_oFetchThread.addCommand(this);
|
1408
1445
|
}
|
1409
1446
|
|
1447
|
+
static class RhoTextMessage implements javax.wireless.messaging.TextMessage
|
1448
|
+
{
|
1449
|
+
String m_strAddress = "", m_strBody = "";
|
1450
|
+
RhoTextMessage(String strAddr, String strBody)
|
1451
|
+
{
|
1452
|
+
super();
|
1453
|
+
|
1454
|
+
m_strAddress = strAddr;
|
1455
|
+
m_strBody = strBody;
|
1456
|
+
}
|
1457
|
+
public String getPayloadText() {
|
1458
|
+
return m_strBody;
|
1459
|
+
}
|
1460
|
+
|
1461
|
+
public void setPayloadText(String arg0)
|
1462
|
+
{
|
1463
|
+
m_strBody = arg0;
|
1464
|
+
}
|
1465
|
+
|
1466
|
+
public String getAddress() {
|
1467
|
+
return m_strAddress;
|
1468
|
+
}
|
1469
|
+
|
1470
|
+
public Date getTimestamp() {
|
1471
|
+
return null;
|
1472
|
+
}
|
1473
|
+
|
1474
|
+
public void setAddress(String addr)
|
1475
|
+
{
|
1476
|
+
m_strAddress = addr;
|
1477
|
+
}
|
1478
|
+
|
1479
|
+
};
|
1480
|
+
|
1410
1481
|
void processCommand()throws IOException
|
1411
1482
|
{
|
1412
1483
|
if ( m_bActivateApp )
|
@@ -1416,6 +1487,7 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
|
|
1416
1487
|
}
|
1417
1488
|
|
1418
1489
|
URI uri = new URI(_url);
|
1490
|
+
String strMsgBody = "";
|
1419
1491
|
String query = uri.getQueryString();
|
1420
1492
|
if (query != null) {
|
1421
1493
|
StringParser tok = new StringParser(query, "&");
|
@@ -1432,9 +1504,23 @@ final public class RhodesApplication extends RhodesApplicationPlatform implement
|
|
1432
1504
|
helper.open_url(_url);
|
1433
1505
|
return;
|
1434
1506
|
}
|
1507
|
+
|
1508
|
+
if (name.equals("body"))
|
1509
|
+
{
|
1510
|
+
strMsgBody = value;
|
1511
|
+
}
|
1435
1512
|
}
|
1436
1513
|
}
|
1437
|
-
|
1514
|
+
|
1515
|
+
if ( uri.getScheme().equalsIgnoreCase("sms"))
|
1516
|
+
{
|
1517
|
+
RhoTextMessage msg = new RhoTextMessage(uri.getPath(), URI.urlDecode(strMsgBody) );
|
1518
|
+
|
1519
|
+
MessageArguments args = new MessageArguments( msg );
|
1520
|
+
Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, args);
|
1521
|
+
return;
|
1522
|
+
}
|
1523
|
+
|
1438
1524
|
HttpConnection connection = Utilities.makeConnection(_url, _requestHeaders, _postData, null);
|
1439
1525
|
|
1440
1526
|
if ( m_bInternalRequest )
|
@@ -21,6 +21,9 @@
|
|
21
21
|
#import "logging/RhoLogConf.h"
|
22
22
|
#include "ruby/ext/rho/rhoruby.h"
|
23
23
|
#import "logging/RhoLog.h"
|
24
|
+
#import "../Event/Event.h"
|
25
|
+
|
26
|
+
|
24
27
|
#undef DEFAULT_LOGCATEGORY
|
25
28
|
#define DEFAULT_LOGCATEGORY "RhodesApp"
|
26
29
|
|
@@ -266,12 +269,23 @@ int rho_sys_set_sleeping(int sleeping)
|
|
266
269
|
void rho_sys_app_exit() {
|
267
270
|
exit(EXIT_SUCCESS);
|
268
271
|
}
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
272
|
+
|
273
|
+
int rho_sys_is_app_installed(const char *appname) {
|
274
|
+
NSString* app_name = [NSString stringWithUTF8String:appname];
|
275
|
+
app_name = [app_name stringByAppendingString:@":check_for_exist"];
|
276
|
+
NSURL* nsurl = [NSURL URLWithString:app_name];
|
277
|
+
if ([[UIApplication sharedApplication] canOpenURL:nsurl]) {
|
278
|
+
return 1;
|
279
|
+
}
|
280
|
+
return 0;
|
281
|
+
}
|
282
|
+
|
283
|
+
void rho_sys_app_uninstall(const char *appname) {
|
284
|
+
NSLog(@"ALERT: Uninstall of applications is unsupported on iOS platfrom !!!");
|
273
285
|
}
|
274
286
|
|
287
|
+
|
288
|
+
|
275
289
|
void rho_sys_open_url(const char* url)
|
276
290
|
{
|
277
291
|
NSString* strUrl = [NSString stringWithUTF8String:url];
|
@@ -285,6 +299,24 @@ void rho_sys_open_url(const char* url)
|
|
285
299
|
RAWLOG_INFO("rho_sys_open_url faled.");
|
286
300
|
}
|
287
301
|
|
302
|
+
void rho_sys_run_app(const char* appname, VALUE params)
|
303
|
+
{
|
304
|
+
NSString* app_name = [NSString stringWithUTF8String:appname];
|
305
|
+
app_name = [app_name stringByAppendingString:@":"];
|
306
|
+
|
307
|
+
if (params != 0) {
|
308
|
+
//if (TYPE(params) == T_STRING) {
|
309
|
+
char* parameter = getStringFromValue(params);
|
310
|
+
if (parameter != NULL) {
|
311
|
+
NSString* param = [NSString stringWithUTF8String:(const char*)parameter];
|
312
|
+
app_name = [app_name stringByAppendingString:param];
|
313
|
+
}
|
314
|
+
//}
|
315
|
+
}
|
316
|
+
rho_sys_open_url([app_name UTF8String]);
|
317
|
+
}
|
318
|
+
|
319
|
+
|
288
320
|
extern VALUE rho_sys_has_network();
|
289
321
|
|
290
322
|
// http://www.apple.com/iphone/specs.html
|
@@ -349,7 +381,13 @@ int rho_sysimpl_get_property(char* szPropName, VALUE* resValue)
|
|
349
381
|
#endif
|
350
382
|
*resValue = rho_ruby_create_boolean(bSim);
|
351
383
|
return 1;
|
352
|
-
}
|
384
|
+
}else if (strcasecmp("has_calendar", szPropName) == 0) {
|
385
|
+
int bCal = 0;
|
386
|
+
if (is_rho_calendar_supported())
|
387
|
+
bCal = 1;
|
388
|
+
*resValue = rho_ruby_create_boolean(bCal);
|
389
|
+
return 1;
|
390
|
+
}
|
353
391
|
|
354
392
|
/*
|
355
393
|
// Removed because it's possibly dangerous: Apple could reject application
|
@@ -19,6 +19,17 @@
|
|
19
19
|
#undef DEFAULT_LOGCATEGORY
|
20
20
|
#define DEFAULT_LOGCATEGORY "Event"
|
21
21
|
|
22
|
+
|
23
|
+
BOOL is_rho_calendar_supported() {
|
24
|
+
BOOL res = YES;
|
25
|
+
#if defined(__IPHONE_4_0)
|
26
|
+
NSString *version = [[UIDevice currentDevice] systemVersion];
|
27
|
+
if ([version hasPrefix:@"3."] || [version hasPrefix:@"2."])
|
28
|
+
#endif
|
29
|
+
res = NO;
|
30
|
+
return res;
|
31
|
+
}
|
32
|
+
|
22
33
|
static void calendar_check()
|
23
34
|
{
|
24
35
|
#if defined(__IPHONE_4_0)
|
@@ -72,7 +83,7 @@ static NSDate *dateFromRuby(VALUE rDate)
|
|
72
83
|
ID id_sec = rb_intern("sec");
|
73
84
|
|
74
85
|
// Get GM time
|
75
|
-
rDate = rb_funcall(rDate, id_gmtime, 0);
|
86
|
+
//rDate = rb_funcall(rDate, id_gmtime, 0);
|
76
87
|
|
77
88
|
int year = FIX2INT(rb_funcall(rDate, id_year, 0));
|
78
89
|
int month = FIX2INT(rb_funcall(rDate, id_month, 0));
|
@@ -18,8 +18,10 @@
|
|
18
18
|
#define DEFAULT_LOGCATEGORY "Location"
|
19
19
|
|
20
20
|
int rho_rhodesapp_check_mode();
|
21
|
+
int rho_conf_getInt(const char *);
|
21
22
|
|
22
|
-
|
23
|
+
#define RHO_GEO_LOCATION_INACTIVITY_TIMEOUT 25
|
24
|
+
static CFTimeInterval timeOutInSeconds = RHO_GEO_LOCATION_INACTIVITY_TIMEOUT;
|
23
25
|
static void _TimerCallBack(CFRunLoopTimerRef timer, void* context);
|
24
26
|
|
25
27
|
// This is a singleton class, see below
|
@@ -49,7 +51,7 @@ static LocationController *sharedLC = nil;
|
|
49
51
|
}
|
50
52
|
if (_timer==NULL) {
|
51
53
|
_timer = CFRunLoopTimerCreate(NULL,
|
52
|
-
CFAbsoluteTimeGetCurrent() +
|
54
|
+
CFAbsoluteTimeGetCurrent() + timeOutInSeconds,
|
53
55
|
0, // interval
|
54
56
|
0, // flags
|
55
57
|
0, // order
|
@@ -60,7 +62,7 @@ static LocationController *sharedLC = nil;
|
|
60
62
|
return false;
|
61
63
|
CFRunLoopAddTimer(CFRunLoopGetCurrent(), _timer, kCFRunLoopCommonModes);
|
62
64
|
} else {
|
63
|
-
CFRunLoopTimerSetNextFireDate(_timer, CFAbsoluteTimeGetCurrent() +
|
65
|
+
CFRunLoopTimerSetNextFireDate(_timer, CFAbsoluteTimeGetCurrent() + timeOutInSeconds);
|
64
66
|
}
|
65
67
|
|
66
68
|
[_locationManager startUpdatingLocation];
|
@@ -72,6 +74,10 @@ static LocationController *sharedLC = nil;
|
|
72
74
|
}
|
73
75
|
|
74
76
|
- (void) initLocationManager {
|
77
|
+
int timeout = rho_conf_getInt("geo_location_inactivity_timeout");
|
78
|
+
if (timeout == 0)
|
79
|
+
timeout = RHO_GEO_LOCATION_INACTIVITY_TIMEOUT;
|
80
|
+
timeOutInSeconds = timeout;
|
75
81
|
self._locationManager = [[[CLLocationManager alloc] init] autorelease];
|
76
82
|
self._locationManager.desiredAccuracy = kCLLocationAccuracyBest;
|
77
83
|
self._locationManager.delegate = self; // Tells the location manager to send updates to this object
|
@@ -36,15 +36,17 @@ static MapViewController *mc = nil;
|
|
36
36
|
MapViewController* map = [[MapViewController alloc] init];
|
37
37
|
[map setParams:[value pointerValue]];
|
38
38
|
UIWindow *window = [[Rhodes sharedInstance] rootWindow];
|
39
|
-
map.view.autoresizingMask =
|
39
|
+
map.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
|
40
40
|
map.view.autoresizesSubviews = YES;
|
41
41
|
|
42
42
|
UIView* v = [[[Rhodes sharedInstance] mainView] view];
|
43
43
|
map.savedMainView = v;
|
44
44
|
[map.savedMainView retain];
|
45
|
+
//[window layoutSubviews];
|
45
46
|
[map.savedMainView removeFromSuperview];
|
46
47
|
//map.savedMainView.hidden = YES;
|
47
48
|
[window addSubview:map.view];
|
49
|
+
//[window layoutSubviews];
|
48
50
|
|
49
51
|
mc = map;
|
50
52
|
}
|
@@ -96,14 +98,15 @@ static MapViewController *mc = nil;
|
|
96
98
|
|
97
99
|
UIWindow *window = [[Rhodes sharedInstance] rootWindow];
|
98
100
|
|
99
|
-
CGRect frame = self.view.bounds;
|
101
|
+
//CGRect frame = self.view.bounds;
|
100
102
|
|
101
|
-
self.savedMainView.frame = frame;
|
103
|
+
//self.savedMainView.frame = frame;
|
102
104
|
|
103
105
|
|
104
106
|
[window addSubview:self.savedMainView];
|
105
|
-
[window layoutSubviews];
|
106
107
|
[self.view removeFromSuperview];
|
108
|
+
//[self.savedMainView layoutSubviews];
|
109
|
+
//[window layoutSubviews];
|
107
110
|
//self.view.hidden = YES;
|
108
111
|
|
109
112
|
[self.savedMainView release];
|
@@ -314,16 +317,21 @@ static MapViewController *mc = nil;
|
|
314
317
|
target:self action:@selector(close_clicked:)];
|
315
318
|
[toolbar setItems:[NSArray arrayWithObjects:closeButton,nil]];
|
316
319
|
|
317
|
-
[toolbar sizeToFit];
|
318
320
|
|
319
321
|
toolbar.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin |
|
320
322
|
UIViewAutoresizingFlexibleWidth;
|
321
323
|
toolbar.autoresizesSubviews = YES;
|
324
|
+
[toolbar sizeToFit];
|
322
325
|
|
323
326
|
CGFloat toolbarHeight = [toolbar frame].size.height;
|
327
|
+
// hack for do not reduce height of toolbar in Landscape mode
|
328
|
+
if (toolbarHeight < 44) {
|
329
|
+
toolbarHeight = 44;
|
330
|
+
}
|
324
331
|
|
325
332
|
//RhoMainView* rw = [[Rhodes sharedInstance] mainView];
|
326
|
-
|
333
|
+
|
334
|
+
CGRect rootViewBounds = [[[Rhodes sharedInstance] mainView] view].frame;//bounds;
|
327
335
|
|
328
336
|
self.view.frame = rootViewBounds;
|
329
337
|
|
@@ -348,7 +356,7 @@ static MapViewController *mc = nil;
|
|
348
356
|
mapView.mapType=mapType;
|
349
357
|
|
350
358
|
mapView.autoresizesSubviews = YES;
|
351
|
-
mapView.autoresizingMask =
|
359
|
+
mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
352
360
|
|
353
361
|
|
354
362
|
|
@@ -367,7 +375,7 @@ static MapViewController *mc = nil;
|
|
367
375
|
}
|
368
376
|
|
369
377
|
[self.view insertSubview:mapView atIndex:0];
|
370
|
-
[self.view layoutSubviews];
|
378
|
+
//[[self.view superview] layoutSubviews];
|
371
379
|
|
372
380
|
}
|
373
381
|
|
@@ -380,11 +388,14 @@ static MapViewController *mc = nil;
|
|
380
388
|
id<RhoMainView> mainView = [[Rhodes sharedInstance] mainView];
|
381
389
|
[mainView navigateRedirect:url tab:[mainView activeTab]];
|
382
390
|
[self dismissModalViewControllerAnimated:YES];
|
383
|
-
self
|
391
|
+
[self close];
|
392
|
+
//mc = nil;
|
393
|
+
//self.view.hidden = YES;
|
384
394
|
}
|
385
395
|
|
386
396
|
- (void) close_clicked:(id)sender {
|
387
397
|
[self close];
|
398
|
+
//mc = nil;
|
388
399
|
}
|
389
400
|
|
390
401
|
- (void)didReceiveMemoryWarning {
|
@@ -111,6 +111,22 @@ static int started = 0;
|
|
111
111
|
}
|
112
112
|
@end
|
113
113
|
|
114
|
+
@interface RhoNativeBarSetTabBadgeTask : NSObject {}
|
115
|
+
+ (void)run:(NSValue*)value :(NSValue*)val;
|
116
|
+
@end
|
117
|
+
|
118
|
+
@implementation RhoNativeBarSetTabBadgeTask
|
119
|
+
+ (void)run:(NSValue*)value :(NSValue*)val
|
120
|
+
{
|
121
|
+
int index;
|
122
|
+
char* badge_val=[val pointerValue];
|
123
|
+
[value getValue:&index];
|
124
|
+
RAWLOG_INFO1("RhoNativeBarSetTabBadgeTask %d",index);
|
125
|
+
RAWLOG_INFO1("RhoNativeBarSetTabBadgeTask %s",badge_val);
|
126
|
+
[[[Rhodes sharedInstance] mainView] setTabBadge:index val:badge_val];
|
127
|
+
}
|
128
|
+
@end
|
129
|
+
|
114
130
|
void create_nativebar(int bar_type, rho_param *p)
|
115
131
|
{
|
116
132
|
if (!rho_rhodesapp_check_mode())
|
@@ -216,6 +232,17 @@ void nativebar_switch_tab(int index) {
|
|
216
232
|
[Rhodes performOnUiThread:runnable arg:arg wait:NO];
|
217
233
|
}
|
218
234
|
|
235
|
+
void nativebar_set_tab_badge(int index, char *val)
|
236
|
+
{
|
237
|
+
RAWLOG_INFO2("set_tab_badge called: %d : %s",index,val);
|
238
|
+
id runnable = [RhoNativeBarSetTabBadgeTask class];
|
239
|
+
id arg1 = [NSValue valueWithBytes:&index objCType:@encode(int)];
|
240
|
+
id arg2 = [NSValue valueWithBytes:&val objCType:@encode(char*)];
|
241
|
+
[Rhodes performOnUiThread:runnable arg:arg1 arg:arg2 wait:YES];
|
242
|
+
|
243
|
+
RAWLOG_INFO("set_tab_badge done");
|
244
|
+
}
|
245
|
+
|
219
246
|
VALUE nativebar_started() {
|
220
247
|
return rho_ruby_create_boolean(started);
|
221
248
|
}
|
@@ -11,10 +11,19 @@
|
|
11
11
|
#include "ruby/ext/phonebook/phonebook.h"
|
12
12
|
#include "phonebook.h"
|
13
13
|
|
14
|
+
#include "logging/RhoLog.h"
|
15
|
+
|
16
|
+
|
17
|
+
#undef DEFAULT_LOGCATEGORY
|
18
|
+
#define DEFAULT_LOGCATEGORY "phonebook"
|
19
|
+
|
20
|
+
#define logging_enable NO
|
21
|
+
|
14
22
|
static int _getProperty(char* property);
|
15
23
|
static CFStringRef getAddressPartValue(ABRecordRef record, const char* property) ;
|
16
24
|
|
17
25
|
void* openPhonebook() {
|
26
|
+
if (logging_enable) RAWLOG_INFO("phonebook :: openPhonebook");
|
18
27
|
|
19
28
|
LocalPhonebook* phonebook = CFAllocatorAllocate(NULL, sizeof(LocalPhonebook), 0);
|
20
29
|
|
@@ -33,18 +42,23 @@ void* openPhonebook() {
|
|
33
42
|
}
|
34
43
|
|
35
44
|
void closePhonebook(void* pb) {
|
45
|
+
if (logging_enable) RAWLOG_INFO("phonebook :: closePhonebook");
|
36
46
|
if (pb) {
|
37
47
|
LocalPhonebook* phonebook = pb;
|
38
48
|
// Free array of pb records
|
39
49
|
if (phonebook->_people) {
|
40
50
|
CFRelease(phonebook->_people);
|
41
51
|
}
|
52
|
+
if (phonebook->_ab) {
|
53
|
+
CFRelease(phonebook->_ab);
|
54
|
+
}
|
42
55
|
// Free the memory in use by context.
|
43
56
|
CFAllocatorDeallocate(NULL, pb);
|
44
57
|
}
|
45
58
|
}
|
46
59
|
|
47
60
|
static void _getAllPeople(LocalPhonebook* phonebook) {
|
61
|
+
if (logging_enable) RAWLOG_INFO("phonebook :: getAllPeople START");
|
48
62
|
if (phonebook->_ab) {
|
49
63
|
if (phonebook->_people) {
|
50
64
|
CFRelease(phonebook->_people);
|
@@ -55,6 +69,7 @@ static void _getAllPeople(LocalPhonebook* phonebook) {
|
|
55
69
|
phonebook->_index = 0;
|
56
70
|
}
|
57
71
|
}
|
72
|
+
if (logging_enable) RAWLOG_INFO("phonebook :: getAllPeople FINISH");
|
58
73
|
}
|
59
74
|
|
60
75
|
|
@@ -315,6 +330,7 @@ static VALUE _getRecordByIndex(CFArrayRef people, CFIndex index, ABRecordID* pre
|
|
315
330
|
|
316
331
|
VALUE getallPhonebookRecords(void* pb) {
|
317
332
|
if (pb) {
|
333
|
+
if (logging_enable) RAWLOG_INFO("phonebook :: getallPhonebookRecords START");
|
318
334
|
LocalPhonebook* phonebook = pb;
|
319
335
|
|
320
336
|
VALUE hash = rho_ruby_createHash();
|
@@ -334,6 +350,7 @@ VALUE getallPhonebookRecords(void* pb) {
|
|
334
350
|
rho_ruby_releaseValue(hash);
|
335
351
|
|
336
352
|
rho_ruby_enable_gc(valGc);
|
353
|
+
if (logging_enable) RAWLOG_INFO("phonebook :: getallPhonebookRecords FINISH");
|
337
354
|
return hash;
|
338
355
|
}
|
339
356
|
return rho_ruby_get_NIL();
|
@@ -18,6 +18,7 @@
|
|
18
18
|
#define DEFAULT_LOGCATEGORY "Alert"
|
19
19
|
|
20
20
|
static UIAlertView *currentAlert = nil;
|
21
|
+
static BOOL is_current_alert_status = NO;
|
21
22
|
|
22
23
|
@interface RhoAlertShowPopupTask : NSObject<UIAlertViewDelegate> {
|
23
24
|
NSString *callback;
|
@@ -54,6 +55,8 @@ static UIAlertView *currentAlert = nil;
|
|
54
55
|
NSString *title = @"Alert";
|
55
56
|
NSString *message = nil;
|
56
57
|
|
58
|
+
is_current_alert_status = NO;
|
59
|
+
|
57
60
|
self.buttons = [NSMutableArray arrayWithCapacity:1];
|
58
61
|
rho_param *p = [v pointerValue];
|
59
62
|
if (p->type == RHO_PARAM_STRING) {
|
@@ -131,11 +134,20 @@ static UIAlertView *currentAlert = nil;
|
|
131
134
|
[buttons addObject:btn];
|
132
135
|
}
|
133
136
|
}
|
137
|
+
else if (strcasecmp(name, "status_type") == 0) {
|
138
|
+
is_current_alert_status = YES;
|
139
|
+
}
|
140
|
+
|
134
141
|
|
135
142
|
}
|
136
143
|
}
|
137
144
|
rho_param_free(p);
|
138
145
|
|
146
|
+
if ((currentAlert != nil) && (is_current_alert_status)) {
|
147
|
+
currentAlert.message = message;
|
148
|
+
return;
|
149
|
+
}
|
150
|
+
|
139
151
|
UIAlertView *alert = [[[UIAlertView alloc]
|
140
152
|
initWithTitle:title
|
141
153
|
message:message
|
@@ -154,6 +166,9 @@ static UIAlertView *currentAlert = nil;
|
|
154
166
|
}
|
155
167
|
|
156
168
|
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
|
169
|
+
currentAlert = nil;
|
170
|
+
is_current_alert_status = NO;
|
171
|
+
|
157
172
|
if (!callback)
|
158
173
|
return;
|
159
174
|
|
@@ -166,7 +181,6 @@ static UIAlertView *currentAlert = nil;
|
|
166
181
|
|
167
182
|
rho_rhodesapp_callPopupCallback([callback UTF8String], [itemId UTF8String], [itemTitle UTF8String]);
|
168
183
|
[self release];
|
169
|
-
currentAlert = nil;
|
170
184
|
}
|
171
185
|
|
172
186
|
@end
|
@@ -181,6 +195,7 @@ static UIAlertView *currentAlert = nil;
|
|
181
195
|
return;
|
182
196
|
[currentAlert dismissWithClickedButtonIndex:-1 animated:NO];
|
183
197
|
currentAlert = nil;
|
198
|
+
is_current_alert_status = NO;
|
184
199
|
}
|
185
200
|
@end
|
186
201
|
|
@@ -230,6 +245,49 @@ static UIAlertView *currentAlert = nil;
|
|
230
245
|
|
231
246
|
@end
|
232
247
|
|
248
|
+
void alert_show_status(const char* szMessage, const char* szHide)
|
249
|
+
{
|
250
|
+
//show new status dialog or update text
|
251
|
+
if (!rho_rhodesapp_check_mode())
|
252
|
+
return;
|
253
|
+
|
254
|
+
rho_param* p = rho_param_hash(4);
|
255
|
+
|
256
|
+
rho_param* p_title_key = rho_param_str("title");
|
257
|
+
rho_param* p_title_value = rho_param_str("");
|
258
|
+
|
259
|
+
rho_param* p_message_key = rho_param_str("message");
|
260
|
+
rho_param* p_message_value = rho_param_str(szMessage);
|
261
|
+
|
262
|
+
rho_param* p_buttons_key = rho_param_str("buttons");
|
263
|
+
rho_param* p_buttons_value = rho_param_array(1);
|
264
|
+
|
265
|
+
rho_param* p_status_key = rho_param_str("status_type");
|
266
|
+
rho_param* p_status_value = rho_param_str("true");
|
267
|
+
|
268
|
+
rho_param* p_button_value = rho_param_str(szHide);
|
269
|
+
|
270
|
+
p_buttons_value->v.array->value[0] = p_button_value;
|
271
|
+
|
272
|
+
p->v.hash->name[0] = p_title_key->v.string;
|
273
|
+
p->v.hash->value[0] = p_title_value;
|
274
|
+
|
275
|
+
p->v.hash->name[1] = p_message_key->v.string;
|
276
|
+
p->v.hash->value[1] = p_message_value;
|
277
|
+
|
278
|
+
p->v.hash->name[2] = p_buttons_key->v.string;
|
279
|
+
p->v.hash->value[2] = p_buttons_value;
|
280
|
+
|
281
|
+
p->v.hash->name[3] = p_status_key->v.string;
|
282
|
+
p->v.hash->value[3] = p_status_value;
|
283
|
+
|
284
|
+
[RhoAlert showPopup:p];
|
285
|
+
|
286
|
+
rho_param_free(p);
|
287
|
+
|
288
|
+
|
289
|
+
}
|
290
|
+
|
233
291
|
void alert_show_popup(rho_param *p) {
|
234
292
|
if (!rho_rhodesapp_check_mode())
|
235
293
|
return;
|
@@ -238,6 +296,8 @@ void alert_show_popup(rho_param *p) {
|
|
238
296
|
return;
|
239
297
|
}
|
240
298
|
|
299
|
+
|
300
|
+
//alert_show_status("Some message", "Close Status");
|
241
301
|
[RhoAlert showPopup:p];
|
242
302
|
}
|
243
303
|
|
@@ -37,6 +37,7 @@
|
|
37
37
|
DateTimePickerDelegate* dateTimePickerDelegate;
|
38
38
|
PickImageDelegate* pickImageDelegate;
|
39
39
|
SignatureDelegate* signatureDelegate;
|
40
|
+
NSString* start_parameters;
|
40
41
|
#ifdef __IPHONE_4_0
|
41
42
|
EKEventStore *eventStore;
|
42
43
|
#endif
|
@@ -52,6 +53,7 @@
|
|
52
53
|
#ifdef __IPHONE_4_0
|
53
54
|
@property (nonatomic, readonly) EKEventStore *eventStore;
|
54
55
|
#endif
|
56
|
+
@property (nonatomic, retain) NSString* start_parameters;
|
55
57
|
|
56
58
|
+ (Rhodes*)sharedInstance;
|
57
59
|
|