rhodes 2.2.3 → 2.2.4.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/CHANGELOG +13 -0
  2. data/Rakefile +1 -1
  3. data/bin/c2dm.rb +59 -0
  4. data/lib/extensions/barcode/ext/barcode/platform/iphone/Rakefile +4 -0
  5. data/lib/framework/rho/rho.rb +2 -0
  6. data/lib/framework/rho/rhoapplication.rb +1 -0
  7. data/lib/framework/rhodes.rb +1 -1
  8. data/lib/framework/version.rb +1 -1
  9. data/lib/rhodes.rb +1 -1
  10. data/platform/android/Rhodes/AndroidManifest.xml +1 -1
  11. data/platform/android/Rhodes/jni/src/callbacks.cpp +21 -0
  12. data/platform/android/Rhodes/jni/src/nativebar.cpp +4 -0
  13. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoActivity.java +3 -1
  14. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +68 -7
  15. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +113 -10
  16. data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +34 -3
  17. data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManager.java +21 -17
  18. data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePickerScreen.java +29 -5
  19. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +7 -0
  20. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java +37 -0
  21. data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +0 -1
  22. data/platform/android/build/RhodesSRC_build.files +24 -23
  23. data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +6 -0
  24. data/platform/bb/RubyVM/src/com/rho/RhoLogger.java +42 -20
  25. data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +111 -19
  26. data/platform/bb/RubyVM/src/com/rho/db/IDBStorage.java +2 -0
  27. data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +2 -1
  28. data/platform/bb/RubyVM/src/com/rho/net/URI.java +80 -0
  29. data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +21 -1
  30. data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +6 -1
  31. data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +139 -46
  32. data/platform/bb/build/bb.rake +8 -3
  33. data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +32 -21
  34. data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +31 -14
  35. data/platform/bb/rhodes/src/com/rho/file/Jsr75File.java +3 -2
  36. data/platform/bb/rhodes/src/com/rho/rubyext/Alert.java +3 -2
  37. data/platform/bb/rhodes/src/com/rho/rubyext/System.java +28 -0
  38. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +111 -26
  39. data/platform/iphone/Classes/AppManager/AppManager.m +22 -0
  40. data/platform/iphone/Classes/DateTimePickerDelegate.m +3 -0
  41. data/platform/iphone/Classes/MapView/MapViewController.h +8 -3
  42. data/platform/iphone/Classes/MapView/MapViewController.m +63 -12
  43. data/platform/iphone/Classes/NativeBar.h +4 -3
  44. data/platform/iphone/Classes/NativeBar.m +28 -1
  45. data/platform/iphone/Classes/Rhodes.m +87 -20
  46. data/platform/iphone/Classes/Signature/SignatureView.m +16 -10
  47. data/platform/iphone/Classes/Signature/SignatureViewController.m +2 -0
  48. data/platform/iphone/Classes/SimpleMainView.h +2 -0
  49. data/platform/iphone/Classes/SimpleMainView.m +120 -35
  50. data/platform/iphone/Classes/SplashViewController.h +8 -1
  51. data/platform/iphone/Classes/SplashViewController.m +233 -11
  52. data/platform/iphone/Classes/SplitView/LeftViewController.h +30 -0
  53. data/platform/iphone/Classes/SplitView/LeftViewController.m +189 -0
  54. data/platform/iphone/Classes/SplitView/RightViewController.h +54 -0
  55. data/platform/iphone/Classes/SplitView/RightViewController.m +268 -0
  56. data/platform/iphone/Classes/SplitView/SplitViewDelegate.h +22 -0
  57. data/platform/iphone/Classes/SplitView/SplitViewDelegate.m +92 -0
  58. data/platform/iphone/Classes/SplitView/SplittedMainView.h +65 -0
  59. data/platform/iphone/Classes/SplitView/SplittedMainView.m +304 -0
  60. data/platform/iphone/Classes/TabbedMainView.m +23 -6
  61. data/platform/iphone/Classes/WebView.m +1 -1
  62. data/platform/iphone/Info.plist +11 -2
  63. data/platform/iphone/rbuild/iphone.rake +80 -3
  64. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +50 -3
  65. data/platform/shared/common/RhoConf.cpp +5 -5
  66. data/platform/shared/db/DBAdapter.cpp +81 -3
  67. data/platform/shared/db/DBAdapter.h +1 -0
  68. data/platform/shared/json/JSONIterator.cpp +5 -0
  69. data/platform/shared/json/JSONIterator.h +1 -0
  70. data/platform/shared/net/CURLNetRequest.cpp +2 -2
  71. data/platform/shared/net/URI.cpp +53 -0
  72. data/platform/shared/net/URI.h +5 -1
  73. data/platform/shared/ruby/ext/system/system.i +9 -1
  74. data/platform/shared/ruby/ext/system/system_wrap.c +2632 -2574
  75. data/platform/shared/ruby/win32/win32.c +2 -0
  76. data/platform/shared/ruby/wince/direct.c +4 -0
  77. data/platform/shared/sync/SyncEngine.cpp +20 -1
  78. data/platform/shared/sync/SyncEngine.h +6 -1
  79. data/platform/shared/sync/SyncNotify.cpp +6 -1
  80. data/platform/shared/sync/SyncSource.cpp +130 -74
  81. data/platform/shared/sync/SyncSource.h +3 -1
  82. data/platform/wm/rhodes.sln +30 -22
  83. data/platform/wm/rhodes/Alert.cpp +4 -3
  84. data/platform/wm/rhodes/MainWindow.cpp +73 -20
  85. data/platform/wm/rhodes/RingtoneManager.cpp +4 -4
  86. data/platform/wm/rhodes/RingtoneManager.h +2 -1
  87. data/platform/wm/rhodes/Vibrate.cpp +1 -2
  88. data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +37 -0
  89. data/platform/wm/rhodes/rhodes.vcproj +219 -5
  90. data/platform/wm/rhodes/stdafx.h +1 -0
  91. data/platform/wm/rubylib/rubylib.vcproj +10 -8
  92. data/platform/wm/sqlite3/sqlite3.vcproj +6 -4
  93. data/platform/wm/syncengine/syncengine.vcproj +7 -5
  94. data/platform/wm/tcmalloc/tcmalloc.vcproj +11 -8
  95. data/rakefile.rb +1 -1
  96. data/res/generators/templates/application/public/jqtouch/jqtouch.js +9 -1
  97. data/rhodes.gemspec +1 -1
  98. data/spec/phone_spec/app/spec/bulksync_spec.rb +71 -1
  99. metadata +17 -5
