Mhurd has submitted this change and it was merged.

Change subject: Don't include article snippet in "Share as text" option
......................................................................


Don't include article snippet in "Share as text" option

Presently, selecting the "Share as text" option when you share something
and haven't actually highlighted any text will cause the auto-generated
snippet to be shared, which generates shares so big they can't even be shared
to Twitter.

This patch changes "Share as text" when you've got nothing hightlighted to
not attempt to share the default snippet. This should fix that issue for now,
until it's refined further.

The "Share as text" option now no longer will attach the stock image, either.

Additionally, this patch lowers the minimum text selection requirement to two
characters. Finally, it updates the logging "target"s to entered_image and
entered_text, respectively, based on user tap, while also letting the system
perform text truncation with an ellipses even for "Share as text" when
text of sufficient length is not already highlighted.

Bug: T89541
Change-Id: Ic8c749d9207d7e28043ecba896a3c2326dd85a34
---
M wikipedia/Categories/NSString+Extras.h
M wikipedia/Categories/NSString+Extras.m
M wikipedia/View Controllers/Navigation/Bottom/BottomMenuViewController.m
M wikipedia/View Controllers/ShareCard/ShareCard.xib
M wikipedia/View Controllers/ShareCard/WMFShareFunnel.h
M wikipedia/View Controllers/ShareCard/WMFShareFunnel.m
M wikipedia/View Controllers/ShareCard/WMFShareOptionsViewController.h
M wikipedia/View Controllers/ShareCard/WMFShareOptionsViewController.m
M wikipedia/View Controllers/WebView/WebViewController_Private.h
M wikipedia/en.lproj/Localizable.strings
10 files changed, 190 insertions(+), 106 deletions(-)

Approvals:
  Fjalapeno: Looks good to me, but someone else must approve
  Mhurd: Verified; Looks good to me, approved



diff --git a/wikipedia/Categories/NSString+Extras.h 
b/wikipedia/Categories/NSString+Extras.h
index 42627e4..d8fa591 100644
--- a/wikipedia/Categories/NSString+Extras.h
+++ b/wikipedia/Categories/NSString+Extras.h
@@ -11,6 +11,7 @@
 
 - (NSDate *)getDateFromIso8601DateString;
 - (NSString *)getStringWithoutHTML;
+- (NSString *)getStringWithoutHTMLAndWastedWhitespace;
 
 - (NSString *)randomlyRepeatMaxTimes:(NSUInteger)maxTimes;
 
diff --git a/wikipedia/Categories/NSString+Extras.m 
b/wikipedia/Categories/NSString+Extras.m
index 7f4af78..041ca23 100644
--- a/wikipedia/Categories/NSString+Extras.m
+++ b/wikipedia/Categories/NSString+Extras.m
@@ -91,6 +91,14 @@
     return result;
 }
 
