Skip to content

Commit

Permalink
Merge branch 'main' into feat/session-replay
Browse files Browse the repository at this point in the history
  • Loading branch information
brustolin committed Feb 14, 2024
2 parents cd816d5 + becc941 commit 3f6f035
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:
- 'scripts/ci-select-xcode.sh'
- 'Sentry.xcodeproj/**'
- '*.podspec'
- 'Gemfile.lock'

# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
concurrency:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Improvements

- Cache installationID async to avoid file IO on the main thread when starting the SDK (#3601)
- Add reason for NSPrivacyAccessedAPICategoryFileTimestamp (#3626)

### Fixes

Expand Down
3 changes: 3 additions & 0 deletions Samples/iOS-Swift/iOS-Swift/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>

<key>NSFaceIDUsageDescription</key>
<string>$(PRODUCT_NAME) Authentication with TouchId or FaceID for testing purposes of the Sentry Cocoa SDK.</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import CoreLocation
import LocalAuthentication
import UIKit

class PermissionsViewController: UIViewController {
Expand All @@ -18,9 +19,16 @@ class PermissionsViewController: UIViewController {
button.addTarget(self, action: #selector(requestLocationPermission), for: .touchUpInside)
return button
}()

private lazy var biometricButton: UIButton = {
let button = UIButton(type: .system)
button.setTitle("Request Biometric Permission", for: .normal)
button.addTarget(self, action: #selector(requestBiometricPermission), for: .touchUpInside)
return button
}()

private lazy var stackView: UIStackView = {
let stackView = UIStackView(arrangedSubviews: [pushPermissionButton, locationPermissionButton])
let stackView = UIStackView(arrangedSubviews: [pushPermissionButton, locationPermissionButton, biometricButton])
stackView.axis = .vertical
stackView.spacing = 10
stackView.alignment = .center
Expand Down Expand Up @@ -71,6 +79,34 @@ class PermissionsViewController: UIViewController {
print(granted)
}
}

@objc func requestBiometricPermission() {
let context = LAContext()
var error: NSError?

if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
let reason = "Identify yourself!"

context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: reason) { success, _ in

DispatchQueue.main.async {
if success {
let crumb = Breadcrumb()
crumb.message = "Biometry success"
SentrySDK.addBreadcrumb(crumb)
} else {
let crumb = Breadcrumb()
crumb.message = "Biometry failure"
SentrySDK.addBreadcrumb(crumb)
}
}
}
} else {
let ac = UIAlertController(title: "No biometry", message: "Couldn't access biometry.", preferredStyle: .alert)
ac.addAction(UIAlertAction(title: "OK", style: .default))
self.present(ac, animated: true)
}
}
}

extension PermissionsViewController: CLLocationManagerDelegate {
Expand Down
8 changes: 8 additions & 0 deletions Sources/Resources/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@
<string>35F9.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
</dict>
</array>
</dict>
</plist>

0 comments on commit 3f6f035

Please sign in to comment.