[ios] Added Settings And Info

This commit is contained in:
Igor Khmurets 2014-08-10 01:28:55 +03:00 committed by Alex Zolotarev
parent 483026e775
commit 65dd5d836a
12 changed files with 435 additions and 79 deletions

View file

@ -7,27 +7,6 @@
</head>
<body>
<p><strong>MAPS.ME</strong> offers the quickest offline maps of all the cities, all countries of the world. Travel with full confidence: wherever you are, <strong>MAPS.ME</strong> addresses all your offline mapping needs. </p>
<p>We are always working on new features and would love to hear from
you on how you think we could improve our maps. If you have any
problems with the app, don't hesitate to contact us at <a href="mailto:support@maps.me">support@maps.me</a>. We respond to every request!</p>
<p>Like <strong>MAPS.ME</strong> and want to support us? There are some simple and
absolutely free ways:
<ul>
<li>leave a review at your App Market
<li>like our <a href="http://fb.maps.me">Facebook</a> page
<li>or just tell about <strong>MAPS.ME</strong> to your mom, friends and
colleagues :)
</ul>
</p>
<p>Thank you for being with us. We appreciate your support very much!</p>
<p>P.S. If you see something is missing on the map, please add or fix it directly
in the <a href="http://www.openstreetmap.org/">OpenStreetMap</a> database</p>
<p>Map data &copy; <a href="http://www.openstreetmap.org/">OpenStreetMap</a> contributors,
<a href="http://opendatacommons.org/licenses/odbl/">ODbL</a>.<br />

View file

@ -0,0 +1,8 @@
#import <UIKit/UIKit.h>
@interface RichTextVC : UIViewController
- (instancetype)initWithText:(NSString *)text;
@end

View file

@ -0,0 +1,45 @@
#import "RichTextVC.h"
@interface RichTextVC ()
@property (nonatomic) NSString * text;
@property (nonatomic) UITextView * textView;
@end
@implementation RichTextVC
- (instancetype)initWithText:(NSString *)text
{
self = [super init];
self.text = text;
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self.view addSubview:self.textView];
self.textView.text = self.text;
}
- (UITextView *)textView
{
if (!_textView)
{
_textView = [[UITextView alloc] initWithFrame:self.view.bounds];
_textView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_textView.editable = NO;
if ([_textView respondsToSelector:@selector(setTextContainerInset:)])
_textView.textContainerInset = UIEdgeInsetsMake(10, 5, 10, 5);
_textView.font = [UIFont fontWithName:@"HelveticaNeue" size:16];
_textView.dataDetectorTypes = UIDataDetectorTypeLink;
}
return _textView;
}
@end

View file

@ -49,6 +49,8 @@
@interface UIApplication (URLs)
- (void)openProVersionFrom:(NSString *)launchPlaceName;
- (void)rateLiteVersionFrom:(NSString *)launchPlaceName;
- (void)rateProVersionFrom:(NSString *)launchPlaceName;
- (void)openGuideWithName:(NSString *)guideName itunesURL:(NSString *)itunesURL;
@end

View file

@ -188,6 +188,18 @@
}
}
- (void)rateProVersionFrom:(NSString *)launchPlaceName
{
NSString * urlString = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id510623322?mt=8&at=1l3v7ya&ct=%@", launchPlaceName];
[self openURL:[NSURL URLWithString:urlString]];
}
- (void)rateLiteVersionFrom:(NSString *)launchPlaceName
{
NSString * urlString = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id431183278?mt=8&at=10lGar&ct=%@", launchPlaceName];
[self openURL:[NSURL URLWithString:urlString]];
}
- (void)openGuideWithName:(NSString *)guideName itunesURL:(NSString *)itunesURL
{
NSString * guide = [[guideName stringByReplacingOccurrencesOfString:@" " withString:@""] lowercaseString];

View file

@ -3,7 +3,6 @@
#import "EAGLView.h"
#import "BookmarksRootVC.h"
#import "UIKitCategories.h"
#import "SettingsViewController.h"
#import "UIViewController+Navigation.h"
#import "ShareActionSheet.h"
#import "AppInfo.h"
@ -17,6 +16,7 @@
#import "BookmarkDescriptionVC.h"
#import "BookmarkNameVC.h"
#import "AccountManager.h"
#import "SettingsAndMoreVC.h"
#import "../Settings/SettingsManager.h"
#import "../../Common/CustomAlertView.h"
@ -35,14 +35,10 @@
#define ALERT_VIEW_FACEBOOK 1
#define ALERT_VIEW_APPSTORE 2
#define ALERT_VIEW_BOOKMARKS 4
#define ITUNES_URL @"itms-apps://itunes.apple.com/app/id%lld"
#define ALERT_VIEW_PROMO 777
#define FACEBOOK_URL @"http://www.facebook.com/MapsWithMe"
#define FACEBOOK_SCHEME @"fb://profile/111923085594432"
const long long PRO_IDL = 510623322L;
const long long LITE_IDL = 431183278L;
@interface MapViewController () <PlacePageViewDelegate, ToolbarViewDelegate, BottomMenuDelegate, SelectSetVCDelegate, BookmarkDescriptionVCDelegate, BookmarkNameVCDelegate>
@property (nonatomic) ShareActionSheet * shareActionSheet;
@ -984,20 +980,44 @@ const long long LITE_IDL = 431183278L;
{
case ALERT_VIEW_APPSTORE:
{
NSString * url = nil;
if (GetPlatform().IsPro())
url = [NSString stringWithFormat:ITUNES_URL, PRO_IDL];
else
url = [NSString stringWithFormat:ITUNES_URL, LITE_IDL];
[self manageAlert:buttonIndex andUrl:[NSURL URLWithString:url] andDlgSetting:dlg_settings::AppStore];
if (buttonIndex == 0)
{
dlg_settings::SaveResult(dlg_settings::AppStore, dlg_settings::Never);
}
else if (buttonIndex == 1)
{
dlg_settings::SaveResult(dlg_settings::AppStore, dlg_settings::OK);
if (GetPlatform().IsPro())
[[UIApplication sharedApplication] rateProVersionFrom:@"ios_popup"];
else
[[UIApplication sharedApplication] rateLiteVersionFrom:@"ios_popup"];
}
else if (buttonIndex == 2)
{
dlg_settings::SaveResult(dlg_settings::AppStore, dlg_settings::Later);
}
return;
}
case ALERT_VIEW_FACEBOOK:
{
NSString * url = [NSString stringWithFormat:FACEBOOK_SCHEME];
if (![[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:url]])
url = [NSString stringWithFormat:FACEBOOK_URL];
[self manageAlert:buttonIndex andUrl:[NSURL URLWithString:url] andDlgSetting:dlg_settings::FacebookDlg];
if (buttonIndex == 0)
{
dlg_settings::SaveResult(dlg_settings::FacebookDlg, dlg_settings::Never);
}
else if (buttonIndex == 1)
{
dlg_settings::SaveResult(dlg_settings::FacebookDlg, dlg_settings::OK);
NSString * url = [NSString stringWithFormat:FACEBOOK_SCHEME];
if (![[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:url]])
url = [NSString stringWithFormat:FACEBOOK_URL];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}
else if (buttonIndex == 2)
{
dlg_settings::SaveResult(dlg_settings::FacebookDlg, dlg_settings::Later);
}
return;
}
case ALERT_VIEW_BOOKMARKS:
@ -1191,31 +1211,6 @@ NSInteger compareAddress(id l, id r, void * context)
[alertView show];
}
- (void)manageAlert:(NSInteger)buttonIndex andUrl:(NSURL *)url andDlgSetting:(dlg_settings::DialogT)set
{
switch (buttonIndex)
{
case 0:
{
dlg_settings::SaveResult(set, dlg_settings::Never);
break;
}
case 1:
{
dlg_settings::SaveResult(set, dlg_settings::OK);
[[UIApplication sharedApplication] openURL:url];
break;
}
case 2:
{
dlg_settings::SaveResult(set, dlg_settings::Later);
break;
}
default:
break;
}
}
- (void)destroyPopover
{
self.popoverVC = nil;

View file

@ -0,0 +1,6 @@
#import <UIKit/UIKit.h>
@interface CommunityVC : UITableViewController
@end

110
iphone/Maps/CommunityVC.m Normal file
View file

@ -0,0 +1,110 @@
#import "CommunityVC.h"
#import "UIViewController+Navigation.h"
#import "UIKitCategories.h"
#import <MessageUI/MFMailComposeViewController.h>
@interface CommunityVC () <MFMailComposeViewControllerDelegate>
@property (nonatomic) NSArray * items;
@end
@implementation CommunityVC
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = NSLocalizedString(@"maps_me_community", nil);
self.items = @[@{@"Id" : @"Facebook", @"Title" : NSLocalizedString(@"like_on_facebook", nil), @"Icon" : @"MWMProIcon"},
@{@"Id" : @"Twitter", @"Title" : NSLocalizedString(@"follow_on_twitter", nil), @"Icon" : @"MWMProIcon"},
@{@"Id" : @"Contact", @"Title" : NSLocalizedString(@"contact_us", nil), @"Icon" : @"MWMProIcon"},
@{@"Id" : @"Subscribe", @"Title" : NSLocalizedString(@"subscribe_to_news", nil), @"Icon" : @"MWMProIcon"}];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.items count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSDictionary * item = self.items[indexPath.row];
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:[UITableViewCell className]];
if (!cell) // iOS 5
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[UITableViewCell className]];
cell.textLabel.text = item[@"Title"];
cell.imageView.image = [UIImage imageNamed:item[@"Icon"]];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString * itemId = self.items[indexPath.row][@"Id"];
if ([itemId isEqualToString:@"Facebook"])
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.facebook.com/MapsWithMe"]];
}
else if ([itemId isEqualToString:@"Twitter"])
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://twitter.com/MAPS_ME"]];
}
else if ([itemId isEqualToString:@"Contact"])
{
[self contact];
}
else if ([itemId isEqualToString:@"Subscribe"])
{
[self subscribe];
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
- (void)contact
{
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController * vc = [MFMailComposeViewController new];
vc.mailComposeDelegate = self;
[vc setSubject:@"maps.me"];
[vc setToRecipients:@[@"info@maps.me"]];
[self presentViewController:vc animated:YES completion:nil];
}
else
{
#warning translation
NSString * text = [NSString stringWithFormat:@"!!!Почтовый клиент не настроен. Попробуйте написать нам другим способом"];
[[[UIAlertView alloc] initWithTitle:@"!!!Не настроена почта" message:text delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) otherButtonTitles:nil] show];
}
}
- (void)subscribe
{
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController * vc = [MFMailComposeViewController new];
vc.mailComposeDelegate = self;
[vc setSubject:NSLocalizedString(@"subscribe_me_subject", nil)];
[vc setToRecipients:@[@"subscribe@maps.me"]];
[vc setMessageBody:NSLocalizedString(@"subscribe_me_body", nil) isHTML:NO];
[self presentViewController:vc animated:YES completion:nil];
}
else
{
#warning translation
NSString * text = [NSString stringWithFormat:@"!!!Почтовый клиент не настроен. Попробуйте написать нам другим способом"];
[[[UIAlertView alloc] initWithTitle:@"!!!Не настроена почта" message:text delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) otherButtonTitles:nil] show];
}
}
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
[self dismissViewControllerAnimated:YES completion:nil];
}
@end