@@ -263,6 +263,28 @@ int rho_sys_set_sleeping(int sleeping)
263
263
  return ret;
264
264
  }
265
265
 
266
+ void rho_sys_app_exit() {
267
+ exit(EXIT_SUCCESS);
268
+ }
269
+ void rho_sys_open_url(const char* url) ;
270
+ void rho_sys_run_app(const char* appname, VALUE params)
271
+ {
272
+ rho_sys_open_url(appname);
273
+ }
274
+
275
+ void rho_sys_open_url(const char* url)
276
+ {
277
+ NSString* strUrl = [NSString stringWithUTF8String:url];
278
+ BOOL res = FALSE;
279
+ if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:strUrl]])
280
+ res = [[UIApplication sharedApplication] openURL:[NSURL URLWithString:strUrl]];
281
+
282
+ if ( res)
283
+ RAWLOG_INFO("rho_sys_open_url suceeded.");
284
+ else
285
+ RAWLOG_INFO("rho_sys_open_url faled.");
286
+ }
287
+
266
288
  extern VALUE rho_sys_has_network();
267
289
 
268
290
  // http://www.apple.com/iphone/specs.html
@@ -105,6 +105,9 @@
105
105
 
106
106
  //CGSize pickerSize = CGSizeMake(parentFrame.size.width, parentFrame.size.height/2);
107
107
  CGSize pickerSize = [pickerView sizeThatFits:pickerView.frame.size];
108
+ if (pickerSize.width < parentFrame.size.width) {
109
+ pickerSize.width = parentFrame.size.width;
110
+ }
108
111
  CGRect pickerFrame = CGRectMake(parentFrame.origin.x,
109
112
  parentFrame.origin.y + parentFrame.size.height - pickerSize.height,
110
113
  pickerSize.width,
@@ -15,7 +15,10 @@
15
15
 
16
16
  #include "ruby/ext/rho/rhoruby.h"
17
17
 
18
- @interface MapViewController : RhoViewController <MKReverseGeocoderDelegate,MKMapViewDelegate> {
18
+
19
+
20
+
21
+ @interface MapViewController : RhoViewController <MKMapViewDelegate, MKReverseGeocoderDelegate> {
19
22
  MKMapView *mapView;
20
23
  MKReverseGeocoder *geoCoder;
21
24
  GoogleGeocoder* ggeoCoder;
@@ -28,13 +31,15 @@
28
31
  MKCoordinateRegion region;
29
32
  NSString *region_center;
30
33
  CLLocationDegrees region_radius;
31
- NSString *gapikey;
34
+ NSString *gapikey;
35
+ UIView* savedMainView;
32
36
  //IBOutlet UISegmentedControl *mapType;
33
37
  }
34
38
 
35
39
  //
36
40
  @property (copy) NSString *region_center;
37
- @property (copy) NSString *gapikey;
41
+ @property (copy) NSString *gapikey;
42
+ @property (nonatomic,retain) UIView *savedMainView;
38
43
 
39
44
  + (void)createMap:(rho_param*)params;
40
45
  + (void)closeMap;
@@ -9,6 +9,7 @@
9
9
  #import "MapAnnotation.h"
10
10
  #import "MapViewController.h"
11
11
  #import "Rhodes.h"
12
+ #import "RhoMainView.h"
12
13
 
13
14
  #include "logging/RhoLog.h"
14
15
  #include "ruby/ext/rho/rhoruby.h"
@@ -18,6 +19,10 @@
18
19
 
19
20
  static MapViewController *mc = nil;
20
21
 
22
+
23
+
24
+
25
+
21
26
  @interface RhoCreateMapTask : NSObject {}
22
27
  + (void)run:(NSValue*)value;
23
28
  @end
@@ -31,7 +36,15 @@ static MapViewController *mc = nil;
31
36
  MapViewController* map = [[MapViewController alloc] init];
32
37
  [map setParams:[value pointerValue]];
33
38
  UIWindow *window = [[Rhodes sharedInstance] rootWindow];
34
- [window addSubview:map.view];
39
+ map.view.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
40
+ map.view.autoresizesSubviews = YES;
41
+
42
+ UIView* v = [[[Rhodes sharedInstance] mainView] view];
43
+ map.savedMainView = v;
44
+ [map.savedMainView retain];
45
+ [map.savedMainView removeFromSuperview];
46
+ //map.savedMainView.hidden = YES;
47
+ [window addSubview:map.view];
35
48
 
36
49
  mc = map;
37
50
  }
@@ -53,7 +66,7 @@ static MapViewController *mc = nil;
53
66
 
54
67
  @implementation MapViewController
55
68
 
56
- @synthesize region_center, gapikey;
69
+ @synthesize region_center, gapikey, savedMainView;
57
70
 
58
71
  + (void)createMap:(rho_param *)params {
59
72
  id runnable = [RhoCreateMapTask class];
@@ -80,7 +93,21 @@ static MapViewController *mc = nil;
80
93
 
81
94
  - (void)close {
82
95
  [self dismissModalViewControllerAnimated:YES];
83
- self.view.hidden = YES;
96
+
97
+ UIWindow *window = [[Rhodes sharedInstance] rootWindow];
98
+
99
+ CGRect frame = self.view.bounds;
100
+
101
+ self.savedMainView.frame = frame;
102
+
103
+
104
+ [window addSubview:self.savedMainView];
105
+ [window layoutSubviews];
106
+ [self.view removeFromSuperview];
107
+ //self.view.hidden = YES;
108
+
109
+ [self.savedMainView release];
110
+ self.savedMainView = nil;
84
111
  }
85
112
 
86
113
  - (void)setSettings:(rho_param*)p {
@@ -274,6 +301,7 @@ static MapViewController *mc = nil;
274
301
  rho_param_free(p);
275
302
  }
276
303
 
304
+
277
305
  // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
278
306
  - (void)viewDidLoad {
279
307
  [super viewDidLoad];
@@ -281,28 +309,49 @@ static MapViewController *mc = nil;
281
309
  //Initialize the toolbar
282
310
  toolbar = [[UIToolbar alloc] init];
283
311
  toolbar.barStyle = UIBarStyleBlack;
284
- [toolbar sizeToFit];
285
- CGFloat toolbarHeight = [toolbar frame].size.height;
286
- CGRect rootViewBounds = self.view.bounds;
287
- CGFloat rootViewHeight = CGRectGetHeight(rootViewBounds);
288
- CGFloat rootViewWidth = CGRectGetWidth(rootViewBounds);
289
- CGRect rectArea = CGRectMake(0, rootViewHeight - toolbarHeight, rootViewWidth, toolbarHeight);
290
- [toolbar setFrame:rectArea];
291
312
  UIBarButtonItem *closeButton = [[UIBarButtonItem alloc]
292
313
  initWithTitle:@"Close" style:UIBarButtonItemStyleBordered
293
314
  target:self action:@selector(close_clicked:)];
294
315
  [toolbar setItems:[NSArray arrayWithObjects:closeButton,nil]];
295
- [self.view addSubview:toolbar];
316
+
317
+ [toolbar sizeToFit];
318
+
319
+ toolbar.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin |
320
+ UIViewAutoresizingFlexibleWidth;
321
+ toolbar.autoresizesSubviews = YES;
322
+
323
+ CGFloat toolbarHeight = [toolbar frame].size.height;
324
+
325
+ //RhoMainView* rw = [[Rhodes sharedInstance] mainView];
326
+ CGRect rootViewBounds = [[[Rhodes sharedInstance] mainView] view].bounds;
327
+
328
+ self.view.frame = rootViewBounds;
329
+
330
+ CGFloat rootViewHeight = rootViewBounds.size.height;
331
+ //CGFloat rootViewHeight = CGRectGetHeight(rootViewBounds);
332
+ CGFloat rootViewWidth = CGRectGetWidth(rootViewBounds);
333
+ CGRect rectArea = CGRectMake(0, rootViewHeight - toolbarHeight, rootViewWidth, toolbarHeight);
334
+ toolbar.frame = rectArea;
335
+
336
+
337
+ [self.view addSubview:toolbar];
296
338
  [closeButton release];
297
339
 
298
340
  CGRect rectMapArea = CGRectMake(0, 0, rootViewWidth, rootViewHeight - toolbarHeight);
299
- mapView=[[MKMapView alloc] initWithFrame:rectMapArea];
341
+ mapView =[[MKMapView alloc] initWithFrame:rectMapArea];
342
+ mapView.frame = rectMapArea;
300
343
  mapView.delegate=self;
301
344
 
302
345
  mapView.showsUserLocation=showsUserLocation;
303
346
  mapView.scrollEnabled=scrollEnabled;
304
347
  mapView.zoomEnabled=zoomEnabled;
305
348
  mapView.mapType=mapType;
349
+
350
+ mapView.autoresizesSubviews = YES;
351
+ mapView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
352
+
353
+
354
+
306
355
 
307
356
  /*Geocoder Stuff*/
308
357
  [ggeoCoder start];
@@ -318,6 +367,8 @@ static MapViewController *mc = nil;
318
367
  }
319
368
 
320
369
  [self.view insertSubview:mapView atIndex:0];
370
+ [self.view layoutSubviews];
371
+
321
372
  }
322
373
 
323
374
  - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view
@@ -9,6 +9,7 @@
9
9
  #import <Foundation/Foundation.h>
10
10
  #import <UIKit/UIKit.h>
11
11
 
12
- #define TOOLBAR_TYPE 0
13
- #define TABBAR_TYPE 1
14
- #define NOBAR_TYPE 2
12
+ #define TOOLBAR_TYPE 0
13
+ #define TABBAR_TYPE 1
14
+ #define NOBAR_TYPE 2
15
+ #define VTABBAR_TYPE 3
@@ -10,6 +10,7 @@
10
10
  #import "Rhodes.h"
11
11
  #import "SimpleMainView.h"
12
12
  #import "TabbedMainView.h"
13
+ #import "SplittedMainView.h"
13
14
 
14
15
  //#include "common/rhoparams.h"
15
16
  #include "logging/RhoLog.h"
@@ -63,11 +64,32 @@ static int started = 0;
63
64
  }
