Skip to content
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
10 changes: 7 additions & 3 deletions ScienceJournal.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3138,7 +3138,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0820;
LastUpgradeCheck = 0940;
LastUpgradeCheck = 1200;
ORGANIZATIONNAME = Arduino;
TargetAttributes = {
68EBA6D91E20421E0089FF7F = {
Expand Down Expand Up @@ -3168,10 +3168,9 @@
};
buildConfigurationList = 68EBA6D51E20421E0089FF7F /* Build configuration list for PBXProject "ScienceJournal" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
English,
ar,
bg,
bs,
Expand Down Expand Up @@ -3249,6 +3248,7 @@
zh_CN,
zh_HK,
zh_TW,
Base,
);
mainGroup = 68EBA6D11E20421E0089FF7F;
productRefGroup = 68EBA6DB1E20421E0089FF7F /* Products */;
Expand Down Expand Up @@ -4151,6 +4151,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -4319,6 +4320,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -4506,6 +4508,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -4565,6 +4568,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,6 +27,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "68EBA6D91E20421E0089FF7F"
BuildableName = "ScienceJournal.app"
BlueprintName = "ScienceJournal"
ReferencedContainer = "container:ScienceJournal.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -49,17 +58,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "68EBA6D91E20421E0089FF7F"
BuildableName = "ScienceJournal.app"
BlueprintName = "ScienceJournal"
ReferencedContainer = "container:ScienceJournal.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -81,8 +79,6 @@
ReferencedContainer = "container:ScienceJournal.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Debug"
Expand Down
22 changes: 17 additions & 5 deletions ScienceJournal/UI/PhotoLibraryDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,31 @@ class PhotoLibraryDataSource: NSObject, PHPhotoLibraryChangeObserver {

/// The permissions state of the capturer.
var isPhotoLibraryPermissionGranted: Bool {
let authStatus = PHPhotoLibrary.authorizationStatus()
let authStatus: PHAuthorizationStatus
if #available(iOS 14, *) {
authStatus = PHPhotoLibrary.authorizationStatus(for: .readWrite)
} else {
authStatus = PHPhotoLibrary.authorizationStatus()
}
switch authStatus {
case .denied, .restricted: return false
case .authorized: return true
case .authorized, .limited: return true
case .notDetermined:
// Prompt user for the permission to use the camera.
PHPhotoLibrary.requestAuthorization({ (status) in
let handler: (PHAuthorizationStatus) -> Void = { status in
DispatchQueue.main.sync {
let granted = status == .authorized
self.delegate?.photoLibraryDataSourcePermissionsDidChange(accessGranted: granted)
}
})
}

// Prompt user for the permission to use the camera.
if #available(iOS 14, *) {
PHPhotoLibrary.requestAuthorization(for: .readWrite, handler: handler)
} else {
PHPhotoLibrary.requestAuthorization(handler)
}
return false
@unknown default: return false
}
}

Expand Down