View file

@ -38,6 +38,10 @@
9747278518338F0C006B7CB7 /* UIViewController+Navigation.m in Sources */ = {isa = PBXBuildFile; fileRef = 9747278318338F0C006B7CB7 /* UIViewController+Navigation.m */; };
974D041D1977DE430081D0A7 /* LocalNotificationManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 974D041B1977DE430081D0A7 /* LocalNotificationManager.mm */; };
974D041E1977DE430081D0A7 /* LocalNotificationManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 974D041B1977DE430081D0A7 /* LocalNotificationManager.mm */; };
9750841F199501F100A7457D /* ImageDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 9750841E199501F100A7457D /* ImageDownloader.m */; };
97508420199501F100A7457D /* ImageDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 9750841E199501F100A7457D /* ImageDownloader.m */; };
97508423199522D300A7457D /* SettingsAndMoreVC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97508422199522D300A7457D /* SettingsAndMoreVC.mm */; };
97508424199522D300A7457D /* SettingsAndMoreVC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97508422199522D300A7457D /* SettingsAndMoreVC.mm */; };
9769D6EF1912BF3000CA6158 /* ContainerView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9769D6EE1912BF3000CA6158 /* ContainerView.mm */; };
9769D6F01912BF3000CA6158 /* ContainerView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9769D6EE1912BF3000CA6158 /* ContainerView.mm */; };
97719D451843B6DC00BDD815 /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 97719D441843B6DC00BDD815 /* MessageUI.framework */; };
@ -56,6 +60,10 @@
9789DB57188D5E2A007C6FAE /* InAppMessagesManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9789DB55188D5E2A007C6FAE /* InAppMessagesManager.mm */; };
9789DB5A188D94F9007C6FAE /* InterstitialView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9789DB59188D94F9007C6FAE /* InterstitialView.mm */; };
9789DB5B188D94F9007C6FAE /* InterstitialView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9789DB59188D94F9007C6FAE /* InterstitialView.mm */; };
978D4A251996B0EC00D72CA7 /* CommunityVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 978D4A241996B0EC00D72CA7 /* CommunityVC.m */; };
978D4A261996B0EC00D72CA7 /* CommunityVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 978D4A241996B0EC00D72CA7 /* CommunityVC.m */; };
978D4A291996C17300D72CA7 /* RichTextVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 978D4A281996C17300D72CA7 /* RichTextVC.m */; };
978D4A2A1996C17300D72CA7 /* RichTextVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 978D4A281996C17300D72CA7 /* RichTextVC.m */; };
978F9240183B660F000D6C7C /* SettingsViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 978F9239183B660F000D6C7C /* SettingsViewController.mm */; };
978F9241183B660F000D6C7C /* SettingsViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 978F9239183B660F000D6C7C /* SettingsViewController.mm */; };
978F9242183B660F000D6C7C /* SelectableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 978F923A183B660F000D6C7C /* SelectableCell.m */; };
@ -1370,6 +1378,10 @@
9747278318338F0C006B7CB7 /* UIViewController+Navigation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIViewController+Navigation.m"; path = "Classes/UIViewController+Navigation.m"; sourceTree = "<group>"; };
974D041B1977DE430081D0A7 /* LocalNotificationManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalNotificationManager.mm; sourceTree = "<group>"; };
974D041C1977DE430081D0A7 /* LocalNotificationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalNotificationManager.h; sourceTree = "<group>"; };
9750841D199501F100A7457D /* ImageDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageDownloader.h; sourceTree = "<group>"; };
9750841E199501F100A7457D /* ImageDownloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageDownloader.m; sourceTree = "<group>"; };
97508421199522D300A7457D /* SettingsAndMoreVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsAndMoreVC.h; sourceTree = "<group>"; };
97508422199522D300A7457D /* SettingsAndMoreVC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SettingsAndMoreVC.mm; sourceTree = "<group>"; };
9769D6ED1912BF3000CA6158 /* ContainerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContainerView.h; sourceTree = "<group>"; };
9769D6EE1912BF3000CA6158 /* ContainerView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContainerView.mm; sourceTree = "<group>"; };
97719D441843B6DC00BDD815 /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; };
@ -1385,6 +1397,10 @@
9789DB55188D5E2A007C6FAE /* InAppMessagesManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InAppMessagesManager.mm; sourceTree = "<group>"; };
9789DB58188D94F9007C6FAE /* InterstitialView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InterstitialView.h; sourceTree = "<group>"; };
9789DB59188D94F9007C6FAE /* InterstitialView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InterstitialView.mm; sourceTree = "<group>"; };
978D4A231996B0EC00D72CA7 /* CommunityVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommunityVC.h; sourceTree = "<group>"; };
978D4A241996B0EC00D72CA7 /* CommunityVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommunityVC.m; sourceTree = "<group>"; };
978D4A271996C17300D72CA7 /* RichTextVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RichTextVC.h; sourceTree = "<group>"; };
978D4A281996C17300D72CA7 /* RichTextVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RichTextVC.m; sourceTree = "<group>"; };
978F9239183B660F000D6C7C /* SettingsViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SettingsViewController.mm; path = Settings/SettingsViewController.mm; sourceTree = "<group>"; };
978F923A183B660F000D6C7C /* SelectableCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SelectableCell.m; path = Settings/SelectableCell.m; sourceTree = "<group>"; };
978F923B183B660F000D6C7C /* SwitchCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SwitchCell.m; path = Settings/SwitchCell.m; sourceTree = "<group>"; };
@ -2390,6 +2406,8 @@
97A0EEF7192F3B43009B2779 /* BottomMenu.mm */,
97A0EEF8192F3B43009B2779 /* BottomMenuCell.h */,
97A0EEF9192F3B43009B2779 /* BottomMenuCell.m */,
9750841D199501F100A7457D /* ImageDownloader.h */,
9750841E199501F100A7457D /* ImageDownloader.m */,
);
name = "Bottom Menu";
sourceTree = "<group>";
@ -2565,6 +2583,8 @@
children = (
FAFCB63413366E78001A5C59 /* WebViewController.h */,
FAFCB63513366E78001A5C59 /* WebViewController.mm */,
978D4A271996C17300D72CA7 /* RichTextVC.h */,
978D4A281996C17300D72CA7 /* RichTextVC.m */,
FA34BEC81338D72F00FFB2A7 /* CustomAlertView.mm */,
FA34BEC91338D72F00FFB2A7 /* CustomAlertView.h */,
FAA4B13E13EC1C8C00BCAB63 /* DiskFreeSpace.h */,
@ -2613,6 +2633,10 @@
FA4135E7120A263C0062D5B4 /* SettingsManager.mm */,
978F923F183B660F000D6C7C /* SettingsViewController.h */,
978F9239183B660F000D6C7C /* SettingsViewController.mm */,
97508421199522D300A7457D /* SettingsAndMoreVC.h */,
97508422199522D300A7457D /* SettingsAndMoreVC.mm */,
978D4A231996B0EC00D72CA7 /* CommunityVC.h */,
978D4A241996B0EC00D72CA7 /* CommunityVC.m */,
FA29FDA8141E77F8004ADF66 /* Preferences.h */,
FA29FDA9141E77F8004ADF66 /* Preferences.mm */,
);
@ -4453,8 +4477,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
978D4A251996B0EC00D72CA7 /* CommunityVC.m in Sources */,
1D60589B0D05DD56006BFB54 /* main.mm in Sources */,
97A0EEFA192F3B43009B2779 /* BottomMenu.mm in Sources */,
978D4A291996C17300D72CA7 /* RichTextVC.m in Sources */,
9747278418338F0C006B7CB7 /* UIViewController+Navigation.m in Sources */,
97908B30196591F7003DD7C6 /* SearchShowOnMapCell.m in Sources */,
1D3623260D0F684500981E51 /* MapsAppDelegate.mm in Sources */,
@ -4465,6 +4491,7 @@
FA4135ED120A263C0062D5B4 /* SettingsManager.mm in Sources */,
EE7F29811219ECA300EB67A9 /* RenderBuffer.mm in Sources */,
97D092B5190A6E1D00FF645B /* PlacePageEditCell.mm in Sources */,
9750841F199501F100A7457D /* ImageDownloader.m in Sources */,
978F9253183BD530000D6C7C /* NavigationController.mm in Sources */,
97354B65196AF97200352536 /* PlacePageRoutingCell.m in Sources */,
974386DD19373EA400FD5659 /* ToastView.m in Sources */,
@ -4507,6 +4534,7 @@
CB252D6F16FF82C9001E41E9 /* Statistics.mm in Sources */,
978F9244183B660F000D6C7C /* SwitchCell.m in Sources */,
EDB811A3175E1A9C00E36BF2 /* TwoButtonsView.m in Sources */,
97508423199522D300A7457D /* SettingsAndMoreVC.mm in Sources */,
97ABBA4518C8DF620079333C /* PlacePageView.mm in Sources */,
97F61794183E7445009919E2 /* LinkCell.m in Sources */,
97D092B1190A681F00FF645B /* PlacePageInfoCell.mm in Sources */,
@ -4522,8 +4550,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
978D4A261996B0EC00D72CA7 /* CommunityVC.m in Sources */,
FAFB08E9151215EE0041901D /* main.mm in Sources */,
9747278518338F0C006B7CB7 /* UIViewController+Navigation.m in Sources */,
978D4A2A1996C17300D72CA7 /* RichTextVC.m in Sources */,
FAFB08EA151215EE0041901D /* MapsAppDelegate.mm in Sources */,
97908B31196591FB003DD7C6 /* SearchShowOnMapCell.m in Sources */,
FAFB08EB151215EE0041901D /* EAGLView.mm in Sources */,
@ -4534,6 +4564,7 @@
FAFB08EF151215EE0041901D /* RenderBuffer.mm in Sources */,
97DEA09718D75BB000C5F963 /* ContextViews.mm in Sources */,
978F9254183BD530000D6C7C /* NavigationController.mm in Sources */,
97508420199501F100A7457D /* ImageDownloader.m in Sources */,
97A0EEFD192F3B43009B2779 /* BottomMenuCell.m in Sources */,
97354B66196AF97200352536 /* PlacePageRoutingCell.m in Sources */,
97C9851F186AE3C500AF7E9E /* Reachability.m in Sources */,
@ -4576,6 +4607,7 @@
9778E99E191A5B6600AD850A /* BookmarkDescriptionVC.mm in Sources */,
978F9245183B660F000D6C7C /* SwitchCell.m in Sources */,
EDB811A4175E1A9C00E36BF2 /* TwoButtonsView.m in Sources */,
97508424199522D300A7457D /* SettingsAndMoreVC.mm in Sources */,
97F61795183E7445009919E2 /* LinkCell.m in Sources */,
EDC5C544175F2CA600420E92 /* ShareActionSheet.mm in Sources */,
9778E9A6191A86D800AD850A /* SelectedColorView.m in Sources */,