64
65
  started = 1;
65
66
  break;
66
- case TABBAR_TYPE:
67
+ case TABBAR_TYPE: {
67
68
  view = [[TabbedMainView alloc] initWithMainView:mainView parent:w tabs:items];
68
69
  started = 1;
69
70
  [r setMainView:view];
70
71
  [view release];
72
+ }
73
+ break;
74
+ case VTABBAR_TYPE: {
75
+
76
+ BOOL is_iPad = NO;
77
+ {
78
+ NSString *model = [[UIDevice currentDevice] model]; // "iPad ..."
79
+ if ([model hasPrefix:@"iPad"]) {
80
+ is_iPad = YES;
81
+ }
82
+ }
83
+ if (is_iPad) {
84
+ view = [[SplittedMainView alloc] initWithMainView:mainView parent:w tabs:items];
85
+ }
86
+ else {
87
+ view = [[TabbedMainView alloc] initWithMainView:mainView parent:w tabs:items];
88
+ }
89
+ started = 1;
90
+ [r setMainView:view];
91
+ [view release];
92
+ }
71
93
  break;
72
94
  default:
73
95
  RAWLOG_ERROR1("Unknown bar type passed: %d", type);
@@ -123,6 +145,7 @@ void create_nativebar(int bar_type, rho_param *p)
123
145
 
