forked from organicmaps/organicmaps
[ios] [mapsme-8980] list settings screen improvements + fix text for sending link via social
This commit is contained in:
parent
7f10448cf3
commit
0b8b230e0c
8 changed files with 26 additions and 53 deletions
|
@ -448,7 +448,7 @@ CGFloat const kPinDiameter = 18.0f;
|
|||
auto actionSheet = [UIAlertController alertControllerWithTitle:nil
|
||||
message:nil
|
||||
preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
[actionSheet addAction:[UIAlertAction actionWithTitle:L(@"search_show_on_map").capitalizedString
|
||||
[actionSheet addAction:[UIAlertAction actionWithTitle:L(@"search_show_on_map")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * _Nonnull action)
|
||||
{
|
||||
|
@ -456,7 +456,7 @@ CGFloat const kPinDiameter = 18.0f;
|
|||
[Statistics logEvent:kStatBookmarksListItemMoreClick withParameters:@{kStatOption : kStatViewOnMap}];
|
||||
}]];
|
||||
|
||||
[actionSheet addAction:[UIAlertAction actionWithTitle:L(@"list_settings").capitalizedString
|
||||
[actionSheet addAction:[UIAlertAction actionWithTitle:L(@"list_settings")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * _Nonnull action)
|
||||
{
|
||||
|
@ -464,7 +464,7 @@ CGFloat const kPinDiameter = 18.0f;
|
|||
[Statistics logEvent:kStatBookmarksListItemMoreClick withParameters:@{kStatOption : kStatSettings}];
|
||||
}]];
|
||||
|
||||
[actionSheet addAction:[UIAlertAction actionWithTitle:L(@"export_file").capitalizedString
|
||||
[actionSheet addAction:[UIAlertAction actionWithTitle:L(@"export_file")
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * _Nonnull action)
|
||||
{
|
||||
|
@ -472,7 +472,7 @@ CGFloat const kPinDiameter = 18.0f;
|
|||
[Statistics logEvent:kStatBookmarksListItemMoreClick withParameters:@{kStatOption : kStatSendAsFile}];
|
||||
}]];
|
||||
|
||||
auto deleteAction = [UIAlertAction actionWithTitle:L(@"delete_list").capitalizedString
|
||||
auto deleteAction = [UIAlertAction actionWithTitle:L(@"delete_list")
|
||||
style:UIAlertActionStyleDestructive
|
||||
handler:^(UIAlertAction * _Nonnull action)
|
||||
{
|
||||
|
@ -483,7 +483,7 @@ CGFloat const kPinDiameter = 18.0f;
|
|||
deleteAction.enabled = [[MWMBookmarksManager sharedManager] groupsIdList].count > 1;
|
||||
[actionSheet addAction:deleteAction];
|
||||
|
||||
[actionSheet addAction:[UIAlertAction actionWithTitle:L(@"cancel").capitalizedString
|
||||
[actionSheet addAction:[UIAlertAction actionWithTitle:L(@"cancel")
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:nil]];
|
||||
|
||||
|
|
|
@ -123,25 +123,25 @@ final class BMCViewController: MWMViewController {
|
|||
ppc.sourceRect = anchor.bounds
|
||||
}
|
||||
|
||||
let settings = L("list_settings").capitalized
|
||||
let settings = L("list_settings")
|
||||
actionSheet.addAction(UIAlertAction(title: settings, style: .default, handler: { _ in
|
||||
self.openCategorySettings(category: category)
|
||||
Statistics.logEvent(kStatBookmarksListSettingsClick,
|
||||
withParameters: [kStatOption : kStatListSettings])
|
||||
}))
|
||||
let showHide = L(category.isVisible ? "hide_from_map" : "zoom_to_country").capitalized
|
||||
let showHide = L(category.isVisible ? "hide_from_map" : "zoom_to_country")
|
||||
actionSheet.addAction(UIAlertAction(title: showHide, style: .default, handler: { _ in
|
||||
self.visibilityAction(category: category)
|
||||
Statistics.logEvent(kStatBookmarksListSettingsClick,
|
||||
withParameters: [kStatOption : kStatMakeInvisibleOnMap])
|
||||
}))
|
||||
let exportFile = L("export_file").capitalized
|
||||
let exportFile = L("export_file")
|
||||
actionSheet.addAction(UIAlertAction(title: exportFile, style: .default, handler: { _ in
|
||||
self.shareCategoryFile(category: category, anchor: anchor)
|
||||
Statistics.logEvent(kStatBookmarksListSettingsClick,
|
||||
withParameters: [kStatOption : kStatSendAsFile])
|
||||
}))
|
||||
let share = L("sharing_options").capitalized
|
||||
let share = L("sharing_options")
|
||||
let shareAction = UIAlertAction(title: share, style: .default, handler: { _ in
|
||||
self.shareCategory(category: category, anchor: anchor)
|
||||
Statistics.logEvent(kStatBookmarksListSettingsClick,
|
||||
|
@ -149,7 +149,7 @@ final class BMCViewController: MWMViewController {
|
|||
})
|
||||
shareAction.isEnabled = MWMBookmarksManager.shared().isCategoryNotEmpty(category.identifier)
|
||||
actionSheet.addAction(shareAction)
|
||||
let delete = L("delete_list").capitalized
|
||||
let delete = L("delete_list")
|
||||
let deleteAction = UIAlertAction(title: delete, style: .destructive, handler: { [viewModel] _ in
|
||||
viewModel!.deleteCategory(category: category)
|
||||
Statistics.logEvent(kStatBookmarksListSettingsClick,
|
||||
|
@ -157,7 +157,7 @@ final class BMCViewController: MWMViewController {
|
|||
})
|
||||
deleteAction.isEnabled = (viewModel.numberOfRows(section: .categories) > 1)
|
||||
actionSheet.addAction(deleteAction)
|
||||
let cancel = L("cancel").capitalized
|
||||
let cancel = L("cancel")
|
||||
actionSheet.addAction(UIAlertAction(title: cancel, style: .cancel, handler: nil))
|
||||
|
||||
present(actionSheet, animated: true, completion: nil)
|
||||
|
|
|
@ -67,22 +67,11 @@
|
|||
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Not shared" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hwp-Cw-qHJ">
|
||||
<rect key="frame" x="260" y="14" width="81" height="20"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<color key="textColor" red="0.5607843137254902" green="0.55686274509803924" blue="0.58039215686274503" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular16"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="hwp-Cw-qHJ" secondAttribute="trailing" id="9UI-T2-6P2"/>
|
||||
<constraint firstItem="rM4-Nu-8WD" firstAttribute="leading" secondItem="0jc-u2-nKr" secondAttribute="leadingMargin" id="Bn3-If-XN5"/>
|
||||
<constraint firstItem="hwp-Cw-qHJ" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="rM4-Nu-8WD" secondAttribute="trailing" constant="10" id="ENS-hs-qEL"/>
|
||||
<constraint firstItem="rM4-Nu-8WD" firstAttribute="centerY" secondItem="0jc-u2-nKr" secondAttribute="centerY" id="YvA-Kx-Bs8"/>
|
||||
<constraint firstItem="hwp-Cw-qHJ" firstAttribute="centerY" secondItem="0jc-u2-nKr" secondAttribute="centerY" id="vtW-Xg-w0U"/>
|
||||
<constraint firstAttribute="trailingMargin" relation="greaterThanOrEqual" secondItem="rM4-Nu-8WD" secondAttribute="trailing" constant="10" id="mwS-M1-1PZ"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
|
@ -183,7 +172,6 @@
|
|||
<toolbarItems/>
|
||||
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
|
||||
<connections>
|
||||
<outlet property="accessStatusLabel" destination="hwp-Cw-qHJ" id="FFA-EU-pHx"/>
|
||||
<outlet property="deleteListButton" destination="u56-Jh-ACU" id="YGi-6E-uHB"/>
|
||||
<outlet property="descriptionCell" destination="WFB-XH-2pJ" id="gBu-qU-6AM"/>
|
||||
<outlet property="descriptionTextView" destination="2hT-xL-Vpf" id="ZGf-vb-TFO"/>
|
||||
|
|
|
@ -19,7 +19,6 @@ class CategorySettingsViewController: MWMTableViewController {
|
|||
|
||||
@objc weak var delegate: CategorySettingsViewControllerDelegate?
|
||||
|
||||
@IBOutlet private weak var accessStatusLabel: UILabel!
|
||||
@IBOutlet private weak var nameTextField: UITextField!
|
||||
@IBOutlet private weak var descriptionTextView: UITextView!
|
||||
@IBOutlet private weak var descriptionCell: UITableViewCell!
|
||||
|
@ -29,14 +28,13 @@ class CategorySettingsViewController: MWMTableViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
title = L("settings")
|
||||
title = L("list_settings")
|
||||
|
||||
assert(categoryId != MWMFrameworkHelper.invalidCategoryId(), "must provide category info")
|
||||
|
||||
deleteListButton.isEnabled = (manager.groupsIdList().count > 1)
|
||||
nameTextField.text = manager.getCategoryName(categoryId)
|
||||
descriptionTextView.text = manager.getCategoryDescription(categoryId)
|
||||
configureAccessStatus()
|
||||
|
||||
navigationItem.rightBarButtonItem = saveButton
|
||||
}
|
||||
|
@ -58,19 +56,6 @@ class CategorySettingsViewController: MWMTableViewController {
|
|||
}
|
||||
}
|
||||
|
||||
func configureAccessStatus() {
|
||||
switch MWMBookmarksManager.shared().getCategoryAccessStatus(categoryId) {
|
||||
case .local:
|
||||
accessStatusLabel.text = L("not_shared")
|
||||
case .public:
|
||||
accessStatusLabel.text = L("bookmarks_public_access")
|
||||
case .private:
|
||||
accessStatusLabel.text = L("bookmarks_link_access")
|
||||
case .other:
|
||||
assert(false, "it's not ok that this category has such access status")
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func deleteListButtonPressed(_ sender: Any) {
|
||||
guard categoryId != MWMFrameworkHelper.invalidCategoryId() else {
|
||||
assert(false)
|
||||
|
@ -86,7 +71,6 @@ class CategorySettingsViewController: MWMTableViewController {
|
|||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
||||
if let destinationVC = segue.destination as? BookmarksSharingViewController {
|
||||
destinationVC.categoryId = categoryId
|
||||
destinationVC.delegate = self
|
||||
Statistics.logEvent(kStatBookmarkSettingsClick,
|
||||
withParameters: [kStatOption : kStatSharingOptions])
|
||||
}
|
||||
|
@ -112,12 +96,6 @@ class CategorySettingsViewController: MWMTableViewController {
|
|||
}
|
||||
}
|
||||
|
||||
extension CategorySettingsViewController: BookmarksSharingViewControllerDelegate {
|
||||
func didShareCategory() {
|
||||
configureAccessStatus()
|
||||
}
|
||||
}
|
||||
|
||||
extension CategorySettingsViewController: UITextViewDelegate {
|
||||
func textViewDidChange(_ textView: UITextView) {
|
||||
let size = textView.bounds.size
|
||||
|
|
|
@ -301,9 +301,14 @@ extension BookmarksSharingViewController: UITextViewDelegate {
|
|||
|
||||
extension BookmarksSharingViewController: UploadActionCellDelegate {
|
||||
func cellDidPressShareButton(_ cell: UploadActionCell) {
|
||||
guard let url = categoryUrl else {
|
||||
assert(false, "must provide guide url")
|
||||
return
|
||||
}
|
||||
|
||||
Statistics.logEvent(kStatSharingOptionsClick, withParameters: [kStatItem : kStatCopyLink])
|
||||
let message = L("share_bookmarks_email_body")
|
||||
let shareController = MWMActivityViewController.share(for: categoryUrl, message: message) {
|
||||
let message = String(coreFormat: L("share_bookmarks_email_body_link"), arguments: [url.absoluteString])
|
||||
let shareController = MWMActivityViewController.share(for: nil, message: message) {
|
||||
_, success, _, _ in
|
||||
if success {
|
||||
Statistics.logEvent(kStatSharingLinkSuccess, withParameters: [kStatFrom : kStatSharingOptions])
|
||||
|
|
|
@ -25,8 +25,8 @@ final class EditOnWebViewController: MWMViewController {
|
|||
}
|
||||
|
||||
Statistics.logEvent(kStatEditOnWebClick, withParameters: [kStatItem : kStatCopyLink])
|
||||
let message = L("share_bookmarks_email_body")
|
||||
let shareController = MWMActivityViewController.share(for: guide, message: message) {
|
||||
let message = String(coreFormat: L("share_bookmarks_email_body_link"), arguments: [guide.absoluteString])
|
||||
let shareController = MWMActivityViewController.share(for: nil, message: message) {
|
||||
[weak self] _, success, _, _ in
|
||||
if success {
|
||||
Statistics.logEvent(kStatSharingLinkSuccess, withParameters: [kStatFrom : kStatEditOnWeb])
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
+ (instancetype)shareControllerForPlacePageObject:(id<MWMPlacePageObject>)object;
|
||||
|
||||
+ (instancetype)shareControllerForURL:(NSURL *)url
|
||||
+ (instancetype)shareControllerForURL:(NSURL * _Nullable)url
|
||||
message:(NSString *)message
|
||||
completionHandler:
|
||||
(_Nullable UIActivityViewControllerCompletionWithItemsHandler)completionHandler;
|
||||
|
|
|
@ -47,7 +47,9 @@
|
|||
completionHandler:
|
||||
(UIActivityViewControllerCompletionWithItemsHandler)completionHandler
|
||||
{
|
||||
MWMActivityViewController * shareVC = [[self alloc] initWithActivityItems:@[message, url]];
|
||||
NSMutableArray * items = [NSMutableArray arrayWithObject:message];
|
||||
if (url) [items addObject:url];
|
||||
MWMActivityViewController * shareVC = [[self alloc] initWithActivityItems:items.copy];
|
||||
shareVC.excludedActivityTypes = [shareVC.excludedActivityTypes arrayByAddingObject:UIActivityTypePostToFacebook];
|
||||
shareVC.completionWithItemsHandler = completionHandler;
|
||||
return shareVC;
|
||||
|
|
Loading…
Add table
Reference in a new issue