View file

@ -17,7 +17,6 @@ typedef NS_ENUM(NSUInteger, Section)
SectionMetrics,
SectionZoomButtons,
SectionStatistics,
SectionAbout,
SectionCount
};
@ -98,12 +97,6 @@ typedef NS_ENUM(NSUInteger, Section)
customCell.titleLabel.text = NSLocalizedString(@"pref_zoom_title", nil);
customCell.delegate = self;
}
else if (indexPath.section == SectionAbout)
{
cell = [tableView dequeueReusableCellWithIdentifier:[LinkCell className]];
LinkCell * customCell = (LinkCell *)cell;
customCell.titleLabel.text = NSLocalizedString(@"about_menu_title", nil);
}
return cell;
}
@ -146,17 +139,6 @@ Settings::Units unitsForIndex(NSInteger index)
[tableView reloadSections:[NSIndexSet indexSetWithIndex:SectionMetrics] withRowAnimation:UITableViewRowAnimationFade];
[[MapsAppDelegate theApp].m_mapViewController setupMeasurementSystem];
}
else if (indexPath.section == SectionAbout)
{
ReaderPtr<Reader> r = GetPlatform().GetReader("about.html");
string s;
r.ReadAsString(s);
NSString * str = [NSString stringWithFormat:@"Version: %@ \n", [[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"]];
NSString * text = [NSString stringWithFormat:@"%@%@", str, [NSString stringWithUTF8String:s.c_str()]];
WebViewController * aboutViewController = [[WebViewController alloc] initWithHtml:text baseUrl:nil andTitleOrNil:NSLocalizedString(@"about", nil)];
aboutViewController.openInSafari = YES;
[self.navigationController pushViewController:aboutViewController animated:YES];
}
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section

View file

@ -0,0 +1,6 @@
#import <UIKit/UIKit.h>
@interface SettingsAndMoreVC : UITableViewController
@end

View file

@ -0,0 +1,179 @@
#import "SettingsAndMoreVC.h"
#import "UIKitCategories.h"
#import <MessageUI/MFMailComposeViewController.h>
#import <sys/utsname.h>
#include "../../map/dialog_settings.hpp"
#include "../../platform/platform.hpp"
#import "SettingsViewController.h"
#import "UIViewController+Navigation.h"
#import "WebViewController.h"
#import "CommunityVC.h"
#import "RichTextVC.h"
@interface SettingsAndMoreVC () <MFMailComposeViewControllerDelegate>
@property (nonatomic) NSArray * items;
@property (nonatomic) NSDictionary * deviceNames;
@end
@implementation SettingsAndMoreVC
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = NSLocalizedString(@"settings_and_more", nil);
self.deviceNames = @{@"x86_64" : @"Simulator",
@"i386" : @"Simulator",
@"iPod1,1" : @"iPod Touch",
@"iPod2,1" : @"iPod Touch 2nd generation",
@"iPod3,1" : @"iPod Touch 3rd generation",
@"iPod4,1" : @"iPod Touch 4th generation",
@"iPhone1,1" : @"iPhone",
@"iPhone1,2" : @"iPhone 3G",
@"iPhone2,1" : @"iPhone 3GS",
@"iPhone3,1" : @"iPhone 4",
@"iPhone4,1" : @"iPhone 4S",
@"iPhone5,1" : @"iPhone 5",
@"iPhone5,2" : @"iPhone 5",
@"iPhone5,3" : @"iPhone 5c",
@"iPhone5,4" : @"iPhone 5c",
@"iPhone6,1" : @"iPhone 5s",
@"iPhone6,2" : @"iPhone 5s",
@"iPad1,1" : @"iPad",
@"iPad2,1" : @"iPad 2",
@"iPad3,1" : @"iPad 3rd generation",
@"iPad3,4" : @"iPad 4th generation",
@"iPad2,5" : @"iPad Mini",
@"iPad4,1" : @"iPad Air - Wifi",
@"iPad4,2" : @"iPad Air - Cellular",
@"iPad4,4" : @"iPad Mini - Wifi 2nd generation",
@"iPad4,5" : @"iPad Mini - Cellular 2nd generation"};
self.items = @[@{@"Id" : @"About", @"Title" : NSLocalizedString(@"about_menu_title", nil), @"Icon" : @"MWMProIcon"},
@{@"Id" : @"Community", @"Title" : NSLocalizedString(@"maps_me_community", nil), @"Icon" : @"MWMProIcon"},
@{@"Id" : @"RateApp", @"Title" : NSLocalizedString(@"rate_the_app", nil), @"Icon" : @"MWMProIcon"},
@{@"Id" : @"Settings", @"Title" : NSLocalizedString(@"settings", nil), @"Icon" : @"MWMProIcon"},
@{@"Id" : @"ReportBug", @"Title" : NSLocalizedString(@"report_a_bug", nil), @"Icon" : @"MWMProIcon"},
@{@"Id" : @"Help", @"Title" : NSLocalizedString(@"help", nil), @"Icon" : @"MWMProIcon"},
@{@"Id" : @"Copyright", @"Title" : NSLocalizedString(@"copyright", nil), @"Icon" : @"MWMProIcon"}];
}
#pragma mark - TableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.items count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSDictionary * item = self.items[indexPath.row];
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:[UITableViewCell className]];
if (!cell) // iOS 5
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[UITableViewCell className]];
cell.textLabel.text = item[@"Title"];
cell.imageView.image = [UIImage imageNamed:item[@"Icon"]];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString * itemId = self.items[indexPath.row][@"Id"];
if ([itemId isEqualToString:@"About"])
{
[self about];
}
else if ([itemId isEqualToString:@"Community"])
{
CommunityVC * vc = [[CommunityVC alloc] init];
[self.navigationController pushViewController:vc animated:YES];
}
else if ([itemId isEqualToString:@"RateApp"])
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
[self rateApp];
}
else if ([itemId isEqualToString:@"Settings"])
{
SettingsViewController * vc = [self.mainStoryboard instantiateViewControllerWithIdentifier:[SettingsViewController className]];
[self.navigationController pushViewController:vc animated:YES];
}
else if ([itemId isEqualToString:@"ReportBug"])
{
[self reportBug];
}
else if ([itemId isEqualToString:@"Help"])
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
else if ([itemId isEqualToString:@"Copyright"])
{
[self copyright];
}
}
- (void)about
{
RichTextVC * vc = [[RichTextVC alloc] initWithText:NSLocalizedString(@"about_text", nil)];
vc.title = NSLocalizedString(@"about_menu_title", nil);
[self.navigationController pushViewController:vc animated:YES];
}
- (void)copyright
{
ReaderPtr<Reader> r = GetPlatform().GetReader("about.html");
string s;
r.ReadAsString(s);
NSString * str = [NSString stringWithFormat:@"Version: %@ \n", [[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"]];
NSString * text = [NSString stringWithFormat:@"%@%@", str, [NSString stringWithUTF8String:s.c_str()]];
WebViewController * aboutViewController = [[WebViewController alloc] initWithHtml:text baseUrl:nil andTitleOrNil:NSLocalizedString(@"copyright", nil)];
aboutViewController.openInSafari = YES;
[self.navigationController pushViewController:aboutViewController animated:YES];
}
- (void)rateApp
{
dlg_settings::SaveResult(dlg_settings::AppStore, dlg_settings::OK);
if (GetPlatform().IsPro())
[[UIApplication sharedApplication] rateProVersionFrom:@"ios_popup"];
else
[[UIApplication sharedApplication] rateLiteVersionFrom:@"ios_popup"];
}
- (void)reportBug
{
struct utsname systemInfo;
uname(&systemInfo);
NSString * machine = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
NSString * text = [NSString stringWithFormat:@"\n\n\n\n- %@ (%@)\n- maps.me %@", self.deviceNames[machine], [UIDevice currentDevice].systemVersion, [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]];
NSString * email = @"bugs@maps.me";
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController * vc = [MFMailComposeViewController new];
vc.mailComposeDelegate = self;
[vc setSubject:@"maps.me"];
[vc setToRecipients:@[email]];
[vc setMessageBody:text isHTML:NO];
[self presentViewController:vc animated:YES completion:nil];
}
else
{
#warning translation
NSString * text = [NSString stringWithFormat:@"!!!Почтовый клиент не настроен. Попробуйте написать нам другим способом на %@", email];
[[[UIAlertView alloc] initWithTitle:@"!!!Не настроена почта" message:text delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) otherButtonTitles:nil] show];
}
}
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
[self dismissViewControllerAnimated:YES completion:nil];
}
@end