rhodes 2.3.0 → 2.3.1.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/Manifest.txt +5819 -0
- data/README.md +2 -2
- data/Rakefile +9 -5
- data/doc/build.txt +7 -13
- data/doc/configuration.txt +4 -0
- data/doc/connect-to-web-services.txt +0 -1
- data/doc/device-caps.txt +2 -2
- data/doc/extensions.txt +2 -0
- data/doc/linea.txt +699 -0
- data/doc/rhom.txt +2 -1
- data/doc/synchronization.txt +39 -2
- data/doc/ui.txt +1 -0
- data/installer/README.html +1 -1
- data/lib/build/jake.rb +3 -0
- data/lib/framework/res/esri.wm.png +0 -0
- data/lib/framework/rho/render.rb +2 -0
- data/lib/framework/rho/rho.rb +17 -10
- data/lib/framework/rho/rhoapplication.rb +13 -3
- data/lib/framework/rho/rhoevent_bb.rb +3 -1
- data/lib/framework/rho/rhoevent_c.rb +4 -1
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rhom/rhom.rb +10 -0
- data/lib/framework/rhom/rhom_object_factory.rb +45 -0
- data/lib/framework/rhom/rhom_source.rb +1 -1
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/AndroidManifest.xml +2 -2
- data/platform/android/Rhodes/jni/include/rhodes/RhoClassFactory.h +1 -1
- data/platform/android/Rhodes/jni/src/RhoClassFactory.cpp +1 -1
- data/platform/android/Rhodes/jni/src/callbacks.cpp +9 -11
- data/platform/android/Rhodes/jni/src/event.cpp +17 -9
- data/platform/android/Rhodes/jni/src/mapview.cpp +34 -4
- data/platform/android/Rhodes/jni/src/rhodes.cpp +1 -1
- data/platform/android/Rhodes/res/drawable/esri.png +0 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +3 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +8 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +80 -9
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +29 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +4 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +50 -10
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java +3 -0
- data/platform/android/build/android.rake +45 -23
- data/platform/android/build/librhocommon_build.files +1 -0
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +6 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/CachedDataRow.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/CachedRow.java +3 -2
- data/platform/bb/Hsqldb/src/org/hsqldb/Row.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/persist/CachedObject.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/persist/DataFileCache.java +66 -16
- data/platform/bb/Hsqldb/src/org/hsqldb/persist/HsqlDatabaseProperties.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/RhoCrypto.java +116 -0
- data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +39 -2
- data/platform/bb/RubyVM/src/com/rho/Tokenizer.java +11 -6
- data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +157 -150
- data/platform/bb/RubyVM/src/com/rho/db/IDBStorage.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/file/RhoFile.java +15 -0
- data/platform/bb/RubyVM/src/com/rho/net/AsyncHttp.java +35 -23
- data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +6 -9
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +54 -16
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +18 -9
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +37 -59
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +3 -0
- data/platform/bb/build/RubyVM_build.files +1 -0
- data/platform/bb/build/bb.rake +4 -5
- data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +4 -1
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteStorage.java +8 -3
- data/platform/bb/rhodes/resources/esri.png +0 -0
- data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +2 -0
- data/platform/bb/rhodes/src/com/rho/db/SqliteStorage.java +8 -3
- data/platform/bb/rhodes/src/com/rho/rubyext/RhoCalendar.java +4 -1
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +2 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/ESRIMapField.java +9 -0
- data/platform/iphone/Classes/Event/Event.m +12 -2
- data/platform/iphone/Classes/NativeBar.h +12 -11
- data/platform/iphone/Classes/NativeBar.m +13 -3
- data/platform/iphone/Classes/Rhodes.m +48 -10
- data/platform/iphone/Classes/SimpleMainView.h +1 -0
- data/platform/iphone/Classes/SimpleMainView.m +7 -1
- data/platform/iphone/Classes/SplitView/LeftViewController.m +3 -0
- data/platform/iphone/Classes/SplitView/RightViewController.m +11 -6
- data/platform/iphone/Classes/SplitView/SplittedMainView.m +8 -0
- data/platform/iphone/Classes/TabbedMainView.m +39 -3
- data/platform/iphone/Info.plist +1 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +4 -0
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +3 -3
- data/platform/shared/SyncClient/SyncClient.cpp +23 -23
- data/platform/shared/common/IRhoClassFactory.h +6 -4
- data/platform/shared/common/RhoAppAdapter.h +1 -1
- data/platform/shared/common/RhoFile.cpp +10 -0
- data/platform/shared/common/RhoFile.h +1 -0
- data/platform/shared/common/RhoMutexLock.h +1 -1
- data/platform/shared/common/RhoStd.h +5 -0
- data/platform/shared/common/RhoThread.cpp +2 -2
- data/platform/shared/common/RhoThread.h +1 -2
- data/platform/shared/common/RhodesApp.cpp +33 -55
- data/platform/shared/common/RhodesApp.h +0 -5
- data/platform/shared/common/RhodesAppBase.cpp +1 -1
- data/platform/shared/common/SplashScreen.cpp +1 -2
- data/platform/shared/common/ThreadQueue.cpp +31 -4
- data/platform/shared/common/ThreadQueue.h +10 -3
- data/platform/shared/common/Tokenizer.cpp +12 -8
- data/platform/shared/common/iphone/RhoClassFactory.cpp +5 -8
- data/platform/shared/common/iphone/RhoClassfactory.h +1 -1
- data/platform/shared/common/map/ESRIMapEngine.cpp +17 -7
- data/platform/shared/common/map/ESRIMapEngine.h +11 -1
- data/platform/shared/common/map/GoogleMapEngine.cpp +3 -3
- data/platform/shared/common/map/GoogleMapEngine.h +2 -2
- data/platform/shared/common/map/MapEngine.cpp +37 -0
- data/platform/shared/common/map/MapEngine.h +5 -0
- data/platform/shared/db/DBAdapter.cpp +113 -81
- data/platform/shared/db/DBAdapter.h +21 -5
- data/platform/shared/db/DBAttrManager.cpp +2 -2
- data/platform/shared/db/DBResult.h +28 -0
- data/platform/shared/net/AsyncHttp.cpp +48 -48
- data/platform/shared/net/AsyncHttp.h +15 -12
- data/platform/shared/net/CURLNetRequest.cpp +27 -105
- data/platform/shared/net/CURLNetRequest.h +8 -15
- data/platform/shared/net/INetRequest.cpp +122 -0
- data/platform/shared/net/INetRequest.h +96 -23
- data/platform/shared/net/ssl.cpp +1 -1
- data/platform/shared/ruby/ext/calendar/calendar.i +2 -2
- data/platform/shared/ruby/ext/calendar/calendar_wrap.c +30 -3
- data/platform/shared/rubyext/GeoLocation.cpp +4 -5
- data/platform/shared/rubyext/GeoLocation.h +4 -4
- data/platform/shared/rubyext/RhoAppAdapter.cpp +1 -1
- data/platform/shared/rubyext/System.cpp +3 -0
- data/platform/shared/sync/ClientRegister.cpp +6 -9
- data/platform/shared/sync/ClientRegister.h +8 -6
- data/platform/shared/sync/SyncEngine.cpp +54 -30
- data/platform/shared/sync/SyncEngine.h +9 -11
- data/platform/shared/sync/SyncNotify.cpp +19 -14
- data/platform/shared/sync/SyncNotify.h +5 -12
- data/platform/shared/sync/SyncSource.cpp +53 -76
- data/platform/shared/sync/SyncSource.h +5 -4
- data/platform/shared/sync/SyncThread.cpp +5 -7
- data/platform/shared/sync/SyncThread.h +2 -2
- data/platform/wm/RhoLib/RhoLib.vcproj +43 -39
- data/platform/wm/build/wm.rake +19 -17
- data/platform/wm/rhodes/AppManager.cpp +4 -4
- data/platform/wm/rhodes/MainWindow.cpp +0 -1
- data/platform/wm/rhodes/MapView/MapViewManager.cpp +4 -0
- data/platform/wm/rhodes/Vibrate.cpp +2 -2
- data/platform/wm/rhodes/Vibrate.h +1 -1
- data/platform/wm/rhodes/rho/common/RhoClassFactory.cpp +7 -5
- data/platform/wm/rhodes/rho/common/RhoClassFactory.h +3 -3
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +24 -10
- data/platform/wm/rhodes/rho/net/NetRequestImpl.h +49 -25
- data/platform/wm/rhodes/rho/rubyext/calendar.cpp +16 -2
- data/platform/wm/rhodes/rhodes.vcproj +77 -85
- data/platform/wm/tools/detool/detool.cpp +16 -6
- data/rakefile.rb +9 -5
- data/res/build-tools/detool.exe +0 -0
- data/rhodes.gemspec +2 -2
- data/spec/phone_spec/app/spec/blobsync_spec.rb +1 -0
- data/spec/phone_spec/app/spec/events_spec.rb +13 -2
- data/spec/phone_spec/app/spec/mapview_spec.rb +2 -2
- data/spec/phone_spec/app/spec/nativebar_spec.rb +3 -3
- data/spec/phone_spec/app/spec/navbar_spec.rb +3 -3
- data/spec/phone_spec/app/spec/rho_spec.rb +1 -1
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +1 -1
- data/spec/phone_spec/app/spec/syncengine_spec.rb +219 -0
- data/spec/phone_spec/build.yml +1 -0
- metadata +15 -8
- data/platform/wm/rhodes/rho/net/NetRequest.cpp +0 -89
- data/platform/wm/rhodes/rho/net/NetRequest.h +0 -45
data/doc/synchronization.txt
CHANGED
@@ -150,8 +150,13 @@ These parameters are included in all notifications.
|
|
150
150
|
#### "error"
|
151
151
|
* `@params["error_code"]` - HTTP response code of the RhoSync server error: 401, 500, 404, etc.
|
152
152
|
* `@params["error_message"]` - Response body (if any)
|
153
|
-
* `@params["
|
154
|
-
|
153
|
+
* `@params["server_errors"]` - Hash of Type objects of RhoSync adapter error (if exists): "login-error", "query-error", "create-error", "update-error", "delete-error", "logoff-error"
|
154
|
+
|
155
|
+
For "login-error", "query-error", "logoff-error": Type object is hash contains 'message' from server: @params["server_errors"]["query-error"]['message']
|
156
|
+
|
157
|
+
For "create-error", "update-error", "delete-error": Type object is hash each containing an "object" as a key (that failed to create) and a corresponding "message": @params["server_errors"]["create-error"][object]['message']
|
158
|
+
|
159
|
+
**NOTE: "create-error" has to be handled in sync callback. Otherwise sync will stop on this model. To fix create errors you should call Model.on_sync_create_error or SyncEngine.on_sync_create_error**
|
155
160
|
|
156
161
|
#### "ok"
|
157
162
|
* `@params["total_count"]` - Total number of records that exist for this RhoSync source.
|
@@ -166,6 +171,21 @@ This status returns for bulk-sync models that use [`FixedSchema`](/rhom#fixed-sc
|
|
166
171
|
|
167
172
|
**NOTE: In this scenario the sync callback should notify the user with a wait screen and start the bulk sync process.**
|
168
173
|
|
174
|
+
### Server create-error processing on client
|
175
|
+
"create-error" has to be handled in sync callback. Otherwise sync will stop on this model. To fix create errors you should call Model.on_sync_create_error or SyncEngine.on_sync_create_error:
|
176
|
+
|
177
|
+
:::ruby
|
178
|
+
SyncEngine.on_sync_create_error( src_name, objects, action )
|
179
|
+
Model.on_sync_create_error( objects, action )
|
180
|
+
|
181
|
+
* objects - One or more error objects
|
182
|
+
* action - May be :delete or :recreate. :delete just remove object from client, :recreate will push this object to server again at next sync.
|
183
|
+
|
184
|
+
For example:
|
185
|
+
:::ruby
|
186
|
+
SyncEngine.on_sync_create_error( @params['source_name'],
|
187
|
+
@params['server_errors']['create-error'].keys(), :delete)
|
188
|
+
|
169
189
|
### Notification Example
|
170
190
|
Here is a simple example of a sync notification method that uses some of the parameters described above:
|
171
191
|
|
@@ -181,6 +201,13 @@ Here is a simple example of a sync notification method that uses some of the par
|
|
181
201
|
WebView.navigate Rho::RhoConfig.start_path
|
182
202
|
|
183
203
|
elsif status == "error"
|
204
|
+
|
205
|
+
if @params['server_errors'] &&
|
206
|
+
@params['server_errors']['create-error']
|
207
|
+
SyncEngine.on_sync_create_error( @params['source_name'],
|
208
|
+
@params['server_errors']['create-error'].keys(), :delete)
|
209
|
+
end
|
210
|
+
|
184
211
|
err_code = @params['error_code'].to_i
|
185
212
|
rho_error = Rho::RhoError.new(err_code)
|
186
213
|
|
@@ -427,6 +454,16 @@ Clears the sync notification for a given source id.
|
|
427
454
|
|
428
455
|
:::ruby
|
429
456
|
SyncEngine.clear_notification(Product.get_source_id)
|
457
|
+
|
458
|
+
### `on_sync_create_error( src_name, objects, action )`
|
459
|
+
"create-error" has to be handled in sync callback. Otherwise sync will stop on this model. To fix create errors you should call Model.on_sync_create_error or SyncEngine.on_sync_create_error.
|
460
|
+
|
461
|
+
:::ruby
|
462
|
+
SyncEngine.on_sync_create_error( @params['source_name'],
|
463
|
+
@params['server_errors']['create-error'].keys(), :delete)
|
464
|
+
|
465
|
+
* objects - One or more error objects
|
466
|
+
* action - May be :delete or :recreate. :delete just remove object from client, :recreate will push this object to server again at next sync.
|
430
467
|
|
431
468
|
### `set_pollinterval(interval)`
|
432
469
|
Update the `SyncEngine` poll interval. Setting this to 0 will disable polling-based sync. However, you may still use [push-based-sync](/rhosync/push).
|
data/doc/ui.txt
CHANGED
@@ -536,6 +536,7 @@ Each tabbar item defined in the above sample defines following tab elements:
|
|
536
536
|
* :selected_color => 0xFFFF00 - Optional parameter for change selected color of this tabs (if you use it on Android - you should defined it for all tabs! and also define :background_color for TabBar!)
|
537
537
|
* :disabled => true - Optional parameter for disable this tab
|
538
538
|
* :web_bkg_color = > int hex value (like HTML color) - background color for tab (use when your app bkg is not white for remove blink during switch tabs)
|
539
|
+
* :use_current_view_for_tab => true - Optional argument which tells rhodes to smooth transfer WebView from current view into this Tab and make this Tab active. Defaults to false. Only one Tab can have this parameter!
|
539
540
|
|
540
541
|
|
541
542
|
Behind the scenes, Rho::RhoApplication will detect the @tabs array in its initialize method and build the native bar through the following function:
|
data/installer/README.html
CHANGED
@@ -65,7 +65,7 @@ html, body {
|
|
65
65
|
|
66
66
|
<h3>Building Your Rhodes Application</h3>
|
67
67
|
|
68
|
-
<p>To build your Rhodes application, please see the <a href="http://
|
68
|
+
<p>To build your Rhodes application, please see the <a href="http://docs.rhomobile.com/rhodes/tutorial">Rhodes Tutorial</a>.</p>
|
69
69
|
|
70
70
|
<h3>More Info</h3>
|
71
71
|
|
data/lib/build/jake.rb
CHANGED
@@ -139,6 +139,8 @@ class Jake
|
|
139
139
|
ensure
|
140
140
|
server.shutdown
|
141
141
|
end
|
142
|
+
|
143
|
+
$failed.to_i
|
142
144
|
end
|
143
145
|
|
144
146
|
def self.before_run_spec()
|
@@ -244,6 +246,7 @@ class Jake
|
|
244
246
|
Process.kill( 9, f.pid )
|
245
247
|
end
|
246
248
|
else
|
249
|
+
retval += line
|
247
250
|
puts "RET: " + line
|
248
251
|
$stdout.flush
|
249
252
|
end
|
Binary file
|
data/lib/framework/rho/render.rb
CHANGED
data/lib/framework/rho/rho.rb
CHANGED
@@ -714,17 +714,20 @@ module Rho
|
|
714
714
|
end
|
715
715
|
|
716
716
|
else
|
717
|
-
if !source['source_id']
|
718
|
-
source['source_id'] = start_id
|
719
|
-
Rho::RhoConfig::sources[name]['source_id'] = start_id
|
720
|
-
|
721
|
-
start_id += 1
|
722
|
-
end
|
723
717
|
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
718
|
+
#puts "Rho::RhoConfig.use_bulk_model : #{Rho::RhoConfig.use_bulk_model}"
|
719
|
+
if Rho::RhoConfig.use_bulk_model.to_s != 'true' && Rho::RhoConfig.use_bulk_model.to_s != '1'
|
720
|
+
if !source['source_id']
|
721
|
+
source['source_id'] = start_id
|
722
|
+
Rho::RhoConfig::sources[name]['source_id'] = start_id
|
723
|
+
|
724
|
+
start_id += 1
|
725
|
+
end
|
726
|
+
|
727
|
+
db.insert_into_table('sources',
|
728
|
+
{"source_id"=>source['source_id'],"name"=>name, "sync_priority"=>sync_priority, "sync_type"=>sync_type, "partition"=>partition,
|
729
|
+
"schema_version"=>source['schema_version'], 'associations'=>associations, 'blob_attribs'=>blob_attribs })
|
730
|
+
end
|
728
731
|
end
|
729
732
|
|
730
733
|
end
|
@@ -1139,6 +1142,10 @@ module SyncEngine
|
|
1139
1142
|
Rho::RhoConfig.rho_sync_user
|
1140
1143
|
end
|
1141
1144
|
|
1145
|
+
def self.on_sync_create_error( src_name, objects, action )
|
1146
|
+
Object.const_get(src_name).on_sync_create_error(objects, action)
|
1147
|
+
end
|
1148
|
+
|
1142
1149
|
def self.search(args)
|
1143
1150
|
searchParams = ""
|
1144
1151
|
|
@@ -28,9 +28,11 @@ module Rho
|
|
28
28
|
Rho::RhoMessages.get_message('sync_menu') => :sync, Rho::RhoMessages.get_message('options_menu') => :options, Rho::RhoMessages.get_message('log_menu') => :log, :separator => nil, Rho::RhoMessages.get_message('close_menu') => :close }
|
29
29
|
end
|
30
30
|
|
31
|
-
if @
|
31
|
+
if @vtabs != nil
|
32
|
+
@@native_bar_data = {:type => :vtabbar, :data => @vtabs}
|
33
|
+
elsif @tabs != nil
|
32
34
|
@@native_bar_data = {:type => :tabbar, :data => @tabs}
|
33
|
-
elsif @@toolbar
|
35
|
+
elsif @@toolbar != nil
|
34
36
|
@@native_bar_data = {:type => :toolbar, :data => @@toolbar}
|
35
37
|
else
|
36
38
|
@@native_bar_data = nil #{:type => :nobar}
|
@@ -44,7 +46,15 @@ module Rho
|
|
44
46
|
def init_nativebar
|
45
47
|
return unless @@native_bar_data
|
46
48
|
|
47
|
-
if @@native_bar_data[:type] == :
|
49
|
+
if @@native_bar_data[:type] == :vtabbar
|
50
|
+
tabs = @@native_bar_data[:data]
|
51
|
+
# normalize the list
|
52
|
+
tabs.map! { |tab| tab[:refresh] = false unless tab[:refresh]; tab }
|
53
|
+
puts "Initializing application with vertical tabs: #{tabs.inspect}"
|
54
|
+
NativeTabbar.create_vertical(tabs)
|
55
|
+
#NativeTabbar.create(tabs)
|
56
|
+
NativeTabbar.switch_tab(0)
|
57
|
+
elsif @@native_bar_data[:type] == :tabbar
|
48
58
|
tabs = @@native_bar_data[:data]
|
49
59
|
# normalize the list
|
50
60
|
tabs.map! { |tab| tab[:refresh] = false unless tab[:refresh]; tab }
|
@@ -27,6 +27,7 @@ module Rho
|
|
27
27
|
|
28
28
|
def self.create!(properties)
|
29
29
|
pb = Calendar::openCalendar
|
30
|
+
return_event = nil
|
30
31
|
unless pb.nil?
|
31
32
|
record = Calendar::createEvent(pb)
|
32
33
|
if record.nil?
|
@@ -41,10 +42,11 @@ module Rho
|
|
41
42
|
end
|
42
43
|
Calendar::setEventValue(record,key,value)
|
43
44
|
end
|
44
|
-
Calendar::addEvent(pb,record)
|
45
|
+
return_event = Calendar::addEvent(pb,record)
|
45
46
|
end
|
46
47
|
Calendar::closeCalendar(pb)
|
47
48
|
end
|
49
|
+
return return_event
|
48
50
|
end
|
49
51
|
|
50
52
|
def self.destroy(recordId)
|
@@ -35,7 +35,10 @@ module Rho
|
|
35
35
|
|
36
36
|
def self.create!(event)
|
37
37
|
event['id'] = nil #indicate that event should be created
|
38
|
-
|
38
|
+
event['reminder'] = event['reminder'].to_i if event['reminder'] != nil
|
39
|
+
new_id = Rho::Calendar.save(event)
|
40
|
+
event['id'] = new_id
|
41
|
+
return event
|
39
42
|
end
|
40
43
|
|
41
44
|
def self.destroy(id)
|
data/lib/framework/rhodes.rb
CHANGED
data/lib/framework/rhom/rhom.rb
CHANGED
@@ -44,6 +44,9 @@ module Rhom
|
|
44
44
|
def database_client_reset(reset_local_models=true)
|
45
45
|
puts "database_client_reset : reset_local_models=#{reset_local_models}"
|
46
46
|
|
47
|
+
#load all partitions
|
48
|
+
Rho::RHO.load_all_sources
|
49
|
+
|
47
50
|
old_interval = SyncEngine.set_pollinterval(0)
|
48
51
|
SyncEngine.stop_sync
|
49
52
|
|
@@ -70,6 +73,9 @@ module Rhom
|
|
70
73
|
def database_local_reset()
|
71
74
|
puts "database_local_reset"
|
72
75
|
|
76
|
+
#load all partitions
|
77
|
+
Rho::RHO.load_all_sources
|
78
|
+
|
73
79
|
::Rho::RHO.get_db_partitions().each do |partition, db|
|
74
80
|
|
75
81
|
next if partition != 'local'
|
@@ -84,6 +90,10 @@ module Rhom
|
|
84
90
|
|
85
91
|
def database_full_reset(reset_client_info=false, reset_local_models=true)
|
86
92
|
puts "database_full_reset : reset_client_info=#{reset_client_info}, reset_local_models=#{reset_local_models}"
|
93
|
+
|
94
|
+
#load all partitions
|
95
|
+
Rho::RHO.load_all_sources
|
96
|
+
|
87
97
|
old_interval = SyncEngine.set_pollinterval(0)
|
88
98
|
SyncEngine.stop_sync
|
89
99
|
|
@@ -1088,6 +1088,51 @@ module Rhom
|
|
1088
1088
|
def clear_notification
|
1089
1089
|
SyncEngine.clear_notification(get_source_id.to_i)
|
1090
1090
|
end
|
1091
|
+
|
1092
|
+
def on_sync_create_error( objects, action )
|
1093
|
+
raise ArgumentError, 'on_create_error action should be :delete or :recreate' unless action == :delete || action == :recreate
|
1094
|
+
return unless is_sync_source()
|
1095
|
+
|
1096
|
+
ar_objs = objects.is_a?(Array) ? objects : [objects]
|
1097
|
+
puts "ar_objs : #{ar_objs}"
|
1098
|
+
tableName = is_schema_source() ? get_schema_table_name : 'object_values'
|
1099
|
+
nSrcID = get_source_id()
|
1100
|
+
|
1101
|
+
db = ::Rho::RHO.get_src_db(get_source_name)
|
1102
|
+
db.start_transaction
|
1103
|
+
|
1104
|
+
begin
|
1105
|
+
ar_objs.each do |obj|
|
1106
|
+
if action == :recreate
|
1107
|
+
deletes = db.select_from_table('changed_values', 'object', {"update_type"=>'delete', "object"=>obj, "source_id"=>nSrcID })
|
1108
|
+
unless ( deletes && deletes.length() > 0 )
|
1109
|
+
|
1110
|
+
db.delete_from_table('changed_values', {'object'=>obj, "source_id"=>nSrcID})
|
1111
|
+
|
1112
|
+
db.insert_into_table('changed_values',
|
1113
|
+
{'update_type'=>'create', 'attrib'=>'object', "source_id"=>nSrcID, "object"=>obj} )
|
1114
|
+
|
1115
|
+
next
|
1116
|
+
end
|
1117
|
+
end
|
1118
|
+
|
1119
|
+
db.delete_from_table('changed_values', {'object'=>obj, "source_id"=>nSrcID})
|
1120
|
+
if is_schema_source()
|
1121
|
+
db.delete_from_table(tableName, {'object'=>obj } )
|
1122
|
+
else
|
1123
|
+
db.delete_from_table(tableName, {'object'=>obj, "source_id"=>nSrcID} )
|
1124
|
+
end
|
1125
|
+
end
|
1126
|
+
|
1127
|
+
db.commit
|
1128
|
+
rescue Exception => e
|
1129
|
+
puts 'on_create_error Exception: ' + e.inspect
|
1130
|
+
db.rollback
|
1131
|
+
|
1132
|
+
raise
|
1133
|
+
end
|
1134
|
+
|
1135
|
+
end
|
1091
1136
|
|
1092
1137
|
# deletes all records matching conditions (optionally nil)
|
1093
1138
|
def delete_all(*args)
|
@@ -79,7 +79,7 @@ module Rhom
|
|
79
79
|
|
80
80
|
::Rho::RHO.get_db_partitions.each_value do |db|
|
81
81
|
result = ::Rho::RHO.get_src_db().select_from_table('sources', '*',
|
82
|
-
{"
|
82
|
+
{"name" => args.first})
|
83
83
|
next unless result && result.length() > 0
|
84
84
|
|
85
85
|
return RhomSource.new(result.first)
|
data/lib/framework/version.rb
CHANGED
data/lib/rhodes.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
3
3
|
package="com.rhomobile.rhodes"
|
4
4
|
android:installLocation="auto"
|
5
|
-
android:versionCode="
|
6
|
-
android:versionName="2.3.
|
5
|
+
android:versionCode="29"
|
6
|
+
android:versionName="2.3.1">
|
7
7
|
|
8
8
|
<uses-sdk android:minSdkVersion="4" />
|
9
9
|
|
@@ -15,7 +15,7 @@ namespace common
|
|
15
15
|
class CRhoClassFactory : public IRhoClassFactory
|
16
16
|
{
|
17
17
|
public:
|
18
|
-
net::
|
18
|
+
net::INetRequestImpl* createNetRequestImpl();
|
19
19
|
IRhoThreadImpl *createThreadImpl();
|
20
20
|
net::ISSL *createSSLEngine();
|
21
21
|
IRhoCrypt* createRhoCrypt();
|
@@ -9,19 +9,12 @@
|
|
9
9
|
|
10
10
|
extern "C" void rho_webview_navigate(const char* url, int index);
|
11
11
|
|
12
|
-
|
12
|
+
static rho::common::CRhoClassFactory g_oRhoClassFactory;
|
13
|
+
rho::common::IRhoClassFactory* rho_get_RhoClassFactory()
|
13
14
|
{
|
14
|
-
|
15
|
-
{
|
16
|
-
|
17
|
-
IRhoClassFactory* rho_impl_createClassFactory()
|
18
|
-
{
|
19
|
-
return new CRhoClassFactory();
|
15
|
+
return &g_oRhoClassFactory;
|
20
16
|
}
|
21
17
|
|
22
|
-
} // namespace common
|
23
|
-
} // namespace rho
|
24
|
-
|
25
18
|
RHO_GLOBAL void rho_map_location(char* query)
|
26
19
|
{
|
27
20
|
rho::String url = "http://maps.google.com/?";
|
@@ -69,7 +62,12 @@ RHO_GLOBAL void rho_net_impl_network_indicator(int enable)
|
|
69
62
|
|
70
63
|
RHO_GLOBAL int rho_net_ping_network(const char* szHost)
|
71
64
|
{
|
72
|
-
|
65
|
+
JNIEnv *env = jnienv();
|
66
|
+
jclass cls = getJNIClass(RHODES_JAVA_CLASS_RHODES_SERVICE);
|
67
|
+
if (!cls) return 0;
|
68
|
+
jmethodID mid = getJNIClassStaticMethod(env, cls, "pingHost", "(Ljava/lang/String;)Z");
|
69
|
+
if (!mid) return 0;
|
70
|
+
return (int)env->CallStaticBooleanMethod(cls, mid, rho_cast<jhstring>(szHost).get());
|
73
71
|
}
|
74
72
|
|
75
73
|
RHO_GLOBAL void *rho_nativethread_start()
|
@@ -384,24 +384,32 @@ RHO_GLOBAL VALUE event_fetch_by_id(const char *id)
|
|
384
384
|
return rEvent;
|
385
385
|
}
|
386
386
|
|
387
|
-
|
387
|
+
static std::string return_string;
|
388
|
+
|
389
|
+
RHO_GLOBAL const char* event_save(VALUE rEvent)
|
388
390
|
{
|
389
391
|
JNIEnv *env = jnienv();
|
390
392
|
jclass cls = getJNIClass(RHODES_JAVA_CLASS_EVENT_STORE);
|
391
|
-
if (!cls) return;
|
393
|
+
if (!cls) return NULL;
|
392
394
|
jmethodID mid = getJNIClassStaticMethod(env, cls, "save", "(Lcom/rhomobile/rhodes/event/Event;)Ljava/lang/String;");
|
393
|
-
if (!mid) return;
|
395
|
+
if (!mid) return NULL;
|
394
396
|
|
395
397
|
jobject jEvent = event_cast<jobject>(rEvent);
|
396
|
-
jstring
|
398
|
+
jstring new_id = (jstring)env->CallStaticObjectMethod(cls, mid, jEvent);
|
397
399
|
env->DeleteLocalRef(jEvent);
|
398
400
|
|
399
|
-
if (jError)
|
400
|
-
{
|
401
|
-
|
402
|
-
|
403
|
-
|
401
|
+
//if (jError)
|
402
|
+
//{
|
403
|
+
// std::string error = rho_cast<std::string>(env, jError);
|
404
|
+
// env->DeleteLocalRef(jError);
|
405
|
+
// rb_raise(rb_eRuntimeError, "Event save failed: %s", error.c_str());
|
406
|
+
//}
|
407
|
+
if (new_id) {
|
408
|
+
return_string = rho_cast<std::string>(env, new_id);
|
409
|
+
env->DeleteLocalRef(new_id);
|
410
|
+
return return_string.c_str();
|
404
411
|
}
|
412
|
+
return NULL;
|
405
413
|
}
|
406
414
|
|
407
415
|
RHO_GLOBAL void event_delete(const char *id)
|
@@ -100,8 +100,9 @@ public:
|
|
100
100
|
void setPinImage(JNIEnv *env, jobject bitmap);
|
101
101
|
void setPinCalloutImage(JNIEnv *env, jobject bitmap);
|
102
102
|
void setPinCalloutLinkImage(JNIEnv *env, jobject bitmap);
|
103
|
-
|
104
|
-
|
103
|
+
void setESRILogoImage(JNIEnv *env, jobject bitmap);
|
104
|
+
|
105
|
+
rho_param *params() const {return m_params;}
|
105
106
|
|
106
107
|
void setMapView(IMapView *mv);
|
107
108
|
IMapView *mapView() const {return m_mapview;}
|
@@ -122,6 +123,7 @@ private:
|
|
122
123
|
std::auto_ptr<IDrawingImage> m_pin_image;
|
123
124
|
std::auto_ptr<IDrawingImage> m_pin_calloutimage;
|
124
125
|
std::auto_ptr<IDrawingImage> m_pin_calloutlinkimage;
|
126
|
+
std::auto_ptr<IDrawingImage> m_esriLogo_image;
|
125
127
|
};
|
126
128
|
|
127
129
|
AndroidImage::AndroidImage(jobject bitmap)
|
@@ -269,6 +271,7 @@ void AndroidMapDevice::setMapView(IMapView *mv)
|
|
269
271
|
|
270
272
|
mv->setPinCalloutImage(m_pin_calloutimage.get(), pin_info1);
|
271
273
|
mv->setPinCalloutLinkImage(m_pin_calloutlinkimage.get(), pin_info1);
|
274
|
+
mv->setESRILogoImage(m_esriLogo_image.get());
|
272
275
|
|
273
276
|
}
|
274
277
|
RHO_MAP_TRACE("AndroidMapDevice: setMapView: finish");
|
@@ -324,6 +327,17 @@ void AndroidMapDevice::setPinCalloutLinkImage(JNIEnv *env, jobject bitmap)
|
|
324
327
|
RHO_MAP_TRACE("AndroidMapDevice: setPinCalloutLinkImage: finish");
|
325
328
|
}
|
326
329
|
|
330
|
+
void AndroidMapDevice::setESRILogoImage(JNIEnv *env, jobject bitmap) {
|
331
|
+
RHO_MAP_TRACE("AndroidMapDevice: setESRILogoImage: start");
|
332
|
+
m_esriLogo_image.reset(new AndroidImage(bitmap));
|
333
|
+
IMapView *mv = mapView();
|
334
|
+
if (mv) {
|
335
|
+
mv->setESRILogoImage(m_esriLogo_image.get());
|
336
|
+
}
|
337
|
+
RHO_MAP_TRACE("AndroidMapDevice: setESRILogoImage: finish");
|
338
|
+
}
|
339
|
+
|
340
|
+
|
327
341
|
|
328
342
|
IDrawingImage *AndroidMapDevice::createImage(String const &path, bool useAlpha)
|
329
343
|
{
|
@@ -485,6 +499,15 @@ RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_mapview_MapView_setPinCalloutL
|
|
485
499
|
RHO_MAP_TRACE("Java_com_rhomobile_rhodes_mapview_MapView_setPinCalloutLinkImage: finish");
|
486
500
|
}
|
487
501
|
|
502
|
+
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_mapview_MapView_setESRILogoImage
|
503
|
+
(JNIEnv *env, jobject, jlong nativeDevice, jobject bitmap)
|
504
|
+
{
|
505
|
+
RHO_MAP_TRACE("Java_com_rhomobile_rhodes_mapview_MapView_setESRILogoImage: start");
|
506
|
+
rhomap::AndroidMapDevice *d = device(env, nativeDevice);
|
507
|
+
d->setESRILogoImage(env, bitmap);
|
508
|
+
RHO_MAP_TRACE("Java_com_rhomobile_rhodes_mapview_MapView_setESRILogoImage: finish");
|
509
|
+
}
|
510
|
+
|
488
511
|
|
489
512
|
RHO_GLOBAL jint JNICALL Java_com_rhomobile_rhodes_mapview_MapView_minZoom
|
490
513
|
(JNIEnv *env, jobject, jlong nativeDevice)
|
@@ -719,7 +742,9 @@ RHO_GLOBAL void mapview_create(rho_param *p)
|
|
719
742
|
eng_p = value;
|
720
743
|
}
|
721
744
|
if (eng_p && eng_p->type == RHO_PARAM_STRING) {
|
722
|
-
|
745
|
+
if ((eng_p->v.string != NULL) && (eng_p->v.string[0] != 0)) {
|
746
|
+
engine = eng_p->v.string;
|
747
|
+
}
|
723
748
|
}
|
724
749
|
}
|
725
750
|
if (strcasecmp(engine, "Google") == 0) {
|
@@ -730,7 +755,12 @@ RHO_GLOBAL void mapview_create(rho_param *p)
|
|
730
755
|
google_mapview_create(p);
|
731
756
|
}
|
732
757
|
else {
|
733
|
-
|
758
|
+
if (rho_map_check_param(p)) {
|
759
|
+
s_mapdevice = new rhomap::AndroidMapDevice(p);
|
760
|
+
}
|
761
|
+
else {
|
762
|
+
RAWLOG_ERROR("MapView.create: wrong input parameters ! (parameters not validated !)");
|
763
|
+
}
|
734
764
|
}
|
735
765
|
}
|
736
766
|
|
@@ -608,7 +608,7 @@ RHO_GLOBAL void JNICALL Java_com_rhomobile_rhodes_RhodesService_setPushRegistrat
|
|
608
608
|
(JNIEnv *env, jobject, jstring jId)
|
609
609
|
{
|
610
610
|
std::string id = rho_cast<std::string>(env, jId);
|
611
|
-
rho::sync::CClientRegister::Create(
|
611
|
+
rho::sync::CClientRegister::Create(id.c_str());
|
612
612
|
}
|
613
613
|
|
614
614
|
RHO_GLOBAL jboolean JNICALL Java_com_rhomobile_rhodes_RhodesService_callPushCallback
|
Binary file
|
@@ -38,6 +38,7 @@ public final class AndroidR {
|
|
38
38
|
public static final int marker=R.drawable.marker;
|
39
39
|
public static final int callout=R.drawable.callout;
|
40
40
|
public static final int callout_link=R.drawable.callout_link;
|
41
|
+
public static final int esri=R.drawable.esri;
|
41
42
|
public static final int next=R.drawable.next;
|
42
43
|
public static final int options=R.drawable.options;
|
43
44
|
public static final int refresh=R.drawable.refresh;
|
@@ -17,6 +17,8 @@ public class BaseActivity extends Activity implements ServiceConnection {
|
|
17
17
|
|
18
18
|
private static final boolean DEBUG = false;
|
19
19
|
|
20
|
+
public static final String INTENT_SOURCE = BaseActivity.class.getName();
|
21
|
+
|
20
22
|
protected RhodesService mRhodesService;
|
21
23
|
private boolean mBoundToService;
|
22
24
|
|
@@ -25,6 +27,7 @@ public class BaseActivity extends Activity implements ServiceConnection {
|
|
25
27
|
super.onCreate(savedInstanceState);
|
26
28
|
|
27
29
|
Intent intent = new Intent(this, RhodesService.class);
|
30
|
+
intent.putExtra(RhodesService.INTENT_SOURCE, INTENT_SOURCE);
|
28
31
|
ComponentName serviceName = startService(intent);
|
29
32
|
if (serviceName == null)
|
30
33
|
throw new RuntimeException("Can not start Rhodes service");
|
@@ -85,13 +85,16 @@ public class RhodesActivity extends BaseActivity {
|
|
85
85
|
mHandler.post(mSetup);
|
86
86
|
|
87
87
|
sInstance = this;
|
88
|
-
|
88
|
+
|
89
|
+
notifyUiCreated();
|
90
|
+
}
|
91
|
+
|
92
|
+
private void notifyUiCreated() {
|
89
93
|
RhodesService r = RhodesService.getInstance();
|
90
|
-
if ( r != null )
|
91
|
-
{
|
94
|
+
if ( r != null ) {
|
92
95
|
r.callUiCreatedCallback();
|
93
|
-
}
|
94
|
-
{
|
96
|
+
}
|
97
|
+
else {
|
95
98
|
mHandler.post(new Runnable() {
|
96
99
|
public void run() {
|
97
100
|
RhodesService r = RhodesService.getInstance();
|