mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
more code review (#25109)
Summary: ## Changelog [Internal] [Changed] - Code review Pull Request resolved: https://github.com/facebook/react-native/pull/25109 Differential Revision: D15602426 Pulled By: cpojer fbshipit-source-id: a47e3d6e0b264b24cc1106a34a7cfdafdadca799
This commit is contained in:
committed by
Facebook Github Bot
parent
1e428093e2
commit
a98772e94c
+21
-17
@@ -293,23 +293,27 @@ public class CameraRollManager extends ReactContextBaseJavaModule {
|
||||
selectionArgs.add(mGroupName);
|
||||
}
|
||||
|
||||
if (mAssetType.equals(ASSET_TYPE_PHOTOS)) {
|
||||
selection.append(" AND " + MediaStore.Files.FileColumns.MEDIA_TYPE + " = "
|
||||
+ MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE);
|
||||
} else if (mAssetType.equals(ASSET_TYPE_VIDEOS)) {
|
||||
selection.append(" AND " + MediaStore.Files.FileColumns.MEDIA_TYPE + " = "
|
||||
+ MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO);
|
||||
} else if (mAssetType.equals(ASSET_TYPE_ALL)) {
|
||||
selection.append(" AND " + MediaStore.Files.FileColumns.MEDIA_TYPE + " IN ("
|
||||
+ MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO + ","
|
||||
+ MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE + ")");
|
||||
} else {
|
||||
mPromise.reject(
|
||||
ERROR_UNABLE_TO_FILTER,
|
||||
"Invalid filter option: '" + mAssetType + "'. Expected one of '"
|
||||
+ ASSET_TYPE_PHOTOS + "', '" + ASSET_TYPE_VIDEOS + "' or '" + ASSET_TYPE_ALL + "'."
|
||||
);
|
||||
return;
|
||||
switch (mAssetType) {
|
||||
case ASSET_TYPE_PHOTOS:
|
||||
selection.append(" AND " + MediaStore.Files.FileColumns.MEDIA_TYPE + " = "
|
||||
+ MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE);
|
||||
break;
|
||||
case ASSET_TYPE_VIDEOS:
|
||||
selection.append(" AND " + MediaStore.Files.FileColumns.MEDIA_TYPE + " = "
|
||||
+ MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO);
|
||||
break;
|
||||
case ASSET_TYPE_ALL:
|
||||
selection.append(" AND " + MediaStore.Files.FileColumns.MEDIA_TYPE + " IN ("
|
||||
+ MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO + ","
|
||||
+ MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE + ")");
|
||||
break;
|
||||
default:
|
||||
mPromise.reject(
|
||||
ERROR_UNABLE_TO_FILTER,
|
||||
"Invalid filter option: '" + mAssetType + "'. Expected one of '"
|
||||
+ ASSET_TYPE_PHOTOS + "', '" + ASSET_TYPE_VIDEOS + "' or '" + ASSET_TYPE_ALL + "'."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+4
-5
@@ -42,13 +42,12 @@ public class VibrationModule extends ReactContextBaseJavaModule {
|
||||
|
||||
@ReactMethod
|
||||
public void vibrateByPattern(ReadableArray pattern, int repeat) {
|
||||
long[] patternLong = new long[pattern.size()];
|
||||
for (int i = 0; i < pattern.size(); i++) {
|
||||
patternLong[i] = pattern.getInt(i);
|
||||
}
|
||||
|
||||
Vibrator v = (Vibrator) getReactApplicationContext().getSystemService(Context.VIBRATOR_SERVICE);
|
||||
if (v != null) {
|
||||
long[] patternLong = new long[pattern.size()];
|
||||
for (int i = 0; i < pattern.size(); i++) {
|
||||
patternLong[i] = pattern.getInt(i);
|
||||
}
|
||||
v.vibrate(patternLong, repeat);
|
||||
}
|
||||
}
|
||||
|
||||
+13
-6
@@ -342,12 +342,19 @@ public final class WebSocketModule extends ReactContextBaseJavaModule {
|
||||
String scheme = "";
|
||||
|
||||
URI requestURI = new URI(uri);
|
||||
if (requestURI.getScheme().equals("wss")) {
|
||||
scheme += "https";
|
||||
} else if (requestURI.getScheme().equals("ws")) {
|
||||
scheme += "http";
|
||||
} else if (requestURI.getScheme().equals("http") || requestURI.getScheme().equals("https")) {
|
||||
scheme += requestURI.getScheme();
|
||||
switch (requestURI.getScheme()) {
|
||||
case "wss":
|
||||
scheme += "https";
|
||||
break;
|
||||
case "ws":
|
||||
scheme += "http";
|
||||
break;
|
||||
case "http":
|
||||
case "https":
|
||||
scheme += requestURI.getScheme();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (requestURI.getPort() != -1) {
|
||||
|
||||
Reference in New Issue
Block a user