rhodes 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. data/CHANGELOG +10 -0
  2. data/lib/framework/rho/rhoerror.rb +4 -0
  3. data/lib/framework/rhodes.rb +2 -2
  4. data/lib/framework/rhom/rhom.rb +21 -1
  5. data/lib/framework/version.rb +2 -2
  6. data/lib/rhodes.rb +2 -2
  7. data/platform/android/Rhodes/AndroidManifest.xml +2 -2
  8. data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +21 -6
  9. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesInstance.java +1 -1
  10. data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +10 -0
  11. data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +1 -1
  12. data/platform/bb/rhodes/src/com/rho/rubyext/GeoLocation.java +2 -2
  13. data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +4 -2
  14. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +52 -11
  15. data/platform/iphone/Classes/NativeBar.m +37 -18
  16. data/platform/iphone/Classes/Rhodes.h +2 -0
  17. data/platform/iphone/Classes/Rhodes.m +27 -8
  18. data/platform/iphone/Classes/SimpleMainView.h +7 -5
  19. data/platform/iphone/Classes/SimpleMainView.m +155 -36
  20. data/platform/iphone/Classes/TabbedMainView.h +2 -4
  21. data/platform/iphone/Classes/TabbedMainView.m +12 -10
  22. data/platform/iphone/Classes/WebView.m +1 -0
  23. data/platform/iphone/Info.plist +7 -1
  24. data/platform/iphone/icon114.png +0 -0
  25. data/platform/iphone/icon57.png +0 -0
  26. data/platform/iphone/icon72.png +0 -0
  27. data/platform/iphone/rbuild/iphone.rake +102 -16
  28. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +12 -0
  29. data/platform/shared/common/IRhoThreadImpl.h +1 -1
  30. data/platform/shared/common/PosixThreadImpl.cpp +17 -22
  31. data/platform/shared/common/PosixThreadImpl.h +1 -1
  32. data/platform/shared/common/RhoThread.cpp +7 -3
  33. data/platform/shared/common/RhoThread.h +21 -7
  34. data/platform/shared/common/RhodesApp.cpp +13 -9
  35. data/platform/shared/common/RhodesApp.h +1 -1
  36. data/platform/shared/common/ThreadQueue.cpp +6 -4
  37. data/platform/shared/rubyJVM/src/com/rho/IRhoRubyHelper.java +2 -0
  38. data/platform/shared/rubyJVM/src/com/rho/RhoThread.java +18 -8
  39. data/platform/shared/rubyJVM/src/com/rho/RhodesApp.java +70 -2
  40. data/platform/shared/rubyJVM/src/com/rho/ThreadQueue.java +143 -0
  41. data/platform/shared/rubyJVM/src/com/rho/sync/ClientRegister.java +15 -5
  42. data/platform/shared/rubyJVM/src/com/rho/sync/SyncEngine.java +42 -36
  43. data/platform/shared/rubyJVM/src/com/rho/sync/SyncNotify.java +63 -20
  44. data/platform/shared/rubyJVM/src/com/rho/sync/SyncSource.java +4 -4
  45. data/platform/shared/rubyJVM/src/com/rho/sync/SyncThread.java +12 -2
  46. data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RhoSupport.java +9 -3
  47. data/platform/shared/sync/ClientRegister.cpp +11 -3
  48. data/platform/shared/sync/ClientRegister.h +1 -0
  49. data/platform/shared/sync/SyncEngine.cpp +38 -35
  50. data/platform/shared/sync/SyncEngine.h +2 -1
  51. data/platform/shared/sync/SyncNotify.cpp +53 -20
  52. data/platform/shared/sync/SyncNotify.h +9 -2
  53. data/platform/shared/sync/SyncSource.cpp +3 -3
  54. data/platform/shared/sync/SyncSource.h +1 -1
  55. data/platform/shared/sync/SyncThread.cpp +9 -2
  56. data/platform/wm/rhodes/Alert.cpp +35 -21
  57. data/platform/wm/rhodes/Alert.h +11 -2
  58. data/platform/wm/rhodes/rho/common/RhoThreadImpl.cpp +11 -12
  59. data/platform/wm/rhodes/rho/common/RhoThreadImpl.h +2 -0
  60. data/res/generators/templates/application/build.yml +1 -1
  61. data/rhodes.gemspec +2 -2
  62. data/spec/framework_spec/rhoconfig.txt +1 -0
  63. data/spec/phone_spec/rhoconfig.txt +2 -0
  64. metadata +8 -5
  65. data/Manifest.txt +0 -5333
