rhodes 7.4.1 → 7.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +5 -5
  2. data/CREDITS +3 -1
  3. data/LICENSE +1 -1
  4. data/README.md +3 -1
  5. data/Rakefile +52 -43
  6. data/SECURITY.md +19 -0
  7. data/appveyor.yml +60 -7
  8. data/azure-pipelines.yml +67 -0
  9. data/extensions/rhoconnect-push/ext/rhoconnect-push/platform/android/src/com/rhomobile/rhoelements/ans/ANSManager.java +2 -2
  10. data/lib/commonAPI/barcode/ext/platform/android/AndroidManifest.xml +3 -1
  11. data/lib/commonAPI/barcode/ext/platform/android/src/com/google/barcodereader/BarcodeCaptureActivity.java +11 -13
  12. data/lib/commonAPI/barcode/ext/platform/android/src/com/google/barcodereader/BarcodeGraphicTracker.java +1 -1
  13. data/lib/commonAPI/barcode/ext/platform/android/src/com/google/barcodereader/ui/camera/CameraSource.java +3 -3
  14. data/lib/commonAPI/barcode/ext/platform/android/src/com/google/barcodereader/ui/camera/CameraSourcePreview.java +1 -1
  15. data/lib/commonAPI/barcode/ext.yml +4 -8
  16. data/lib/commonAPI/coreapi/ext/platform/android/Rakefile +0 -12
  17. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/Notification.java +4 -2
  18. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationScheduler.java +3 -3
  19. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationSingleton.java +1 -1
  20. data/lib/commonAPI/coreapi/ext/push.xml +5 -2
  21. data/lib/commonAPI/mediacapture/ext/camera.xml +4 -9
  22. data/lib/commonAPI/mediacapture/ext/platform/android/ApplicationFileProvider.erb +1 -1
  23. data/lib/commonAPI/mediacapture/ext/platform/android/ext_java.files +1 -9
  24. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraExtension.java +0 -2
  25. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraFactory.java +19 -24
  26. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraObject.java +317 -729
  27. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraRhoListener.java +240 -434
  28. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/{CameraSingletonObject.java → CameraSingleton.java} +68 -74
  29. data/lib/commonAPI/printing_zebra/ext/platform/android/src/com/rhomobile/printing/zebra/impl/ZebraPrintingProviderImpl.java +2 -1
  30. data/lib/extensions/fcm-push/ext/android/ApplicationManifestAdds.erb +15 -17
  31. data/lib/extensions/fcm-push/ext/android/Rakefile +59 -34
  32. data/lib/extensions/fcm-push/ext/android/ext_java.files +0 -1
  33. data/lib/extensions/fcm-push/ext/android/src/com/rhomobile/rhodes/fcm/FCMFacade.java +13 -17
  34. data/lib/extensions/fcm-push/ext/android/src/com/rhomobile/rhodes/fcm/FCMIntentService.java +81 -80
  35. data/lib/extensions/fcm-push/ext/android/src/com/rhomobile/rhodes/fcm/FCMListener.java +0 -16
  36. data/lib/extensions/fcm-push/ext.yml +1 -1
  37. data/lib/extensions/gmaps/ext/platform/android/ApplicationManifestAdds.erb +1 -0
  38. data/lib/extensions/gmaps/ext/platform/android/src/com/rhomobile/rhodes/gmaps/GMapActivity.java +12 -4
  39. data/lib/extensions/gmaps/ext.yml +3 -1
  40. data/platform/android/Rhodes/jni/src/MethodResultJni.cpp +4 -0
  41. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +3 -3
  42. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +3 -3
  43. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/StatusNotification.java +1 -1
  44. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +14 -14
  45. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +18 -9
  46. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality26.java +1 -1
  47. data/platform/android/build/{aab_builder.rb → aapt2_helper.rb} +94 -37
  48. data/platform/android/build/android.rake +124 -191
  49. data/platform/android/build/android_tools.rb +9 -9
  50. data/platform/android/build/androidcommon.rb +18 -7
  51. data/platform/android/build/build_tools_finder.rb +46 -0
  52. data/platform/android/build/config.yml +5 -0
  53. data/platform/android/build/dex_builder.rb +88 -0
  54. data/platform/android/build/hostplatform.rb +9 -0
  55. data/platform/android/build/manifest_generator.rb +1 -0
  56. data/platform/android/build/maven_deps_extractor.rb +22 -21
  57. data/platform/android/build/ndkwrapper.rb +80 -51
  58. data/platform/iphone/Classes/AppManager/AppManager.m +3 -1
  59. data/platform/iphone/Classes/Camera/PickImageDelegate.h +2 -0
  60. data/platform/iphone/Classes/Camera/PickImageDelegate.m +45 -23
  61. data/platform/iphone/Classes/CocoaServer/CCocoaServer.h +27 -0
  62. data/platform/iphone/Classes/CocoaServer/CCocoaServer.m +107 -0
  63. data/platform/iphone/Classes/CocoaServer/RhoHTTPConnection.h +16 -0
  64. data/platform/iphone/Classes/CocoaServer/RhoHTTPConnection.m +226 -0
  65. data/platform/iphone/Classes/RhoWKWebView.mm +78 -11
  66. data/platform/iphone/Classes/RhoWebViewFabrique.m +6 -1
  67. data/platform/iphone/Classes/Rhodes.m +3 -0
  68. data/platform/iphone/CocoaHTTPServer/Core/Categories/DDData.h +14 -0
  69. data/platform/iphone/CocoaHTTPServer/Core/Categories/DDData.m +158 -0
  70. data/platform/iphone/CocoaHTTPServer/Core/Categories/DDNumber.h +12 -0
  71. data/platform/iphone/CocoaHTTPServer/Core/Categories/DDNumber.m +88 -0
  72. data/platform/iphone/CocoaHTTPServer/Core/Categories/DDRange.h +56 -0
  73. data/platform/iphone/CocoaHTTPServer/Core/Categories/DDRange.m +104 -0
  74. data/platform/iphone/CocoaHTTPServer/Core/HTTPAuthenticationRequest.h +45 -0
  75. data/platform/iphone/CocoaHTTPServer/Core/HTTPAuthenticationRequest.m +195 -0
  76. data/platform/iphone/CocoaHTTPServer/Core/HTTPConnection.h +120 -0
  77. data/platform/iphone/CocoaHTTPServer/Core/HTTPConnection.m +2708 -0
  78. data/platform/iphone/CocoaHTTPServer/Core/HTTPLogging.h +136 -0
  79. data/platform/iphone/CocoaHTTPServer/Core/HTTPMessage.h +48 -0
  80. data/platform/iphone/CocoaHTTPServer/Core/HTTPMessage.m +113 -0
  81. data/platform/iphone/CocoaHTTPServer/Core/HTTPResponse.h +149 -0
  82. data/platform/iphone/CocoaHTTPServer/Core/HTTPServer.h +205 -0
  83. data/platform/iphone/CocoaHTTPServer/Core/HTTPServer.m +772 -0
  84. data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.h +65 -0
  85. data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.m +529 -0
  86. data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.h +33 -0
  87. data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.m +86 -0
  88. data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.h +23 -0
  89. data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.m +211 -0
  90. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.h +75 -0
  91. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.m +405 -0
  92. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPDataResponse.h +13 -0
  93. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPDataResponse.m +79 -0
  94. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPDynamicFileResponse.h +52 -0
  95. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPDynamicFileResponse.m +292 -0
  96. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.h +9 -0
  97. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.m +38 -0
  98. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPFileResponse.h +25 -0
  99. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPFileResponse.m +237 -0
  100. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.h +12 -0
  101. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.m +73 -0
  102. data/platform/iphone/CocoaHTTPServer/Core/WebSocket.h +105 -0
  103. data/platform/iphone/CocoaHTTPServer/Core/WebSocket.m +791 -0
  104. data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DAVConnection.h +7 -0
  105. data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DAVConnection.m +160 -0
  106. data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.h +11 -0
  107. data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.m +372 -0
  108. data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.h +7 -0
  109. data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.m +49 -0
  110. data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/PUTResponse.h +8 -0
  111. data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/PUTResponse.m +69 -0
  112. data/platform/iphone/CocoaHTTPServer/LICENSE.txt +18 -0
  113. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaAsyncSocket/About.txt +4 -0
  114. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaAsyncSocket/GCDAsyncSocket.h +1226 -0
  115. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaAsyncSocket/GCDAsyncSocket.m +8528 -0
  116. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/About.txt +33 -0
  117. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDASLLogger.h +41 -0
  118. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDASLLogger.m +99 -0
  119. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDAbstractDatabaseLogger.h +102 -0
  120. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDAbstractDatabaseLogger.m +727 -0
  121. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDFileLogger.h +334 -0
  122. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDFileLogger.m +1353 -0
  123. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDLog.h +601 -0
  124. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDLog.m +1083 -0
  125. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDTTYLogger.h +167 -0
  126. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDTTYLogger.m +1479 -0
  127. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/Extensions/ContextFilterLogFormatter.h +65 -0
  128. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/Extensions/ContextFilterLogFormatter.m +191 -0
  129. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/Extensions/DispatchQueueLogFormatter.h +116 -0
  130. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/Extensions/DispatchQueueLogFormatter.m +251 -0
  131. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/Extensions/README.txt +7 -0
  132. data/platform/iphone/Framework/Rhodes/Rhodes.xcodeproj/project.pbxproj +1 -1
  133. data/platform/iphone/RhoAppBaseLib/RhoAppBaseLib.xcodeproj/project.pbxproj +364 -0
  134. data/platform/iphone/rbuild/iphone.rake +4 -0
  135. data/platform/osx/bin/RhoSimulator/RhoSimulator.app.zip +0 -0
  136. data/platform/shared/common/RhodesApp.cpp +26 -1
  137. data/platform/shared/net/HttpServer.cpp +20 -0
  138. data/platform/shared/qt/RhoSimulator.pro +1 -1
  139. data/platform/shared/ruby/osx/ruby/config.h +2 -0
  140. data/platform/shared/ruby/win32/win32.c +10 -3
  141. data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
  142. data/rakefile.rb +52 -43
  143. data/res/build-tools/RhoRuby.exe +0 -0
  144. data/res/build-tools/aapt2/linux/aapt2 +0 -0
  145. data/res/build-tools/aapt2/osx/aapt2 +0 -0
  146. data/res/generators/templates/application/AndroidManifest.erb +2 -1
  147. data/res/generators/templates/application/build.yml +4 -1
  148. data/res/generators/templates/application/rhoconfig.txt +5 -0
  149. data/rhobuild.yml.example +4 -4
  150. data/rhodes.gemspec +1 -2
  151. data/version +1 -1
  152. metadata +80 -35
  153. data/lib/commonAPI/mediacapture/ext/platform/android/adds/res/drawable/camera_btn.xml +0 -14
  154. data/lib/commonAPI/mediacapture/ext/platform/android/adds/res/layout/camera_land.xml +0 -23
  155. data/lib/commonAPI/mediacapture/ext/platform/android/adds/res/layout/camera_port.xml +0 -23
  156. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraActivity.java +0 -156
  157. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraEclair.java +0 -227
  158. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraGingerbread.java +0 -152
  159. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraPreview.java +0 -183
  160. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraSingletonEclair.java +0 -14
  161. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraSingletonGingerbread.java +0 -60
  162. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/ICameraObject.java +0 -20
  163. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/ICameraSingletonObject.java +0 -8
  164. data/lib/extensions/fcm-push/ext/android/src/com/rhomobile/rhodes/fcm/FCMTokenRefresherService.java +0 -27
  165. data/platform/android/Rhodes/AndroidManifest.xml.erb +0 -89