124
146
  int size = params->v.array->size;
125
147
  NSMutableArray *items = [NSMutableArray arrayWithCapacity:size];
148
+
126
149
  for (int i = 0; i < size; ++i) {
127
150
  rho_param *hash = params->v.array->value[i];
128
151
  if (hash->type != RHO_PARAM_HASH) {
@@ -134,6 +157,7 @@ void create_nativebar(int bar_type, rho_param *p)
134
157
  const char *action = NULL;
135
158
  const char *icon = NULL;
136
159
  const char *reload = NULL;
160
+ const char *colored_icon = NULL;
137
161
 
138
162
  for (int j = 0, lim = hash->v.hash->size; j < lim; ++j) {
139
163
  const char *name = hash->v.hash->name[j];
@@ -151,6 +175,8 @@ void create_nativebar(int bar_type, rho_param *p)
151
175
  icon = value->v.string;
152
176
  else if (strcasecmp(name, "reload") == 0)
153
177
  reload = value->v.string;
178
+ else if (strcasecmp(name, "colored_icon") == 0)
179
+ colored_icon = value->v.string;
154
180
  }
155
181
 
156
182
  if (label == NULL && bar_type == TOOLBAR_TYPE)
@@ -165,6 +191,7 @@ void create_nativebar(int bar_type, rho_param *p)
165
191
  [items addObject:[NSString stringWithUTF8String:action]];
166
192
  [items addObject:[NSString stringWithUTF8String:(icon ? icon : "")]];
167
193
  [items addObject:[NSString stringWithUTF8String:(reload ? reload : "false")]];
194
+ [items addObject:[NSString stringWithUTF8String:(colored_icon ? colored_icon : "false")]];
168
195
  }
169
196
 
170
197
  id runnable = [RhoNativeBarCreateTask class];
@@ -9,6 +9,7 @@
9
9
  #include "logging/RhoLog.h"
10
10
  #include "common/RhoConf.h"
11
11
  #include "common/RhodesApp.h"
12
+ #import "SplitView/SplittedMainView.h"
12
13
 
13
14
  #undef DEFAULT_LOGCATEGORY
14
15
  #define DEFAULT_LOGCATEGORY "Rhodes"
@@ -302,46 +303,110 @@ static Rhodes *instance = NULL;
302
303
  [splashViewController hideSplash];
303
304
  [splashViewController release];
304
305
  splashViewController = nil;
306
+
307
+ [window addSubview:mainView.view];
308
+ [window bringSubviewToFront:mainView.view];
305
309
  }
