Skip to content

Commit fdb12ed

Browse files
committed
removed tab bar and minor ui tweaks..
1 parent 9335a37 commit fdb12ed

46 files changed

Lines changed: 6014 additions & 7269 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

DocScan.xcodeproj/xcuserdata/ankit.xcuserdatad/xcschemes/xcschememanagement.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>DocScan.xcscheme_^#shared#^_</key>
88
<dict>
99
<key>orderHint</key>
10-
<integer>23</integer>
10+
<integer>22</integer>
1111
</dict>
1212
</dict>
1313
</dict>

DocScan/Storyboards/Base.lproj/Main.storyboard

Lines changed: 61 additions & 59 deletions
Large diffs are not rendered by default.

DocScan/VCs/1ScanSubVC/ScanVC.swift

Lines changed: 62 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,42 @@ import PDFKit
1010
import Vision
1111
import VisionKit
1212

13-
class ScanVC: UIViewController, UIImagePickerControllerDelegate & UINavigationControllerDelegate,UICollectionViewDelegate,UICollectionViewDataSource{
13+
class ScanVC: UIViewController, UIImagePickerControllerDelegate & UINavigationControllerDelegate,UICollectionViewDelegate,UICollectionViewDataSource, UIGestureRecognizerDelegate{
1414

1515
var workingDirectory : URL?
1616
var allFiles : [File] = []
17+
var storedBarItem : UIBarButtonItem?
1718

19+
@IBOutlet weak var backBttn: UIBarButtonItem!
1820
@IBOutlet var InstructionView: UIView!
1921
@IBOutlet weak var collectionView: UICollectionView!
2022
@IBOutlet var emptyView: UIView!
2123
@IBOutlet weak var addBttn: UIBarButtonItem!
24+
@IBAction func backBttnTapped(_ sender: Any) {
25+
returnToPreviousDirectory()
26+
}
2227

2328
//MARK: - Create directory
2429
func gotoDirectory(directory:URL) {
2530
if(directory.lastPathComponent == "DocScanner"){
2631
self.navigationItem.leftBarButtonItem = nil
2732
self.title = "HOME"
2833
}else{
29-
//self.navigationItem.leftBarButtonItem = self.barBackButton
34+
self.navigationItem.leftBarButtonItem = self.backBttn
3035
self.title = directory.lastPathComponent.uppercased()
3136
}
3237
self.workingDirectory = directory
3338
reloadTableData()
39+
self.tabBarController?.tabBar.isHidden = true
40+
}
41+
func returnToPreviousDirectory(){
42+
if(self.workingDirectory?.lastPathComponent == "DocScanner"){
43+
}else{
44+
self.workingDirectory?.deleteLastPathComponent()
45+
self.title = workingDirectory!.lastPathComponent.uppercased()
46+
}
47+
self.gotoDirectory(directory: self.workingDirectory!)
48+
self.tabBarController?.tabBar.isHidden = false
3449
}
3550

3651
//MARK: -
@@ -57,6 +72,7 @@ class ScanVC: UIViewController, UIImagePickerControllerDelegate & UINavigationCo
5772
self.allFiles = FileUtility.shared.scanDirectory(directory: self.workingDirectory!)
5873
}
5974
self.collectionView.reloadData()
75+
6076
}
6177

6278
func reloadTableData() {
@@ -79,7 +95,7 @@ class ScanVC: UIViewController, UIImagePickerControllerDelegate & UINavigationCo
7995
//cell.dateLabel.text = dateArr[indexPath.row]
8096
//cell.documentName.text = nameArr[indexPath.row]
8197

82-
//cell.imageView?.image = self.allFiles[indexPath.row].image
98+
cell.imageView?.image = self.allFiles[indexPath.row].image
8399
cell.documentName?.text = self.allFiles[indexPath.row].name
84100
cell.dateLabel?.text = self.allFiles[indexPath.row].size
85101

@@ -131,14 +147,52 @@ class ScanVC: UIViewController, UIImagePickerControllerDelegate & UINavigationCo
131147
override func viewDidLoad() {
132148
super.viewDidLoad()
133149
// To hide the top line
150+
self.storedBarItem = self.backBttn
151+
self.navigationItem.leftBarButtonItem = nil
134152
self.navigationController?.navigationBar.shadowImage = UIImage()
135-
// To hide the top line
136-
//self.tabBarController?.tabBar.shadowImage = UIImage()
137-
//self.tabBarController?.tabBar.backgroundImage = UIImage()
138-
setUpMenu()
153+
let longPressGR = UILongPressGestureRecognizer(target: self, action: #selector(handleLongPress(longPressGR:)))
154+
longPressGR.minimumPressDuration = 0.5
155+
longPressGR.delaysTouchesBegan = true
156+
self.collectionView.addGestureRecognizer(longPressGR)
157+
//setUpMenu()
158+
}
159+
160+
@objc
161+
func handleLongPress(longPressGR: UILongPressGestureRecognizer) {
162+
if longPressGR.state != .ended {
163+
return
164+
}
165+
166+
let point = longPressGR.location(in: self.collectionView)
167+
let indexPath = self.collectionView.indexPathForItem(at: point)
168+
169+
if let indexPath = indexPath {
170+
var cell = self.collectionView.cellForItem(at: indexPath)
171+
let deleteAction = self.contextualDeleteAction(forRowAt: indexPath)
172+
} else {
173+
print("Could not find index path")
174+
}
139175
}
140176

141-
177+
func contextualDeleteAction(forRowAt indexPath : IndexPath) -> UIContextualAction {
178+
let action = UIContextualAction(style: .normal, title: "Delete") { (contextAction, sourceView, completionHandler) in
179+
let errorMessage = FileUtility.shared.deleteFile(url: self.allFiles[indexPath.row].url)
180+
if(errorMessage == ""){
181+
self.reloadTableData()
182+
completionHandler(true)
183+
}else{
184+
self.presentAlert(title: "Failed", message: errorMessage)
185+
completionHandler(false)
186+
}
187+
}
188+
action.image = UIImage(named: "delete_forever")
189+
action.title = "Delete"
190+
action.backgroundColor = UIColor.red
191+
return action
192+
}
193+
194+
195+
142196
//MARK:- Set up uimenu Button
143197

144198
@objc func setUpMenu(){

DocScan/VCs/Custom Files/FileUtility.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ struct File {
326326
let name : String!
327327
let type : FileType!
328328
let size : String!
329-
//let image : UIImage!
329+
let image : UIImage!
330330
let path : String!
331331
let url : URL!
332332
init(fileUrl:URL) {
@@ -337,28 +337,28 @@ struct File {
337337
case "":
338338
name = fileUrl.lastPathComponent
339339
type = .folder
340-
//image = UIImage(named: "FolderIconPink") //?.tint(with: Theme.folderColor)
340+
self.image = UIImage(named: "FolderIconPink") //?.tint(with: Theme.folderColor)
341341
size = FileUtility.shared.getSize(ofDirectory: self.url)
342342
case "pdf":
343343
name = fileUrl.deletingPathExtension().lastPathComponent
344344
type = .pdf
345345
self.size = FileUtility.shared.fileSize(fileAt: self.url)
346-
//image = UIImage(named: "pictureAsPdf")?.tint(with:Theme.pdfIconColor)
346+
image = UIImage(named: "pictureAsPdf") //?.tint(with:Theme.pdfIconColor)
347347
case "jpg":
348348
name = fileUrl.deletingPathExtension().lastPathComponent
349349
type = .jpg
350350
self.size = FileUtility.shared.fileSize(fileAt: self.url)
351-
//image = UIImage(named: "pictureAsPdf")
351+
image = UIImage(named: "pictureAsPdf")
352352
case "png":
353353
name = fileUrl.deletingPathExtension().lastPathComponent
354354
type = .png
355355
self.size = FileUtility.shared.fileSize(fileAt: self.url)
356-
//image = UIImage(named: "pictureAsPdf")
356+
image = UIImage(named: "pictureAsPdf")
357357
default:
358358
name = fileUrl.lastPathComponent
359359
type = .folder
360360
size = FileUtility.shared.getFileSize(ofFolder: self.url)
361-
//image = UIImage(named: "folder")
361+
image = UIImage(named: "folder")
362362
}
363363
}
364364
}

Podfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ target 'DocScan' do
66

77
# Pods for DocScan
88
pod 'TDCRoundButton'
9-
pod 'CBFlashyTabBarController'
109
pod 'Firebase'
1110
pod 'Firebase/Auth'
1211
pod 'Firebase/Storage'

Podfile.lock

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ PODS:
44
- AppAuth/ExternalUserAgent (= 1.4.0)
55
- AppAuth/Core (1.4.0)
66
- AppAuth/ExternalUserAgent (1.4.0)
7-
- CBFlashyTabBarController (0.8.3)
87
- Firebase (6.34.0):
98
- Firebase/Core (= 6.34.0)
109
- Firebase/Auth (6.34.0):
@@ -104,7 +103,6 @@ PODS:
104103
- TDCRoundButton (0.1.4)
105104

106105
DEPENDENCIES:
107-
- CBFlashyTabBarController
108106
- Firebase
109107
- Firebase/Auth
110108
- Firebase/Database
@@ -115,7 +113,6 @@ DEPENDENCIES:
115113
SPEC REPOS:
116114
trunk:
117115
- AppAuth
118-
- CBFlashyTabBarController
119116
- Firebase
120117
- FirebaseAnalytics
121118
- FirebaseAuth
@@ -137,7 +134,6 @@ SPEC REPOS:
137134

138135
SPEC CHECKSUMS:
139136
AppAuth: 31bcec809a638d7bd2f86ea8a52bd45f6e81e7c7
140-
CBFlashyTabBarController: bc6b11dd4cbc9b54785c8944156e2f4d4f03b088
141137
Firebase: c23a36d9e4cdf7877dfcba8dd0c58add66358999
142138
FirebaseAnalytics: 3bb096873ee0d7fa4b6c70f5e9166b6da413cc7f
143139
FirebaseAuth: c92d49ada7948d1a23466e3db17bc4c2039dddc3
@@ -157,6 +153,6 @@ SPEC CHECKSUMS:
157153
PromisesObjC: 8c196f5a328c2cba3e74624585467a557dcb482f
158154
TDCRoundButton: e62175861daca33f6d780f3718505747fe4db70a
159155

160-
PODFILE CHECKSUM: f3d6ed65f0da829aba5a70f77469c3b3048c599d
156+
PODFILE CHECKSUM: f6e21c487d184f030da668b19a648a4834c1b5a9
161157

162158
COCOAPODS: 1.9.3

Pods/CBFlashyTabBarController/CBFlashyTabBarController/Classes/Animation/CBTabItemAnimation.swift

Lines changed: 0 additions & 24 deletions
This file was deleted.

Pods/CBFlashyTabBarController/CBFlashyTabBarController/Classes/Animation/CBTabItemBasicAnimation.swift

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)