mirror of
https://github.com/zydeco/minivmac4ios.git
synced 2024-11-25 07:32:30 +00:00
iOS 7 compatibility (disables some animations and disk image creation/renaming)
This commit is contained in:
parent
ce7552af33
commit
aae7b67945
@ -59,6 +59,7 @@
|
||||
28F6B4C11CF07F5C002D76D0 /* liblibmfs.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 28F6B4A81CF07EC9002D76D0 /* liblibmfs.a */; };
|
||||
28F6B4C21CF07F5C002D76D0 /* liblibres.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 28F6B4B61CF07F32002D76D0 /* liblibres.a */; };
|
||||
28F6B4CA1CF1FA7A002D76D0 /* about.plist in Resources */ = {isa = PBXBuildFile; fileRef = 28F6B4C91CF1FA7A002D76D0 /* about.plist */; };
|
||||
28F6B4CF1CF77099002D76D0 /* compat.m in Sources */ = {isa = PBXBuildFile; fileRef = 28F6B4CE1CF77099002D76D0 /* compat.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@ -206,6 +207,7 @@
|
||||
28F6B4A81CF07EC9002D76D0 /* liblibmfs.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liblibmfs.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
28F6B4B61CF07F32002D76D0 /* liblibres.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liblibres.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
28F6B4C91CF1FA7A002D76D0 /* about.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = about.plist; sourceTree = "<group>"; };
|
||||
28F6B4CE1CF77099002D76D0 /* compat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = compat.m; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -362,6 +364,7 @@
|
||||
28F6B4501CF07C48002D76D0 /* UIImage+DiskImageIcon.h */,
|
||||
28F6B4511CF07C48002D76D0 /* UIImage+DiskImageIcon.m */,
|
||||
28F6B4C91CF1FA7A002D76D0 /* about.plist */,
|
||||
28F6B4CE1CF77099002D76D0 /* compat.m */,
|
||||
);
|
||||
path = "Mini vMac";
|
||||
sourceTree = "<group>";
|
||||
@ -455,6 +458,7 @@
|
||||
28F676B91CD15E0B00FC6FA6 /* Sources */,
|
||||
28F676BA1CD15E0B00FC6FA6 /* Frameworks */,
|
||||
28F676BB1CD15E0B00FC6FA6 /* Resources */,
|
||||
28F6B4CD1CF76D88002D76D0 /* ShellScript */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@ -612,6 +616,7 @@
|
||||
28CE8EB81CD4C3B200FE25A8 /* M68KITAB.c in Sources */,
|
||||
28848B651CDE97E900B86C45 /* SettingsViewController.m in Sources */,
|
||||
28BA89881CE73FBC00A98104 /* MNVMApplication.m in Sources */,
|
||||
28F6B4CF1CF77099002D76D0 /* compat.m in Sources */,
|
||||
28F6B4521CF07C48002D76D0 /* UIImage+DiskImageIcon.m in Sources */,
|
||||
28CE8EB71CD4C3B200FE25A8 /* KBRDEMDV.c in Sources */,
|
||||
28CE8EBC1CD4C3B200FE25A8 /* ROMEMDEV.c in Sources */,
|
||||
@ -724,7 +729,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@ -763,7 +768,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
@ -779,6 +784,7 @@
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
HEADER_SEARCH_PATHS = "$(SRCROOT)";
|
||||
INFOPLIST_FILE = "Mini vMac/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
OTHER_CFLAGS = "-DUSE_LIBRES";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = net.namedfork.minivmac;
|
||||
@ -795,6 +801,7 @@
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
HEADER_SEARCH_PATHS = "$(SRCROOT)";
|
||||
INFOPLIST_FILE = "Mini vMac/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
OTHER_CFLAGS = "-DUSE_LIBRES";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = net.namedfork.minivmac;
|
||||
|
@ -90,10 +90,15 @@ NSString * const MNVMDidEjectDiskNotification = @"MNVMDidEjectDisk";
|
||||
});
|
||||
return;
|
||||
}
|
||||
if ([UIAlertController class]) {
|
||||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]];
|
||||
UIViewController *controller = self.window.rootViewController;
|
||||
[controller presentViewController:alert animated:YES completion:nil];
|
||||
} else {
|
||||
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
|
||||
[alertView show];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Settings / Insert Disk panels
|
||||
@ -150,7 +155,7 @@ NSString * const MNVMDidEjectDiskNotification = @"MNVMDidEjectDisk";
|
||||
UIViewController *viewController = [rootViewController.storyboard instantiateViewControllerWithIdentifier:name];
|
||||
viewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
|
||||
viewController.modalPresentationStyle = UIModalPresentationFormSheet;
|
||||
if ([sender isKindOfClass:[UISwipeGestureRecognizer class]]) {
|
||||
if ([sender isKindOfClass:[UISwipeGestureRecognizer class]] && [UIDevice currentDevice].systemVersion.integerValue >= 8) {
|
||||
modalPanePresentationDirection = [(UISwipeGestureRecognizer*)sender direction];
|
||||
viewController.transitioningDelegate = self;
|
||||
}
|
||||
|
@ -4,6 +4,51 @@
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeIconFiles</key>
|
||||
<array/>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Disk Image</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Owner</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>com.apple.disk-image</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeIconFiles</key>
|
||||
<array/>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Disk Copy 4.2 Disk Image</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Owner</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>com.apple.disk-image-dc42</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeIconFiles</key>
|
||||
<array/>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>ROM image</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Owner</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>net.namedfork.minivmac.rom</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
@ -15,11 +60,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.0</string>
|
||||
<string>2.0.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<string>2</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UIFileSharingEnabled</key>
|
||||
@ -114,50 +159,5 @@
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeIconFiles</key>
|
||||
<array/>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Disk Image</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Owner</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>com.apple.disk-image</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeIconFiles</key>
|
||||
<array/>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Disk Copy 4.2 Disk Image</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Owner</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>com.apple.disk-image-dc42</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeIconFiles</key>
|
||||
<array/>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>ROM image</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Owner</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>net.namedfork.minivmac.rom</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -104,7 +104,7 @@
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
switch (section) {
|
||||
case 0: return diskImages.count + (self.editing ? 1 : 0);
|
||||
case 0: return diskImages.count + (self.editing && [UIAlertController class] ? 1 : 0);
|
||||
case 1: return otherFiles.count;
|
||||
default: return 0;
|
||||
}
|
||||
@ -188,7 +188,12 @@
|
||||
|
||||
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (editingStyle == UITableViewCellEditingStyleDelete) {
|
||||
[self askDeleteFile:[self fileAtIndexPath:indexPath]];
|
||||
NSString *filePath = [self fileAtIndexPath:indexPath];
|
||||
if ([UIAlertController class]) {
|
||||
[self askDeleteFile:filePath];
|
||||
} else {
|
||||
[self deleteFile:filePath];
|
||||
}
|
||||
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
|
||||
[self createDiskImage];
|
||||
}
|
||||
@ -199,7 +204,7 @@
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender {
|
||||
return (action == @selector(share:) || action == @selector(rename:) || action == @selector(delete:));
|
||||
return (action == @selector(share:) || ([UIAlertController class] && (action == @selector(rename:) || action == @selector(delete:))));
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender {
|
||||
@ -217,11 +222,7 @@
|
||||
|
||||
#pragma mark - File Actions
|
||||
|
||||
- (void)askDeleteFile:(NSString*)filePath {
|
||||
NSString *fileName = filePath.lastPathComponent;
|
||||
NSString *message = [NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete %@? This operation cannot be undone.", nil), fileName];
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Delete File", nil) message:message preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Delete", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
|
||||
- (void)deleteFile:(NSString*)filePath {
|
||||
NSError *error = nil;
|
||||
if ([[NSFileManager defaultManager] removeItemAtPath:filePath error:&error]) {
|
||||
NSIndexPath *indexPath = [self indexPathForFile:filePath];
|
||||
@ -230,6 +231,14 @@
|
||||
} else {
|
||||
[[AppDelegate sharedInstance] showAlertWithTitle:NSLocalizedString(@"Could not delete file", nil) message:error.localizedDescription];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)askDeleteFile:(NSString*)filePath {
|
||||
NSString *fileName = filePath.lastPathComponent;
|
||||
NSString *message = [NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete %@? This operation cannot be undone.", nil), fileName];
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Delete File", nil) message:message preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Delete", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
|
||||
[self deleteFile:filePath];
|
||||
}]];
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil) style:UIAlertActionStyleCancel handler:nil]];
|
||||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
@ -451,9 +460,11 @@
|
||||
|
||||
- (void)share:(id)sender {
|
||||
UIActivityViewController *avc = [[UIActivityViewController alloc] initWithActivityItems:@[[NSURL fileURLWithPath:self.filePath]] applicationActivities:nil];
|
||||
if ([avc respondsToSelector:@selector(popoverPresentationController)]) {
|
||||
avc.modalPresentationStyle = UIModalPresentationPopover;
|
||||
avc.popoverPresentationController.sourceView = self.imageView;
|
||||
avc.popoverPresentationController.sourceRect = self.imageView.bounds;
|
||||
}
|
||||
[self.controller presentViewController:avc animated:YES completion:nil];
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@
|
||||
fontScale *= [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone ? 0.6 : 0.65;
|
||||
}
|
||||
key.label = label;
|
||||
key.titleLabel.font = [UIFont systemFontOfSize:fontSize * fontScale weight:UIFontWeightRegular];
|
||||
key.titleLabel.font = [UIFont systemFontOfSize:fontSize * fontScale weight:&UIFontWeightRegular ? UIFontWeightRegular : 1.0];
|
||||
[keyPlane addObject:key];
|
||||
}];
|
||||
return keyPlane;
|
||||
|
@ -1548,6 +1548,7 @@ LOCALPROC MacMsgDisplayOn() {
|
||||
if (SavedBriefMsg != nullpr) {
|
||||
NSString *title = NSStringCreateFromSubstCStr(SavedBriefMsg, falseblnr);
|
||||
NSString *message = NSStringCreateFromSubstCStr(SavedLongMsg, falseblnr);
|
||||
if ([UIAlertController class]) {
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
|
||||
blnr wasStopped = CurSpeedStopped;
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
||||
@ -1555,6 +1556,11 @@ LOCALPROC MacMsgDisplayOn() {
|
||||
}]];
|
||||
SetSpeedStopped(trueblnr);
|
||||
[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:alertController animated:YES completion:nil];
|
||||
} else {
|
||||
// fallback for iOS 7
|
||||
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
|
||||
[alertView show];
|
||||
}
|
||||
SavedBriefMsg = nullpr;
|
||||
SavedLongMsg = nullpr;
|
||||
}
|
||||
|
54
Mini vMac/compat.m
Normal file
54
Mini vMac/compat.m
Normal file
@ -0,0 +1,54 @@
|
||||
//
|
||||
// compat.m
|
||||
// Mini vMac
|
||||
//
|
||||
// Created by Jesús A. Álvarez on 26/05/2016.
|
||||
// Copyright © 2016 namedfork. All rights reserved.
|
||||
//
|
||||
|
||||
@import Foundation;
|
||||
@import UIKit;
|
||||
@import ObjectiveC.runtime;
|
||||
|
||||
@implementation NSObject (Compat)
|
||||
|
||||
/// Add newSelector if it doesn't exist, backed by originalSelector
|
||||
+ (void)_nfCompatAddInstanceMethod:(SEL)newSelector withCompatibilityMethod:(SEL)originalSelector {
|
||||
if (![self instancesRespondToSelector:newSelector]) {
|
||||
Method m = class_getInstanceMethod(self, originalSelector);
|
||||
class_addMethod(self, newSelector, method_getImplementation(m), method_getTypeEncoding(m));
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)_nfCompatAddClassMethod:(SEL)newSelector withCompatibilityMethod:(SEL)originalSelector {
|
||||
if (class_getClassMethod(self, newSelector) == NULL) {
|
||||
Method m = class_getClassMethod(self, originalSelector);
|
||||
class_addMethod(object_getClass(self), newSelector, method_getImplementation(m), method_getTypeEncoding(m));
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSString (Compat)
|
||||
|
||||
+ (void)load {
|
||||
[NSString _nfCompatAddInstanceMethod:@selector(containsString:) withCompatibilityMethod:@selector(_nfCompatContainsString:)];
|
||||
}
|
||||
|
||||
- (BOOL)_nfCompatContainsString:(NSString*)string {
|
||||
return [self rangeOfString:string].location != NSNotFound;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation UIFont (Compat)
|
||||
|
||||
+ (void)load {
|
||||
[UIFont _nfCompatAddClassMethod:@selector(systemFontOfSize:weight:) withCompatibilityMethod:@selector(_nfCompatSystemFontOfSize:weight:)];
|
||||
}
|
||||
|
||||
+ (UIFont *)_nfCompatSystemFontOfSize:(CGFloat)fontSize weight:(CGFloat)weight {
|
||||
return [self systemFontOfSize:fontSize];
|
||||
}
|
||||
|
||||
@end
|
Loading…
Reference in New Issue
Block a user