306
310
  }
307
311
 
308
312
  - (void)setMainView:(id<RhoMainView,NSObject>)view {
309
313
  if (mainView == view)
310
314
  return;
311
-
312
- [self hideSplash];
315
+
316
+ UIViewController* sv = mainView;
317
+ //[self hideSplash];
313
318
 
314
- [mainView.view removeFromSuperview];
315
- [mainView release];
319
+ // Special hack for solve problem with VerticalTabBar on iPad
320
+ // When we switch from VerticalTabBar to any View - autorotation is disabled and application switch to Portrait orientation
321
+ // But there are no problme on iPhone 4.1 and above
322
+ //I think this is special iPad 3.2 problem
323
+ BOOL isVerticalTab = NO;
324
+ if ([mainView isKindOfClass:[SplittedMainView class]]) {
325
+ BOOL is_iPad = NO;
326
+
327
+ NSString *model = [[UIDevice currentDevice] model]; // "iPad ..."
328
+ if ([model hasPrefix:@"iPad"]) {
329
+ is_iPad = YES;
330
+ }
331
+
332
+ isVerticalTab = is_iPad;
333
+ }
334
+
335
+ CGRect main_frame = mainView.view.frame;
336
+
337
+ UIWindow* www = window;
338
+ if (isVerticalTab) {
339
+
340
+ window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
341
+ window.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
342
+ window.autoresizesSubviews = YES;
343
+
344
+ //view.view.frame = main_frame;
345
+ mainView = nil;
346
+ }
347
+ else {
348
+ [mainView.view removeFromSuperview];
349
+ [mainView release];
350
+ }
351
+
316
352
  mainView = [view retain];
317
353
  [window addSubview:mainView.view];
354
+ //[window bringSubviewToFront:mainView.view];
355
+
356
+ if (isVerticalTab) {
357
+ [window makeKeyAndVisible];
358
+
359
+ [sv.view removeFromSuperview];
360
+ [sv release];
361
+ [www release];
362
+ }
363
+ [window layoutSubviews];
364
+
318
365
  }
319
366
 
320
367
  - (id<RhoMainView,NSObject>)mainView {
321
368
  return mainView;
322
369
  }
323
370
 