+-(NSString*)getStringWithoutHTMLAndWastedWhitespace
+{
+    return [[[self getStringWithoutHTML]
+             stringByReplacingOccurrencesOfString:@"\n\n" withString:@"\n"]
+            stringByTrimmingCharactersInSet:
+            [NSCharacterSet whitespaceAndNewlineCharacterSet]];
+}
+
 - (NSString *)randomlyRepeatMaxTimes:(NSUInteger)maxTimes;
 {
     float(^rnd)() = ^(){
diff --git a/wikipedia/View 
Controllers/Navigation/Bottom/BottomMenuViewController.m b/wikipedia/View 
Controllers/Navigation/Bottom/BottomMenuViewController.m
index 3e0f262..4de7e92 100644
--- a/wikipedia/View Controllers/Navigation/Bottom/BottomMenuViewController.m
+++ b/wikipedia/View Controllers/Navigation/Bottom/BottomMenuViewController.m
@@ -33,8 +33,6 @@
     BOTTOM_MENU_BUTTON_SAVE
 };
 
-static const int kUpperTextSelectionSize = 160;
-
 @interface BottomMenuViewController ()
 
 @property (weak, nonatomic) IBOutlet WikiGlyphButton *backButton;
@@ -234,38 +232,19 @@
 {
     WebViewController *webViewController = [NAV 
searchNavStackForViewControllerOfClass:[WebViewController class]];
     NSString *selectedText = [webViewController getSelectedtext];
-    if ([selectedText isEqualToString:@""]) {
-        MWKSectionList *sections = [SessionSingleton 
sharedInstance].article.sections;
-        for (MWKSection *section in sections) {
-            NSString *sectionText = section.text;
-            NSRegularExpression *re = [NSRegularExpression 
regularExpressionWithPattern:@"<p>(.+)</p>" options:0 error:nil];
-            NSArray *matches = [re matchesInString:sectionText options:0 
range:NSMakeRange(0, sectionText.length)];
-            if ([matches count]) {
-                sectionText = [sectionText substringWithRange:[matches[0] 
rangeAtIndex:1]];
-                selectedText = [[sectionText getStringWithoutHTML] 
stringByReplacingOccurrencesOfString:@"\n\n" withString:@"\n"];
-                if (selectedText.length > kUpperTextSelectionSize) {
-                    selectedText = [NSString stringWithFormat:@"%@%@",
-                                    [selectedText 
substringToIndex:kUpperTextSelectionSize],
-                                    @"..."];
-                }
-                break;
-            }
-        }
-        if ([selectedText isEqualToString:@""]) {
-            if (sections[0]) {
-                selectedText = [[sections[0].text getStringWithoutHTML] 
stringByReplacingOccurrencesOfString:@"\n\n" withString:@"\n"];
-            }
-        }
+    if (selectedText.length == 0) {
+        selectedText = nil;
     }
     [self shareSnippet:selectedText];
 }
 
 - (void)shareButtonPushedWithNotification:(NSNotification *)notification
 {
-    [self 
shareSnippet:notification.userInfo[WebViewControllerShareSelectedText]];
+    NSString *snippet = 
notification.userInfo[WebViewControllerShareSelectedText];
+    [self shareSnippet:snippet];
 }
 
-- (void)shareSnippet:(NSString*) snippet
+- (void)shareSnippet:(NSString*)snippet
 {
     WebViewController *webViewController = [NAV 
searchNavStackForViewControllerOfClass:[WebViewController class]];
     [webViewController.webView wmf_suppressSelection];
@@ -275,7 +254,10 @@
     UIViewController *rootViewController = 
appDelegate.window.rootViewController;
     UIView *rootView = rootViewController.view;
     
-    self.shareOptionsViewController = [[WMFShareOptionsViewController alloc] 
initWithMWKArticle:article snippet:snippet backgroundView:rootView 
delegate:self];
+    self.shareOptionsViewController = [[WMFShareOptionsViewController alloc] 
initWithMWKArticle:article
+                                                                               
         snippet:snippet
+                                                                               
  backgroundView:rootView
+                                                                               
        delegate:self];
 }
 
 
@@ -285,27 +267,24 @@
     if (!self.funnel) {
         self.funnel = [[WMFShareFunnel alloc] initWithArticle:article];
     }
-    [self.funnel logShareIntentWithSelection:text];
+    [self.funnel logShareButtonTappedResultingInSelection:text];
     
 }
 
 -(void) tappedBackgroundToAbandonWithText:(NSString *)text
 {
-    [self.funnel logShareWithSelection:text
-                       platformOutcome:@"abandoned_before_choosing"];
+    [self.funnel logAbandonedAfterSeeingShareAFact];
     [self releaseShareResources];
 }
 
 -(void) tappedShareCardWithText:(NSString *)text
 {
-    [self.funnel logShareWithSelection:text
-                       platformOutcome:@"entered_card"];
+    [self.funnel logShareAsImageTapped];
 }
 
 -(void) tappedShareTextWithText:(NSString *)text
 {
-    [self.funnel logShareWithSelection:text
-                       platformOutcome:@"entered_snippet"];
+    [self.funnel logShareAsTextTapped];
 }
 
 
@@ -338,11 +317,11 @@
     }
     
     [shareActivityVC setCompletionHandler:^(NSString *activityType, BOOL 
completed) {
-        [self.funnel logShareWithSelection:text
-                           platformOutcome: [NSString 
stringWithFormat:@"finished_%@_%@",
-                                             completed ? @"success" : 
@"unknown",
-                                             activityType]];
-        NSLog(@"activityType = %@", activityType);
+        if (completed) {
+            [self.funnel logShareSucceededWithShareMethod:activityType];
+        } else {
+            [self.funnel logShareFailedWithShareMethod:activityType];
+        }
         [self releaseShareResources];
     }];
 }
diff --git a/wikipedia/View Controllers/ShareCard/ShareCard.xib 
b/wikipedia/View Controllers/ShareCard/ShareCard.xib
index 1aef0cf..b84bc4b 100644
--- a/wikipedia/View Controllers/ShareCard/ShareCard.xib
+++ b/wikipedia/View Controllers/ShareCard/ShareCard.xib
@@ -64,7 +64,7 @@
                     <color key="shadowColor" white="0.33333333333333331" 
alpha="1" colorSpace="calibratedWhite"/>
                     <size key="shadowOffset" width="0.0" height="1"/>
                 </label>
-                <label opaque="NO" userInteractionEnabled="NO" 
contentMode="top" horizontalHuggingPriority="251" verticalHuggingPriority="251" 
text="Snippet" lineBreakMode="tailTruncation" numberOfLines="5" 
baselineAdjustment="alignBaselines" minimumScaleFactor="0.16" 
preferredMaxLayoutWidth="560" translatesAutoresizingMaskIntoConstraints="NO" 
id="QlQ-cG-u6Y" userLabel="Selected Text">
+                <label opaque="NO" userInteractionEnabled="NO" 
contentMode="top" horizontalHuggingPriority="251" verticalHuggingPriority="251" 
text="Snippet" lineBreakMode="tailTruncation" numberOfLines="5" 
baselineAdjustment="alignBaselines" minimumFontSize="38" 
preferredMaxLayoutWidth="560" translatesAutoresizingMaskIntoConstraints="NO" 
id="QlQ-cG-u6Y" userLabel="Selected Text">
                     <rect key="frame" x="30" y="1" width="580" height="225"/>
                     <constraints>
                         <constraint firstAttribute="height" 
relation="lessThanOrEqual" constant="225" id="GMh-Yg-20E"/>
diff --git a/wikipedia/View Controllers/ShareCard/WMFShareFunnel.h 
b/wikipedia/View Controllers/ShareCard/WMFShareFunnel.h
index ec6edf1..f86ca76 100644
--- a/wikipedia/View Controllers/ShareCard/WMFShareFunnel.h
+++ b/wikipedia/View Controllers/ShareCard/WMFShareFunnel.h
@@ -10,25 +10,22 @@
 
 @interface WMFShareFunnel : EventLoggingFunnel
 
-@property NSString *shareSessionToken;
-
--(id)initWithArticle:(MWKArticle*) article;
+-(id)initWithArticle:(MWKArticle*)article;
 
 -(void)logHighlight;
--(void)logShareIntentWithSelection:(NSString*) selection;
+-(void)logShareButtonTappedResultingInSelection:(NSString*)selection;
+-(void)logAbandonedAfterSeeingShareAFact;
+-(void)logShareAsImageTapped;
+-(void)logShareAsTextTapped;
 
-/*! Log the final outcome of the share
- * @param selection the textual selection made by the user for sharing
- * @param platformOutcome the success/failure status and, if known, platform.
- * For example, "entered_card" might represent the user tapping on a visually
- * presented card. Next, if the user attempted to share something, it will
- * either succeed (yay) or fail (e.g., if connection didn't work). It's 
possible
- * to infer from UIActivityViewController's setCompletionHandler block what
- * the outcome was should the user be presented with the official sharing
- * activities list. And in this case it makes sense to concatenate the success
- * or failure status along with the app activity as provided in
- * setCompletionHandler.
+/*! Log the final outcome of the share as a failure
+ * @param shareMethod System provided share application string if known
  */
--(void)logShareWithSelection:(NSString*) selection platformOutcome: 
(NSString*) platformOutcome;
+-(void)logShareFailedWithShareMethod:(NSString*)shareMethod;
+
+/*! Log the final outcome of the share as a success
+ * @param shareMethod System provided share application string if known
+ */
+-(void)logShareSucceededWithShareMethod:(NSString*)shareMethod;
 
 @end
diff --git a/wikipedia/View Controllers/ShareCard/WMFShareFunnel.m 
b/wikipedia/View Controllers/ShareCard/WMFShareFunnel.m
index 1e681b9..416941a 100644
--- a/wikipedia/View Controllers/ShareCard/WMFShareFunnel.m
+++ b/wikipedia/View Controllers/ShareCard/WMFShareFunnel.m
@@ -7,70 +7,131 @@
 //
 
 #import "WMFShareFunnel.h"
+#import "NSMutableDictionary+WMFMaybeSet.h"
 
-static NSString *const kSchemaName = @"MobileWikiAppShareAFact";
-static const int kSchemaVersion = 10916168;
-static NSString *const kActionHighlight = @"highlight";
-static NSString *const kActionShareIntent = @"shareintent"; // lowercase
-static NSString *const kActionShare = @"share";
-static NSString *const kActionKey = @"action";
-static NSString *const kAppInstallIdKey = @"appInstallID"; // uppercase
-static NSString *const kShareSessionTokenKey = @"shareSessionToken";
-static NSString *const kTextKey = @"text";
-static NSString *const kArticleKey = @"article";
-static NSString *const kPageIdKey = @"pageID"; // ID uppercase
-static NSString *const kRevIdKey = @"revID"; // ID uppercase
-static NSString *const kTargetKey = @"target";
+static NSString* const kSchemaName = @"MobileWikiAppShareAFact";
+static const int kSchemaVersion = 11331974;
+static NSString* const kActionKey = @"action";
+static NSString* const kActionHighlight = @"highlight";
+static NSString* const kActionShareTap = @"sharetap";
+static NSString* const kActionAbandoned = @"abandoned";
+static NSString* const kActionShareIntent = @"shareintent";
+static NSString* const kShareModeKey = @"sharemode";
+static NSString* const kShareModeImage = @"image";
+static NSString* const kShareModeText = @"text";
+static NSString* const kActionFailure = @"failure";
+static NSString* const kActionSystemShareSheet = @"systemsharesheet";
+static NSString* const kActionShare = @"share";
+static NSString* const kTargetKey = @"target";
+
+static NSString* const kAppInstallIdKey = @"appInstallID"; // uppercase
+static NSString* const kShareSessionTokenKey = @"shareSessionToken";
+static NSString* const kTextKey = @"text"; // same as kShareModeImage by design
+static NSString* const kArticleKey = @"article";
+static NSString* const kPageIdKey = @"pageID"; // ID uppercase
+static NSString* const kRevIdKey = @"revID"; // ID uppercase
+
+static NSString* const kInitWithArticleAssertVerbiage = @"Article title 
invalid";
+static NSString* const kEventDataAssertVerbiage = @"Event data not present";
+static NSString* const kSelectionAssertVerbiage = @"No selection provided";
 
 @interface WMFShareFunnel ()
 @property NSString *sessionToken;
 @property NSString *appInstallId;
-@property MWKArticle *article;
+@property NSString *articleTitle;
+@property int articleId;
+@property NSString *selection;
+@property NSString *shareMode;
 @end
 
 @implementation WMFShareFunnel
 
--(id)initWithArticle:(MWKArticle*) article
+-(id)initWithArticle:(MWKArticle*)article
 {
+    NSString *title = [[article title] prefixedText];
+    // ...implicitly, the articleId is okay if the title is okay.
+    // But in case the title is broken (and, implicitly, articleId is, too)
+    if (!title) {
+        NSAssert(false, @"%@ : %@",
+                 kInitWithArticleAssertVerbiage,
+                 [article title]);
+        return nil;
+    }
     // https://meta.wikimedia.org/wiki/Schema:MobileWikiAppShareAFact
     self = [super initWithSchema:kSchemaName version:kSchemaVersion];
     if (self) {
         _sessionToken = [self singleUseUUID];
         _appInstallId = [self persistentUUID:kSchemaName];
-        _article = article;
+        _articleTitle = title;
+        _articleId = [article articleId];
     }
     return self;
 }
 
--(NSDictionary *)preprocessData:(NSDictionary *)eventData
+-(NSDictionary*)preprocessData:(NSDictionary*)eventData
 {
+    if (!eventData) {
+        NSAssert(false, @"%@ : %@",
+                 kEventDataAssertVerbiage,
+                 eventData);
+        return nil;
+    }
     NSMutableDictionary *dict = [eventData mutableCopy];
     dict[kShareSessionTokenKey] = self.sessionToken;
     dict[kAppInstallIdKey] = self.appInstallId;
-    dict[kPageIdKey] = [NSNumber numberWithInt:self.article.articleId];
-    dict[kArticleKey] = self.article.title.prefixedText;
+    dict[kPageIdKey] = @(self.articleId);
+    dict[kArticleKey] = self.articleTitle;
+    [dict wmf_maybeSetObject:self.selection forKey:kTextKey];
+    [dict wmf_maybeSetObject:self.shareMode forKey:kShareModeKey];
     
     // TODO: refactor MWKArticle (and ArticleFetcher - the prop would be 
'revision')
-    
-    dict[kRevIdKey] = [NSNumber numberWithInt:0];
-    return [NSDictionary dictionaryWithDictionary: dict];
+    dict[kRevIdKey] = @(-1);
+    return [dict copy];
 }
 
 -(void)logHighlight
 {
-    [self log:@{kActionKey: kActionHighlight}];
+    [self log:@{kActionKey : kActionHighlight}];
 }
 
--(void)logShareIntentWithSelection:(NSString*) selection
+-(void)logShareButtonTappedResultingInSelection:(NSString*)selection
 {
-    [self log:@{kActionKey: kActionShareIntent, kTextKey: selection}];
+    if (!selection) {
+        NSAssert(false, kSelectionAssertVerbiage);
+        self.selection = @"";
+    } else {
+        self.selection = selection;
+    }
+    [self log:@{kActionKey : kActionShareTap}];
 }
 
--(void)logShareWithSelection:(NSString*) selection platformOutcome: 
(NSString*) platformOutcome;
+-(void)logAbandonedAfterSeeingShareAFact
 {
-    [self log:@{kActionKey: kActionShare,
-                kTextKey: selection,
-                kTargetKey: platformOutcome}];
+    [self log:@{kActionKey : kActionAbandoned}];
+}
+
+-(void)logShareAsImageTapped
+{
+    self.shareMode = kShareModeImage;
+    [self log:@{kActionKey : kActionShareIntent}];
+}
+
+-(void)logShareAsTextTapped
+{
+    self.shareMode = kShareModeText;
+    [self log:@{kActionKey : kActionShareIntent}];
+}
+
+-(void)logShareFailedWithShareMethod:(NSString*)shareMethod
+{
+    [self log:@{kActionKey : kActionFailure,
+                kTargetKey : shareMethod ? shareMethod : 
kActionSystemShareSheet}];
+}
+
+-(void)logShareSucceededWithShareMethod:(NSString*)shareMethod;
+{
+    [self log:@{kActionKey : kActionShare,
+                kTargetKey : shareMethod ? shareMethod : 
kActionSystemShareSheet}];
 }
 
 @end
diff --git a/wikipedia/View 
Controllers/ShareCard/WMFShareOptionsViewController.h b/wikipedia/View 
Controllers/ShareCard/WMFShareOptionsViewController.h
index 4b079a0..8f3ee06 100644
--- a/wikipedia/View Controllers/ShareCard/WMFShareOptionsViewController.h
+++ b/wikipedia/View Controllers/ShareCard/WMFShareOptionsViewController.h
@@ -21,8 +21,12 @@
 
 @property (readonly) MWKArticle *article;
 @property (readonly) NSString *snippet;
+@property (readonly) NSString *snippetForTextOnlySharing;
 @property (readonly) UIView *backgroundView;
 @property (readonly) id<WMFShareOptionsViewControllerDelegate> delegate;
 
-- (instancetype)initWithMWKArticle: (MWKArticle*) article snippet: (NSString 
*) snippet backgroundView: (UIView*) backgroundView delegate: (id) delegate;
+- (instancetype)initWithMWKArticle:(MWKArticle*)article
+                           snippet:(NSString*)snippet
+                    backgroundView:(UIView*)backgroundView
+                          delegate:(id)delegate;
 @end
diff --git a/wikipedia/View 
Controllers/ShareCard/WMFShareOptionsViewController.m b/wikipedia/View 
Controllers/ShareCard/WMFShareOptionsViewController.m
index 239f37e..f4be78f 100644
--- a/wikipedia/View Controllers/ShareCard/WMFShareOptionsViewController.m
+++ b/wikipedia/View Controllers/ShareCard/WMFShareOptionsViewController.m
@@ -11,11 +11,13 @@
 #import "WMFShareOptionsView.h"
 #import "PaddedLabel.h"
 #import "WikipediaAppUtils.h"
+#import "NSString+Extras.h"
 
 @interface WMFShareOptionsViewController ()
 
 @property (strong, nonatomic, readwrite) UIView *backgroundView;
 @property (strong, nonatomic, readwrite) NSString *snippet;
+@property (strong, nonatomic, readwrite) NSString *snippetForTextOnlySharing;
 @property (strong, nonatomic, readwrite) MWKArticle *article;
 @property (nonatomic, assign, readwrite) 
id<WMFShareOptionsViewControllerDelegate> delegate;
 
@@ -41,8 +43,19 @@
     // Dispose of any resources that can be recreated.
 }
 
-- (instancetype)initWithMWKArticle: (MWKArticle*) article snippet: (NSString 
*) snippet backgroundView: (UIView*) backgroundView delegate: (id) delegate
+- (instancetype)initWithMWKArticle:(MWKArticle*)article
+                           snippet:(NSString*)snippet
+                    backgroundView:(UIView*)backgroundView
+                          delegate:(id)delegate
 {
+    if (!article || !backgroundView) {
+        NSAssert(false,
+                 @"Valid (article, backgroundView) required: (%@, %@)",
+                 article,
+                 backgroundView);
+        // seriously, we don't need to be crashing the app in prod
+        return nil;
+    }
     self = [super init];
     if (self) {
         _desktopURL = [[NSURL alloc] initWithString:[NSString 
stringWithFormat:@"%@%@",
@@ -58,10 +71,16 @@
         _shareTitle = article.title.prefixedText;
         WMFShareCardViewController* cardViewController = 
[[WMFShareCardViewController alloc] initWithNibName:@"ShareCard" bundle:nil];
         _snippet = snippet;
+        if (snippet.length == 0) {
+            _snippet = [self generateSnippetHeuristicallyWithArticle:article];
+            _snippetForTextOnlySharing = @"";
+        } else {
+            _snippetForTextOnlySharing = snippet;
+        }
         
         // get handle, fill, and render
         UIView *cardView = cardViewController.view;
-        [cardViewController fillCardWithMWKArticle:article snippet:snippet];
+        [cardViewController fillCardWithMWKArticle:article snippet:_snippet];
         _shareImage = [self cardAsUIImageWithView:cardView];
         
         WMFShareOptionsView *shareOptionsView = [[[NSBundle mainBundle] 
loadNibNamed:@"ShareOptions" owner:self options:nil] objectAtIndex:0];
@@ -80,6 +99,28 @@
         
     }
     return self;
+}
+
+-(NSString*)generateSnippetHeuristicallyWithArticle:(MWKArticle*)article
+{
+    NSString *heuristicText = @"";
+    MWKSectionList *sections = article.sections;
+    for (MWKSection *section in sections) {
+        NSString *sectionText = section.text;
+        NSRegularExpression *re = [NSRegularExpression 
regularExpressionWithPattern:@"<p>(.+)</p>" options:0 error:nil];
+        NSArray *matches = [re matchesInString:sectionText options:0 
range:NSMakeRange(0, sectionText.length)];
+        if ([matches count]) {
+            sectionText = [sectionText substringWithRange:[matches[0] 
rangeAtIndex:1]];
+            heuristicText = [sectionText 
getStringWithoutHTMLAndWastedWhitespace];
+            break;
+        }
+    }
+    if ([heuristicText isEqualToString:@""]) {
+        if (sections[0]) {
+            heuristicText = [sections[0].text 
getStringWithoutHTMLAndWastedWhitespace];
+        }
+    }
+    return heuristicText;
 }
 
 - (UIImage*) cardAsUIImageWithView: (UIView*) theView
@@ -218,26 +259,18 @@
 
 - (void)respondToTapForTextGesture: (UITapGestureRecognizer*) recognizer
 {
-    [self.delegate tappedShareCardWithText: self.snippet];
-    if ([self.snippet isEqualToString:@""]) {
+    [self.delegate tappedShareTextWithText:self.snippet];
+    if (self.snippetForTextOnlySharing.length == 0) {
         self.shareTitle = 
[MWLocalizedString(@"share-article-name-on-wikipedia", nil)
-                 stringByReplacingOccurrencesOfString:@"$1" 
withString:self.shareTitle];
+                           stringByReplacingOccurrencesOfString:@"$1" 
withString:self.shareTitle];
     } else {
         self.shareTitle = 
[[MWLocalizedString(@"share-article-name-on-wikipedia-with-selected-text", nil)
-                  stringByReplacingOccurrencesOfString:@"$1" 
withString:self.shareTitle]
-                 stringByReplacingOccurrencesOfString:@"$2" 
withString:self.snippet];
+                            stringByReplacingOccurrencesOfString:@"$1" 
withString:self.shareTitle]
+                           stringByReplacingOccurrencesOfString:@"$2" 
withString:self.snippetForTextOnlySharing];
     }
-    
-    MWKImage *bestImage = self.article.image;
-    if (!bestImage) {
-        bestImage = self.article.thumbnail;
-    }
-    if (bestImage) {
-        self.shareImage = [bestImage asUIImage];
-    } else {
-        // Well, there's no image and the user didn't want a card
-        self.shareImage = nil;
-    }
+
+    // per UX, don't have an image for Share as text
+    self.shareImage = nil;
     [self transferSharingToDelegate];
 }
 
