Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

๐Ÿ”€ :: [#284] Camera ๊ถŒํ•œ ํ™•์ธ ์ถ”๊ฐ€ #288

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Projects/App/Sources/Application/NeedleGenerated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ private func registerProviderFactory(_ componentPath: String, _ factory: @escapi

#if !NEEDLE_DYNAMIC

private func register1() {
@inline(never) private func register1() {
registerProviderFactory("^->AppComponent->JwtStoreComponent", factoryb27d5aae1eb7e73575a6f47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent", factoryEmptyDependencyProvider)
registerProviderFactory("^->AppComponent->KeychainComponent", factoryEmptyDependencyProvider)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,47 @@ public extension View {
isShow: Binding<Bool>,
pickedImageResult: Binding<PickedImageResult?>
) -> some View {
self.fullScreenCover(isPresented: isShow) {
CameraPicker(pickedImageResult: pickedImageResult, isPresented: isShow)
.ignoresSafeArea()
self.modifier(CameraPickerViewModifier(isShow: isShow, pickedImageResult: pickedImageResult))
}
}

struct CameraPickerViewModifier: ViewModifier {
@Environment(\.openURL) var openURL
@Environment(\.dismiss) var dismiss
@Binding var isShow: Bool
@Binding var pickedImageResult: PickedImageResult?
@State var isShowPermissionAlert = false

func body(content: Content) -> some View {
content
.fullScreenCover(isPresented: $isShow) {
CameraPicker(pickedImageResult: $pickedImageResult, isPresented: $isShow)
.ignoresSafeArea()
.alert("์นด๋ฉ”๋ผ ์ ‘๊ทผ ๊ถŒํ•œ ํ•„์š”", isPresented: $isShowPermissionAlert) {
Button("ํ™•์ธ", role: .cancel) {
dismiss()
}

Button("์„ค์ •์œผ๋กœ ์ด๋™") {
guard
let settingURL = URL(string: UIApplication.openSettingsURLString),
UIApplication.shared.canOpenURL(settingURL)
else { return }
openURL(settingURL)
}
}
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
checkPermission()
}
}
}
}

func checkPermission() {
AVCaptureDevice.requestAccess(for: .video) { isGranted in
if isGranted { return }
isShowPermissionAlert = true
}
}
}
Expand Down