Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove deprecations #543

Merged
merged 8 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion __tests__/interface.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ describe("Public Interface", () => {

// constants
"UserTrackingMode",
"UserTrackingModes", // deprecated
"UserLocationRenderMode",
"StyleURL",
"EventTypes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ public List<NativeModule> createNativeModules(ReactApplicationContext reactAppli
return modules;
}

@Deprecated
public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}

@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactApplicationContext) {
List<ViewManager> managers = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,70 +243,4 @@ public void getClusterChildren(String callbackID, String featureJSON) {
AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
mManager.handleEvent(event);
}

// Deprecated. Will be removed in 9+ ver.
public void getClusterExpansionZoomById(String callbackID, int clusterId) {
if (mSource == null) {
WritableMap payload = new WritableNativeMap();
payload.putString("error", "source is not yet loaded");
AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
mManager.handleEvent(event);
return;
}
List<Feature> features = mSource.querySourceFeatures(Expression.eq(Expression.id(), clusterId));
int zoom = -1;
if (features.size() > 0) {
zoom = mSource.getClusterExpansionZoom(features.get(0));
}

if (zoom == -1) {
WritableMap payload = new WritableNativeMap();
payload.putString("error", "Could not get zoom for cluster id " + clusterId);
AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
mManager.handleEvent(event);
return;
}

WritableMap payload = new WritableNativeMap();
payload.putInt("data", zoom);

AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
mManager.handleEvent(event);
}

// Deprecated. Will be removed in 9+ ver.
public void getClusterLeavesById(String callbackID, int clusterId, int number, int offset) {
if (mSource == null) {
WritableMap payload = new WritableNativeMap();
payload.putString("error", "source is not yet loaded");
AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
mManager.handleEvent(event);
return;
}
Feature clusterFeature = mSource.querySourceFeatures(Expression.eq(Expression.get("cluster_id"), clusterId)).get(0);
FeatureCollection leaves = mSource.getClusterLeaves(clusterFeature, number, offset);
WritableMap payload = new WritableNativeMap();
payload.putString("data", leaves.toJson());

AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
mManager.handleEvent(event);
}

// Deprecated. Will be removed in 9+ ver.
public void getClusterChildrenById(String callbackID, int clusterId) {
if (mSource == null) {
WritableMap payload = new WritableNativeMap();
payload.putString("error", "source is not yet loaded");
AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
mManager.handleEvent(event);
return;
}
Feature clusterFeature = mSource.querySourceFeatures(Expression.eq(Expression.get("cluster_id"), clusterId)).get(0);
FeatureCollection leaves = mSource.getClusterChildren(clusterFeature);
WritableMap payload = new WritableNativeMap();
payload.putString("data", leaves.toJson());

AndroidCallbackEvent event = new AndroidCallbackEvent(this, callbackID, payload);
mManager.handleEvent(event);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,6 @@ public Map<String, String> customEvents() {
public static final int METHOD_GET_CLUSTER_LEAVES = 105;
public static final int METHOD_GET_CLUSTER_CHILDREN = 106;

// Deprecated. Will be removed in 9+ ver.
public static final int METHOD_GET_CLUSTER_EXPANSION_ZOOM_BY_ID = 107;
public static final int METHOD_GET_CLUSTER_LEAVES_BY_ID = 108;
public static final int METHOD_GET_CLUSTER_CHILDREN_BY_ID = 109;

@Nullable
@Override
public Map<String, Integer> getCommandsMap() {
Expand All @@ -192,12 +187,6 @@ public Map<String, Integer> getCommandsMap() {
.put("getClusterExpansionZoom", METHOD_GET_CLUSTER_EXPANSION_ZOOM)
.put("getClusterLeaves", METHOD_GET_CLUSTER_LEAVES)
.put("getClusterChildren", METHOD_GET_CLUSTER_CHILDREN)

// Deprecated. Will be removed in 9+ ver.
.put("getClusterExpansionZoomById", METHOD_GET_CLUSTER_EXPANSION_ZOOM_BY_ID)
.put("getClusterLeavesById", METHOD_GET_CLUSTER_LEAVES_BY_ID)
.put("getClusterChildrenById", METHOD_GET_CLUSTER_CHILDREN_BY_ID)

.build();
}

Expand Down Expand Up @@ -227,23 +216,6 @@ public void receiveCommand(MLRNShapeSource source, int commandID, @Nullable Read
args.getString(1)
);
break;
case METHOD_GET_CLUSTER_EXPANSION_ZOOM_BY_ID:
source.getClusterExpansionZoomById(args.getString(0), args.getInt(1));
break;
case METHOD_GET_CLUSTER_LEAVES_BY_ID:
source.getClusterLeavesById(
args.getString(0),
args.getInt(1),
args.getInt(2),
args.getInt((3))
);
break;
case METHOD_GET_CLUSTER_CHILDREN_BY_ID:
source.getClusterChildrenById(
args.getString(0),
args.getInt(1)
);
break;
}
}
}
2 changes: 1 addition & 1 deletion docs/components/Camera.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
| maxZoomLevel | `number` | `none` | `false` | Maximum zoom level of the map |
| maxBounds | `CameraBounds` | `none` | `false` | Restrict map panning so that the center is within these bounds |
| followUserLocation | `boolean` | `none` | `false` | Should the map orientation follow the user's. |
| followUserMode | `UserTrackingMode` | `none` | `false` | The mode used to track the user location on the map. One of; "normal", "compass", "course". Each mode string is also available as a member on the `MapLibreGL.UserTrackingModes` object. `Follow` (normal), `FollowWithHeading` (compass), `FollowWithCourse` (course). NOTE: `followUserLocation` must be set to `true` for any of the modes to take effect. [Example](/packages/examples/src/examples/Camera/SetUserTrackingModes.js) |
| followUserMode | `UserTrackingMode` | `none` | `false` | The mode used to track the user location on the map. One of; "normal", "compass", "course". Each mode string is also available as a member on the `MapLibreGL.UserTrackingMode` object. `Follow` (normal), `FollowWithHeading` (compass), `FollowWithCourse` (course). NOTE: `followUserLocation` must be set to `true` for any of the modes to take effect. [Example](/packages/examples/src/examples/Camera/SetUserTrackingMode.js) |
| followZoomLevel | `number` | `none` | `false` | The zoomLevel on map while followUserLocation is set to `true` |
| followPitch | `number` | `none` | `false` | The pitch on map while followUserLocation is set to `true` |
| followHeading | `number` | `none` | `false` | The heading on map while followUserLocation is set to `true` |
Expand Down
6 changes: 0 additions & 6 deletions docs/components/MapView.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@ this._map.queryRenderedFeaturesInRect([30, 40, 20, 10], ['==', 'type', 'Point'],
```


### `setCamera()`

Map camera will perform updates based on provided config. Deprecated use Camera#setCamera.



### `takeSnap([writeToDisk])`

Takes snapshot of map with current tiles and returns a URI to the image
Expand Down
1 change: 0 additions & 1 deletion docs/components/SymbolLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ SymbolLayer is a style layer that renders icon and text labels at points or alon
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| style | `SymbolLayerStyleProps` | `none` | `false` | Customizable style attributes |
| children | `ReactElement \| ReactElement[]` | `none` | `false` | @deprecated passed children used to create an image with id of symbol in style and also set the iconImageName property accordingly.<br/>This is now deprecated, use Image component instead. |
| sourceID | `FIX ME UNKNOWN TYPE` | `MapLibreRN.StyleSource.DefaultSourceID` | `false` | FIX ME NO DESCRIPTION |


Expand Down
22 changes: 1 addition & 21 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@
"required": false,
"type": "UserTrackingMode",
"default": "none",
"description": "The mode used to track the user location on the map. One of; \"normal\", \"compass\", \"course\". Each mode string is also available as a member on the `MapLibreGL.UserTrackingModes` object. `Follow` (normal), `FollowWithHeading` (compass), `FollowWithCourse` (course). NOTE: `followUserLocation` must be set to `true` for any of the modes to take effect. [Example](/packages/examples/src/examples/Camera/SetUserTrackingModes.js)"
"description": "The mode used to track the user location on the map. One of; \"normal\", \"compass\", \"course\". Each mode string is also available as a member on the `MapLibreGL.UserTrackingMode` object. `Follow` (normal), `FollowWithHeading` (compass), `FollowWithCourse` (course). NOTE: `followUserLocation` must be set to `true` for any of the modes to take effect. [Example](/packages/examples/src/examples/Camera/SetUserTrackingMode.js)"
},
{
"name": "followZoomLevel",
Expand Down Expand Up @@ -2250,19 +2250,6 @@
"\nthis._map.queryRenderedFeaturesInRect([30, 40, 20, 10], ['==', 'type', 'Point'], ['id1', 'id2'])\n\n"
]
},
{
"name": "setCamera",
"docblock": "Map camera will perform updates based on provided config. Deprecated use Camera#setCamera.",
"modifiers": [],
"params": [],
"returns": {
"type": {
"name": "void"
}
},
"description": "Map camera will perform updates based on provided config. Deprecated use Camera#setCamera.",
"examples": []
},
{
"name": "takeSnap",
"docblock": "Takes snapshot of map with current tiles and returns a URI to the image\n@param {Boolean} writeToDisk If true will create a temp file, otherwise it is in base64\n@return {String}",
Expand Down Expand Up @@ -3397,13 +3384,6 @@
"default": "none",
"description": "Customizable style attributes"
},
{
"name": "children",
"required": false,
"type": "ReactElement \\| ReactElement[]",
"default": "none",
"description": "@deprecated passed children used to create an image with id of symbol in style and also set the iconImageName property accordingly.\nThis is now deprecated, use Image component instead."
},
{
"name": "sourceID",
"required": false,
Expand Down
1 change: 0 additions & 1 deletion ios/MLRN/MLRNBackgroundLayer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#import "MLRNLayer.h"
@import MapLibre;

@interface MLRNBackgroundLayer : MLRNLayer

Expand Down
1 change: 0 additions & 1 deletion ios/MLRN/MLRNFillExtrusionLayer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#import "MLRNVectorLayer.h"
@import MapLibre;

@interface MLRNFillExtrusionLayer : MLRNVectorLayer

Expand Down
1 change: 0 additions & 1 deletion ios/MLRN/MLRNFillLayer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#import "MLRNVectorLayer.h"
@import MapLibre;

@interface MLRNFillLayer : MLRNVectorLayer

Expand Down
1 change: 1 addition & 0 deletions ios/MLRN/MLRNFillLayer.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import "MLRNFillLayer.h"
#import "MLRNStyle.h"

#import <React/RCTLog.h>

@implementation MLRNFillLayer
Expand Down
1 change: 0 additions & 1 deletion ios/MLRN/MLRNLineLayer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#import "MLRNVectorLayer.h"
@import MapLibre;

@interface MLRNLineLayer : MLRNVectorLayer

Expand Down
1 change: 0 additions & 1 deletion ios/MLRN/MLRNRasterLayer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#import "MLRNLayer.h"
@import MapLibre;

@interface MLRNRasterLayer : MLRNLayer

Expand Down
11 changes: 0 additions & 11 deletions ios/MLRN/MLRNShapeSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,4 @@

- (double)getClusterExpansionZoom:(nonnull NSString *)featureJSON;

// Deprecated. Will be removed in 9+ ver.
- (nonnull NSArray<id <MLNFeature>> *)getClusterLeavesById:(nonnull NSNumber *)clusterId
number:(NSUInteger)number
offset:(NSUInteger)offset;

// Deprecated. Will be removed in 9+ ver.
- (nonnull NSArray<id <MLNFeature>> *)getClusterChildrenById:(nonnull NSNumber *)clusterId;

// Deprecated. Will be removed in 9+ ver.
- (double)getClusterExpansionZoomById:(nonnull NSNumber *)clusterId;

@end
38 changes: 0 additions & 38 deletions ios/MLRN/MLRNShapeSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -145,42 +145,4 @@ - (double)getClusterExpansionZoom:(nonnull NSString *)featureJSON
return [shapeSource childrenOfCluster:cluster];
}


// Deprecated. Will be removed in 9+ ver.
- (double)getClusterExpansionZoomById:(nonnull NSNumber *)clusterId
{
MLNShapeSource *shapeSource = (MLNShapeSource *)self.source;
NSArray<id<MLNFeature>> *features = [shapeSource featuresMatchingPredicate: [NSPredicate predicateWithFormat:@"%K = %i", @"cluster_id", clusterId.intValue]];
if (features.count == 0) {
return -1;
}
return [shapeSource zoomLevelForExpandingCluster:(MLNPointFeatureCluster *)features[0]];
}

// Deprecated. Will be removed in 9+ ver.
- (nonnull NSArray<id <MLNFeature>> *)getClusterLeavesById:(nonnull NSNumber *)clusterId
number:(NSUInteger)number
offset:(NSUInteger)offset
{
MLNShapeSource *shapeSource = (MLNShapeSource *)self.source;

NSPredicate* predicate = [NSPredicate predicateWithFormat:@"cluster_id == %@", clusterId];
NSArray<id<MLNFeature>> *features = [shapeSource featuresMatchingPredicate:predicate];

MLNPointFeatureCluster * cluster = (MLNPointFeatureCluster *)features[0];
return [shapeSource leavesOfCluster:cluster offset:offset limit:number];
}

// Deprecated. Will be removed in 9+ ver.
- (nonnull NSArray<id <MLNFeature>> *)getClusterChildrenById:(nonnull NSNumber *)clusterId
{
MLNShapeSource *shapeSource = (MLNShapeSource *)self.source;

NSPredicate* predicate = [NSPredicate predicateWithFormat:@"cluster_id == %@", clusterId];
NSArray<id<MLNFeature>> *features = [shapeSource featuresMatchingPredicate:predicate];

MLNPointFeatureCluster * cluster = (MLNPointFeatureCluster *)features[0];
return [shapeSource childrenOfCluster:cluster];
}

@end
68 changes: 0 additions & 68 deletions ios/MLRN/MLRNShapeSourceManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,72 +128,4 @@ - (UIView*)view
}];
}

// Deprecated. Will be removed in 9+ ver.
RCT_EXPORT_METHOD(getClusterExpansionZoomById:(nonnull NSNumber*)reactTag
clusterId:(nonnull NSNumber*)clusterId
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)
{
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *manager, NSDictionary<NSNumber*, UIView*> *viewRegistry) {
MLRNShapeSource* shapeSource = (MLRNShapeSource *)viewRegistry[reactTag];

if (![shapeSource isKindOfClass:[MLRNShapeSource class]]) {
RCTLogError(@"Invalid react tag, could not find MLRNMapView");
return;
}

double zoom = [shapeSource getClusterExpansionZoomById:clusterId];
if (zoom == -1) {
reject(@"zoom_error", [NSString stringWithFormat:@"Could not get zoom for cluster id %@", clusterId], nil);
return;
}
resolve(@{@"data":@(zoom)});
}];
}

// Deprecated. Will be removed in 9+ ver.
RCT_EXPORT_METHOD(getClusterLeavesById:(nonnull NSNumber*)reactTag
clusterId:(nonnull NSNumber *)clusterId
number:(NSUInteger) number
offset:(NSUInteger) offset
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)
{
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *manager, NSDictionary<NSNumber*, UIView*> *viewRegistry) {
MLRNShapeSource* shapeSource = (MLRNShapeSource *)viewRegistry[reactTag];

NSArray<id<MLNFeature>> *shapes = [shapeSource getClusterLeavesById:clusterId number:number offset:offset];

NSMutableArray<NSDictionary*> *features = [[NSMutableArray alloc] initWithCapacity:shapes.count];
for (int i = 0; i < shapes.count; i++) {
[features addObject:shapes[i].geoJSONDictionary];
}

resolve(@{
@"data": @{ @"type": @"FeatureCollection", @"features": features }
});
}];
}
// Deprecated. Will be removed in 9+ ver.
RCT_EXPORT_METHOD(getClusterChildrenById:(nonnull NSNumber*)reactTag
clusterId:(nonnull NSNumber *)clusterId
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)
{
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *manager, NSDictionary<NSNumber*, UIView*> *viewRegistry) {
MLRNShapeSource* shapeSource = (MLRNShapeSource *)viewRegistry[reactTag];

NSArray<id<MLNFeature>> *shapes = [shapeSource getClusterChildrenById: clusterId];

NSMutableArray<NSDictionary*> *features = [[NSMutableArray alloc] initWithCapacity:shapes.count];
for (int i = 0; i < shapes.count; i++) {
[features addObject:shapes[i].geoJSONDictionary];
}

resolve(@{
@"data": @{ @"type": @"FeatureCollection", @"features": features }
});
}];
}

@end
8 changes: 1 addition & 7 deletions ios/MLRN/MLRNSymbolLayer.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
#import <React/RCTComponent.h>
#import "MLRNVectorLayer.h"

@interface MLRNSymbolLayer : MLRNVectorLayer<RCTInvalidating>

@property (nonatomic, strong) NSMutableArray<id<RCTComponent>> *reactSubviews;

@property (nonatomic, assign) BOOL snapshot;
@property (nonatomic, copy) NSString *sourceLayerID;
@interface MLRNSymbolLayer : MLRNVectorLayer

@end
Loading
Loading