324
- - (void) showLoadingPage
371
+
372
+
373
+ // make splash screen
374
+ // return YES if SplashScreen maked
375
+ - (BOOL) showLoadingPagePre
325
376
  {
326
377
  NSFileManager *fileManager = [NSFileManager defaultManager];
327
378
 
328
379
  NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
329
- NSString *pngPath = [NSString stringWithFormat:@"%@/apps/app/loading.png", resourcePath];
330
380
  NSString *htmPath = [NSString stringWithFormat:@"%@/apps/app/loading.html", resourcePath];
331
381
 
332
- if ([fileManager fileExistsAtPath:pngPath]) {
382
+ if ([SplashViewController hasLoadingImage]) {
333
383
  splashViewController = [[SplashViewController alloc] initWithParentView:window];
334
- [splashViewController showSplash:pngPath];
335
384
  }
336
385
  else if ([fileManager fileExistsAtPath:htmPath]) {
337
386
  NSError *err;
338
387
  NSString *data = [NSString stringWithContentsOfFile:htmPath encoding:NSUTF8StringEncoding error:&err];
339
388
  [mainView loadHTMLString:data];
340
- rho_splash_screen_start();
389
+ }
390
+ return [SplashViewController hasLoadingImage];
391
+ }
341
392
 
393
+ // execute rho_splash_screen_start(); - we can do it only after Rhodes initialization
394
+ - (void) showLoadingPagePost
395
+ {
396
+ NSFileManager *fileManager = [NSFileManager defaultManager];
397
+ NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
398
+ NSString *htmPath = [NSString stringWithFormat:@"%@/apps/app/loading.html", resourcePath];
399
+
400
+ if (splashViewController != nil) {
401
+ rho_splash_screen_start();
402
+ }
403
+ else if ([fileManager fileExistsAtPath:htmPath]) {
404
+ rho_splash_screen_start();
405
+
342
406
  }
343
407
  }
344
408
 
409
+
345
410
  - (void)doRhoActivate {
346
411
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
347
412
  @try {
@@ -374,7 +439,7 @@ static Rhodes *instance = NULL;
374
439
  rotationLocked = rho_conf_getBool("disable_screen_rotation");
375
440
 
376
441
  NSLog(@"Show loading page");
377
- [self performSelectorOnMainThread:@selector(showLoadingPage) withObject:nil waitUntilDone:NO];
442
+ [self performSelectorOnMainThread:@selector(showLoadingPagePost) withObject:nil waitUntilDone:NO];
378
443
 
379
444
  NSLog(@"Start rhodes app");
380
445
  rho_rhodesapp_start();
@@ -388,7 +453,7 @@ static Rhodes *instance = NULL;
388
453
  NSLog(@"Rhodes starting application...");
389
454
  instance = self;
390
455
  application = [UIApplication sharedApplication];
391
- rotationLocked = YES;
456
+ rotationLocked = NO;
392
457
 
393
458
  [NSThread setThreadPriority:1.0];
394
459
 
@@ -401,16 +466,22 @@ static Rhodes *instance = NULL;
401
466
  window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
402
467
  window.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
403
468
  window.autoresizesSubviews = YES;
404
-
469
+
405
470
  mainView = nil;
406
- self.mainView = [[SimpleMainView alloc] initWithParentView:window frame:[Rhodes applicationFrame]];
471
+ mainView = [[SimpleMainView alloc] initWithParentView:window frame:[Rhodes applicationFrame]];
407
472
  mainView.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
408
473
  mainView.view.autoresizesSubviews = YES;
409
474
 
475
+ BOOL is_splash_screen_maked = [self showLoadingPagePre];
476
+
477
+ if (!is_splash_screen_maked) {
478
+ [window addSubview:mainView.view];
479
+ }
480
+
410
481
  [window makeKeyAndVisible];
411
-
412
- [window addSubview:mainView.view];
413
-
482
+
483
+ CGRect rrr = [application statusBarFrame];
484
+
414
485
  NSLog(@"Init cookies");
415
486
  cookies = [[NSMutableDictionary alloc] initWithCapacity:0];
416
487
 
@@ -689,7 +760,3 @@ void _rho_ext_syscall(PARAMS_WRAPPER* params) {
689
760
  void rho_conf_show_log() {
690
761
  [[Rhodes sharedInstance] showLog];
691
762
  }
692
-
693
- void rho_sys_app_exit() {
694
- exit(EXIT_SUCCESS);
695
- }