Skip to content

Commit bcc3eb1

Browse files
committed
fix status label on latest iOS version + update build
1 parent 1ba53e8 commit bcc3eb1

4 files changed

Lines changed: 56 additions & 10 deletions

File tree

Hadge.xcodeproj/project.pbxproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,9 @@
279279
4DB3F66C2453F7AC004C8BF3 /* Project object */ = {
280280
isa = PBXProject;
281281
attributes = {
282+
BuildIndependentTargetsInParallel = YES;
282283
LastSwiftUpdateCheck = 1140;
283-
LastUpgradeCheck = 1230;
284+
LastUpgradeCheck = 2630;
284285
ORGANIZATIONNAME = Entire;
285286
TargetAttributes = {
286287
4DB3F6732453F7AC004C8BF3 = {
@@ -488,6 +489,7 @@
488489
MTL_FAST_MATH = YES;
489490
ONLY_ACTIVE_ARCH = YES;
490491
SDKROOT = iphoneos;
492+
STRING_CATALOG_GENERATE_SYMBOLS = YES;
491493
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
492494
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
493495
};
@@ -542,7 +544,9 @@
542544
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
543545
MTL_ENABLE_DEBUG_INFO = NO;
544546
MTL_FAST_MATH = YES;
547+
ONLY_ACTIVE_ARCH = YES;
545548
SDKROOT = iphoneos;
549+
STRING_CATALOG_GENERATE_SYMBOLS = YES;
546550
SWIFT_COMPILATION_MODE = wholemodule;
547551
SWIFT_OPTIMIZATION_LEVEL = "-O";
548552
VALIDATE_PRODUCT = YES;
@@ -565,6 +569,7 @@
565569
);
566570
PRODUCT_BUNDLE_IDENTIFIER = "$(ORGANIZATION_IDENTIFIER).hadge";
567571
PRODUCT_NAME = "$(TARGET_NAME)";
572+
SWIFT_ENABLE_EXPLICIT_MODULES = NO;
568573
SWIFT_VERSION = 5.0;
569574
TARGETED_DEVICE_FAMILY = 1;
570575
};
@@ -586,6 +591,7 @@
586591
);
587592
PRODUCT_BUNDLE_IDENTIFIER = "$(ORGANIZATION_IDENTIFIER).hadge";
588593
PRODUCT_NAME = "$(TARGET_NAME)";
594+
SWIFT_ENABLE_EXPLICIT_MODULES = NO;
589595
SWIFT_VERSION = 5.0;
590596
TARGETED_DEVICE_FAMILY = 1;
591597
};

