|
|
|
@ -21,10 +21,37 @@ enum SupportButtonType { |
|
|
|
case supervisorRequest |
|
|
|
case supervisorRequest |
|
|
|
case bugReport |
|
|
|
case bugReport |
|
|
|
case sharingRequest |
|
|
|
case sharingRequest |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var localizedPrefix: String { |
|
|
|
|
|
|
|
switch self { |
|
|
|
|
|
|
|
case .contentIsUnavailable: |
|
|
|
|
|
|
|
return "Décrivez votre problème" |
|
|
|
|
|
|
|
case .supervisorRequest: |
|
|
|
|
|
|
|
return localizedTopic |
|
|
|
|
|
|
|
case .bugReport: |
|
|
|
|
|
|
|
return "Décrivez votre problème" |
|
|
|
|
|
|
|
case .sharingRequest: |
|
|
|
|
|
|
|
return localizedTopic |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var localizedTopic: String { |
|
|
|
|
|
|
|
switch self { |
|
|
|
|
|
|
|
case .contentIsUnavailable: |
|
|
|
|
|
|
|
return "Support Padel Club" |
|
|
|
|
|
|
|
case .supervisorRequest: |
|
|
|
|
|
|
|
return "Demande d'ajout de superviseur" |
|
|
|
|
|
|
|
case .bugReport: |
|
|
|
|
|
|
|
return "Support Padel Club" |
|
|
|
|
|
|
|
case .sharingRequest: |
|
|
|
|
|
|
|
return "Demande de partage" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
struct SupportButtonView: View { |
|
|
|
struct SupportButtonView: View { |
|
|
|
let supportButtonType: SupportButtonType |
|
|
|
let supportButtonType: SupportButtonType |
|
|
|
|
|
|
|
var showIcon: Bool = false |
|
|
|
|
|
|
|
|
|
|
|
@State private var sentError: ContactManagerError? = nil |
|
|
|
@State private var sentError: ContactManagerError? = nil |
|
|
|
@State private var zipFilePath: URL? |
|
|
|
@State private var zipFilePath: URL? |
|
|
|
@ -48,10 +75,16 @@ struct SupportButtonView: View { |
|
|
|
_zip() |
|
|
|
_zip() |
|
|
|
} |
|
|
|
} |
|
|
|
case .supervisorRequest: |
|
|
|
case .supervisorRequest: |
|
|
|
Button("Demande d'ajout de superviseur", systemImage: "plus") { |
|
|
|
if showIcon { |
|
|
|
_zip() |
|
|
|
Button("Demande d'ajout de superviseur", systemImage: "person.badge.plus") { |
|
|
|
|
|
|
|
_zip() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.labelStyle(.iconOnly) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Button("Demande d'ajout de superviseur") { |
|
|
|
|
|
|
|
_zip() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.labelStyle(.titleOnly) |
|
|
|
|
|
|
|
case .contentIsUnavailable: |
|
|
|
case .contentIsUnavailable: |
|
|
|
FooterButtonView("Besoin d'aide ? Un problème ? Contactez-nous !") { |
|
|
|
FooterButtonView("Besoin d'aide ? Un problème ? Contactez-nous !") { |
|
|
|
_zip() |
|
|
|
_zip() |
|
|
|
@ -92,14 +125,14 @@ struct SupportButtonView: View { |
|
|
|
private func _getSubject() -> String { |
|
|
|
private func _getSubject() -> String { |
|
|
|
let device = UIDevice.current |
|
|
|
let device = UIDevice.current |
|
|
|
let iOSVersion = device.systemVersion |
|
|
|
let iOSVersion = device.systemVersion |
|
|
|
return "[\(PadelClubApp.appVersion), \(iOSVersion), \(_getDeviceIdentifier())] Support Padel Club" |
|
|
|
return "[\(PadelClubApp.appVersion), \(iOSVersion), \(_getDeviceIdentifier())] \(supportButtonType.localizedTopic)" |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private func _getBody() -> String { |
|
|
|
private func _getBody() -> String { |
|
|
|
let separator = "---------------------------------------------" |
|
|
|
let separator = "---------------------------------------------" |
|
|
|
let token = try? StoreCenter.main.token() |
|
|
|
let token = try? StoreCenter.main.token() |
|
|
|
return ["Décrivez votre problème", "\n\n\n", separator, "token", token ?? "", separator, "userId", StoreCenter.main.userId, separator, "dataStore userId", DataStore.shared.user.id].compacted().joined(separator: "\n") |
|
|
|
return [supportButtonType.localizedPrefix, "\n\n\n", separator, "token", token ?? "", separator, "userId", StoreCenter.main.userId, separator, "dataStore userId", DataStore.shared.user.id].compacted().joined(separator: "\n") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private func _getDeviceIdentifier() -> String { |
|
|
|
private func _getDeviceIdentifier() -> String { |
|
|
|
|