Skip to content

Buy sell marks#10

Merged
rturtu merged 5 commits intomainfrom
buy-sell-marks
Feb 6, 2026
Merged

Buy sell marks#10
rturtu merged 5 commits intomainfrom
buy-sell-marks

Conversation

@rturtu
Copy link

@rturtu rturtu commented Jan 26, 2026

Pull Request

Summary

Add buy sell marks

Linear ticket: PRO-2187

Author Checklist

  • PR tested locally
  • PR tested on preview
  • No new warnings or console errors
  • Analytics added where applicable

Web ↔ Mobile Consistency (if applicable)

  • Common/shared logic matches web implementation
  • Behavior compared with web where relevant

Screenshots / Video (if applicable)

  • Screenshots or video attached

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

✅ PR Checklist Validation Passed

Status: All 7 checklist items completed
Linear ticket: Valid ✅

🎉 This PR meets all requirements and is ready for review!


This validation ensures all PR requirements are met before merging.

@rturtu rturtu merged commit 0485d4c into main Feb 6, 2026
1 of 3 checks passed
Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

View 4 additional findings in Devin Review.

Open in Devin Review

Comment on lines +100 to +103
commands.put("addBuySellMark", 8);
commands.put("removeBuySellMark", 9);
commands.put("updateBuySellMark", 10);
commands.put("getBuySellMarks", 11);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 MapBuilder.of() returns unmodifiable map, calling put() will throw UnsupportedOperationException

The code attempts to add entries to a map returned by MapBuilder.of(), which returns an unmodifiable map in React Native. Calling put() on this map will throw an UnsupportedOperationException at runtime, preventing the buy/sell mark commands from being registered.

Root Cause

At RNKLineView.java:89-97, MapBuilder.of() creates an immutable map with 7 entries. Then at lines 100-103, the code attempts to add 4 more entries using put(), which will fail:

Map<String, Integer> commands = MapBuilder.of(
    "updateLastCandlestick", 1,
    ...
);
commands.put("addBuySellMark", 8);  // Throws UnsupportedOperationException

Impact: The app will crash when getCommandsMap() is called, preventing any command dispatching from working on Android.

Suggested change
commands.put("addBuySellMark", 8);
commands.put("removeBuySellMark", 9);
commands.put("updateBuySellMark", 10);
commands.put("getBuySellMarks", 11);
Map<String, Integer> commands = new java.util.HashMap<>();
commands.put("updateLastCandlestick", 1);
commands.put("addCandlesticksAtTheEnd", 2);
commands.put("addCandlesticksAtTheStart", 3);
commands.put("addOrderLine", 4);
commands.put("removeOrderLine", 5);
commands.put("updateOrderLine", 6);
commands.put("getOrderLines", 7);
commands.put("addBuySellMark", 8);
commands.put("removeBuySellMark", 9);
commands.put("updateBuySellMark", 10);
commands.put("getBuySellMarks", 11);
return commands;
}
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

final KLineEntity point = (KLineEntity) view.getItem(index);

// Get the basic selectedItemList
List<Map<String, Object>> itemList = new ArrayList<>(point.selectedItemList);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 NullPointerException when selectedItemList is null in drawSelector

The code creates a new ArrayList from point.selectedItemList without null checking, but selectedItemList can be null when parsed from input data.

Root Cause

In HTKLineConfigManager.java:249, selectedItemList is set directly from the map without null checking:

entity.selectedItemList = (List<Map<String, Object>>) keyValue.get("selectedItemList");

If the key doesn't exist, this sets selectedItemList to null, overwriting the default empty ArrayList from KLineEntity.java:135.

Then in MainDraw.java:343, passing null to ArrayList constructor throws NullPointerException:

List<Map<String, Object>> itemList = new ArrayList<>(point.selectedItemList);

Impact: App crashes when user long-presses on a candlestick that was created from data without a selectedItemList field.

Suggested change
List<Map<String, Object>> itemList = new ArrayList<>(point.selectedItemList);
List<Map<String, Object>> itemList = point.selectedItemList != null ? new ArrayList<>(point.selectedItemList) : new ArrayList<>();
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants