Showing
10 changed files
with
88 additions
and
13 deletions
| @@ -14,6 +14,7 @@ | @@ -14,6 +14,7 @@ | ||
| 14 | 190DB9FC2AC450F6000A7BF3 /* RemoveAdvertViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 190DB9FB2AC450F6000A7BF3 /* RemoveAdvertViewController.swift */; }; | 14 | 190DB9FC2AC450F6000A7BF3 /* RemoveAdvertViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 190DB9FB2AC450F6000A7BF3 /* RemoveAdvertViewController.swift */; }; |
| 15 | 190DBA002AC45A3C000A7BF3 /* CachingManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 190DB9FF2AC45A3C000A7BF3 /* CachingManager.swift */; }; | 15 | 190DBA002AC45A3C000A7BF3 /* CachingManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 190DB9FF2AC45A3C000A7BF3 /* CachingManager.swift */; }; |
| 16 | 190DBA0D2AC47701000A7BF3 /* BinaryFloatingPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 190DBA0C2AC47701000A7BF3 /* BinaryFloatingPoint.swift */; }; | 16 | 190DBA0D2AC47701000A7BF3 /* BinaryFloatingPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 190DBA0C2AC47701000A7BF3 /* BinaryFloatingPoint.swift */; }; |
| 17 | + 1918115E2B17623D00F7CB6F /* NotificationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1918115D2B17623D00F7CB6F /* NotificationManager.swift */; }; | ||
| 17 | 191BB84F2AC5A9C900A2DEB9 /* TabsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191BB84E2AC5A9C900A2DEB9 /* TabsView.swift */; }; | 18 | 191BB84F2AC5A9C900A2DEB9 /* TabsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191BB84E2AC5A9C900A2DEB9 /* TabsView.swift */; }; |
| 18 | 191BB8522AC5AB4600A2DEB9 /* TabsToolbarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191BB8512AC5AB4600A2DEB9 /* TabsToolbarView.swift */; }; | 19 | 191BB8522AC5AB4600A2DEB9 /* TabsToolbarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191BB8512AC5AB4600A2DEB9 /* TabsToolbarView.swift */; }; |
| 19 | 191BB8542AC5B3CD00A2DEB9 /* TabsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191BB8532AC5B3CD00A2DEB9 /* TabsViewController.swift */; }; | 20 | 191BB8542AC5B3CD00A2DEB9 /* TabsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191BB8532AC5B3CD00A2DEB9 /* TabsViewController.swift */; }; |
| @@ -115,6 +116,7 @@ | @@ -115,6 +116,7 @@ | ||
| 115 | 190DB9FB2AC450F6000A7BF3 /* RemoveAdvertViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoveAdvertViewController.swift; sourceTree = "<group>"; }; | 116 | 190DB9FB2AC450F6000A7BF3 /* RemoveAdvertViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoveAdvertViewController.swift; sourceTree = "<group>"; }; |
| 116 | 190DB9FF2AC45A3C000A7BF3 /* CachingManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CachingManager.swift; sourceTree = "<group>"; }; | 117 | 190DB9FF2AC45A3C000A7BF3 /* CachingManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CachingManager.swift; sourceTree = "<group>"; }; |
| 117 | 190DBA0C2AC47701000A7BF3 /* BinaryFloatingPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BinaryFloatingPoint.swift; sourceTree = "<group>"; }; | 118 | 190DBA0C2AC47701000A7BF3 /* BinaryFloatingPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BinaryFloatingPoint.swift; sourceTree = "<group>"; }; |
| 119 | + 1918115D2B17623D00F7CB6F /* NotificationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationManager.swift; sourceTree = "<group>"; }; | ||
| 118 | 191BB84E2AC5A9C900A2DEB9 /* TabsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabsView.swift; sourceTree = "<group>"; }; | 120 | 191BB84E2AC5A9C900A2DEB9 /* TabsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabsView.swift; sourceTree = "<group>"; }; |
| 119 | 191BB8512AC5AB4600A2DEB9 /* TabsToolbarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabsToolbarView.swift; sourceTree = "<group>"; }; | 121 | 191BB8512AC5AB4600A2DEB9 /* TabsToolbarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabsToolbarView.swift; sourceTree = "<group>"; }; |
| 120 | 191BB8532AC5B3CD00A2DEB9 /* TabsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabsViewController.swift; sourceTree = "<group>"; }; | 122 | 191BB8532AC5B3CD00A2DEB9 /* TabsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabsViewController.swift; sourceTree = "<group>"; }; |
| @@ -241,6 +243,7 @@ | @@ -241,6 +243,7 @@ | ||
| 241 | 193B3B892ACAF714002161ED /* TabManager.swift */, | 243 | 193B3B892ACAF714002161ED /* TabManager.swift */, |
| 242 | 1907D6962ADE766F00C40E9F /* HistoryDBManager.swift */, | 244 | 1907D6962ADE766F00C40E9F /* HistoryDBManager.swift */, |
| 243 | 1907D6982ADE7E9C00C40E9F /* DateManager.swift */, | 245 | 1907D6982ADE7E9C00C40E9F /* DateManager.swift */, |
| 246 | + 1918115D2B17623D00F7CB6F /* NotificationManager.swift */, | ||
| 244 | ); | 247 | ); |
| 245 | path = Managers; | 248 | path = Managers; |
| 246 | sourceTree = "<group>"; | 249 | sourceTree = "<group>"; |
| @@ -963,6 +966,7 @@ | @@ -963,6 +966,7 @@ | ||
| 963 | 191BB8642AC6A02300A2DEB9 /* SearchingView.swift in Sources */, | 966 | 191BB8642AC6A02300A2DEB9 /* SearchingView.swift in Sources */, |
| 964 | 190DBA002AC45A3C000A7BF3 /* CachingManager.swift in Sources */, | 967 | 190DBA002AC45A3C000A7BF3 /* CachingManager.swift in Sources */, |
| 965 | 1984BF422AFB907A0050F816 /* PrivacyView.swift in Sources */, | 968 | 1984BF422AFB907A0050F816 /* PrivacyView.swift in Sources */, |
| 969 | + 1918115E2B17623D00F7CB6F /* NotificationManager.swift in Sources */, | ||
| 966 | 191BB8692AC6A66900A2DEB9 /* SearchingTableViewCell.swift in Sources */, | 970 | 191BB8692AC6A66900A2DEB9 /* SearchingTableViewCell.swift in Sources */, |
| 967 | 1990C69C2AEFDF89004AF856 /* UICollectionViewCell+convertFrameToScreenCoordinates.swift in Sources */, | 971 | 1990C69C2AEFDF89004AF856 /* UICollectionViewCell+convertFrameToScreenCoordinates.swift in Sources */, |
| 968 | 19FCBF222AC1727800F83A7F /* AppDelegate.swift in Sources */, | 972 | 19FCBF222AC1727800F83A7F /* AppDelegate.swift in Sources */, |
No preview for this file type
| @@ -3,12 +3,13 @@ import UIKit | @@ -3,12 +3,13 @@ import UIKit | ||
| 3 | @main | 3 | @main |
| 4 | class AppDelegate: UIResponder, UIApplicationDelegate { | 4 | class AppDelegate: UIResponder, UIApplicationDelegate { |
| 5 | var window: UIWindow? | 5 | var window: UIWindow? |
| 6 | - | 6 | + |
| 7 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | 7 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { |
| 8 | let screenRect = UIScreen.main.bounds | 8 | let screenRect = UIScreen.main.bounds |
| 9 | window = UIWindow(frame: screenRect) | 9 | window = UIWindow(frame: screenRect) |
| 10 | 10 | ||
| 11 | if let window = window { | 11 | if let window = window { |
| 12 | + let notification = NotificationManager() | ||
| 12 | let navigationViewController = NavigationViewController() | 13 | let navigationViewController = NavigationViewController() |
| 13 | window.rootViewController = navigationViewController | 14 | window.rootViewController = navigationViewController |
| 14 | window.makeKeyAndVisible() | 15 | window.makeKeyAndVisible() |
browser/Managers/NotificationManager.swift
0 → 100644
| 1 | +// | ||
| 2 | +// NotificationManager.swift | ||
| 3 | +// Pro-Seecurity-VPN | ||
| 4 | +// | ||
| 5 | +// Created by Artem Talko on 29.11.2023. | ||
| 6 | +// | ||
| 7 | +import UIKit | ||
| 8 | +import UserNotifications | ||
| 9 | + | ||
| 10 | +final class NotificationManager { | ||
| 11 | + private let notificationInterval: TimeInterval = 60 * 4 * 60 | ||
| 12 | + | ||
| 13 | + init() { | ||
| 14 | + chechForPermission() | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + private func chechForPermission() { | ||
| 18 | + let notificationCenter = UNUserNotificationCenter.current() | ||
| 19 | + | ||
| 20 | + notificationCenter.getNotificationSettings { settings in | ||
| 21 | + switch settings.authorizationStatus { | ||
| 22 | + case .authorized: | ||
| 23 | + self.dispatchNotification() | ||
| 24 | + | ||
| 25 | + case .notDetermined: | ||
| 26 | + notificationCenter.requestAuthorization(options: [.alert, .sound]) { didAllow, error in | ||
| 27 | + if didAllow { | ||
| 28 | + self.dispatchNotification() | ||
| 29 | + } | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + case .denied: | ||
| 33 | + return | ||
| 34 | + | ||
| 35 | + default: | ||
| 36 | + return | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + private func generateRandomNotificationBody() -> String { | ||
| 42 | + return StringConstants.notificationMessages.randomElement() ?? "" | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + private func dispatchNotification() { | ||
| 46 | + let identifier = StringConstants.notificationIdentifier | ||
| 47 | + let notificationCenter = UNUserNotificationCenter.current() | ||
| 48 | + | ||
| 49 | + let content = UNMutableNotificationContent() | ||
| 50 | + content.title = StringConstants.notificationTitle | ||
| 51 | + content.body = generateRandomNotificationBody() | ||
| 52 | + content.sound = .default | ||
| 53 | + | ||
| 54 | + let trigger = UNTimeIntervalNotificationTrigger(timeInterval: notificationInterval, repeats: true) | ||
| 55 | + let request = UNNotificationRequest(identifier: identifier, content: content, trigger: trigger) | ||
| 56 | + | ||
| 57 | + notificationCenter.removePendingNotificationRequests(withIdentifiers: [identifier]) | ||
| 58 | + notificationCenter.add(request) | ||
| 59 | + } | ||
| 60 | +} |
| @@ -13,6 +13,7 @@ enum menuCases: CaseIterable { | @@ -13,6 +13,7 @@ enum menuCases: CaseIterable { | ||
| 13 | case todayAndYesterday | 13 | case todayAndYesterday |
| 14 | case today | 14 | case today |
| 15 | case lastHour | 15 | case lastHour |
| 16 | + | ||
| 16 | var action: UIAction { | 17 | var action: UIAction { |
| 17 | switch self { | 18 | switch self { |
| 18 | case .allTime: | 19 | case .allTime: |
| @@ -66,7 +66,6 @@ final class HistoryViewController: UIViewController { | @@ -66,7 +66,6 @@ final class HistoryViewController: UIViewController { | ||
| 66 | 66 | ||
| 67 | //MARK: - TableView Extention | 67 | //MARK: - TableView Extention |
| 68 | extension HistoryViewController: UITableViewDelegate, UITableViewDataSource { | 68 | extension HistoryViewController: UITableViewDelegate, UITableViewDataSource { |
| 69 | - | ||
| 70 | func numberOfSections(in tableView: UITableView) -> Int { | 69 | func numberOfSections(in tableView: UITableView) -> Int { |
| 71 | return filteredData.count | 70 | return filteredData.count |
| 72 | } | 71 | } |
| @@ -61,10 +61,6 @@ final class BrowserHomeViewController: UIViewController { | @@ -61,10 +61,6 @@ final class BrowserHomeViewController: UIViewController { | ||
| 61 | init(url: String?, currentTabId: Int?) { | 61 | init(url: String?, currentTabId: Int?) { |
| 62 | searchResultViewController = SearchResultViewController(searchLink: String()) | 62 | searchResultViewController = SearchResultViewController(searchLink: String()) |
| 63 | searchingViewController = SearchingViewController(dataForReq: []) | 63 | searchingViewController = SearchingViewController(dataForReq: []) |
| 64 | - | ||
| 65 | - | ||
| 66 | - | ||
| 67 | - | ||
| 68 | subscriptions = [] | 64 | subscriptions = [] |
| 69 | searchRequestURL = URLConstants.googleURL | 65 | searchRequestURL = URLConstants.googleURL |
| 70 | 66 | ||
| @@ -289,19 +285,18 @@ extension BrowserHomeViewController { | @@ -289,19 +285,18 @@ extension BrowserHomeViewController { | ||
| 289 | let finalUrl = siteUrl.absoluteString | 285 | let finalUrl = siteUrl.absoluteString |
| 290 | let lastVisit = DateManager.shared.currentDate | 286 | let lastVisit = DateManager.shared.currentDate |
| 291 | let homeViewSnapshot = SnapshotService.shared.makeSnapshot(mainView) | 287 | let homeViewSnapshot = SnapshotService.shared.makeSnapshot(mainView) |
| 292 | - | 288 | + navigationController?.popViewController(animated: true) |
| 293 | TabManager.shared.saveTab(tabTitle: siteTitle, snapshotImage: homeViewSnapshot, tabUrl: finalUrl) | 289 | TabManager.shared.saveTab(tabTitle: siteTitle, snapshotImage: homeViewSnapshot, tabUrl: finalUrl) |
| 294 | self.currentTabId = tabsViewController?.getCellIndex().row | 290 | self.currentTabId = tabsViewController?.getCellIndex().row |
| 295 | 291 | ||
| 296 | - tabsViewController?.refreshData() | ||
| 297 | HistoryDBManager.shared.saveToHistory(siteTitle: siteTitle, siteUrl: finalUrl, lastVisit: lastVisit) | 292 | HistoryDBManager.shared.saveToHistory(siteTitle: siteTitle, siteUrl: finalUrl, lastVisit: lastVisit) |
| 298 | - navigationController?.popViewController(animated: true) | 293 | + |
| 299 | } else { | 294 | } else { |
| 300 | let homeViewSnapshot = SnapshotService.shared.makeSnapshot(mainView) | 295 | let homeViewSnapshot = SnapshotService.shared.makeSnapshot(mainView) |
| 296 | + navigationController?.popViewController(animated: true) | ||
| 301 | TabManager.shared.saveTab(tabTitle: "Start Page", snapshotImage: homeViewSnapshot, tabUrl: "homeUrl") | 297 | TabManager.shared.saveTab(tabTitle: "Start Page", snapshotImage: homeViewSnapshot, tabUrl: "homeUrl") |
| 302 | - tabsViewController?.refreshData() | 298 | + |
| 303 | currentTabId = tabsViewController?.getCellIndex().row | 299 | currentTabId = tabsViewController?.getCellIndex().row |
| 304 | - navigationController?.popViewController(animated: true) | ||
| 305 | } | 300 | } |
| 306 | } | 301 | } |
| 307 | 302 |
| @@ -13,6 +13,7 @@ final class SubscriptionViewController: UIViewController { | @@ -13,6 +13,7 @@ final class SubscriptionViewController: UIViewController { | ||
| 13 | private let mainView = SubscriptionView() | 13 | private let mainView = SubscriptionView() |
| 14 | 14 | ||
| 15 | private let tableViewData: [String] | 15 | private let tableViewData: [String] |
| 16 | + | ||
| 16 | 17 | ||
| 17 | override func viewDidLoad() { | 18 | override func viewDidLoad() { |
| 18 | super.viewDidLoad() | 19 | super.viewDidLoad() |
| @@ -10,7 +10,6 @@ import UIKit | @@ -10,7 +10,6 @@ import UIKit | ||
| 10 | final class SubscriptionTableViewCell: UITableViewCell { | 10 | final class SubscriptionTableViewCell: UITableViewCell { |
| 11 | static let cellID = String(describing: SubscriptionTableViewCell.self) | 11 | static let cellID = String(describing: SubscriptionTableViewCell.self) |
| 12 | 12 | ||
| 13 | - | ||
| 14 | let advantagesCellLabel: UILabel = { | 13 | let advantagesCellLabel: UILabel = { |
| 15 | let obj = UILabel() | 14 | let obj = UILabel() |
| 16 | obj.font = FontConstants.regularFont_14 | 15 | obj.font = FontConstants.regularFont_14 |
| @@ -55,8 +55,23 @@ struct StringConstants { | @@ -55,8 +55,23 @@ struct StringConstants { | ||
| 55 | 55 | ||
| 56 | static let menuTitle = "Clearing will remove history, cookies and other browsing data. History will be cleared from devices signed into your iCloud Account. Clear from:" | 56 | static let menuTitle = "Clearing will remove history, cookies and other browsing data. History will be cleared from devices signed into your iCloud Account. Clear from:" |
| 57 | 57 | ||
| 58 | - //mainView labels | 58 | + ///mainView labels |
| 59 | static let adBlockProtectFrom = "Adblock will protect you from:" | 59 | static let adBlockProtectFrom = "Adblock will protect you from:" |
| 60 | static let tableViewData = ["Harmful ads", "Phishing sites", "Ads in video"] | 60 | static let tableViewData = ["Harmful ads", "Phishing sites", "Ads in video"] |
| 61 | + | ||
| 62 | + | ||
| 63 | + ///notifications | ||
| 64 | + static let notificationMessages = [ | ||
| 65 | + "Enhance Your Security! Tap to Enable Gotoweb Safe Browsing and Shield Your Data.", | ||
| 66 | + "Protect Your Privacy! Open Gotoweb Safe Browser for a Secure Online Journey.", | ||
| 67 | + "Safety First! Tap to Browse Anonymously with Gotoweb Safe Browser.", | ||
| 68 | + "Stay Anonymous Online! Tap to Activate Gotoweb Safe Browsing and Keep Your Data Safe.", | ||
| 69 | + "Gotoweb Alert: Ensure Your Online Safety - Enable Safe Browsing Now!", | ||
| 70 | + "Your Privacy Matters! Browse Securely with Gotoweb Safe Browser - Tap to Activate.", | ||
| 71 | + "Gotoweb Protection: Keep Your Online Activities Private - Activate Safe Browsing Today!", | ||
| 72 | + "Browse Safely with Gotoweb! Activate Privacy Mode Now for a Secure Online Experience." | ||
| 73 | + ] | ||
| 74 | + static let notificationTitle = "Gotoweb Notification" | ||
| 75 | + static let notificationIdentifier = "browser-notification" | ||
| 61 | } | 76 | } |
| 62 | 77 |
Please
register
or
login
to post a comment