data/CHANGELOG CHANGED
@@ -1,3 +1,13 @@
1
+ ## 2.0.3
2
+ * #4317065 - App store requires 3 icons now for iphone
3
+ * #4356949 - iPhone simulator: rake run:iphone open simulator but there is no
4
+ application
5
+ * #4394846 - Android: no application screen when go to background and switch back
6
+ * #4365316 - build.yml should default to iPhoneSimulator 4.0
7
+
8
+ ## 2.0.2
9
+ * #4223112 - fixed problem with script order in iphone build
10
+
1
11
  ## 2.0.1
2
12
  * #4049590 - Android 2.2, rhodes rc2: take picture hangs
3
13
  * #4103477 - Android 2.2: can't write to DB
@@ -24,6 +24,10 @@ module Rho
24
24
  ::Rho::RhoError.err_message(code)
25
25
  end
26
26
 
27
+ def unknown_client?(msg)
28
+ code == ERR_REMOTESERVER && msg && msg.downcase == 'unknown client'
29
+ end
30
+
27
31
  end # RhoError
28
32
  end # Rho
29
33
 
@@ -1,9 +1,9 @@
1
1
  module Rhodes
2
2
  unless defined? Rhodes::VERSION
3
- VERSION = '2.0.2'
3
+ VERSION = '2.0.3'
4
4
  end
5
5
  unless defined? Rhodes::DBVERSION
6
- DBVERSION = '2.0.2'
6
+ DBVERSION = '2.0.3'
7
7
  end
8
8
 
9
9
  end
@@ -40,6 +40,26 @@ module Rhom
40
40
  c_id = ::Rho::RHO.get_user_db().select_from_table('client_info','client_id')[0]
41
41
  c_id.nil? ? nil : c_id['client_id']
42
42
  end
43
+
44
+ def database_client_reset
45
+ SyncEngine.stop_sync
46
+
47
+ params = ["", "", 0]
48
+ ::Rho::RHO.get_user_db().execute_sql("UPDATE client_info SET client_id=?, token=?, token_sent=?", params)
49
+
50
+ if ( Rho::RhoConfig.exists?('bulksync_state') )
51
+ Rho::RhoConfig.bulksync_state='0'
52
+ end
53
+ ::Rho::RHO.get_user_db().execute_sql("UPDATE sources SET token=0")
54
+
55
+ ::Rho::RHO.get_db_partitions().each_value do |db|
56
+ db.destroy_tables(
57
+ :exclude => (['sources','client_info']) )
58
+ end
59
+
60
+ hash_migrate = {}
61
+ ::Rho::RHO.init_schema_sources(hash_migrate)
62
+ end
43
63
 
44
64
  def database_full_reset(reset_client_info=false)
45
65
  SyncEngine.stop_sync
@@ -68,7 +88,7 @@ module Rhom
68
88
  database_full_reset(true)
69
89
  SyncEngine.logout
70
90
  end
71
-
91
+
72
92
  def search(args)
73
93
  searchParams = ""
74
94
 
@@ -1,8 +1,8 @@
1
1
  module RhodesFramework
2
2
  unless defined? RhodesFramework::VERSION
3
- VERSION = '2.0.2'
3
+ VERSION = '2.0.3'
4
4
  end
5
5
  unless defined? RhodesFramework::DBVERSION
6
- DBVERSION = '2.0.2'
6
+ DBVERSION = '2.0.3'
7
7
  end
8
8
  end
data/lib/rhodes.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  module Rhodes
2
2
  unless defined? Rhodes::VERSION
3
- VERSION = '2.0.2'
3
+ VERSION = '2.0.3'
4
4
  end
5
5
  unless defined? Rhodes::DBVERSION
6
- DBVERSION = '2.0.2'
6
+ DBVERSION = '2.0.3'
7
7
  end
8
8
 
9
9
  end
@@ -1,8 +1,8 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
3
  package="com.rhomobile.rhodes"
4
- android:versionCode="22"
5
- android:versionName="2.0.2">
4
+ android:versionCode="23"
5
+ android:versionName="2.0.3">
6
6
  <uses-sdk android:minSdkVersion="3" />
7
7
  <application android:icon="@drawable/icon"
8
8
  android:multiprocess="true"
