[ios] Mail and message controllers presentation fix

This commit is contained in:
Igor Khmurets 2014-07-22 12:04:03 +03:00 committed by Alex Zolotarev
parent 34b1367ed9
commit b45f7cf7ea
9 changed files with 21 additions and 77 deletions

View file

@ -1,8 +1,7 @@
#import <UIKit/UIKit.h>
#import "MailComposeViewController.h"
#import "LocationManager.h"
@interface BookmarksVC : UITableViewController <LocationObserver, UITextFieldDelegate, MFMailComposeViewControllerDelegate>
@interface BookmarksVC : UITableViewController <LocationObserver, UITextFieldDelegate>
{
LocationManager * m_locationManager;
size_t m_categoryIndex;

View file

@ -7,7 +7,7 @@
#import "CircleView.h"
#import "ColorPickerView.h"
#import "UIKitCategories.h"
#import "MailComposeViewController.h"
#import <MessageUI/MFMailComposeViewController.h>
#include "Framework.h"
@ -23,7 +23,7 @@
#define EMPTY_SECTION -666
@interface BookmarksVC()
@interface BookmarksVC() <MFMailComposeViewControllerDelegate>
{
int m_trackSection;
int m_bookmarkSection;
@ -276,7 +276,7 @@
}
}
- (void)mailComposeController:(MailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
[self dismissModalViewControllerAnimated:YES];
[[Statistics instance] logEvent:@"KML Export"];
@ -422,7 +422,7 @@
- (void)sendBookmarksWithExtension:(NSString *)fileExtension andType:(NSString *)mimeType andFile:(NSString *)filePath andCategory:(NSString *)catName
{
MailComposeViewController * mailVC = [[MailComposeViewController alloc] init];
MFMailComposeViewController * mailVC = [[MFMailComposeViewController alloc] init];
mailVC.mailComposeDelegate = self;
[mailVC setSubject:NSLocalizedString(@"share_bookmarks_email_subject", nil)];
NSData * myData = [[NSData alloc] initWithContentsOfFile:filePath];
@ -443,7 +443,7 @@
m_bookmarkSection = index++;
else
m_bookmarkSection = EMPTY_SECTION;
if ([MailComposeViewController canSendMail])
if ([MFMailComposeViewController canSendMail])
m_shareSection = index++;
else
m_shareSection = EMPTY_SECTION;

View file

@ -1,6 +0,0 @@
#import <MessageUI/MessageUI.h>
@interface MailComposeViewController : MFMailComposeViewController
@end

View file

@ -1,15 +0,0 @@
#import "MailComposeViewController.h"
#import "UIKitCategories.h"
@implementation MailComposeViewController
- (void)viewDidLoad
{
[super viewDidLoad];
if (!SYSTEM_VERSION_IS_LESS_THAN(@"7"))
self.navigationBar.tintColor = [UIColor whiteColor];
}
@end

View file

@ -262,18 +262,21 @@ void InitLocalizedStrings()
NSMutableDictionary * attributes = [[NSMutableDictionary alloc] init];
attributes[UITextAttributeTextColor] = [UIColor whiteColor];
attributes[UITextAttributeTextShadowColor] = [UIColor clearColor];
[[UINavigationBar appearance] setTintColor:[UIColor colorWithColorCode:@"15c584"]];
[[UINavigationBar appearanceWhenContainedIn:[NavigationController class], nil] setTintColor:[UIColor colorWithColorCode:@"15c584"]];
if (!SYSTEM_VERSION_IS_LESS_THAN(@"7"))
{
[[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];
[[UIBarButtonItem appearance] setTitleTextAttributes:attributes forState:UIControlStateNormal];
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"NavigationBarBackground7"] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearanceWhenContainedIn:[NavigationController class], nil] setBackgroundImage:[UIImage imageNamed:@"NavigationBarBackground7"] forBarMetrics:UIBarMetricsDefault];
attributes[UITextAttributeFont] = [UIFont fontWithName:@"HelveticaNeue" size:17.5];
}
if ([UINavigationBar instancesRespondToSelector:@selector(setShadowImage:)])
[[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];
[[UINavigationBar appearance] setTitleTextAttributes:attributes];
[[UINavigationBar appearanceWhenContainedIn:[NavigationController class], nil] setShadowImage:[[UIImage alloc] init]];
[[UINavigationBar appearanceWhenContainedIn:[NavigationController class], nil] setTitleTextAttributes:attributes];
}
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification

View file

@ -1,6 +0,0 @@
#import <MessageUI/MessageUI.h>
@interface MessageComposeViewController : MFMessageComposeViewController
@end

View file

@ -1,15 +0,0 @@
#import "MessageComposeViewController.h"
#import "UIKitCategories.h"
@implementation MessageComposeViewController
- (void)viewDidLoad
{
[super viewDidLoad];
if (!SYSTEM_VERSION_IS_LESS_THAN(@"7"))
self.navigationBar.tintColor = [UIColor whiteColor];
}
@end

View file

@ -1,7 +1,7 @@
#import "ShareActionSheet.h"
#import "Framework.h"
#import "MessageComposeViewController.h"
#import "MailComposeViewController.h"
#import <MessageUI/MFMessageComposeViewController.h>
#import <MessageUI/MFMailComposeViewController.h>
#import "Statistics.h"
#include "../../search/result.hpp"
@ -45,9 +45,9 @@
{
UIActionSheet * as = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"share", nil) delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
if ([MessageComposeViewController canSendText])
if ([MFMessageComposeViewController canSendText])
[as addButtonWithTitle:NSLocalizedString(@"message", nil)];
if ([MailComposeViewController canSendMail] || [self canUseGmailApp])
if ([MFMailComposeViewController canSendMail] || [self canUseGmailApp])
[as addButtonWithTitle:NSLocalizedString(@"email", nil)];
[as addButtonWithTitle:NSLocalizedString(@"copy_link", nil)];
[as addButtonWithTitle:NSLocalizedString(@"cancel", nil)];
@ -96,9 +96,9 @@
subject = NSLocalizedString(@"bookmark_share_email_subject", nil);
}
if ([MailComposeViewController canSendMail])
if ([MFMailComposeViewController canSendMail])
{
MailComposeViewController * mailVC = [[MailComposeViewController alloc] init];
MFMailComposeViewController * mailVC = [[MFMailComposeViewController alloc] init];
[mailVC setMessageBody:body isHTML:NO];
[mailVC setSubject:subject];
mailVC.mailComposeDelegate = self;
@ -116,7 +116,7 @@
- (void)sendMessageWithUrl:(NSString *)shortUrl
{
NSString * httpGe0Url = [shortUrl stringByReplacingCharactersInRange:NSMakeRange(0, 6) withString:@"http://ge0.me/"];
MessageComposeViewController * messageVC = [[MessageComposeViewController alloc] init];
MFMessageComposeViewController * messageVC = [[MFMessageComposeViewController alloc] init];
if (self.info.myPosition)
[messageVC setBody:[NSString stringWithFormat:NSLocalizedString(@"my_position_share_sms", nil), shortUrl, httpGe0Url]];
else

View file

@ -26,8 +26,6 @@
97354B66196AF97200352536 /* PlacePageRoutingCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97354B64196AF97200352536 /* PlacePageRoutingCell.m */; };
97354B6E196EDD3A00352536 /* AccountManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 97354B6D196EDD3A00352536 /* AccountManager.m */; };
97354B6F196EDD3F00352536 /* AccountManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 97354B6D196EDD3A00352536 /* AccountManager.m */; };
97387546184E475000170BC4 /* MessageComposeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 97387545184E475000170BC4 /* MessageComposeViewController.m */; };
97387547184E475000170BC4 /* MessageComposeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 97387545184E475000170BC4 /* MessageComposeViewController.m */; };
974386D91934CBAC00FD5659 /* FacebookSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 974386D81934CBAC00FD5659 /* FacebookSDK.framework */; };
974386DA1934CBAD00FD5659 /* FacebookSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 974386D81934CBAC00FD5659 /* FacebookSDK.framework */; };
974386DD19373EA400FD5659 /* ToastView.m in Sources */ = {isa = PBXBuildFile; fileRef = 974386DC19373EA400FD5659 /* ToastView.m */; };
@ -112,8 +110,6 @@
97D40C08184CFA4100A1D572 /* ImagesPro.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97D40C07184CFA4100A1D572 /* ImagesPro.xcassets */; };
97D40C0A184D031900A1D572 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97D40C09184D031900A1D572 /* Images.xcassets */; };
97D40C0B184D031900A1D572 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97D40C09184D031900A1D572 /* Images.xcassets */; };
97D40C0E184E389000A1D572 /* MailComposeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 97D40C0D184E389000A1D572 /* MailComposeViewController.m */; };
97D40C0F184E389000A1D572 /* MailComposeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 97D40C0D184E389000A1D572 /* MailComposeViewController.m */; };
97D807B818A92AAB00D416E0 /* MoreAppsVC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97D807B718A92AAB00D416E0 /* MoreAppsVC.mm */; };
97D807B918A92AAB00D416E0 /* MoreAppsVC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97D807B718A92AAB00D416E0 /* MoreAppsVC.mm */; };
97D807BC18A933FB00D416E0 /* MoreAppsCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97D807BB18A933FB00D416E0 /* MoreAppsCell.m */; };
@ -1363,8 +1359,6 @@
97354B64196AF97200352536 /* PlacePageRoutingCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PlacePageRoutingCell.m; sourceTree = "<group>"; };
97354B6C196EDD3A00352536 /* AccountManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccountManager.h; sourceTree = "<group>"; };
97354B6D196EDD3A00352536 /* AccountManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AccountManager.m; sourceTree = "<group>"; };
97387544184E475000170BC4 /* MessageComposeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageComposeViewController.h; sourceTree = "<group>"; };
97387545184E475000170BC4 /* MessageComposeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageComposeViewController.m; sourceTree = "<group>"; };
974386D81934CBAC00FD5659 /* FacebookSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = FacebookSDK.framework; sourceTree = "<group>"; };
974386DB19373EA400FD5659 /* ToastView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ToastView.h; sourceTree = "<group>"; };
974386DC19373EA400FD5659 /* ToastView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ToastView.m; sourceTree = "<group>"; };
@ -1443,8 +1437,6 @@
97D40C04184CF5F100A1D572 /* ImagesLite.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = ImagesLite.xcassets; sourceTree = SOURCE_ROOT; };
97D40C07184CFA4100A1D572 /* ImagesPro.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = ImagesPro.xcassets; sourceTree = SOURCE_ROOT; };
97D40C09184D031900A1D572 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = SOURCE_ROOT; };
97D40C0C184E389000A1D572 /* MailComposeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = MailComposeViewController.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
97D40C0D184E389000A1D572 /* MailComposeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MailComposeViewController.m; sourceTree = "<group>"; };
97D807B618A92AAB00D416E0 /* MoreAppsVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MoreAppsVC.h; sourceTree = "<group>"; };
97D807B718A92AAB00D416E0 /* MoreAppsVC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MoreAppsVC.mm; sourceTree = "<group>"; };
97D807BA18A933FB00D416E0 /* MoreAppsCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MoreAppsCell.h; sourceTree = "<group>"; };
@ -2224,10 +2216,6 @@
974D041C1977DE430081D0A7 /* LocalNotificationManager.h */,
978F9251183BD530000D6C7C /* NavigationController.h */,
978F9252183BD530000D6C7C /* NavigationController.mm */,
97D40C0C184E389000A1D572 /* MailComposeViewController.h */,
97D40C0D184E389000A1D572 /* MailComposeViewController.m */,
97387544184E475000170BC4 /* MessageComposeViewController.h */,
97387545184E475000170BC4 /* MessageComposeViewController.m */,
EE7F297C1219ECA300EB67A9 /* RenderBuffer.hpp */,
EE7F297D1219ECA300EB67A9 /* RenderBuffer.mm */,
EE16192B126E374500622BD0 /* RenderContext.hpp */,
@ -4502,7 +4490,6 @@
F785EB4016386FC4003A38A8 /* BookmarkCell.mm in Sources */,
9789DB56188D5E2A007C6FAE /* InAppMessagesManager.mm in Sources */,
9778E99D191A5B6600AD850A /* BookmarkDescriptionVC.mm in Sources */,
97387546184E475000170BC4 /* MessageComposeViewController.m in Sources */,
974D041D1977DE430081D0A7 /* LocalNotificationManager.mm in Sources */,
97354B6E196EDD3A00352536 /* AccountManager.m in Sources */,
97C98522186AE3CF00AF7E9E /* AppInfo.mm in Sources */,
@ -4517,7 +4504,6 @@
EDC5C543175F2CA600420E92 /* ShareActionSheet.mm in Sources */,
9778E9A1191A663700AD850A /* BookmarkNameVC.mm in Sources */,
ED48BBB517C267F5003E7E92 /* ColorPickerView.mm in Sources */,
97D40C0E184E389000A1D572 /* MailComposeViewController.m in Sources */,
ED48BBBA17C2B1E2003E7E92 /* CircleView.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -4571,7 +4557,6 @@
FAAEA7D6161D8D3100CCD661 /* BookmarksRootVC.mm in Sources */,
97D092B6190A6E1D00FF645B /* PlacePageEditCell.mm in Sources */,
F785EB4116386FC4003A38A8 /* BookmarkCell.mm in Sources */,
97387547184E475000170BC4 /* MessageComposeViewController.m in Sources */,
97C98523186AE3CF00AF7E9E /* AppInfo.mm in Sources */,
978F9243183B660F000D6C7C /* SelectableCell.m in Sources */,
974D041E1977DE430081D0A7 /* LocalNotificationManager.mm in Sources */,
@ -4588,7 +4573,6 @@
ED48BBBB17C2B1E2003E7E92 /* CircleView.mm in Sources */,
97D092B2190A681F00FF645B /* PlacePageInfoCell.mm in Sources */,
9746492818EEE2F8004B4658 /* ToolbarView.m in Sources */,
97D40C0F184E389000A1D572 /* MailComposeViewController.m in Sources */,
ED48BBC417C3B3BF003E7E92 /* ColorPickerView.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;