Hadge.xcodeproj/xcshareddata/xcschemes/Hadge.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1310"
3+
LastUpgradeVersion = "2630"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Hadge/Controllers/WorkoutViewController.swift

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ class WorkoutViewController: EntireTableViewController {
133133
saveState()
134134
updateButtonState()
135135
updateStatus(string: "Export finished.")
136-
clearStatusAfterDelay()
137136

138137
exportSemaphore = false
139138
completionHandler()
@@ -257,27 +256,46 @@ class WorkoutViewController: EntireTableViewController {
257256
}
258257

259258
func loadStatusView() {
260-
statusLabel = UILabel(frame: CGRect.init(x: 0, y: 0, width: 200, height: 34))
259+
statusLabel = PaddingLabel()
261260
statusLabel?.text = ""
262261
statusLabel?.textAlignment = NSTextAlignment.center
263262
statusLabel?.textColor = UIColor.secondaryLabel
264263
statusLabel?.font = UIFont.preferredFont(forTextStyle: .footnote)
265264
statusLabel?.lineBreakMode = .byWordWrapping
266265
statusLabel?.numberOfLines = 2
266+
statusLabel?.preferredMaxLayoutWidth = 250
267+
268+
let statusContainer = UIView()
269+
statusContainer.translatesAutoresizingMaskIntoConstraints = false
270+
statusContainer.addSubview(statusLabel!)
271+
272+
NSLayoutConstraint.activate([
273+
statusLabel!.leadingAnchor.constraint(equalTo: statusContainer.leadingAnchor, constant: 8),
274+
statusLabel!.trailingAnchor.constraint(equalTo: statusContainer.trailingAnchor, constant: -8),
275+
statusLabel!.topAnchor.constraint(equalTo: statusContainer.topAnchor),
276+
statusLabel!.bottomAnchor.constraint(equalTo: statusContainer.bottomAnchor)
277+
])
278+
279+
let widthConstraint = statusContainer.widthAnchor.constraint(equalToConstant: 200)
280+
widthConstraint.priority = .defaultLow
281+
widthConstraint.isActive = true
267282

268283
let statusItem = UIBarButtonItem(customView: statusLabel!)
284+
statusItem.customView?.setContentHuggingPriority(.defaultLow, for: .horizontal)
285+
statusItem.customView?.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
269286
exportButton = UIBarButtonItem(image: UIImage(systemName: "plus.app"), style: .plain, target: self, action: #selector(export(sender:)))
270287
exportButton?.tintColor = UIColor.secondaryLabel
288+
271289
let leftSpaceItem = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
272290
let rightSpaceItem = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
291+
273292
self.toolbarItems = [leftSpaceItem, statusItem, rightSpaceItem, exportButton]
274293

275294
updateButtonState()
276295

277296
if let exported = self.state["exported"] as? Bool, exported == true {
278297
} else {
279298
updateStatus(string: "Tap the ﹢ button to export this workout's samples to your repo.")
280-
clearStatusAfterDelay()
281299
}
282300

283301
}

Hadge/Controllers/WorkoutsViewController.swift

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class WorkoutsViewController: EntireTableViewController {
137137
if lastSyncDate != nil && data.count > 0 {
138138
updateStatusLabel("GitHub last updated on\n\(formatter.string(from: lastSyncDate!)).")
139139
} else {
140-
updateStatusLabel("")
140+
updateStatusLabel("No update yet.")
141141
}
142142
}
143143

@@ -207,21 +207,43 @@ class WorkoutsViewController: EntireTableViewController {
207207
}
208208

209209
func loadStatusView() {
210-
statusLabel = UILabel(frame: CGRect.init(x: 0, y: 0, width: 200, height: 34))
211-
statusLabel?.text = ""
212-
statusLabel?.textAlignment = NSTextAlignment.center
210+
statusLabel = PaddingLabel()
211+
statusLabel?.translatesAutoresizingMaskIntoConstraints = false
212+
statusLabel?.text = "No update yet."
213+
statusLabel?.textAlignment = .center
213214
statusLabel?.textColor = UIColor.secondaryLabel
214215
statusLabel?.font = UIFont.preferredFont(forTextStyle: .footnote)
215216
statusLabel?.lineBreakMode = .byWordWrapping
216217
statusLabel?.numberOfLines = 2
218+
statusLabel?.preferredMaxLayoutWidth = 300
219+
220+
let statusContainer = UIView()
221+
statusContainer.translatesAutoresizingMaskIntoConstraints = false
222+
statusContainer.addSubview(statusLabel!)
223+
224+
NSLayoutConstraint.activate([
225+
statusLabel!.leadingAnchor.constraint(equalTo: statusContainer.leadingAnchor, constant: 8),
226+
statusLabel!.trailingAnchor.constraint(equalTo: statusContainer.trailingAnchor, constant: -8),
227+
statusLabel!.topAnchor.constraint(equalTo: statusContainer.topAnchor),
228+
statusLabel!.bottomAnchor.constraint(equalTo: statusContainer.bottomAnchor)
229+
])
230+
231+
let widthConstraint = statusContainer.widthAnchor.constraint(equalToConstant: 200)
232+
widthConstraint.priority = .defaultLow
233+
widthConstraint.isActive = true
234+
235+
let statusItem = UIBarButtonItem(customView: statusContainer)
236+
statusItem.customView?.setContentHuggingPriority(.defaultLow, for: .horizontal)
237+
statusItem.customView?.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
217238

218-
let statusItem = UIBarButtonItem(customView: statusLabel!)
219239
filterButton = UIBarButtonItem(image: UIImage(systemName: "line.horizontal.3.decrease.circle"), style: .plain, target: self, action: #selector(showFilter(sender:)))
220240
filterButton?.tintColor = (self.filter.isEmpty ? UIColor.secondaryLabel : UIColor.systemBlue)
221241
let rightButtonItem = UIBarButtonItem(image: UIImage(systemName: "safari"), style: .plain, target: self, action: #selector(openSafari(sender:)))
222242
rightButtonItem.tintColor = UIColor.secondaryLabel
243+
223244
let leftSpaceItem = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
224245
let rightSpaceItem = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
246+
225247
self.toolbarItems = [filterButton!, leftSpaceItem, statusItem, rightSpaceItem, rightButtonItem]
226248
}
227249

0 commit comments

Comments
 (0)