@@ -41,6 +41,7 @@ import com.rhomobile.rhodes.uri.VideoUriHandler;
41
41
 
42
42
  import android.app.Activity;
43
43
  import android.content.Context;
44
+ import android.content.Intent;
44
45
  import android.content.pm.ActivityInfo;
45
46
  import android.content.pm.ApplicationInfo;
46
47
  import android.content.pm.PackageManager.NameNotFoundException;
@@ -84,9 +85,11 @@ public class Rhodes extends Activity {
84
85
  public static int WINDOW_FLAGS = WindowManager.LayoutParams.FLAG_FULLSCREEN;
85
86
  public static int WINDOW_MASK = WindowManager.LayoutParams.FLAG_FULLSCREEN;
86
87
 
87
- private static int MAX_PROGRESS = 10000;
88
+ public static int MAX_PROGRESS = 10000;
88
89
 
89
- private static boolean ENABLE_LOADING_INDICATION = true;
90
+ public static boolean ENABLE_LOADING_INDICATION = true;
91
+
92
+ private static boolean ownActivityActivated;
90
93
 
91
94
  private boolean needGeoLocationRestart = false;
92
95
 
@@ -481,8 +484,9 @@ public class Rhodes extends Activity {
481
484
  @Override
482
485
  public void onCreate(Bundle savedInstanceState) {
483
486
  super.onCreate(savedInstanceState);
484
-
485
- Logger.T(TAG, "+++ onCreate");
487
+
488
+ // Here Log should be used, not Logger. It is because Logger is not initialized yet.
489
+ Log.v(TAG, "+++ onCreate");
486
490
 
487
491
  Thread ct = Thread.currentThread();
488
492
  ct.setPriority(Thread.MAX_PRIORITY);
@@ -571,13 +575,16 @@ public class Rhodes extends Activity {
571
575
  protected void onStart() {
572
576
  super.onStart();
573
577
  Logger.T(TAG, "+++ onStart");
578
+ ownActivityActivated = false;
579
+ if (needGeoLocationRestart) {
580
+ GeoLocation.isKnownPosition();
581
+ needGeoLocationRestart = false;
582
+ }
574
583
  }
575
584
 
576
585
  @Override
577
586
  protected void onResume() {
578
587
  super.onResume();
579
- if (needGeoLocationRestart)
580
- GeoLocation.isKnownPosition();
581
588
  Logger.T(TAG, "+++ onResume");
582
589
  }
583
590
 
@@ -592,6 +599,8 @@ public class Rhodes extends Activity {
592
599
  Logger.T(TAG, "+++ onStop");
593
600
  needGeoLocationRestart = GeoLocation.isAvailable();
594
601
  GeoLocation.stop();
602
+ if (!ownActivityActivated)
603
+ stopSelf();
595
604
  super.onStop();
596
605
  }
597
606
 
@@ -765,6 +774,12 @@ public class Rhodes extends Activity {
765
774
  Process.killProcess(Process.myPid());
766
775
  }
767
776
 
777
+ @Override
778
+ public void startActivity(Intent intent) {
779
+ ownActivityActivated = true;
780
+ super.startActivity(intent);
781
+ }
782
+
768
783
  static {
769
784
  NativeLibraries.load();
770
785
  }
@@ -29,7 +29,7 @@ public class RhodesInstance {
29
29
  }
30
30
 
31
31
  public static void setInstance(Rhodes instance) {
32
- if ( RhodesInstance.instance == null )
32
+ if ( RhodesInstance.instance != instance )
33
33
  RhodesInstance.instance = instance;
34
34
  }
35
35
 
@@ -111,6 +111,16 @@ public class RhoRubyHelper implements IRhoRubyHelper {
111
111
  return netCallback.m_response;
112
112
  }
113
113
 
114
+ public void navigateUrl(String url)
115
+ {
116
+ WebView.navigate(url);
117
+ }
118
+
119
+ public void navigateBack()
120
+ {
121
+ RhodesApplication.getInstance().navigateBack();
122
+ }
123
+
114
124
  static Hashtable m_appProperties = new Hashtable();
115
125
  public String getAppProperty(String name)
116
126
  {
@@ -205,7 +205,7 @@ public class NetworkAccess implements INetworkAccess {
205
205
 
206
206
  try {
207
207
  String url = strUrl;
208
- if (!ignoreSuffix)
208
+ if ( RhoConf.getInstance().getBool("bb_sim_use_deviceside") || !ignoreSuffix )
209
209
  url += URLsuffix;
210
210
  if (url.startsWith("https"))
211
211
  url += ";EndToEndDesired;RdHTTPS";
@@ -138,9 +138,9 @@ public class GeoLocation extends RhoThread{
138
138
  {
139
139
  LOG.INFO( "Starting main routine..." );
140
140
 
141
- while(!m_bStop)
141
+ while(!isStopping())
142
142
  {
143
- if (!m_bStop)
143
+ if (!isStopping())
144
144
  checkAlive();
145
145
 
146
146
  wait( 10*10000);
@@ -5,6 +5,7 @@ import java.util.Vector;
5
5
 
6
6
  import javax.microedition.io.*;
7
7
 
8
+ import com.rho.FilePath;
8
9
  import com.rho.RhoEmptyLogger;
9
10
  import com.rho.RhoLogger;
10
11
  import com.rho.RhodesApp;
@@ -268,10 +269,11 @@ public class PushListeningThread extends Thread {
268
269
  op = splitOnce(ops[loop],"=");
269
270
  if (op.length>1) {
270
271
  op = splitOnce(op[1],",");
272
+ String fileName = FilePath.join("/public/alerts/", op[0]);
271
273
  if (op.length>1) {
272
- play_file(op[0],op[1]);
274
+ play_file(fileName,op[1]);
273
275
  } else {
274
- play_file(op[0],null);
276
+ play_file(fileName,null);
275
277
  }
276
278
  }
277
279
  }
@@ -86,7 +86,8 @@ final public class RhodesApplication extends UiApplication implements SystemList
86
86
  /*if ( m_bSkipKeyPress )
87
87
  m_bSkipKeyPress = false;
88
88
  else*/
89
- back();
89
+ //back();
90
+ RHODESAPP().navigateBack();
90
91
  return true;
91
92
  }
92
93
 
@@ -123,11 +124,12 @@ final public class RhodesApplication extends UiApplication implements SystemList
123
124
  _mainScreen.addCustomMenuItem(label, value);
124
125
  }
125
126
 
126
- private String m_strAppBackUrl ="";
127
+ //private String m_strAppBackUrl ="";
127
128
 
128
129
  public void resetMenuItems() {
129
130
  _mainScreen.setMenuItems(new Vector());
130
- m_strAppBackUrl = "";
131
+ //m_strAppBackUrl = "";
132
+ RHODESAPP().setAppBackUrl("");
131
133
  }
132
134
 
133
135
  public void postUrl(String url, String body, HttpHeaders headers) {
@@ -194,7 +196,35 @@ final public class RhodesApplication extends UiApplication implements SystemList
194
196
  return false;
195
197
  }
196
198
 
197
- void back(){
199
+ public void navigateBack()
200
+ {
201
+ if ( RHODESAPP().isCloseBack() )
202
+ {
203
+ _mainScreen.close();
204
+ return;
205
+ }
206
+
207
+ String url = "";
208
+ if ( _history.size() <= 1 )
209
+ {
210
+ if ( RhoConf.getInstance().getBool("bb_disable_closebyback"))
211
+ return;
212
+
213
+ _mainScreen.close();
214
+ return;
215
+ }
216
+ int nPos = _history.size()-2;
217
+ url = (String)_history.elementAt(nPos);
218
+ _history.removeElementAt(nPos+1);
219
+
220
+ // this.m_oBrowserAdapter.goBack();
221
+
222
+ saveCurrentLocation(url);
223
+ navigateUrl(url);
224
+ }
225
+ /*
226
+ void back()
227
+ {
198
228
  String url = m_strAppBackUrl;
199
229
  if ( url.length() == 0)
200
230
  {
@@ -220,7 +250,7 @@ final public class RhodesApplication extends UiApplication implements SystemList
220
250
 
221
251
  saveCurrentLocation(url);
222
252
  navigateUrl(url);
223
- }
253
+ }*/
224
254
 
225
255
  String removeSemicolon(String str)
226
256
  {
@@ -673,7 +703,8 @@ final public class RhodesApplication extends UiApplication implements SystemList
673
703
  };
674
704
  private MenuItem backItem = new MenuItem("", 200000, 10) {
675
705
  public void run() {
676
- back();
706
+ //back();
707
+ RHODESAPP().navigateBack();
677
708
  }
678
709
  };
679
710
  private MenuItem syncItem = new MenuItem("", 200000, 10) {
@@ -748,7 +779,9 @@ final public class RhodesApplication extends UiApplication implements SystemList
748
779
  menu.add(contextMenu);
749
780
  }
750
781
 
751
- public void addCustomMenuItem(String label, final String value) {
782
+ public void addCustomMenuItem(String label, final String value)
783
+ {
784
+ final String _label = label;
752
785
  // Is this a default item? If so, use the existing menu item we have.
753
786
  if (value.equalsIgnoreCase(RhodesApplication.LABEL_HOME)) {
754
787
  setDefaultItemToMenuItems(label, homeItem);
@@ -772,13 +805,21 @@ final public class RhodesApplication extends UiApplication implements SystemList
772
805
  menuItems = null;
773
806
  } else {
774
807
  if ( label.equalsIgnoreCase("back") )
775
- m_strAppBackUrl = value;
808
+ //m_strAppBackUrl = value;
809
+ RHODESAPP().setAppBackUrl(value);
776
810
  else
777
811
  {
778
- MenuItem itemToAdd = new MenuItem(label, 200000, 10) {
812
+ MenuItem itemToAdd = new MenuItem(label, 200000, 10)
813
+ {
779
814
  public void run()
780
815
  {
781
- if (value != null && value.startsWith("callback:") )
816
+ try{
817
+ RHODESAPP().loadUrl(value);
818
+ }catch(Exception exc)
819
+ {
820
+ LOG.ERROR("Execute menu item: '" + _label + "' failed.", exc);
821
+ }
822
+ /* if (value != null && value.startsWith("callback:") )
782
823
  {
783
824
  String url = RHODESAPP().canonicalizeRhoUrl(value.substring(9));
784
825
  RhoRubyHelper helper = new RhoRubyHelper();
@@ -788,7 +829,7 @@ final public class RhodesApplication extends UiApplication implements SystemList
788
829
  String url = RHODESAPP().canonicalizeRhoUrl(value);
789
830
  addToHistory(url, null );
790
831
  navigateUrl(url);
791
- }
832
+ }*/
792
833
  }
793
834
  };
794
835
  menuItems.addElement(itemToAdd);
@@ -34,27 +34,46 @@ static int started = 0;
34
34
  Rhodes *r = [Rhodes sharedInstance];
35
35
 
36
36
  id mainView = [r mainView];
37
-
37
+ UIWindow* w = r.window;
38
+
39
+ SimpleMainView* smv = nil;
40
+ if ([mainView isKindOfClass:[SimpleMainView class]]) {
41
+ smv = (SimpleMainView*)mainView;
42
+ }
38
43
  switch (type) {
39
- case NOBAR_TYPE:
40
- view = [[SimpleMainView alloc] initWithMainView:mainView];
41
- started = 0;
42
- break;
43
- case TOOLBAR_TYPE:
44
- view = [[SimpleMainView alloc] initWithMainView:mainView toolbar:items];
45
- started = 1;
46
- break;
47
- case TABBAR_TYPE:
48
- view = [[TabbedMainView alloc] initWithMainView:mainView tabs:items];
49
- started = 1;
50
- break;
51
- default:
52
- RAWLOG_ERROR1("Unknown bar type passed: %d", type);
44
+ case NOBAR_TYPE:
45
+ if (smv != nil) {
46
+ [smv removeToolbar];
47
+ }
48
+ else {
49
+ view = [[SimpleMainView alloc] initWithMainView:mainView parent:w ];
50
+ [r setMainView:view];
51
+ [view release];
52
+ }
53
+ started = 0;
54
+ break;
55
+ case TOOLBAR_TYPE:
56
+ if (smv != nil) {
57
+ [smv addToolbar:items];
58
+ }
59
+ else {
60
+ view = [[SimpleMainView alloc] initWithMainView:mainView parent:w toolbar:items];
61
+ [r setMainView:view];
62
+ [view release];
63
+ }
64
+ started = 1;
65
+ break;
66
+ case TABBAR_TYPE:
67
+ view = [[TabbedMainView alloc] initWithMainView:mainView parent:w tabs:items];
68
+ started = 1;
69
+ [r setMainView:view];
70
+ [view release];
71
+ break;
72
+ default:
73
+ RAWLOG_ERROR1("Unknown bar type passed: %d", type);
53
74
  return;
54
75
  }
55
-
56
- [r setMainView:view];
57
- [view release];
76
+
58
77
  }
59
78
  @end
60
79