Yashasvi has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/364097 )
Change subject: Fix : ShareAFact schema : populating text field in case of highlight type events ...................................................................... Fix : ShareAFact schema : populating text field in case of highlight type events Change-Id: I1c98a355bdce51db9f72b15c137ee380d921f10a --- M app/src/main/java/org/wikipedia/analytics/ShareAFactFunnel.java M app/src/main/java/org/wikipedia/page/snippet/ShareHandler.java 2 files changed, 25 insertions(+), 14 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia refs/changes/97/364097/1 diff --git a/app/src/main/java/org/wikipedia/analytics/ShareAFactFunnel.java b/app/src/main/java/org/wikipedia/analytics/ShareAFactFunnel.java index 867df74..982d6ca 100644 --- a/app/src/main/java/org/wikipedia/analytics/ShareAFactFunnel.java +++ b/app/src/main/java/org/wikipedia/analytics/ShareAFactFunnel.java @@ -61,8 +61,8 @@ } /** Text in the web view was highlighted. */ - public void logHighlight() { - logAction("highlight", null); + public void logHighlight(String text) { + logAction("highlight", text); } /** The share button in the UI was tapped. */ diff --git a/app/src/main/java/org/wikipedia/page/snippet/ShareHandler.java b/app/src/main/java/org/wikipedia/page/snippet/ShareHandler.java index 8ad7dae..bed0926 100755 --- a/app/src/main/java/org/wikipedia/page/snippet/ShareHandler.java +++ b/app/src/main/java/org/wikipedia/page/snippet/ShareHandler.java @@ -57,6 +57,7 @@ private static final String PAYLOAD_PURPOSE_SHARE = "share"; private static final String PAYLOAD_PURPOSE_DEFINE = "define"; private static final String PAYLOAD_PURPOSE_EDIT_HERE = "edit_here"; + private static final String PAYLOAD_PURPOSE_HIGHLIGHT = "highlight"; private static final String PAYLOAD_TEXT_KEY = "text"; @ColorRes private static final int SHARE_TOOL_TIP_COLOR = R.color.foundation_blue; @@ -93,11 +94,21 @@ case PAYLOAD_PURPOSE_EDIT_HERE: onEditHerePayload(messagePayload.optInt("sectionID", 0), text); break; + case PAYLOAD_PURPOSE_HIGHLIGHT: + onHighlightText(text); + break; default: L.d("Unknown purpose=" + purpose); } } }); + } + + private void onHighlightText(String text) { + if (funnel == null) { + createFunnel(); + } + funnel.logHighlight(text); } public void showWiktionaryDefinition(String text) { @@ -192,8 +203,7 @@ editItem.setVisible(false); } - createFunnel(); - funnel.logHighlight(); + requestTextSelection(PAYLOAD_PURPOSE_HIGHLIGHT); } private boolean shouldEnableWiktionaryDialog() { @@ -260,6 +270,7 @@ private class RequestTextSelectOnMenuItemClickListener implements MenuItem.OnMenuItemClickListener { @NonNull private final String purpose; + RequestTextSelectOnMenuItemClickListener(@NonNull String purpose) { this.purpose = purpose; } @@ -270,17 +281,17 @@ leaveActionMode(); return true; } + } - private void requestTextSelection(String purpose) { - // send an event to the WebView that will make it return the - // selected text (or first paragraph) back to us... - try { - JSONObject payload = new JSONObject(); - payload.put(PAYLOAD_PURPOSE_KEY, purpose); - bridge.sendMessage("getTextSelection", payload); - } catch (JSONException e) { - throw new RuntimeException(e); - } + private void requestTextSelection(String purpose) { + // send an event to the WebView that will make it return the + // selected text (or first paragraph) back to us... + try { + JSONObject payload = new JSONObject(); + payload.put(PAYLOAD_PURPOSE_KEY, purpose); + bridge.sendMessage("getTextSelection", payload); + } catch (JSONException e) { + throw new RuntimeException(e); } } } -- To view, visit https://gerrit.wikimedia.org/r/364097 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1c98a355bdce51db9f72b15c137ee380d921f10a Gerrit-PatchSet: 1 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Yashasvi <yash.gird...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits