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
@@ -27,26 +27,35 @@ import com.rhomobile.rhodes.api.IMethodResult;
27
27
  import com.rhomobile.rhodes.file.RhoFileApi;
28
28
  import com.rhomobile.rhodes.ui.FileList;
29
29
 
30
- public class CameraSingletonObject implements ICameraSingletonObject {
31
- private static final String TAG = CameraSingletonObject.class.getSimpleName();
32
- public static boolean deprecated_choose_pic;
33
- private int mId;
30
+ public class CameraSingleton implements ICameraSingleton {
31
+ private static final String TAG = CameraSingleton.class.getSimpleName();
32
+ private int mId = 0;
34
33
 
35
34
  static int getCameraIndex(String id) {
36
35
  return Integer.valueOf(id.substring(7)).intValue();
37
36
  }
37
+
38
38
  static String getCameraId(int idx) {
39
39
  return "camera#" + String.valueOf(idx);
40
40
  }
41
41
 
42
- @Override
43
42
  public int getCameraCount() {
44
43
  Logger.T(TAG, "getCameraCount");
45
- return 1;
44
+ return android.hardware.Camera.getNumberOfCameras();
46
45
  }
47
46
 
48
- public CameraSingletonObject() {
49
- mId = 0;
47
+
48
+ public CameraSingleton() {
49
+ int camera_count = getCameraCount();
50
+ for (int i = 0 ; i < camera_count; i++) {
51
+ android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();
52
+ android.hardware.Camera.getCameraInfo(i, info);
53
+ if (info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK) {
54
+ setDefaultIndex(i);
55
+ return;
56
+ }
57
+ }
58
+
50
59
  }
51
60
 
52
61
  @Override
@@ -76,7 +85,29 @@ public class CameraSingletonObject implements ICameraSingletonObject {
76
85
 
77
86
  @Override
78
87
  public void getCameraByType(String cameraType, IMethodResult result) {
79
- result.set(getDefaultID());
88
+ int cameraTypeId = android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK;
89
+ if (cameraType.equalsIgnoreCase(ICameraSingleton.CAMERA_TYPE_FRONT)) {
90
+ Logger.T(TAG, "Requesting front camera.");
91
+ cameraTypeId = android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT;
92
+ } else if (cameraType.equalsIgnoreCase(ICameraSingleton.CAMERA_TYPE_BACK)) {
93
+ Logger.T(TAG, "Requesting back camera.");
94
+ cameraTypeId = android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK;
95
+ } else {
96
+ Logger.E(TAG, "Unknown camera type requested: " + cameraType);
97
+ result.setArgError("Unknown camera type requested: " + cameraType);
98
+ return;
99
+ }
100
+
101
+ int cameraCount = getCameraCount();
102
+ int i;
103
+ for (i = 0 ; i < cameraCount; i++) {
104
+ android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();
105
+ android.hardware.Camera.getCameraInfo(i, info);
106
+ if (info.facing == cameraTypeId) {
107
+ result.set(getCameraId(i));
108
+ return;
109
+ }
110
+ }
80
111
  }
81
112
 
82
113
  @Override
@@ -84,73 +115,56 @@ public class CameraSingletonObject implements ICameraSingletonObject {
84
115
  CameraObject.CURRENT_SCREEN_AUTO_ROTATE_MODE = RhodesActivity.safeGetInstance().getScreenAutoRotateMode();
85
116
  CameraObject.CURRENT_FULL_SCREEN_MODE = RhodesActivity.safeGetInstance().getFullScreenMode();
86
117
 
87
- if(propertyMap.get("deprecated") == null || propertyMap.get("deprecated").equalsIgnoreCase("false")){
88
118
 
89
- CameraObject.deprecated_take_pic = false;
90
-
91
- propertyMap.put("deprecated", "false");
92
- deprecated_choose_pic = false;
93
- }
94
- else
95
- deprecated_choose_pic = true;
96
-
97
- // set default values
98
- if(propertyMap.get("useSystemViewfinder") == null) {
99
- propertyMap.put("useSystemViewfinder", "true");
119
+ if(propertyMap.get(ICameraSingleton.PROPERTY_USE_REAL_BITMAP_RESIZE) == null) {
120
+ propertyMap.put(ICameraSingleton.PROPERTY_USE_REAL_BITMAP_RESIZE, "true");
100
121
  }
101
- if(propertyMap.get("useRealBitmapResize") == null) {
102
- propertyMap.put("useRealBitmapResize", "true");
103
- }
104
- if(propertyMap.get("useRotationBitmapByEXIF") == null) {
105
- propertyMap.put("useRotationBitmapByEXIF", "true");
122
+ if(propertyMap.get(ICameraSingleton.PROPERTY_USE_ROTATION_BITMAP_BY_EXIF) == null) {
123
+ propertyMap.put(ICameraSingleton.PROPERTY_USE_ROTATION_BITMAP_BY_EXIF, "true");
106
124
  }
107
125
 
108
126
  Intent intent = null;
109
127
  String outputFormat = null;
110
- if(propertyMap.get("outputFormat") == null){
111
- propertyMap.put("outputFormat", "image");
112
- outputFormat = propertyMap.get("outputFormat");
113
- }
114
- else{
115
- outputFormat = propertyMap.get("outputFormat");
128
+ if(propertyMap.get(ICameraSingleton.PROPERTY_OUTPUT_FORMAT) == null){
129
+ propertyMap.put(ICameraSingleton.PROPERTY_OUTPUT_FORMAT, ICameraSingleton.OUTPUT_FORMAT_IMAGE);
116
130
  }
131
+ outputFormat = propertyMap.get(ICameraSingleton.PROPERTY_OUTPUT_FORMAT);
132
+
117
133
  CameraFactory factory = (CameraFactory)CameraFactorySingleton.getInstance();
118
134
  factory.getRhoListener().setMethodResult(result);
119
135
  factory.getRhoListener().setActualPropertyMap(propertyMap);
120
136
  RhodesActivity ra = RhodesActivity.safeGetInstance();
121
137
 
122
138
 
123
- if ( Boolean.parseBoolean(propertyMap.get("useSystemViewfinder")) ) {
124
- /*
125
- Intent getIntent = new Intent(Intent.ACTION_GET_CONTENT);
126
- getIntent.setType("image/*");
127
139
 
128
- Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
129
- pickIntent.setType("image/*");
140
+ /*
141
+ Intent getIntent = new Intent(Intent.ACTION_GET_CONTENT);
142
+ getIntent.setType("image/*");
130
143
 
131
- Intent chooserIntent = Intent.createChooser(getIntent, "Select Image");
132
- chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] {pickIntent});
144
+ Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
145
+ pickIntent.setType("image/*");
133
146
 
134
- intent = chooserIntent;
135
- */
147
+ Intent chooserIntent = Intent.createChooser(getIntent, "Select Image");
148
+ chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] {pickIntent});
149
+
150
+ intent = chooserIntent;
151
+ */
152
+
153
+ intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
154
+ intent.setType("image/*");
136
155
 
137
- intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
138
- intent.setType("image/*");
139
156
 
140
- }else{
141
- intent = new Intent(ra, FileList.class);
142
- }
143
157
 
144
158
  propertyMap.put("fromGallery", "true");
145
159
  String fileName = null;
146
- if(!propertyMap.containsKey("fileName")){
160
+ if(!propertyMap.containsKey(ICameraSingleton.PROPERTY_FILE_NAME)){
147
161
  fileName = "/sdcard/DCIM/Camera/";
148
162
  }
149
163
  else{
150
- fileName = propertyMap.get("fileName");
164
+ fileName = propertyMap.get(ICameraSingleton.PROPERTY_FILE_NAME);
151
165
  }
152
166
  if (fileName != null && fileName.length() > 0) {
153
- if (outputFormat.equalsIgnoreCase("image")) {
167
+ if (outputFormat.equalsIgnoreCase(ICameraSingleton.OUTPUT_FORMAT_IMAGE)) {
154
168
  String tmpPath = getTemporaryLoc(fileName);
155
169
  if (tmpPath == null) {
156
170
  throw new RuntimeException("Failed to access shared temporary folder");
@@ -193,15 +207,6 @@ public class CameraSingletonObject implements ICameraSingletonObject {
193
207
 
194
208
  }
195
209
  */
196
-
197
- @Override
198
- public ICameraObject createCameraObject(String id) {
199
- Logger.T(TAG, "createCameraObject: " + id);
200
- return new CameraObject(id);
201
- }
202
-
203
-
204
-
205
210
  private static String insertImage(ContentResolver cr, String imageFullPath) {
206
211
 
207
212
  String filename = imageFullPath.substring(imageFullPath.lastIndexOf("/")+1, imageFullPath.length());
@@ -272,13 +277,8 @@ public class CameraSingletonObject implements ICameraSingletonObject {
272
277
  * @see android.provider.MediaStore.Images.Media (StoreThumbnail private method)
273
278
  */
274
279
 
275
- private static Bitmap storeThumbnail(
276
- ContentResolver cr,
277
- Bitmap source,
278
- long id,
279
- float width,
280
- float height,
281
- int kind) {
280
+ private static Bitmap storeThumbnail(ContentResolver cr, Bitmap source, long id,
281
+ float width, float height, int kind) {
282
282
 
283
283
  // create the matrix to scale it
284
284
  Matrix matrix = new Matrix();
@@ -315,8 +315,6 @@ private static Bitmap storeThumbnail(
315
315
 
316
316
  }
317
317
 
318
-
319
-
320
318
  public static void copyImageFileToDeviceGallery(String imageFullPath) {
321
319
 
322
320
  String imageName = imageFullPath.substring(imageFullPath.lastIndexOf("/")+1, imageFullPath.length());
@@ -327,15 +325,12 @@ private static Bitmap storeThumbnail(
327
325
 
328
326
 
329
327
  @Override
330
- public void copyImageToDeviceGallery(String pathToImage,
331
- IMethodResult result) {
328
+ public void copyImageToDeviceGallery(String pathToImage, IMethodResult result) {
332
329
  copyImageFileToDeviceGallery(pathToImage);
333
330
  }
334
331
 
335
332
 
336
-
337
- public void copyImageToDeviceGalleryOld(String pathToImage,
338
- IMethodResult result) {
333
+ public void copyImageToDeviceGalleryOld(String pathToImage, IMethodResult result) {
339
334
  // TODO Auto-generated method stub
340
335
  String imageName = pathToImage.substring(pathToImage.lastIndexOf("/")+1, pathToImage.length());
341
336
  String abspath = copyImageToDesired(pathToImage, imageName);
@@ -428,5 +423,4 @@ private static Bitmap storeThumbnail(
428
423
 
429
424
  return mediafile.getAbsolutePath();
430
425
  }
431
-
432
426
  }
@@ -100,7 +100,8 @@ public class ZebraPrintingProviderImpl implements IZebraPrintingProvider {
100
100
  }
101
101
  };
102
102
  mUsbManager = (UsbManager) RhodesActivity.safeGetInstance().getSystemService(Context.USB_SERVICE);
103
- mPermissionIntent = PendingIntent.getBroadcast(RhodesActivity.safeGetInstance(), 0, new Intent(ACTION_USB_PERMISSION), 0);
103
+ mPermissionIntent = PendingIntent.getBroadcast(RhodesActivity.safeGetInstance(), 0, new Intent(ACTION_USB_PERMISSION),
104
+ PendingIntent.FLAG_IMMUTABLE);
104
105
  IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION);
105
106
  RhodesActivity.safeGetInstance().registerReceiver(mUsbReceiver, filter);
106
107
  }
@@ -1,29 +1,17 @@
1
- <service android:name="com.rhomobile.rhodes.fcm.FCMIntentService">
1
+ <service android:name="com.rhomobile.rhodes.fcm.FCMIntentService" android:exported='false'>
2
2
  <intent-filter android:priority="900">
3
3
  <action android:name="com.google.firebase.MESSAGING_EVENT"/>
4
+ <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
4
5
  </intent-filter>
5
6
  </service>
6
7
 
7
8
  <service android:exported="true" android:name="com.google.firebase.messaging.FirebaseMessagingService">
8
9
  <intent-filter android:priority="-500">
9
10
  <action android:name="com.google.firebase.MESSAGING_EVENT"/>
11
+ <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
10
12
  </intent-filter>
11
13
  </service>
12
14
 
13
- <service android:name="com.rhomobile.rhodes.fcm.FCMTokenRefresherService" android:exported="true">
14
- <intent-filter>
15
- <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
16
- </intent-filter>
17
- </service>
18
-
19
- <receiver android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
20
- android:enabled="true">
21
- <intent-filter>
22
- <action android:name="com.google.android.gms.measurement.UPLOAD" />
23
- <action android:name="com.android.vending.INSTALL_REFERRER"/>
24
- </intent-filter>
25
- </receiver>
26
-
27
15
 
28
16
  <receiver android:exported="false" android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"/>
29
17
  <service android:exported="true" android:name="com.google.firebase.iid.FirebaseInstanceIdService">
@@ -35,9 +23,19 @@
35
23
  <receiver android:exported="true" android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:permission="com.google.android.c2dm.permission.SEND">
36
24
  <intent-filter>
37
25
  <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
38
- <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
39
- <category android:name="<%=@appPackageName%>"/>
40
26
  </intent-filter>
41
27
  </receiver>
42
28
 
29
+
30
+
31
+ <service android:directBootAware="true" android:exported="false" android:name="com.google.firebase.components.ComponentDiscoveryService">
32
+ <meta-data android:name="com.google.firebase.components:com.google.firebase.messaging.FirebaseMessagingRegistrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
33
+ <meta-data android:name="com.google.firebase.components:com.google.firebase.iid.Registrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
34
+ <meta-data android:name="com.google.firebase.components:com.google.firebase.datatransport.TransportRegistrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
35
+ <meta-data android:name="com.google.firebase.components:com.google.firebase.installations.FirebaseInstallationsRegistrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
36
+ </service>
37
+
38
+ <provider android:authorities="<%=@appPackageName%>.firebaseinitprovider" android:directBootAware="true" android:exported="false" android:initOrder="100" android:name="com.google.firebase.provider.FirebaseInitProvider"/>
39
+
40
+
43
41
  <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
@@ -132,49 +132,74 @@ end
132
132
  multitask TARGETLIB_AARCH64 => OBJ_AARCH64
133
133
 
134
134
 
135
- $jsonfile = File.read(File.join($app_dir, 'google-services.json')) if File.exists?(File.join($app_dir, 'google-services.json'))
136
-
135
+
136
+
137
+
138
+
139
+ ###############
140
+
137
141
  $xmlFileWithDataFromJson = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>"
142
+
138
143
  def add_data_to_string(name, dataFromJson)
139
- $xmlFileWithDataFromJson << "\n\t<string name=\"" << name << "\" translatable=\"false\">" <<
140
- $jsonfile.scan(/#{dataFromJson}.*\".*\"/).last.scan(/:.*\".*\"/).last.scan(/\".*\"/).last.gsub("\"","") << "</string>"
144
+ $xmlFileWithDataFromJson << "\n\t<string name=\"" << name << "\" translatable=\"false\">" << dataFromJson << "</string>"
141
145
  end
142
146
 
143
- def createXmlFromJson()
144
- puts "Creating values.xml from google-sevices.json" if $jsonfile
145
- add_data_to_string("default_web_client_id", "client_id") if $jsonfile
146
- add_data_to_string("firebase_database_url", "firebase_url") if $jsonfile
147
-
148
- if ENV["CUSTOM_FCM_SENDER_ID"].nil?
149
- add_data_to_string("gcm_defaultSenderId", "project_number") if $jsonfile
150
- else
151
- $xmlFileWithDataFromJson << "\n\t<string name=\"gcm_defaultSenderId\" translatable=\"false\">" <<
152
- ENV["CUSTOM_FCM_SENDER_ID"] << "</string>"
147
+ $jsonfile = File.read(File.join($app_dir, 'google-services.json')) if File.exists?(File.join($app_dir, 'google-services.json'))
148
+
149
+ if $jsonfile.nil?
150
+
151
+ if ENV["FCM_MPBILESDK_APP_ID"].nil?
152
+ puts "Please set mobilesdk_app_id variable in android/fcm section of build.yml"
153
+ end
154
+ if ENV["FCM_PROJECT_NUMBER"].nil?
155
+ puts "Please set project_number variable in android/fcm section of build.yml"
156
+ end
157
+ if ENV["FCM_CURRENT_KEY"].nil?
158
+ puts "Please set current_key variable in android/fcm section of build.yml"
159
+ end
160
+ if ENV["FCM_PROJECT_ID"].nil?
161
+ puts "Please set project_id variable in android/fcm section of build.yml"
153
162
  end
154
- add_data_to_string("google_api_key", "current_key") if $jsonfile
155
163
 
156
- if ENV["CUSTOM_FCM_APPLICATION_ID"].nil?
157
- add_data_to_string("google_app_id", "mobilesdk_app_id") if $jsonfile
158
- else
159
- $xmlFileWithDataFromJson << "\n\t<string name=\"google_app_id\" translatable=\"false\">" <<
160
- ENV["CUSTOM_FCM_APPLICATION_ID"] << "</string>"
164
+ if ENV["FCM_MPBILESDK_APP_ID"].nil? or ENV["FCM_PROJECT_NUMBER"].nil? or ENV["FCM_CURRENT_KEY"].nil? or ENV["FCM_PROJECT_ID"].nil?
165
+ exit 1
166
+ end
167
+
168
+
169
+ add_data_to_string("google_app_id", ENV["FCM_MPBILESDK_APP_ID"])
170
+ add_data_to_string("gcm_defaultSenderId", ENV["FCM_PROJECT_NUMBER"])
171
+ add_data_to_string("google_api_key", ENV["FCM_CURRENT_KEY"])
172
+ add_data_to_string("project_id", ENV["FCM_PROJECT_ID"])
173
+
174
+ else
175
+ begin
176
+ jsonHash = JSON.parse($jsonfile)
177
+
178
+ puts "Creating values.xml from google-sevices.json" if $jsonfile
179
+
180
+ add_data_to_string("google_app_id", jsonHash["client"][0]["client_info"]["mobilesdk_app_id"])
181
+ add_data_to_string("gcm_defaultSenderId", jsonHash["project_info"]["project_number"])
182
+ add_data_to_string("default_web_client_id", jsonHash["client"][0]["oauth_client"][0]["client_id"])
183
+ add_data_to_string("google_api_key", jsonHash["client"][0]["api_key"][0]["current_key"])
184
+ add_data_to_string("google_crash_reporting_api_key", jsonHash["client"][0]["api_key"][0]["current_key"])
185
+ add_data_to_string("project_id", jsonHash["project_info"]["project_id"])
186
+
187
+ rescue Exception => e
188
+ puts "\nCan't create id values for firebase. Please check your google-services.json.\n"
189
+ puts e
190
+ exit 1
161
191
  end
162
- add_data_to_string("google_crash_reporting_api_key", "current_key") if $jsonfile
163
- add_data_to_string("google_storage_bucket", "storage_bucket") if $jsonfile
164
- add_data_to_string("project_id", "project_id") if $jsonfile
165
-
166
- $xmlFileWithDataFromJson << "\n</resources>"
167
- resGoogleDir = File.join($curdir, 'res', 'res', 'values')
168
- #resDebug = File.join(resGoogleDir, 'debug')
169
- #resRelease = File.join(resGoogleDir, 'release')
170
- #FileUtils.mkdir_p(resDebug) unless File.exists?(resDebug)
171
- FileUtils.mkdir_p(resGoogleDir) unless File.exists?(resGoogleDir)
172
- #File.open(File.join(resDebug, 'values.xml'), 'w') {|f| f.write($xmlFileWithDataFromJson) }
173
- File.open(File.join(resGoogleDir, 'fireBaseValues.xml'), 'w') {|f| f.write($xmlFileWithDataFromJson) }
174
- puts "fireBaseValues.xml created"
175
192
  end
176
193
 
177
- createXmlFromJson()
194
+ $xmlFileWithDataFromJson << "\n</resources>"
195
+ resGoogleDir = File.join($curdir, 'res', 'res', 'values')
196
+
197
+ FileUtils.mkdir_p(resGoogleDir) unless File.exists?(resGoogleDir)
198
+ File.open(File.join(resGoogleDir, 'fireBaseValues.xml'), 'w') {|f| f.write($xmlFileWithDataFromJson) }
199
+ puts "fireBaseValues.xml created"
200
+
201
+ ##############
202
+
178
203
 
179
204
  namespace 'arch' do
180
205
  task :arm => [TARGETLIB_ARM]
@@ -1,4 +1,3 @@
1
1
  ext/android/src/com/rhomobile/rhodes/fcm/FCMFacade.java
2
2
  ext/android/src/com/rhomobile/rhodes/fcm/FCMIntentService.java
3
- ext/android/src/com/rhomobile/rhodes/fcm/FCMTokenRefresherService.java
4
3
  ext/android/src/com/rhomobile/rhodes/fcm/FCMListener.java
@@ -37,7 +37,6 @@ import com.google.firebase.messaging.RemoteMessage;
37
37
  import com.google.firebase.FirebaseApp;
38
38
  import com.google.firebase.FirebaseOptions;
39
39
  import com.google.firebase.messaging.FirebaseMessaging;
40
- import com.google.firebase.iid.FirebaseInstanceId;
41
40
  import com.rhomobile.rhodes.R;
42
41
  import java.lang.Throwable;
43
42
  import com.rhomobile.rhodes.extmanager.AbstractRhoListener;
@@ -46,13 +45,13 @@ import com.rhomobile.rhodes.RhodesService;
46
45
  import com.rhomobile.rhodes.extmanager.RhoExtManager;
47
46
  import com.rhomobile.rhodes.extmanager.RhoExtManagerImpl;
48
47
  import com.rhomobile.rhodes.extmanager.IRhoExtManager;
48
+ import com.google.firebase.iid.FirebaseInstanceId;
49
49
 
50
50
  public final class FCMFacade {
51
51
  private static final String TAG = FCMFacade.class.getSimpleName();
52
52
  public static final FCMListener listener = FCMListener.getInstance();
53
53
 
54
54
  static final String FCM_PUSH_CLIENT = "fcm";
55
- static String clientToken = "";
56
55
 
57
56
  private static String gStr(int key){
58
57
  String value = "";
@@ -90,13 +89,12 @@ public final class FCMFacade {
90
89
  try {
91
90
  options = new FirebaseOptions.Builder()
92
91
  .setApplicationId(gStr(R.string.google_app_id))
93
- //.setApiKey(gStr(R.string.google_api_key))
94
- //.setDatabaseUrl(gStr(R.string.firebase_database_url))
95
- //.setStorageBucket(gStr(R.string.google_storage_bucket))
92
+ .setApiKey(gStr(R.string.google_api_key))
93
+ .setProjectId(gStr(R.string.project_id))
96
94
  .setGcmSenderId(gStr(R.string.gcm_defaultSenderId))
97
95
  .build();
98
96
  } catch( Throwable e ) {
99
- Logger.E(TAG, "FCM: poblems on building options: " + e);
97
+ Logger.E(TAG, "FCM: problems on building options: " + e);
100
98
  e.printStackTrace();
101
99
  }
102
100
 
@@ -104,39 +102,37 @@ public final class FCMFacade {
104
102
  FirebaseApp.initializeApp(ContextFactory.getContext(), options);
105
103
  Logger.T(TAG, "FCM: initialization of application");
106
104
  }catch(Exception e){
107
- Logger.E(TAG, "FCM: poblems on initialization app: " + e);
105
+ Logger.E(TAG, "FCM: problems on initialization app: " + e);
108
106
  e.printStackTrace();
109
107
  }
110
108
  try{
111
109
  FirebaseApp.getInstance();
112
110
  Logger.T(TAG, "FCM: Firebase Inited");
113
111
  }catch(Exception e){
114
- Logger.E(TAG, "FCM: poblems on getting instance: " + e);
112
+ Logger.E(TAG, "FCM: problems on getting instance: " + e);
115
113
  e.printStackTrace();
116
114
  }
117
115
  }
118
116
 
119
117
  refreshToken();
120
-
121
-
122
-
123
118
  }
119
+
124
120
  public static void refreshToken(){
125
121
  try{
126
122
  Logger.T(TAG, "FCM: registation of application");
127
- clientToken = "";
123
+ String clientToken = ContextFactory.getContext().getSharedPreferences("FireBase",
124
+ ContextFactory.getContext().MODE_PRIVATE).getString("token", "");
125
+
128
126
  clientToken = FirebaseInstanceId.getInstance().getToken();
129
- if ((clientToken != "")&&(clientToken != null)){
127
+ if ((clientToken != "") && (clientToken != null)){
130
128
  PushContract.handleRegistration(ContextFactory.getContext(), clientToken, FCMFacade.FCM_PUSH_CLIENT);
131
- Logger.T(TAG, "FCM: registation successfully");
129
+ Logger.T(TAG, "FCM: registation successfully, token = " + clientToken);
132
130
  }else{
133
- clientToken = "";
134
131
  Logger.T(TAG, "FCM: can't get token, try to refresh later");
135
132
  }
136
133
  }catch(Exception exc){
137
- Logger.T(TAG, "FCM: can't handle registation");
134
+ Logger.T(TAG, "FCM: can't handle registation " + exc.toString() );
138
135
  }
139
- Logger.T(TAG, "FCM: token = " + clientToken);
140
136
  }
141
137
 
142
138
  }