Skip to content

Commit

Permalink
changed alertView to alertController
Browse files Browse the repository at this point in the history
added recommended graphic for older devices
  • Loading branch information
mgmart committed Dec 17, 2016
1 parent a8fa2f0 commit 3be2fe1
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 43 deletions.
1 change: 0 additions & 1 deletion Classes/Outline/DetailsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ - (void)viewDidLoad {

segmented = [[UISegmentedControl alloc] initWithItems:buttons];
segmented.frame = CGRectMake(0, 0, 110, 30);
segmented.segmentedControlStyle = UISegmentedControlStyleBar;
segmented.momentary = YES;
[segmented addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];

Expand Down
67 changes: 27 additions & 40 deletions Classes/Sync/SyncManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -755,14 +755,7 @@ - (void)transferFailed:(TransferContext*)context {
if ([context statusCode] == 404) {
[self uploadEmptyEditsFile];
} else {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Error syncing changes"
message:[NSString stringWithFormat:@"An error was encountered while attempting to fetch mobileorg.org from the server. The error was:\n\n%@", [context errorText]]
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil];
[alert show];
[alert autorelease];
[self showAlert:@"Error syncing changes" withText:[NSString stringWithFormat:@"An error was encountered while attempting to fetch mobileorg.org from the server. The error was:\n\n%@", [context errorText]]];

[self abort];
}
Expand All @@ -771,14 +764,7 @@ - (void)transferFailed:(TransferContext*)context {
case SyncManagerTransferStateUploadingEmptyEditsFile:
{
// Abort.. we tried to make the mobileorg.org file and couldn't
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Error creating mobileorg.org"
message:[NSString stringWithFormat:@"An error was encountered while attempting to create mobileorg.org on the server. The error was:\n\n%@", [context errorText]]
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil];
[alert show];
[alert autorelease];
[self showAlert:@"Error creating mobileorg.org" withText:[NSString stringWithFormat:@"An error was encountered while attempting to create mobileorg.org on the server. The error was:\n\n%@", [context errorText]]];

[self abort];

Expand All @@ -788,14 +774,7 @@ - (void)transferFailed:(TransferContext*)context {
case SyncManagerTransferStateUploadingLocalChanges:
{
// Abort.. we couldn't upload local changes
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Error uploading mobileorg.org"
message:[NSString stringWithFormat:@"An error was encountered while attempting to upload mobileorg.org to the server. The error was:\n\n%@", [context errorText]]
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil];
[alert show];
[alert autorelease];
[self showAlert:@"Error uploading mobileorg.org" withText:[NSString stringWithFormat:@"An error was encountered while attempting to upload mobileorg.org to the server. The error was:\n\n%@", [context errorText]]];

[self abort];

Expand All @@ -810,14 +789,7 @@ - (void)transferFailed:(TransferContext*)context {
} else {
DeleteFile([context localFile]);

UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Error downloading checksums"
message:[NSString stringWithFormat:@"An error was encountered while downloading checksums.dat from the server. This file isn't required, but the error received was unusual. The error was:\n\n%@", [context errorText]]
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil];
[alert show];
[alert autorelease];
[self showAlert:@"Error downloading checksums" withText:[NSString stringWithFormat:@"An error was encountered while downloading checksums.dat from the server. This file isn't required, but the error received was unusual. The error was:\n\n%@", [context errorText]]];

[self abort];
}
Expand All @@ -827,14 +799,7 @@ - (void)transferFailed:(TransferContext*)context {
// Only abort if we were downloading the index org file
if ([[context.remoteUrl absoluteString] isEqualToString:[[[Settings instance] indexUrl] absoluteString]]) {

UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Error downloading Org-file"
message:[NSString stringWithFormat:@"An error was encountered while attempting to download %@ from the server. The error was:\n\n%@", [[context remoteUrl] path], [context errorText]]
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil];
[alert show];
[alert autorelease];
[self showAlert:@"Error downloading Org-file" withText:[NSString stringWithFormat:@"An error was encountered while attempting to download %@ from the server. The error was:\n\n%@", [[context remoteUrl] path], [context errorText]]];

[self abort];

Expand All @@ -859,6 +824,28 @@ - (void)updateStatus {
[[StatusViewController instance] progressBar].hidden = YES;
}
[[StatusViewController instance] setActionMessage:transferFilename];
}


- (void) showAlert:(NSString*)alertTitle withText:(NSString*)alertMessage {

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:alertTitle message:alertMessage preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
[alertController addAction:ok];


id rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
if([rootViewController isKindOfClass:[UINavigationController class]])
{
rootViewController = ((UINavigationController *)rootViewController).viewControllers.firstObject;
}
if([rootViewController isKindOfClass:[UITabBarController class]])
{
rootViewController = ((UITabBarController *)rootViewController).selectedViewController;
}
[rootViewController presentViewController:alertController animated:YES completion:nil];


}

- (void)dealloc {
Expand Down
Binary file added [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion MobileOrg.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
747BF9811DFCBC3F00E800FB /* libicucore.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 747BF9801DFCBC3F00E800FB /* libicucore.tbd */; };
747BF98A1DFD5CD900E800FB /* AppKey.plist in Resources */ = {isa = PBXBuildFile; fileRef = 747BF9881DFD5CD900E800FB /* AppKey.plist */; };
747BF9A31DFD738E00E800FB /* NodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 747BF9A21DFD738E00E800FB /* NodeTests.m */; };
749CCE3D1E05A8A600DE4648 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 749CCE3C1E05A8A600DE4648 /* [email protected] */; };
749CCE3F1E05ABC200DE4648 /* UIAlertViewController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 749CCE3E1E05ABC200DE4648 /* UIAlertViewController+Extension.swift */; };
790B413F10814D8400A852F1 /* ActionMenuController.m in Sources */ = {isa = PBXBuildFile; fileRef = 790B413E10814D8400A852F1 /* ActionMenuController.m */; };
790B417E10814FAC00A852F1 /* OutlineTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 790B417D10814FAC00A852F1 /* OutlineTableView.m */; };
790B455610826A0900A852F1 /* PriorityEditController.m in Sources */ = {isa = PBXBuildFile; fileRef = 790B455510826A0900A852F1 /* PriorityEditController.m */; };
Expand Down Expand Up @@ -162,6 +164,8 @@
747BF9971DFD719400E800FB /* MobileOrgTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MobileOrgTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
747BF99B1DFD719400E800FB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
747BF9A21DFD738E00E800FB /* NodeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NodeTests.m; sourceTree = "<group>"; };
749CCE3C1E05A8A600DE4648 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
749CCE3E1E05ABC200DE4648 /* UIAlertViewController+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIAlertViewController+Extension.swift"; path = "Classes/Extensions/UIAlertViewController+Extension.swift"; sourceTree = "<group>"; };
790B413D10814D8400A852F1 /* ActionMenuController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActionMenuController.h; sourceTree = "<group>"; };
790B413E10814D8400A852F1 /* ActionMenuController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ActionMenuController.m; sourceTree = "<group>"; };
790B417C10814FAC00A852F1 /* OutlineTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OutlineTableView.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -335,6 +339,7 @@
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
isa = PBXGroup;
children = (
749CCE3C1E05A8A600DE4648 /* [email protected] */,
74F666231E03D7FA00F1864C /* Foundation+Extension */,
747BF98B1DFD5CF500E800FB /* Configuration */,
79BA55581073A6F800D67917 /* Classes */,
Expand Down Expand Up @@ -429,6 +434,7 @@
74F666231E03D7FA00F1864C /* Foundation+Extension */ = {
isa = PBXGroup;
children = (
749CCE3E1E05ABC200DE4648 /* UIAlertViewController+Extension.swift */,
746102FC1DFF0EDB00C8E34F /* String+RegexSplitter.swift */,
);
name = "Foundation+Extension";
Expand Down Expand Up @@ -746,7 +752,7 @@
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0810;
LastUpgradeCheck = 0820;
TargetAttributes = {
1D6058900D05DD3D006BFB54 = {
DevelopmentTeam = 9VWR9JYXC6;
Expand Down Expand Up @@ -837,6 +843,7 @@
7461031E1E0189F100C8E34F /* Icon-debug-72.png in Resources */,
8322ED88176AF1C7008B37C7 /* [email protected] in Resources */,
7461031C1E0189F100C8E34F /* Icon-72.png in Resources */,
749CCE3D1E05A8A600DE4648 /* [email protected] in Resources */,
8322ED89176AF1C7008B37C7 /* [email protected] in Resources */,
8322ED8A176AF1C7008B37C7 /* [email protected] in Resources */,
8322ED8B176AF1C7008B37C7 /* [email protected] in Resources */,
Expand Down Expand Up @@ -923,6 +930,7 @@
files = (
1D60589B0D05DD56006BFB54 /* main.m in Sources */,
28C3AD8A0F43EF2300507BA6 /* MobileOrg.xcdatamodel in Sources */,
749CCE3F1E05ABC200DE4648 /* UIAlertViewController+Extension.swift in Sources */,
79BA55621073A6F800D67917 /* MobileOrgAppDelegate.m in Sources */,
7982F3621073F2FA00AEA6BC /* Node.m in Sources */,
7982F3631073F2FA00AEA6BC /* Note.m in Sources */,
Expand Down Expand Up @@ -988,6 +996,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 8B262305779E2631EE21FE20 /* Pods-MobileOrg.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-2";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -1195,6 +1204,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 8202E5BD58AEDFCB8A890758 /* Pods-MobileOrg.adhoc.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-2";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -1257,6 +1267,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 6561B399A841A3A5958A5889 /* Pods-MobileOrg.appstore.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-2";
CLANG_ENABLE_MODULES = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0810"
LastUpgradeVersion = "0820"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down

0 comments on commit 3be2fe1

Please sign in to comment.