rhodes 3.0.0 → 3.0.1.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/Rakefile +9 -2
- data/doc/application.txt +1 -1
- data/doc/build.txt +49 -70
- data/doc/device-caps.txt +22 -97
- data/doc/extensions.txt +1 -1
- data/doc/nfc.txt +542 -0
- data/doc/rhom.txt +7 -5
- data/doc/simulator.txt +116 -0
- data/doc/ui.txt +1 -1
- data/lib/build/jake.rb +5 -5
- data/lib/extensions/debugger/debugger.rb +63 -35
- data/lib/extensions/nfc/ext/nfc/platform/android/AndroidManifest.xml +8 -6
- data/lib/extensions/nfc/ext/nfc/platform/android/jni/src/nfc.cpp +1070 -249
- data/lib/extensions/nfc/ext/nfc/platform/android/res/xml/filter_nfc.xml +1 -5
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/Nfc.java +894 -72
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/NfcActivity.java +82 -18
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/NfcMessage.java +65 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/NfcRecord.java +88 -24
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/NfcTechActivity.java +3 -0
- data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc.i +204 -3
- data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc_wrap.c +1047 -5
- data/lib/extensions/nfc/nfc.rb +635 -91
- data/lib/extensions/rhoxml/rexml/encodings/CP-1252.rb +103 -0
- data/lib/extensions/rhoxml/rexml/encodings/ISO-8859-1.rb +7 -0
- data/lib/framework/dateME.rb +26 -0
- data/lib/framework/rho/render.rb +21 -9
- data/lib/framework/rho/rho.rb +12 -0
- data/lib/framework/rho/rhoevent_bb.rb +3 -0
- data/lib/framework/rho/rhoevent_c.rb +3 -0
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rhom/rhom_db_adapter.rb +9 -9
- data/lib/framework/rhosystem.rb +17 -0
- data/lib/framework/stringio.rb +18 -0
- 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/res/xml/filter_nfc.xml +1 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +0 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +10 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoCryptImpl.java +29 -18
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +67 -12
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityListener.java +14 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +102 -28
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +35 -66
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +5 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +69 -41
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/PopupActivity.java +7 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/PerformOnUiThread.java +68 -35
- data/platform/android/build/RhodesSRC_build.files +1 -0
- data/platform/android/build/android.rake +2 -2
- data/platform/bb/RubyVM/src/com/rho/RhoConf.java +1 -0
- data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +18 -6
- data/platform/bb/build/bb.rake +1 -1
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +5 -4
- data/platform/iphone/Classes/SimpleMainView.m +1 -1
- data/platform/iphone/Info.plist +1 -1
- data/platform/shared/common/RhodesApp.cpp +9 -3
- data/platform/shared/curl/lib/rhossl.c +5 -2
- data/platform/shared/db/DBAdapter.cpp +9 -0
- data/platform/shared/net/CURLNetRequest.cpp +8 -3
- data/platform/shared/net/iphone/sslimpl.cpp +3 -2
- data/platform/shared/net/ssl.cpp +8 -0
- data/platform/shared/ruby/ext/rho/rhoruby.c +10 -0
- data/platform/shared/ruby/ext/rho/rhoruby.h +1 -0
- data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +3 -4
- data/platform/win32/RhoSimulator/QtCore4.dll +0 -0
- data/platform/win32/RhoSimulator/QtGui4.dll +0 -0
- data/platform/win32/RhoSimulator/QtNetwork4.dll +0 -0
- data/platform/win32/RhoSimulator/QtWebKit4.dll +0 -0
- data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
- data/platform/win32/RhoSimulator/imageformats/qgif4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qico4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qjpeg4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qmng4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qsvg4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qtiff4.dll +0 -0
- data/platform/win32/RhoSimulator/libeay32.dll +0 -0
- data/platform/win32/RhoSimulator/ssleay32.dll +0 -0
- data/platform/wm/build/wm.rake +27 -3
- data/platform/wm/rhodes/Rhodes.cpp +4 -0
- data/platform/wm/rhodes/emulator/MainWindowCallback.h +1 -0
- data/platform/wm/rhodes/emulator/MainWindowProxy.cpp +3 -1
- data/platform/wm/rhodes/emulator/MainWindowQt.cpp +23 -12
- data/platform/wm/rhodes/emulator/MainWindowQt.h +5 -1
- data/platform/wm/rhodes/emulator/QtMainWindow.cpp +39 -6
- data/platform/wm/rhodes/emulator/QtMainWindow.h +1 -1
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +5 -0
- data/platform/wp7/IronRuby/{Bin → bin}/Silverlight3Release/IronRuby.Libraries.dll +0 -0
- data/platform/wp7/IronRuby/{Bin → bin}/Silverlight3Release/IronRuby.dll +0 -0
- data/platform/wp7/IronRuby/bin/Silverlight3Release/Microsoft.Dynamic.dll +0 -0
- data/platform/wp7/IronRuby/{Bin → bin}/Silverlight3Release/Microsoft.Scripting.Core.dll +0 -0
- data/platform/wp7/IronRuby/{Bin → bin}/Silverlight3Release/Microsoft.Scripting.dll +0 -0
- data/platform/wp7/RhoAppRunner/Program.cs +2 -2
- data/platform/wp7/RhoRubyLib/RhoRuby.cs +8 -0
- data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +29 -7
- data/platform/wp7/RhoRubyLib/db/DBAdapter.cs +5 -2
- data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +12 -0
- data/platform/wp7/RhoRubyLib/net/HttpServer.cs +2 -0
- data/platform/wp7/RhoRubyLib/net/NetRequest.cs +1 -1
- data/platform/wp7/RhoRubyLib/rubyext/RhoAsyncHttp.cs +52 -7
- data/platform/wp7/RhoRubyLib/rubyext/RhoDatabase.cs +85 -18
- data/platform/wp7/RhoRubyLib/rubyext/RhoJSON.cs +38 -3
- data/platform/wp7/RhoRubyLib/rubyext/RhoKernelOps.cs +27 -2
- data/platform/wp7/RhoRubyLib/rubyext/RhoNativeBar.cs +111 -15
- data/platform/wp7/RhoRubyLib/rubyext/RhoSyncEngine.cs +330 -55
- data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +61 -4
- data/platform/wp7/build/wp.rake +89 -72
- data/platform/wp7/rhodes/App.xaml.cs +1 -1
- data/rakefile.rb +9 -2
- data/rhodes.gemspec +1 -3
- data/spec/phone_spec/app/spec/asynchttp_spec.rb +7 -9
- data/spec/phone_spec/app/spec/uri_spec.rb +75 -0
- data/spec/phone_spec/app/spec_runner.rb +4 -0
- metadata +21 -15
- data/Manifest.txt +0 -6403
- data/platform/win32/RhoSimulator/codecs/qcncodecs4.dll +0 -0
- data/platform/win32/RhoSimulator/codecs/qjpcodecs4.dll +0 -0
- data/platform/win32/RhoSimulator/codecs/qkrcodecs4.dll +0 -0
- data/platform/win32/RhoSimulator/codecs/qtwcodecs4.dll +0 -0
- data/platform/wp7/IronRuby/Bin/Silverlight3Release/Microsoft.Dynamic.dll +0 -0
@@ -0,0 +1,103 @@
|
|
1
|
+
#
|
2
|
+
# This class was contributed by Mikko Tiihonen mikko DOT tiihonen AT hut DOT fi
|
3
|
+
#
|
4
|
+
module REXML
|
5
|
+
module Encoding
|
6
|
+
register( "CP-1252" ) do |o|
|
7
|
+
class << o
|
8
|
+
alias encode encode_cp1252
|
9
|
+
alias decode decode_cp1252
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# Convert from UTF-8
|
14
|
+
def encode_cp1252(content)
|
15
|
+
array_utf8 = content.unpack('U*')
|
16
|
+
array_enc = []
|
17
|
+
array_utf8.each do |num|
|
18
|
+
case num
|
19
|
+
# shortcut first bunch basic characters
|
20
|
+
when 0..0xFF; array_enc << num
|
21
|
+
# characters added compared to iso-8859-1
|
22
|
+
when 0x20AC; array_enc << 0x80 # 0xe2 0x82 0xac
|
23
|
+
when 0x201A; array_enc << 0x82 # 0xe2 0x82 0x9a
|
24
|
+
when 0x0192; array_enc << 0x83 # 0xc6 0x92
|
25
|
+
when 0x201E; array_enc << 0x84 # 0xe2 0x82 0x9e
|
26
|
+
when 0x2026; array_enc << 0x85 # 0xe2 0x80 0xa6
|
27
|
+
when 0x2020; array_enc << 0x86 # 0xe2 0x80 0xa0
|
28
|
+
when 0x2021; array_enc << 0x87 # 0xe2 0x80 0xa1
|
29
|
+
when 0x02C6; array_enc << 0x88 # 0xcb 0x86
|
30
|
+
when 0x2030; array_enc << 0x89 # 0xe2 0x80 0xb0
|
31
|
+
when 0x0160; array_enc << 0x8A # 0xc5 0xa0
|
32
|
+
when 0x2039; array_enc << 0x8B # 0xe2 0x80 0xb9
|
33
|
+
when 0x0152; array_enc << 0x8C # 0xc5 0x92
|
34
|
+
when 0x017D; array_enc << 0x8E # 0xc5 0xbd
|
35
|
+
when 0x2018; array_enc << 0x91 # 0xe2 0x80 0x98
|
36
|
+
when 0x2019; array_enc << 0x92 # 0xe2 0x80 0x99
|
37
|
+
when 0x201C; array_enc << 0x93 # 0xe2 0x80 0x9c
|
38
|
+
when 0x201D; array_enc << 0x94 # 0xe2 0x80 0x9d
|
39
|
+
when 0x2022; array_enc << 0x95 # 0xe2 0x80 0xa2
|
40
|
+
when 0x2013; array_enc << 0x96 # 0xe2 0x80 0x93
|
41
|
+
when 0x2014; array_enc << 0x97 # 0xe2 0x80 0x94
|
42
|
+
when 0x02DC; array_enc << 0x98 # 0xcb 0x9c
|
43
|
+
when 0x2122; array_enc << 0x99 # 0xe2 0x84 0xa2
|
44
|
+
when 0x0161; array_enc << 0x9A # 0xc5 0xa1
|
45
|
+
when 0x203A; array_enc << 0x9B # 0xe2 0x80 0xba
|
46
|
+
when 0x0152; array_enc << 0x9C # 0xc5 0x93
|
47
|
+
when 0x017E; array_enc << 0x9E # 0xc5 0xbe
|
48
|
+
when 0x0178; array_enc << 0x9F # 0xc5 0xb8
|
49
|
+
else
|
50
|
+
# all remaining basic characters can be used directly
|
51
|
+
if num <= 0xFF
|
52
|
+
array_enc << num
|
53
|
+
else
|
54
|
+
# Numeric entity (&#nnnn;); shard by Stefan Scholl
|
55
|
+
array_enc.concat "&\##{num};".unpack('C*')
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
array_enc.pack('C*')
|
60
|
+
end
|
61
|
+
|
62
|
+
# Convert to UTF-8
|
63
|
+
def decode_cp1252(str)
|
64
|
+
array_latin9 = str.unpack('C*')
|
65
|
+
array_enc = []
|
66
|
+
array_latin9.each do |num|
|
67
|
+
case num
|
68
|
+
# characters that added compared to iso-8859-1
|
69
|
+
when 0x80; array_enc << 0x20AC # 0xe2 0x82 0xac
|
70
|
+
when 0x82; array_enc << 0x201A # 0xe2 0x82 0x9a
|
71
|
+
when 0x83; array_enc << 0x0192 # 0xc6 0x92
|
72
|
+
when 0x84; array_enc << 0x201E # 0xe2 0x82 0x9e
|
73
|
+
when 0x85; array_enc << 0x2026 # 0xe2 0x80 0xa6
|
74
|
+
when 0x86; array_enc << 0x2020 # 0xe2 0x80 0xa0
|
75
|
+
when 0x87; array_enc << 0x2021 # 0xe2 0x80 0xa1
|
76
|
+
when 0x88; array_enc << 0x02C6 # 0xcb 0x86
|
77
|
+
when 0x89; array_enc << 0x2030 # 0xe2 0x80 0xb0
|
78
|
+
when 0x8A; array_enc << 0x0160 # 0xc5 0xa0
|
79
|
+
when 0x8B; array_enc << 0x2039 # 0xe2 0x80 0xb9
|
80
|
+
when 0x8C; array_enc << 0x0152 # 0xc5 0x92
|
81
|
+
when 0x8E; array_enc << 0x017D # 0xc5 0xbd
|
82
|
+
when 0x91; array_enc << 0x2018 # 0xe2 0x80 0x98
|
83
|
+
when 0x92; array_enc << 0x2019 # 0xe2 0x80 0x99
|
84
|
+
when 0x93; array_enc << 0x201C # 0xe2 0x80 0x9c
|
85
|
+
when 0x94; array_enc << 0x201D # 0xe2 0x80 0x9d
|
86
|
+
when 0x95; array_enc << 0x2022 # 0xe2 0x80 0xa2
|
87
|
+
when 0x96; array_enc << 0x2013 # 0xe2 0x80 0x93
|
88
|
+
when 0x97; array_enc << 0x2014 # 0xe2 0x80 0x94
|
89
|
+
when 0x98; array_enc << 0x02DC # 0xcb 0x9c
|
90
|
+
when 0x99; array_enc << 0x2122 # 0xe2 0x84 0xa2
|
91
|
+
when 0x9A; array_enc << 0x0161 # 0xc5 0xa1
|
92
|
+
when 0x9B; array_enc << 0x203A # 0xe2 0x80 0xba
|
93
|
+
when 0x9C; array_enc << 0x0152 # 0xc5 0x93
|
94
|
+
when 0x9E; array_enc << 0x017E # 0xc5 0xbe
|
95
|
+
when 0x9F; array_enc << 0x0178 # 0xc5 0xb8
|
96
|
+
else
|
97
|
+
array_enc << num
|
98
|
+
end
|
99
|
+
end
|
100
|
+
array_enc.pack('U*')
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
data/lib/framework/dateME.rb
CHANGED
@@ -2,6 +2,9 @@ require 'date/format'
|
|
2
2
|
|
3
3
|
class Time
|
4
4
|
|
5
|
+
def getlocal() localtime end
|
6
|
+
def to_time() getlocal end
|
7
|
+
|
5
8
|
def __makeTwoDigit(num)
|
6
9
|
str = num.to_s
|
7
10
|
if str.length < 2
|
@@ -101,7 +104,27 @@ class Date
|
|
101
104
|
((@m_date-x._get_date()).to_i)/(60*60*24)
|
102
105
|
end
|
103
106
|
|
107
|
+
def + (x)
|
108
|
+
Date.new( @m_date + x*(60*60*24) )
|
109
|
+
end
|
110
|
+
|
111
|
+
# Get the week day of this date. Sunday is day-of-week 0;
|
112
|
+
# Saturday is day-of-week 6.
|
104
113
|
def wday() @m_date.wday end
|
114
|
+
|
115
|
+
# Get the commercial day of the week of this date. Monday is
|
116
|
+
# commercial day-of-week 1; Sunday is commercial day-of-week 7.
|
117
|
+
def cwday()
|
118
|
+
_wday = @m_date.wday
|
119
|
+
return 7 if _wday == 0
|
120
|
+
|
121
|
+
return _wday
|
122
|
+
end
|
123
|
+
|
124
|
+
# Get the commercial week of the year of this date.
|
125
|
+
# TODO: cweek()
|
126
|
+
#def cweek() 0 end
|
127
|
+
|
105
128
|
def mon() @m_date.mon end
|
106
129
|
def year() @m_date.year end
|
107
130
|
def mday() @m_date.mday end
|
@@ -121,6 +144,9 @@ class Date
|
|
121
144
|
end
|
122
145
|
|
123
146
|
private_class_method :now
|
147
|
+
|
148
|
+
def to_time() Time.local(year(), mon(), mday()) end
|
149
|
+
def to_date() self end
|
124
150
|
|
125
151
|
end
|
126
152
|
|
data/lib/framework/rho/render.rb
CHANGED
@@ -26,16 +26,28 @@ module Rho
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.renderfile(filename, req = {}, res = {})
|
29
|
-
|
29
|
+
begin
|
30
|
+
res = ""
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
32
|
+
if filename.end_with?(RHO_ERB_EXT)
|
33
|
+
res = (RhoController.new).inst_render_index(filename, req, res)
|
34
|
+
else
|
35
|
+
res = IO.read(filename)
|
36
|
+
end
|
37
|
+
RhoController.start_objectnotify()
|
38
|
+
RhoController.start_geoview_notification()
|
39
|
+
res
|
40
|
+
rescue Exception => exception
|
41
|
+
if defined? RHO_WP7
|
42
|
+
#For some reason rho_serve get another exception, so report original one here
|
43
|
+
if exception
|
44
|
+
trace_msg = exception.backtrace.join("\n")
|
45
|
+
puts "renderfile error: #{exception}\n #{trace_msg}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
raise
|
50
|
+
end
|
39
51
|
end
|
40
52
|
|
41
53
|
def inst_render_index(filename, req, res)
|
data/lib/framework/rho/rho.rb
CHANGED
@@ -16,6 +16,18 @@ module Rho
|
|
16
16
|
System::get_property('platform') == 'APPLE' || System::get_property('platform') == 'ANDROID' || is_bb6
|
17
17
|
end
|
18
18
|
|
19
|
+
def self.close_database(arg_partition=nil)
|
20
|
+
if arg_partition
|
21
|
+
puts "Close database for partition: #{arg_partition}"
|
22
|
+
::Rho::RHO.get_db_partitions()[arg_partition].close
|
23
|
+
else
|
24
|
+
::Rho::RHO.get_db_partitions().each do |partition, db|
|
25
|
+
puts "Close database for partition: #{partition}"
|
26
|
+
db.close
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
19
31
|
class RHO
|
20
32
|
APPLICATIONS = {}
|
21
33
|
APPNAME = 'app'
|
@@ -11,6 +11,9 @@ module Rho
|
|
11
11
|
elsif args.first == :all
|
12
12
|
|
13
13
|
if args.length > 1
|
14
|
+
args[1][:start_date] = args[1][:start_date].to_time unless args[1][:start_date].nil?
|
15
|
+
args[1][:end_date] = args[1][:end_date].to_time unless args[1][:end_date].nil?
|
16
|
+
|
14
17
|
records = Calendar::findCalendarEvents(pb, args[1])
|
15
18
|
else
|
16
19
|
records = Calendar::getallCalendarEvents(pb)
|
@@ -12,6 +12,9 @@ module Rho
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
+
params['start_date'] = params['start_date'].to_time unless params['start_date'].nil?
|
16
|
+
params['end_date'] = params['end_date'].to_time unless params['end_date'].nil?
|
17
|
+
|
15
18
|
params['start_date'] = MIN_TIME if params['start_date'].nil? or params['start_date'] < MIN_TIME
|
16
19
|
params['end_date'] = MAX_TIME if params['end_date'].nil? or params['end_date'] > MAX_TIME
|
17
20
|
|
data/lib/framework/rhodes.rb
CHANGED
@@ -32,15 +32,15 @@ class RhomDbAdapter
|
|
32
32
|
end
|
33
33
|
|
34
34
|
# closes the database if and only if it is open
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
35
|
+
def close
|
36
|
+
if @database
|
37
|
+
@database.close
|
38
|
+
@database = nil
|
39
|
+
else
|
40
|
+
return false
|
41
|
+
end
|
42
|
+
return true
|
43
|
+
end
|
44
44
|
|
45
45
|
def is_ui_waitfordb
|
46
46
|
@database.is_ui_waitfordb
|
data/lib/framework/rhosystem.rb
CHANGED
@@ -35,6 +35,23 @@ module Alert
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
module NavBar
|
39
|
+
def self.create( arg )
|
40
|
+
#TODO: create
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.remove( )
|
44
|
+
#TODO: remove
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.started( )
|
48
|
+
#TODO: started
|
49
|
+
|
50
|
+
false
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
38
55
|
module Rho
|
39
56
|
|
40
57
|
class RhoConf
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# ****************************************************************************
|
2
|
+
#
|
3
|
+
# Copyright (c) Microsoft Corporation.
|
4
|
+
#
|
5
|
+
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
|
6
|
+
# copy of the license can be found in the License.html file at the root of this distribution. If
|
7
|
+
# you cannot locate the Apache License, Version 2.0, please send an email to
|
8
|
+
# ironruby@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
|
9
|
+
# by the terms of the Apache License, Version 2.0.
|
10
|
+
#
|
11
|
+
# You must not remove this notice, or any other, from this software.
|
12
|
+
#
|
13
|
+
#
|
14
|
+
# ****************************************************************************
|
15
|
+
|
16
|
+
if defined?( RHO_WP7 )
|
17
|
+
load_assembly 'IronRuby.Libraries', 'IronRuby.StandardLibrary.StringIO'
|
18
|
+
end
|
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="3.0.
|
5
|
+
android:versionCode="33"
|
6
|
+
android:versionName="3.0.1">
|
7
7
|
|
8
8
|
<uses-sdk android:minSdkVersion="4" />
|
9
9
|
|
@@ -4,10 +4,6 @@
|
|
4
4
|
<tech>android.nfc.tech.MifareClassic</tech>
|
5
5
|
</tech-list>
|
6
6
|
<tech-list>
|
7
|
-
<tech>android.nfc.tech.
|
8
|
-
</tech-list>
|
9
|
-
<tech-list>
|
10
|
-
<tech>android.nfc.tech.MifareClassic</tech>
|
11
|
-
<tech>android.nfc.tech.MifareUltralight</tech>
|
7
|
+
<tech>android.nfc.tech.Ndef</tech>
|
12
8
|
</tech-list>
|
13
9
|
</resources>
|
@@ -1,9 +1,7 @@
|
|
1
1
|
package com.rhomobile.rhodes;
|
2
2
|
|
3
3
|
import android.app.Activity;
|
4
|
-
import android.app.Application;
|
5
4
|
import android.content.ComponentName;
|
6
|
-
//import android.content.Context;
|
7
5
|
import android.content.Context;
|
8
6
|
import android.content.Intent;
|
9
7
|
import android.content.ServiceConnection;
|
@@ -51,12 +51,16 @@ public class PushReceiver extends BroadcastReceiver {
|
|
51
51
|
private void handleMessage(Context context, Intent intent) {
|
52
52
|
Bundle extras = intent.getExtras();
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
54
|
+
if (DEBUG) {
|
55
|
+
if (extras != null) {
|
56
|
+
Log.d(TAG, "Message: " + extras.toString());
|
57
|
+
for (String key: extras.keySet()) {
|
58
|
+
Log.d(TAG, key + ": " + extras.get(key).toString());
|
59
|
+
}
|
60
|
+
} else {
|
61
|
+
Log.d(TAG, "Message: <empty>");
|
62
|
+
}
|
63
|
+
}
|
60
64
|
|
61
65
|
Intent serviceIntent = new Intent(context, RhodesService.class);
|
62
66
|
serviceIntent.putExtra(RhodesService.INTENT_SOURCE, INTENT_SOURCE);
|
@@ -10,9 +10,8 @@ import javax.crypto.spec.IvParameterSpec;
|
|
10
10
|
import javax.crypto.spec.SecretKeySpec;
|
11
11
|
import java.nio.ByteBuffer;
|
12
12
|
|
13
|
-
|
13
|
+
import android.content.Context;
|
14
14
|
import android.content.SharedPreferences;
|
15
|
-
import android.app.Activity;
|
16
15
|
import com.rhomobile.rhodes.Logger;
|
17
16
|
|
18
17
|
public class RhoCryptImpl
|
@@ -24,10 +23,10 @@ public class RhoCryptImpl
|
|
24
23
|
final String m_strPrefName = "rho_internal_data";
|
25
24
|
Cipher m_encryptCipher, m_decryptCipher;
|
26
25
|
final int m_nKeyLenBit = 128; // 192 and 256 bits may not be available
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
|
27
|
+
private void readKeyFromStorage()
|
28
|
+
{
|
29
|
+
SharedPreferences settings = RhodesService.getInstance().getSharedPreferences( m_strPrefName, Context.MODE_PRIVATE);
|
31
30
|
String strOldKey = settings.getString(m_strDBPartition, "");
|
32
31
|
if ( strOldKey != null && strOldKey.length() > 0 )
|
33
32
|
{
|
@@ -46,7 +45,7 @@ public class RhoCryptImpl
|
|
46
45
|
|
47
46
|
private void writeKeyToStorage()
|
48
47
|
{
|
49
|
-
SharedPreferences settings =
|
48
|
+
SharedPreferences settings = RhodesService.getInstance().getSharedPreferences(m_strPrefName, Context.MODE_PRIVATE);
|
50
49
|
SharedPreferences.Editor editor = settings.edit();
|
51
50
|
String strKey = Base64.encodeToString(m_dbKeyData, false);//, Base64.DEFAULT);
|
52
51
|
editor.putString(m_strDBPartition, strKey );
|
@@ -70,8 +69,10 @@ public class RhoCryptImpl
|
|
70
69
|
|
71
70
|
private void initContext(String szPartition)throws Exception
|
72
71
|
{
|
73
|
-
if ( m_dbKeyData != null )
|
72
|
+
if ( m_dbKeyData != null ) {
|
73
|
+
Logger.T(TAG, "RhoCrypt context already initialized, partition: " + szPartition);
|
74
74
|
return;
|
75
|
+
}
|
75
76
|
|
76
77
|
initKey(szPartition);
|
77
78
|
|
@@ -89,6 +90,8 @@ public class RhoCryptImpl
|
|
89
90
|
m_decryptCipher = Cipher.getInstance("AES/CBC/NoPadding");
|
90
91
|
m_decryptCipher.init(Cipher.DECRYPT_MODE, skeySpec, paramSpec);
|
91
92
|
|
93
|
+
Logger.T(TAG, "RhoCrypt context initialized for partition: " + szPartition);
|
94
|
+
|
92
95
|
}
|
93
96
|
|
94
97
|
private static void reportFail(String name, Exception e)
|
@@ -103,8 +106,12 @@ public class RhoCryptImpl
|
|
103
106
|
initContext(szPartition);
|
104
107
|
|
105
108
|
dataOut.rewind();
|
106
|
-
|
107
|
-
|
109
|
+
|
110
|
+
if (m_encryptCipher == null)
|
111
|
+
throw new NullPointerException("m_encryptCipher == null");
|
112
|
+
|
113
|
+
m_encryptCipher.doFinal(dataIn, dataOut);
|
114
|
+
|
108
115
|
return true;
|
109
116
|
}catch(Exception exc)
|
110
117
|
{
|
@@ -115,17 +122,21 @@ public class RhoCryptImpl
|
|
115
122
|
|
116
123
|
public boolean db_decrypt( String szPartition, ByteBuffer dataIn, ByteBuffer dataOut )
|
117
124
|
{
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
125
|
+
try
|
126
|
+
{
|
127
|
+
initContext(szPartition);
|
128
|
+
|
122
129
|
dataOut.rewind();
|
123
|
-
|
124
|
-
|
125
|
-
|
130
|
+
|
131
|
+
if (m_decryptCipher == null)
|
132
|
+
throw new NullPointerException("m_decryptCipher == null");
|
133
|
+
|
134
|
+
m_decryptCipher.doFinal(dataIn, dataOut);
|
135
|
+
|
136
|
+
return true;
|
126
137
|
}catch(Exception exc)
|
127
138
|
{
|
128
|
-
reportFail("
|
139
|
+
reportFail("db_decrypt", exc);
|
129
140
|
return false;
|
130
141
|
}
|
131
142
|
}
|