Minor improvements

main
Laurent 2 years ago
parent 0174531e88
commit aa6aebad91
  1. 6
      LeCountdown/Utils/Extensions.swift
  2. 11
      LeCountdown/Utils/UIDevice+Extensions.swift
  3. 5
      LeCountdown/Views/ContentView.swift
  4. 2
      LeCountdown/Views/Reusable/MailView.swift
  5. 11
      LeCountdown/Views/SettingsView.swift
  6. 1
      LeCountdown/fr.lproj/Localizable.strings

@ -38,6 +38,7 @@ extension String: StringRepresentable {
}
extension Bundle {
var applicationName: String {
if let displayName: String = self.localizedInfoDictionary?["CFBundleDisplayName"] as? String {
return displayName
@ -48,4 +49,9 @@ extension Bundle {
}
return "No Name Found"
}
var version: String {
return Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "no version"
}
}

@ -17,4 +17,15 @@ extension UIDevice {
@objc static var isPhoneIdiom: Bool {
return UIDevice.current.userInterfaceIdiom == .phone
}
static var modelName: String {
var systemInfo = utsname()
uname(&systemInfo)
let machineMirror = Mirror(reflecting: systemInfo.machine)
return machineMirror.children.reduce("") { identifier, element in
guard let value = element.value as? Int8, value != 0 else { return identifier }
return identifier + String(UnicodeScalar(UInt8(value)))
}
}
}

@ -189,7 +189,7 @@ struct MainToolbarView: ToolbarContent {
NavigationStack {
SettingsView()
.navigationBarTitleDisplayMode(.inline)
}.presentationDetents([.height(360.0)])
}.presentationDetents([.height(400.0)])
})
}
Button {
@ -246,7 +246,8 @@ class TimerSpot : Identifiable, Equatable {
struct Toolbar_Previews: PreviewProvider {
static var previews: some View {
NavigationStack {
Text(NSLocalizedString("Disclaimer", comment: "")).padding(32.0).multilineTextAlignment(.center)
ContentView<AbstractTimer>()
.environmentObject(Conductor.maestro)
}
.navigationTitle("Title")
.toolbar {

@ -36,7 +36,7 @@ struct MailView: UIViewControllerRepresentable {
let vc = MFMailComposeViewController()
vc.mailComposeDelegate = context.coordinator
vc.setSubject(Bundle.main.applicationName)
vc.setSubject("\(Bundle.main.applicationName) - \(Bundle.main.version) - iOS \(UIDevice.current.systemVersion) - \(UIDevice.modelName)")
vc.setToRecipients([URLs.mail.rawValue])
let lastLogs = FileLogger.main.logs.suffix(40).reversed()

@ -26,18 +26,12 @@ struct SettingsView: View {
.onChange(of: self.confirmationSound) { newValue in
Preferences.playConfirmationSound = newValue
}
// Toggle("Play cancellation sound", isOn: self.$cancellationSound)
// .onChange(of: self.cancellationSound) { newValue in
// Preferences.playCancellationSound = newValue
// }
Toggle("Raise sound on launch", isOn: self.$raiseSoundOnLaunch)
Toggle("Adjust volume on launch", isOn: self.$raiseSoundOnLaunch)
.onChange(of: self.raiseSoundOnLaunch) { newValue in
Preferences.raiseSoundOnLaunch = newValue
}
if self.raiseSoundOnLaunch {
HStack {
Text("Default Volume")
@ -54,7 +48,7 @@ struct SettingsView: View {
Button {
self.showMailView = true
} label: {
Text("Contact us")
Label("Contact us", systemImage: "mail")
}
} else {
if self.emailCopied {
@ -97,7 +91,6 @@ struct SettingsView: View {
}
.navigationTitle("Settings")
}
fileprivate func _requestReview() {

@ -291,3 +291,4 @@
"Copied" = "Copié";
"tap to copy email" = "Tapez pour copier l'email";
"Write a review!" = "Écrivez un avis !";
"Adjust volume on launch" = "Ajuster le volume au lancement";

Loading…
Cancel
Save