sovled #100
This commit is contained in:
@@ -16,14 +16,13 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
|
||||
var startDate: Date
|
||||
var endDate: Date
|
||||
var totalEntryCount: Int = 0
|
||||
|
||||
@State var showSharingTemplate = false
|
||||
|
||||
@Environment(\.presentationMode) var presentationMode
|
||||
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
|
||||
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
||||
|
||||
@StateObject private var shareImage = StupidAssShareObservableObject()
|
||||
private var entries = [MoodMetrics]()
|
||||
|
||||
init(isPreview: Bool, startDate: Date, endDate: Date, fakeData: Bool) {
|
||||
self.isPreview = isPreview
|
||||
self.startDate = startDate
|
||||
@@ -53,7 +52,7 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
|
||||
}
|
||||
|
||||
var image: UIImage {
|
||||
let image = shareView.snapshot()
|
||||
let image = shareView.asImage(size: CGSize(width: 666, height: 1190))
|
||||
return image
|
||||
}
|
||||
|
||||
@@ -155,7 +154,10 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Button(action: {
|
||||
showSharingTemplate = true
|
||||
let _image = self.image
|
||||
print(_image)
|
||||
self.shareImage.showFuckingSheet = true
|
||||
self.shareImage.fuckingWrappedShrable = _image
|
||||
}, label: {
|
||||
Text("Share")
|
||||
.font(.title)
|
||||
@@ -163,6 +165,11 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
|
||||
.foregroundColor(Color.white)
|
||||
.padding(.top, 20)
|
||||
})
|
||||
.sheet(isPresented: self.$shareImage.showFuckingSheet) {
|
||||
if let uiImage = self.shareImage.fuckingWrappedShrable {
|
||||
ShareSheet(photo: uiImage)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
.background(
|
||||
Color.green
|
||||
@@ -185,8 +192,6 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
|
||||
.padding(.leading, -5)
|
||||
}
|
||||
.padding([.leading, .trailing], -20)
|
||||
}.sheet(isPresented: $showSharingTemplate) {
|
||||
ActivityViewController(activityItems: [self.image])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user