@@ -32,9 +32,10 @@ import android.app.NotificationManager;
32
32
  import android.graphics.BitmapFactory;
33
33
  import android.media.RingtoneManager;
34
34
  import android.net.Uri;
35
- import android.support.v4.app.NotificationCompat;
35
+ import androidx.core.app.NotificationCompat;
36
36
  import com.google.firebase.messaging.FirebaseMessagingService;
37
37
  import com.google.firebase.messaging.RemoteMessage;
38
+ import com.google.firebase.messaging.Constants;
38
39
  import com.rhomobile.rhodes.util.ContextFactory;
39
40
  import com.rhomobile.rhodes.Logger;
40
41
  import com.rhomobile.rhodes.PushContract;
@@ -49,123 +50,123 @@ import org.json.JSONObject;
49
50
  import java.util.Timer;
50
51
  import java.util.TimerTask;
51
52
  import java.util.concurrent.TimeUnit;
53
+ import android.os.Bundle;
52
54
  import android.os.Handler;
55
+ import java.util.Queue;
56
+ import java.util.LinkedList;
53
57
 
54
58
 
55
59
  public class FCMIntentService extends FirebaseMessagingService {
56
60
 
57
61
  private static final String TAG = FCMIntentService.class.getSimpleName();
58
62
  public static final FCMListener listener = FCMListener.getInstance();
59
- static private String lastHandledIntent = null;
63
+
64
+ public static Queue<String> messagesQueue = new LinkedList<String>();
60
65
 
61
- private static FirebaseMessagingService savedService = null;
62
- private static Map<String, Intent> savedIntents = new HashMap<String, Intent>();
66
+
67
+ public FCMIntentService(){
68
+ super();
69
+ Logger.I(TAG, "FCM: creating FCMIntentService");
70
+ }
71
+
63
72
 
64
73
  @Override
65
- public void onMessageReceived(RemoteMessage remoteMessage) {
66
- lastHandledIntent = null;
67
- savedIntents.remove(remoteMessage.getMessageId());
74
+ public void handleIntent(Intent intent) {
75
+ Logger.W(TAG, "FCM: onHandleIntent()");
76
+ extractDataFromIntent(intent);
77
+ super.handleIntent(intent);
78
+ }
68
79
 
69
- Logger.I(TAG, "FCM: onMessageReceived()");
70
- Map<String, String> params = new HashMap<String, String>();
71
80
 
72
- if (remoteMessage.getMessageId() != null) params.put("id", remoteMessage.getMessageId());
73
- Logger.I(TAG, "FCM: id - " + remoteMessage.getMessageId());
81
+ void extractDataFromIntent(Intent intent){
74
82
 
75
- if (remoteMessage.getFrom() != null) params.put("from", remoteMessage.getFrom());
76
- Logger.I(TAG, "FCM: from - " + remoteMessage.getFrom());
83
+ Bundle bundle = intent.getExtras();
84
+ if (bundle != null) {
85
+ try{
77
86
 
78
- if (remoteMessage.getTo() != null) params.put("to", remoteMessage.getTo());
79
- Logger.I(TAG, "FCM: to - " + remoteMessage.getTo());
87
+ RemoteMessage remoteMessage = new RemoteMessage(bundle);
80
88
 
81
- if (remoteMessage.getNotification() != null){
82
- if (remoteMessage.getNotification().getBody() != null) params.put("body", remoteMessage.getNotification().getBody());
83
- Logger.I(TAG, "FCM: body - " + remoteMessage.getNotification().getBody());
89
+ if (remoteMessage.getMessageId() == null) return;
84
90
 
85
- if (remoteMessage.getNotification().getTitle() != null) params.put("title", remoteMessage.getNotification().getTitle());
86
- Logger.I(TAG, "FCM: title - " + remoteMessage.getNotification().getTitle());
91
+ Logger.I(TAG, "FCM: onMessageReceived()");
92
+ Map<String, String> params = new HashMap<String, String>();
87
93
 
88
- if (remoteMessage.getNotification().getTag() != null) params.put("tag", remoteMessage.getNotification().getTag());
89
- Logger.I(TAG, "FCM: tag - " + remoteMessage.getNotification().getTag());
90
- }
91
94
 
92
- try{
93
- JSONObject jsonObject = new JSONObject(params);
95
+ if (remoteMessage.getMessageId() != null) params.put("id", remoteMessage.getMessageId());
96
+ Logger.I(TAG, "FCM: id - " + remoteMessage.getMessageId());
94
97
 
95
- try {
96
- jsonObject.put("data", new JSONObject(remoteMessage.getData()));
97
- Logger.I(TAG, "FCM: data - " + remoteMessage.getData());
98
- } catch (JSONException e) {
99
- Logger.I(TAG, "FCM: jsonObject generation error");
100
- e.printStackTrace();
101
- }
98
+ if (remoteMessage.getFrom() != null) params.put("from", remoteMessage.getFrom());
99
+ Logger.I(TAG, "FCM: from - " + remoteMessage.getFrom());
102
100
 
103
- Logger.W(TAG, "FCM: push message in JSON: " + jsonObject.toString());
101
+ if (remoteMessage.getTo() != null) params.put("to", remoteMessage.getTo());
102
+ Logger.I(TAG, "FCM: to - " + remoteMessage.getTo());
104
103
 
105
- PushContract.handleMessage(ContextFactory.getContext(), jsonObject.toString(), FCMFacade.FCM_PUSH_CLIENT);
106
- }catch(Exception e){
107
- Logger.E(TAG, "FCM: can't create object for handleMessage");
108
- e.printStackTrace();
109
- }
110
- }
104
+ if (remoteMessage.getNotification() != null){
105
+ if (remoteMessage.getNotification().getBody() != null) params.put("body", remoteMessage.getNotification().getBody());
106
+ Logger.I(TAG, "FCM: body - " + remoteMessage.getNotification().getBody());
111
107
 
112
-
108
+ if (remoteMessage.getNotification().getTitle() != null) params.put("title", remoteMessage.getNotification().getTitle());
109
+ Logger.I(TAG, "FCM: title - " + remoteMessage.getNotification().getTitle());
113
110
 
114
- @Override
115
- public void onDeletedMessages() {
116
- Logger.W(TAG, "FCM: onDeletedMessages()");
117
-
118
- }
111
+ if (remoteMessage.getNotification().getTag() != null) params.put("tag", remoteMessage.getNotification().getTag());
112
+ Logger.I(TAG, "FCM: tag - " + remoteMessage.getNotification().getTag());
113
+ }
119
114
 
120
- @Override
121
- synchronized public void handleIntent(Intent intent) {
122
- Logger.W(TAG, "FCM: onHandleIntent()");
123
- savedService = this;
124
- if (intent.getExtras() != null) {
125
- for (String key : intent.getExtras().keySet()) {
126
- Object value = intent.getExtras().get(key);
127
- //Logger.W(TAG, "Key: " + key + " Value: " + value);
128
- if (key.equals("google.message_id")){
129
- savedIntents.put((String) value, intent);
130
- lastHandledIntent = (String) value;
131
- Logger.W(TAG, "FCM: onHandleIntent() : message id captured");
115
+
116
+ JSONObject jsonObject = new JSONObject(params);
117
+
118
+ try {
119
+ jsonObject.put("data", new JSONObject(remoteMessage.getData()));
120
+ Logger.I(TAG, "FCM: data - " + remoteMessage.getData());
121
+ } catch (JSONException e) {
122
+ Logger.I(TAG, "FCM: jsonObject generation error");
123
+ e.printStackTrace();
132
124
  }
125
+
126
+ Logger.W(TAG, "FCM: push message in JSON: " + jsonObject.toString());
127
+
128
+ messagesQueue.add(jsonObject.toString());
129
+
130
+ }catch(Exception e){
131
+ Logger.W(TAG, "FCM: exception on extracting data from intent");
132
+ e.printStackTrace();
133
133
  }
134
+
135
+ handleMessagesQueue();
134
136
  }
135
- super.handleIntent(intent);
137
+
136
138
  }
137
139
 
138
- public static void tryToHandleIntent(String value){
140
+ public static void handleMessagesQueue(){
139
141
  try{
140
- if (savedService != null){
141
- Logger.W(TAG, "FCM: tryToHandleIntent() - trying to handle intent");
142
- if (savedIntents.containsKey(value)){
143
- savedService.handleIntent(savedIntents.get(value));
144
- Logger.W(TAG, "FCM: tryToHandleIntent() - intent handled");
145
- }
142
+ while(messagesQueue.size() != 0){
143
+ Logger.W(TAG, "FCM: tryToHandleIntent() - trying to handle messages queue");
144
+ PushContract.handleMessage(ContextFactory.getContext(), messagesQueue.peek(), FCMFacade.FCM_PUSH_CLIENT);
145
+ messagesQueue.remove();
146
146
  }
147
147
  }catch(Exception e){
148
- Logger.W(TAG, "FCM: tryToHandleIntent() - can't handle intent");
148
+ Logger.E(TAG, "FCM: can't handle the messages queue");
149
+ e.printStackTrace();
149
150
  }
150
151
  }
151
152
 
152
-
153
153
  static public void resume()
154
154
  {
155
- if (lastHandledIntent != null){
156
-
157
- Timer timerObj = new Timer();
158
- TimerTask timerTaskObj = new TimerTask() {
159
- public void run() {
160
- if (lastHandledIntent != null){
161
- tryToHandleIntent(lastHandledIntent);
162
- }
163
- }
164
- };
165
- timerObj.schedule(timerTaskObj, 1000);
155
+ Timer timerObj = new Timer();
156
+ TimerTask timerTaskObj = new TimerTask() {
157
+ public void run() {
158
+ handleMessagesQueue();
159
+ }
160
+ };
161
+ timerObj.schedule(timerTaskObj, 1000);
162
+ }
166
163
 
167
-
168
- }
164
+ @Override
165
+ public void onNewToken(String token){
166
+ super.onNewToken(token);
167
+ Logger.W(TAG, "FCM: onNewToken: " + token);
168
+ ContextFactory.getContext().getSharedPreferences("FireBase", MODE_PRIVATE).edit().putString("token", token).apply();
169
+ FCMFacade.refreshToken();
169
170
  }
170
171
 
171
172
 
@@ -74,22 +74,6 @@ public class FCMListener extends AbstractRhoListener{
74
74
  @Override
75
75
  public void onNewIntent(RhodesActivity activity, Intent intent) {
76
76
  Logger.W("fcm", "FCM: onNewIntent");
77
- if ((intent != null)&&(intent.getExtras() != null)) {
78
- try{
79
- for (String key : intent.getExtras().keySet()) {
80
- Object value = intent.getExtras().get(key);
81
- Logger.W(TAG, "Key: " + key + " Value: " + value);
82
- if (key.equals("google.message_id")){
83
- FCMIntentService.tryToHandleIntent((String)value);
84
- }
85
- }
86
- }catch(Exception e){
87
-
88
- }
89
- }else{
90
- Logger.W(TAG, "New intent is null");
91
- }
92
-
93
77
  }
94
78
 
95
79
  @Override
@@ -13,7 +13,7 @@ android:
13
13
  library_deps: [extras/google/google_play_services/libproject/google-play-services_lib]
14
14
  source_list: ext/android/ext_java.files
15
15
  maven_deps:
16
- - 'com.google.firebase:firebase-messaging:11.0.2'
16
+ - 'com.google.firebase:firebase-messaging:21.1.0'
17
17
  adds: ext/android/res
18
18
  libraries: ['fcm-push']
19
19
  xml_api_paths: ext/fcm.xml
@@ -1,3 +1,4 @@
1
1
  <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="<%=@apikey%>"/>
2
2
  <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
3
3
  <activity android:name='com.rhomobile.rhodes.gmaps.GMapActivity' android:windowSoftInputMode='stateAlwaysHidden' android:configChanges='orientation' android:screenOrientation='<%= @screenOrientation %>'/>
4
+ <uses-library android:name="org.apache.http.legacy" android:required="false" />
@@ -7,7 +7,7 @@ import java.util.List;
7
7
  import java.util.Map;
8
8
  import java.util.Vector;
9
9
 
10
- import android.support.v4.app.FragmentActivity;
10
+ import androidx.fragment.app.FragmentActivity;
11
11
  import android.view.Window;
12
12
  import android.view.WindowManager;
13
13
 
@@ -16,6 +16,7 @@ import com.google.android.gms.maps.CameraUpdateFactory;
16
16
  import com.google.android.gms.maps.GoogleMap;
17
17
  import com.google.android.gms.maps.GoogleMapOptions;
18
18
  import com.google.android.gms.maps.SupportMapFragment;
19
+ import com.google.android.gms.maps.OnMapReadyCallback;
19
20
  import com.google.android.gms.maps.UiSettings;
20
21
  import com.google.android.gms.maps.model.BitmapDescriptorFactory;
21
22
  import com.google.android.gms.maps.model.CameraPosition;
@@ -45,7 +46,7 @@ import android.location.Geocoder;
45
46
  import android.os.Bundle;
46
47
  import android.os.IBinder;
47
48
 
48
- public class GMapActivity extends FragmentActivity {
49
+ public class GMapActivity extends FragmentActivity implements OnMapReadyCallback {
49
50
 
50
51
  static class MarkerAdds {
51
52
  public String url;
@@ -117,8 +118,14 @@ public class GMapActivity extends FragmentActivity {
117
118
  setContentView(R.layout.gmaplayout);
118
119
 
119
120
  SupportMapFragment mapFragment = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map);
120
-
121
- mMap = mapFragment.getMap();
121
+
122
+ mapFragment.getMapAsync(this);
123
+ }
124
+
125
+
126
+ @Override
127
+ public void onMapReady(GoogleMap googleMap){
128
+ mMap = googleMap;
122
129
 
123
130
  if ( null == mMap ) {
124
131
  Logger.E(TAG,"GoogleMap object is null from fragment. Finishing activity.");
@@ -298,6 +305,7 @@ public class GMapActivity extends FragmentActivity {
298
305
  geocoding.start();
299
306
  }
300
307
 
308
+
301
309
  @Override
302
310
  protected void onStart() {
303
311
  super.onStart();
@@ -13,4 +13,6 @@ android:
13
13
  library_deps: [extras/google/google_play_services/libproject/google-play-services_lib]
14
14
 
15
15
  #will work with newer SDKs
16
- maven_deps: ['com.google.android.gms:play-services-maps:9.0.2']
16
+ maven_deps:
17
+ - 'com.google.android.gms:play-services-maps:17.0.0'
18
+ - 'androidx.fragment:fragment:1.2.5'
@@ -421,6 +421,10 @@ void MethodResultJni::setRubyProcCallback(JNIEnv* env, jlong jRubyProc)
421
421
 
422
422
  env->SetLongField(m_jResult, s_fidRubyProcCallback, jRubyProc);
423
423
 
424
+ m_hasCallback = true;
425
+
426
+ rho_ruby_holdValue(jRubyProc);
427
+
424
428
  RAWTRACE("Callback has been set ^^^");
425
429
  }
426
430
  //----------------------------------------------------------------------------------------------------------------------
@@ -70,8 +70,8 @@ import android.view.Window;
70
70
  import android.widget.FrameLayout;
71
71
  import android.util.Log;
72
72
 
73
- import android.support.v4.content.PermissionChecker;
74
- import android.support.v4.app.ActivityCompat;
73
+ import androidx.core.content.PermissionChecker;
74
+ import androidx.core.app.ActivityCompat;
75
75
 
76
76
  public class RhodesActivity extends BaseActivity implements SplashScreen.SplashScreenListener, ActivityCompat.OnRequestPermissionsResultCallback {
77
77
 
@@ -636,7 +636,7 @@ public class RhodesActivity extends BaseActivity implements SplashScreen.SplashS
636
636
  mHandler.postDelayed(r, delay);
637
637
  }
638
638
 
639
- public SplashScreen getSplashScreen() {
639
+ public SplashScreen getRhodesSplashScreen() {
640
640
  return mSplashScreen;
641
641
  }
642
642
 
@@ -436,7 +436,7 @@ public class RhodesService extends Service {
436
436
 
437
437
  try {
438
438
  // Show splash screen only if we have active activity
439
- SplashScreen splashScreen = RhodesActivity.safeGetInstance().getSplashScreen();
439
+ SplashScreen splashScreen = RhodesActivity.safeGetInstance().getRhodesSplashScreen();
440
440
  if (splashScreen != null) {
441
441
  splashScreen.start();
442
442
  }
@@ -1197,9 +1197,9 @@ public class RhodesService extends Service {
1197
1197
  //min API = 24
1198
1198
  //builder.setCustomContentView(expandedView);
1199
1199
  Intent intent = new Intent(ACTION_ASK_CANCEL_DOWNLOAD);
1200
- builder.setContentIntent(PendingIntent.getBroadcast(context, 0, intent, 0));
1200
+ builder.setContentIntent(PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_IMMUTABLE));
1201
1201
  intent = new Intent(ACTION_CANCEL_DOWNLOAD);
1202
- builder.setDeleteIntent(PendingIntent.getBroadcast(context, 0, intent, 0));
1202
+ builder.setDeleteIntent(PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_IMMUTABLE));
1203
1203
 
1204
1204
  mNM.notify(DOWNLOAD_PACKAGE_ID, builder.build() );
1205
1205
  }
@@ -47,7 +47,7 @@ public class StatusNotification
47
47
  public static Notification simpleNotification(String tag, int notificationId, Context ctx, Intent intent, String title, String text)
48
48
  {
49
49
  Notification notification = makeNotification(text);
50
- PendingIntent contentIntent = PendingIntent.getActivity(ctx, 0, intent, 0);
50
+ PendingIntent contentIntent = PendingIntent.getActivity(ctx, 0, intent, PendingIntent.FLAG_IMMUTABLE);
51
51
 
52
52
  notification.setLatestEventInfo(ctx, title, text, contentIntent);
53
53
  notification.defaults = Notification.DEFAULT_ALL;
@@ -166,9 +166,9 @@ public class GeoLocation {
166
166
  return false;
167
167
  }
168
168
 
169
- public static double getLatitude() {
170
- onUpdateLocation();
169
+ public static double getLatitude() {
171
170
  try {
171
+ onUpdateLocation();
172
172
  checkState();
173
173
  Logger.T(TAG, "getLatitude");
174
174
  return ourLatitude;
@@ -179,9 +179,9 @@ public class GeoLocation {
179
179
  return 0.0;
180
180
  }
181
181
 
182
- public static double getSpeed() {
183
- onUpdateLocation();
182
+ public static double getSpeed() {
184
183
  try {
184
+ onUpdateLocation();
185
185
  checkState();
186
186
  Logger.T(TAG, "getSpeed");
187
187
  return ourSpeed;
@@ -192,9 +192,9 @@ public class GeoLocation {
192
192
  return 0.0;
193
193
  }
194
194
 
195
- public static int getSatellities() {
196
- onUpdateLocation();
195
+ public static int getSatellities() {
197
196
  try {
197
+ onUpdateLocation();
198
198
  checkState();
199
199
  Logger.T(TAG, "getSatellities");
200
200
  return ourSatellities;
@@ -206,9 +206,9 @@ public class GeoLocation {
206
206
  }
207
207
 
208
208
 
209
- public static double getLongitude() {
210
- onUpdateLocation();
209
+ public static double getLongitude() {
211
210
  try {
211
+ onUpdateLocation();
212
212
  checkState();
213
213
  Logger.T(TAG, "getLongitude");
214
214
  return ourLongitude;
@@ -219,9 +219,9 @@ public class GeoLocation {
219
219
  return 0.0;
220
220
  }
221
221
 
222
- public static double getAltitude() {
223
- onUpdateLocation();
222
+ public static double getAltitude() {
224
223
  try {
224
+ onUpdateLocation();
225
225
  checkState();
226
226
  Logger.T(TAG, "getAltitude");
227
227
  return ourAltitude;
@@ -232,9 +232,9 @@ public class GeoLocation {
232
232
  return 0.0;
233
233
  }
234
234
 
235
- public static float getAccuracy() {
236
- onUpdateLocation();
235
+ public static float getAccuracy() {
237
236
  try {
237
+ onUpdateLocation();
238
238
  checkState();
239
239
  Logger.T(TAG, "getAccuracy");
240
240
  return (float)ourAccuracy;
@@ -245,9 +245,9 @@ public class GeoLocation {
245
245
  return 0;
246
246
  }
247
247
 
248
- public static boolean isKnownPosition() {
249
- onUpdateLocation();
248
+ public static boolean isKnownPosition() {
250
249
  try {
250
+ onUpdateLocation();
251
251
  checkState();
252
252
  Logger.T(TAG, "isKnownPosition");
253
253
  return ourIsKnownPosition;
@@ -87,13 +87,17 @@ public class GeoLocationImpl {
87
87
  }
88
88
  }
89
89
  if(this.provider != null) {
90
- if (exMode) {
91
- this.manager.requestLocationUpdates(providerName, minTime, (float)minDistance, this);
92
- }
93
- else {
94
- this.manager.requestLocationUpdates(providerName, UPDATE_PERIOD_IN_MILLISECONDS, 0, this, Looper.getMainLooper());
90
+ try {
91
+ if (exMode) {
92
+ this.manager.requestLocationUpdates(providerName, minTime, (float)minDistance, this);
93
+ }
94
+ else {
95
+ this.manager.requestLocationUpdates(providerName, UPDATE_PERIOD_IN_MILLISECONDS, 0, this, Looper.getMainLooper());
96
+ }
97
+ available = this.manager.isProviderEnabled(this.providerName);
98
+ } catch ( SecurityException e ) {
99
+ Logger.E(TAG,e);
95
100
  }
96
- available = this.manager.isProviderEnabled(this.providerName);
97
101
  }
98
102
  return available;
99
103
  }
@@ -102,7 +106,7 @@ public class GeoLocationImpl {
102
106
  available = false;
103
107
  if (this.provider != null && this.manager != null) {
104
108
  Logger.T(TAG, "Unregistering location listener for '" + this.providerName + "'.");
105
- this.manager.removeUpdates(this);
109
+ this.manager.removeUpdates(this);
106
110
  this.provider = null;
107
111
  return true;
108
112
  }
@@ -112,8 +116,13 @@ public class GeoLocationImpl {
112
116
 
113
117
  void requestLastLocation() {
114
118
  if (this.provider != null && this.manager != null) {
115
- Location location = this.manager.getLastKnownLocation(this.providerName);
116
- onLocationChanged(location);
119
+ try
120
+ {
121
+ Location location = this.manager.getLastKnownLocation(this.providerName);
122
+ onLocationChanged(location);
123
+ } catch ( SecurityException e ) {
124
+ Logger.E(TAG,e);
125
+ }
117
126
  }
118
127
  }
119
128
 
@@ -26,7 +26,7 @@
26
26
 
27
27
  package com.rhomobile.rhodes.osfunctionality;
28
28
 
29
- import android.support.annotation.RequiresApi;
29
+ import androidx.annotation.RequiresApi;
30
30
  import android.app.Notification.Builder;
31
31
  import android.content.Context;
32
32
  import android.app.NotificationManager;