diff --git a/wikipedia/View Controllers/WebView/WebViewController_Private.h 
b/wikipedia/View Controllers/WebView/WebViewController_Private.h
index 2a4a233..d5a3076 100644
--- a/wikipedia/View Controllers/WebView/WebViewController_Private.h
+++ b/wikipedia/View Controllers/WebView/WebViewController_Private.h
@@ -81,7 +81,8 @@
 
 // TODO: rename the WebViewControllerVariableNames once we rename this class
 
-static const int kMinimumTextSelectionLength = 10;
+// Some dialects have complex characters, so we use 2 instead of 10
+static const int kMinimumTextSelectionLength = 2;
 
 @interface WebViewController () <LanguageSelectionDelegate>
 {
diff --git a/wikipedia/en.lproj/Localizable.strings 
b/wikipedia/en.lproj/Localizable.strings
index 1314d30..9969d4f 100644
--- a/wikipedia/en.lproj/Localizable.strings
+++ b/wikipedia/en.lproj/Localizable.strings
@@ -194,7 +194,7 @@
 "share-menu-page-saved-access" = "Tip: to access your saved pages, tap $1 
above or long-press $2 below.";
 
 "share-custom-menu-item" = "Share";
-"share-article-name-on-wikipedia" = "\"$1\" on @Wikipedia";
+"share-article-name-on-wikipedia" = "\"$1\" on @Wikipedia:";
 "share-article-name-on-wikipedia-with-selected-text" = "\"$1\" on @Wikipedia: 
\"$2\"";
 "share-as-image" = "Share as image";
 "share-as-text" = "Share as text";

-- 
To view, visit https://gerrit.wikimedia.org/r/190637
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic8c749d9207d7e28043ecba896a3c2326dd85a34
Gerrit-PatchSet: 8
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Deskana <[email protected]>
Gerrit-Reviewer: Bgerstle <[email protected]>
Gerrit-Reviewer: Deskana <[email protected]>
Gerrit-Reviewer: Dr0ptp4kt <[email protected]>
Gerrit-Reviewer: Fjalapeno <[email protected]>
Gerrit-Reviewer: Mhurd <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to