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 { extension Bundle {
var applicationName: String { var applicationName: String {
if let displayName: String = self.localizedInfoDictionary?["CFBundleDisplayName"] as? String { if let displayName: String = self.localizedInfoDictionary?["CFBundleDisplayName"] as? String {
return displayName return displayName
@ -48,4 +49,9 @@ extension Bundle {
} }
return "No Name Found" 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 { @objc static var isPhoneIdiom: Bool {
return UIDevice.current.userInterfaceIdiom == .phone 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 { NavigationStack {
SettingsView() SettingsView()
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
}.presentationDetents([.height(360.0)]) }.presentationDetents([.height(400.0)])
}) })
} }
Button { Button {
@ -246,7 +246,8 @@ class TimerSpot : Identifiable, Equatable {
struct Toolbar_Previews: PreviewProvider { struct Toolbar_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
NavigationStack { NavigationStack {
Text(NSLocalizedString("Disclaimer", comment: "")).padding(32.0).multilineTextAlignment(.center) ContentView<AbstractTimer>()
.environmentObject(Conductor.maestro)
} }
.navigationTitle("Title") .navigationTitle("Title")
.toolbar { .toolbar {

@ -36,7 +36,7 @@ struct MailView: UIViewControllerRepresentable {
let vc = MFMailComposeViewController() let vc = MFMailComposeViewController()
vc.mailComposeDelegate = context.coordinator 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]) vc.setToRecipients([URLs.mail.rawValue])
let lastLogs = FileLogger.main.logs.suffix(40).reversed() let lastLogs = FileLogger.main.logs.suffix(40).reversed()

@ -26,17 +26,11 @@ struct SettingsView: View {
.onChange(of: self.confirmationSound) { newValue in .onChange(of: self.confirmationSound) { newValue in
Preferences.playConfirmationSound = newValue Preferences.playConfirmationSound = newValue
} }
// Toggle("Play cancellation sound", isOn: self.$cancellationSound)
// .onChange(of: self.cancellationSound) { newValue in
// Preferences.playCancellationSound = newValue
// }
Toggle("Adjust volume on launch", isOn: self.$raiseSoundOnLaunch)
Toggle("Raise sound on launch", isOn: self.$raiseSoundOnLaunch)
.onChange(of: self.raiseSoundOnLaunch) { newValue in .onChange(of: self.raiseSoundOnLaunch) { newValue in
Preferences.raiseSoundOnLaunch = newValue Preferences.raiseSoundOnLaunch = newValue
} }
if self.raiseSoundOnLaunch { if self.raiseSoundOnLaunch {
HStack { HStack {
@ -54,7 +48,7 @@ struct SettingsView: View {
Button { Button {
self.showMailView = true self.showMailView = true
} label: { } label: {
Text("Contact us") Label("Contact us", systemImage: "mail")
} }
} else { } else {
if self.emailCopied { if self.emailCopied {
@ -96,7 +90,6 @@ struct SettingsView: View {
MailView(isShowing: $showMailView) MailView(isShowing: $showMailView)
} }
.navigationTitle("Settings") .navigationTitle("Settings")
} }

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

Loading…
Cancel
Save