Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Spellbook.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1071,10 +1071,12 @@
PRODUCT_BUNDLE_IDENTIFIER = dnd.jon.Spellbook;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_OBJC_BRIDGING_HEADER = "SWRevealViewController/Spellbook-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
Expand All @@ -1100,9 +1102,11 @@
PRODUCT_BUNDLE_IDENTIFIER = dnd.jon.Spellbook;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_OBJC_BRIDGING_HEADER = "SWRevealViewController/Spellbook-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion Spellbook/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}

// Disable rotation
var orientationLock = UIInterfaceOrientationMask.portrait
private let orientationLock = oniPad ? UIInterfaceOrientationMask.allButUpsideDown : UIInterfaceOrientationMask.portrait
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return self.orientationLock
}
Expand Down
445 changes: 197 additions & 248 deletions Spellbook/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

87 changes: 24 additions & 63 deletions Spellbook/SideMenuController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class SideMenuController: UIViewController, UIPopoverPresentationControllerDeleg
@IBOutlet weak var updateInfoLabel: UILabel!
@IBOutlet weak var whatsNewButton: UIButton!
@IBOutlet weak var spellSlotsButton: UIButton!
@IBOutlet weak var scrollView: UIScrollView!
@IBOutlet weak var contentView: UIView!

var statusController: StatusFilterController?

Expand Down Expand Up @@ -61,69 +63,12 @@ class SideMenuController: UIViewController, UIPopoverPresentationControllerDeleg
viewHeight = viewRect.size.height
viewWidth = viewRect.size.width

// Set the dimensions for the background image
// No padding necessary for this
backgroundView.frame = CGRect(x: 0, y: -backgroundOffset, width: viewWidth, height: viewHeight + backgroundOffset)

//let headerHeight = CGFloat(0.1 * viewHeight)
//let statusFilterHeight = CGFloat(0.3 * viewHeight)
let headerHeight = CGFloat(57)
let statusFilterHeight = CGFloat(171)
let characterLabelHeight = CGFloat(20)
let exportSpellListLabelHeight = CGFloat(20)
let selectionButtonHeight = CGFloat(20)
let spellSlotsButtonHeight = CGFloat(20)
let belowFilterPadding = min(max(0.05 * SizeUtils.screenHeight, 25), 40)
let belowCharacterLabelPadding = CGFloat(14)
let belowExportSpellListLabelPadding = CGFloat(14)
let belowSelectionButtonPadding = CGFloat(20)
let belowSpellSlotsButtonPadding = CGFloat(23)
let notchTopPadding = CGFloat(35)
let updateInfoLabelHeight = CGFloat(20)
let belowUpdateInfoLabelPadding = CGFloat(14)
let whatsNewButtonHeight = CGFloat(20)

// Does the device have a notch or not?
let hasNotch = UIDevice.current.hasNotch

// Set up the view positioning
var currentY = CGFloat(topPadding)
if hasNotch {
currentY += notchTopPadding
}
sideMenuHeader.frame = CGRect(x: leftPadding, y: currentY, width: viewWidth, height: headerHeight)

currentY += (headerHeight + tablePadding)
statusFilterView.frame = CGRect(x: leftPadding, y: currentY, width: viewWidth - leftPadding, height: statusFilterHeight + belowFilterPadding)

currentY += (statusFilterHeight + belowFilterPadding)
characterLabel.frame = CGRect(x: leftPadding, y: currentY, width: viewWidth - leftPadding, height: characterLabelHeight)

currentY += characterLabelHeight + belowCharacterLabelPadding
selectionButton.frame = CGRect(x: leftPadding, y: currentY, width: viewWidth - leftPadding, height: selectionButtonHeight)

currentY += exportSpellListLabelHeight + belowExportSpellListLabelPadding
exportSpellListButton.frame = CGRect(x: leftPadding, y: currentY, width: viewWidth - leftPadding, height: exportSpellListLabelHeight)

currentY += spellSlotsButtonHeight + belowSelectionButtonPadding
spellSlotsButton.frame = CGRect(x: leftPadding, y: currentY, width: viewWidth - leftPadding, height: spellSlotsButtonHeight)

currentY += selectionButtonHeight + belowSpellSlotsButtonPadding
updateInfoLabel.frame = CGRect(x: leftPadding, y: currentY, width: viewWidth - leftPadding, height: updateInfoLabelHeight)

currentY += updateInfoLabelHeight + belowUpdateInfoLabelPadding
whatsNewButton.frame = CGRect(x: leftPadding, y: currentY, width: viewWidth - leftPadding, height: whatsNewButtonHeight)
characterLabel.textColor = defaultFontColor

selectionButton.addTarget(self, action: #selector(selectionButtonPressed), for: UIControl.Event.touchUpInside)

exportSpellListButton.addTarget(self, action: #selector(exportSpellListButtonPressed), for: UIControl.Event.touchUpInside)

whatsNewButton.addTarget(self, action: #selector(updateInfoButtonPressed), for: UIControl.Event.touchUpInside)

spellSlotsButton.addTarget(self, action: #selector(spellSlotsButtonPressed), for: UIControl.Event.touchUpInside)

characterLabel.textColor = defaultFontColor

}

override func viewWillAppear(_ animated: Bool) {
Expand All @@ -132,7 +77,7 @@ class SideMenuController: UIViewController, UIPopoverPresentationControllerDeleg
$0.select { $0.profile?.name }
}
}

override func viewDidAppear(_ animated: Bool) {

// Set the character label
Expand All @@ -141,7 +86,24 @@ class SideMenuController: UIViewController, UIPopoverPresentationControllerDeleg
characterLabel.text = "Character: " + name!
}
}


func setScrollViewSize() {
if let content = contentView, let scroll = scrollView {
// The content size of the scroll view is equal to the content view's size
scroll.contentSize = content.frame.size

}
}

override func viewWillTransition(to size: CGSize,
with coordinator: UIViewControllerTransitionCoordinator) {
setScrollViewSize()
}

override func viewDidLayoutSubviews() {
setScrollViewSize()
}

// Connecting to the child controllers
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "statusSegue" {
Expand All @@ -158,16 +120,15 @@ class SideMenuController: UIViewController, UIPopoverPresentationControllerDeleg
//
// }
}

func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
return UIModalPresentationStyle.none
}

@objc func selectionButtonPressed() {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let controller = storyboard.instantiateViewController(withIdentifier: "characterSelection") as! CharacterSelectionController


let popupHeight = 0.5 * SizeUtils.screenHeight
let popupWidth = 0.75 * SizeUtils.screenWidth
let maxPopupHeight = CGFloat(320)
Expand Down
Loading