-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
670 additions
and
3 deletions.
There are no files selected for viewing
512 changes: 512 additions & 0 deletions
512
iOS/PolishBanknotesApp/PolishBanknotesApp.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...ishBanknotesApp/PolishBanknotesApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...pp/PolishBanknotesApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
78 changes: 78 additions & 0 deletions
78
...knotesApp/PolishBanknotesApp.xcodeproj/xcshareddata/xcschemes/PolishBanknotesApp.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "1400" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "356516C0291C51F4006A460B" | ||
BuildableName = "PolishBanknotesApp.app" | ||
BlueprintName = "PolishBanknotesApp" | ||
ReferencedContainer = "container:PolishBanknotesApp.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES"> | ||
<Testables> | ||
</Testables> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "356516C0291C51F4006A460B" | ||
BuildableName = "PolishBanknotesApp.app" | ||
BlueprintName = "PolishBanknotesApp" | ||
ReferencedContainer = "container:PolishBanknotesApp.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "356516C0291C51F4006A460B" | ||
BuildableName = "PolishBanknotesApp.app" | ||
BlueprintName = "PolishBanknotesApp" | ||
ReferencedContainer = "container:PolishBanknotesApp.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
44 changes: 44 additions & 0 deletions
44
iOS/PolishBanknotesApp/PolishBanknotesApp/Torch/TorchManager.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// FlashlightManager.swift | ||
// PolishBanknotesApp | ||
// | ||
// Created by Miłosz Chojnacki on 20/06/2023. | ||
// | ||
|
||
import Foundation | ||
import AVFoundation | ||
import UIKit | ||
|
||
class TorchManager { | ||
var isOn = false | ||
|
||
func activateTorch(interval: TimeInterval) { | ||
isOn = true | ||
DispatchQueue.global().async { | ||
self.toggleTorch(on: true) | ||
Thread.sleep(forTimeInterval: interval) | ||
self.toggleTorch(on: false) | ||
} | ||
isOn = false | ||
} | ||
|
||
func toggleTorch(on: Bool) { | ||
guard let device = AVCaptureDevice.default(for: AVMediaType.video) else { return } | ||
guard device.hasTorch else { print("Torch isn't available"); return } | ||
|
||
do { | ||
try device.lockForConfiguration() | ||
device.torchMode = on ? .on : .off | ||
if on { try device.setTorchModeOn(level: AVCaptureDevice.maxAvailableTorchLevel) } | ||
device.unlockForConfiguration() | ||
|
||
if on { | ||
UIAccessibility.post(notification: .announcement, argument: "Flash turned on!") | ||
} else { | ||
UIAccessibility.post(notification: .announcement, argument: "Flash turned off!") | ||
} | ||
} catch { | ||
print("Torch can't be used") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters