Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
- removed cocoapods and moved to SPM
Browse files Browse the repository at this point in the history
- updated dependencies
- updated readme
  • Loading branch information
rursache committed Jun 10, 2021
1 parent a793248 commit 0bbdc3f
Show file tree
Hide file tree
Showing 19 changed files with 497 additions and 347 deletions.
18 changes: 8 additions & 10 deletions Classes/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD

func setupSDKs() {
_ = RealmManager()
self.syncEngine = SyncEngine(objects: [
SyncObject<TaskModel>(realmConfiguration: RealmManager.sharedInstance.getConfig()),
SyncObject<CommentModel>(realmConfiguration: RealmManager.sharedInstance.getConfig()),
SyncObject<NotificationModel>(realmConfiguration: RealmManager.sharedInstance.getConfig())
SyncObject(type: TaskModel.self),
SyncObject(type: CommentModel.self),
SyncObject(type: NotificationModel.self)
], databaseScope: .private)
}

func requestPushNotificationsPerms() {
Robin.shared.requestAuthorization()
let center = UNUserNotificationCenter.current()
center.delegate = self

self.currentApplication?.registerForRemoteNotifications()
func requestPushNotificationsPerms(handler: (() -> Void)? = nil) {
Robin.settings.requestAuthorization(forOptions: [.alert, .badge, .sound]) { _, _ in
handler?()
}
}

func setupDefaults() {
Expand Down
4 changes: 2 additions & 2 deletions Classes/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit
import IceCream
import CloudKit
import ActionSheetPicker_3_0
import CoreActionSheetPicker
import BLTNBoard

class HomeViewController: BaseViewController {
Expand Down Expand Up @@ -78,7 +78,7 @@ class HomeViewController: BaseViewController {
self.tableView.dataSource = self

NotificationCenter.default.addObserver(self, selector: #selector(self.shouldReloadDataNotification), name: Config.Notifications.shouldReloadData, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(self.newCloudDataReceived(_:)), name: Notifications.cloudKitNewData.name, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(self.newCloudDataReceived(_:)), name: Notifications.cloudKitDataDidChangeRemotely.name, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(self.threeDTouchShortcutAction(_:)), name: Config.Notifications.threeDTouchShortcut, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(self.completeTask), name: Config.Notifications.completeTask, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(self.shouldReloadDataNotification), name: UIApplication.didBecomeActiveNotification, object: nil)
Expand Down
1 change: 1 addition & 0 deletions Classes/Models/NotificationModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import UIKit
import Realm
import RealmSwift
#if realApp
import IceCream
Expand Down
12 changes: 3 additions & 9 deletions Classes/Settings/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

import UIKit
import AcknowList
import MessageUI
import LKAlertController

Expand Down Expand Up @@ -83,19 +82,18 @@ class SettingsViewController: BaseViewController {
SettingsItemModel(title: "SETTINGS_ITEM_ENTRY_THEME".localized(), icon: "settings_theme", subtitle: nil, rightTitle: themeOption),
SettingsItemModel(title: "SETTINGS_ITEM_ENTRY_LANGUAGE".localized(), icon: "settings_language", subtitle: nil, rightTitle: languageOption),
SettingsItemModel(title: "SETTINGS_ITEM_ENTRY_OPEN_WEB_LINKS".localized(), icon: "settings_openurl", subtitle: nil, rightTitle: openLinksOption)
])
])

let togglesSection = SettingsItemSection(items: [
SettingsItemModel(title: "SETTINGS_ITEM_ENTRY_AUTOMATIC_REMINDERS".localized(), icon: "settings_auto_reminders", subtitle: "SETTINGS_ITEM_ENTRY_AUTOMATIC_REMINDERS_DESC".localized(), rightTitle: nil, showSwitch: true, switchIsOn: !disableAutoReminders),
SettingsItemModel(title: "SETTINGS_ITEM_ENTRY_HELPFUL_PROMPTS".localized(), icon: "settings_help", subtitle: "SETTINGS_ITEM_ENTRY_HELPFUL_PROMPTS_DESC".localized(), rightTitle: nil, showSwitch: true, switchIsOn: helpPrompts)
])
])

let aboutSection = SettingsItemSection(items: [
SettingsItemModel(title: "SETTINGS_ITEM_ENTRY_MANUAL_SYNC".localized(), icon: "settings_sync", subtitle: nil, rightTitle: nil),
SettingsItemModel(title: "SETTINGS_ITEM_ENTRY_FEEDBACK".localized(), icon: "settings_feedback", subtitle: nil, rightTitle: nil),
SettingsItemModel(title: "SETTINGS_ITEM_ENTRY_ACKNOW".localized(), icon: "settings_acknowledgments", subtitle: nil, rightTitle: nil),
SettingsItemModel(title: "SETTINGS_ITEM_ENTRY_ABOUT".localized(), icon: "settings_about", subtitle: nil, rightTitle: nil)
])
])

self.dataSource = [mainSection, togglesSection, aboutSection]

Expand Down Expand Up @@ -152,10 +150,6 @@ class SettingsViewController: BaseViewController {
}

} else if row == 3 {
// acknowledgments
self.navigationController?.pushViewController(AcknowListViewController(), animated: true)

} else if row == 4 {
// about
Utils().showAbout()
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Tasks/EditTaskViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit
import Realm
import RealmSwift
import ActionSheetPicker_3_0
import CoreActionSheetPicker
import UnderKeyboard
import LKAlertController
import RSTextViewMaster
Expand Down
2 changes: 1 addition & 1 deletion Classes/Tasks/RemindersViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

import UIKit
import ActionSheetPicker_3_0
import CoreActionSheetPicker

class RemindersViewController: BaseViewController {

Expand Down
2 changes: 1 addition & 1 deletion Classes/Tasks/TasksViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class TasksViewController: BaseViewController {
self.searchController.searchResultsUpdater = self

NotificationCenter.default.addObserver(self, selector: #selector(self.shouldReloadDataNotification), name: Config.Notifications.shouldReloadData, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(self.newCloudDataReceived), name: Notifications.cloudKitNewData.name, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(self.newCloudDataReceived), name: Notifications.cloudKitDataDidChangeRemotely.name, object: nil)
}

func loadData() {
Expand Down
2 changes: 1 addition & 1 deletion Others/ActionSheetDateTimeRangePicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import UIKit
import ActionSheetPicker_3_0
import CoreActionSheetPicker

class ActionSheetDateTimeRangePicker: AbstractActionSheetPicker {

Expand Down
1 change: 1 addition & 0 deletions Others/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Foundation
import UIKit
import LKAlertController
import SDWebImage
import ImageViewer_swift

extension Date {
Expand Down
5 changes: 3 additions & 2 deletions Others/OnboardingDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ enum OnboardingDataSource {
page.isDismissable = false

page.actionHandler = { item in
(UIApplication.shared.delegate as! AppDelegate).requestPushNotificationsPerms()
item.manager?.displayNextItem()
(UIApplication.shared.delegate as! AppDelegate).requestPushNotificationsPerms {
item.manager?.displayNextItem()
}
}

page.alternativeHandler = { item in
Expand Down
15 changes: 8 additions & 7 deletions Others/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,21 +115,22 @@ class Utils: NSObject {
let realmNotification = NotificationModel(text: text ?? task.content, date: date)
realmNotification.setTask(task: task)

let notification = RobinNotification(identifier: realmNotification.identifier, body: realmNotification.text, date: date)

let notification = RobinNotification(identifier: realmNotification.identifier, body: realmNotification.text, trigger: .date(date, repeats: .none))
notification.badge = 1
notification.setUserInfo(value: task.content, forKey: "taskName")
notification.setUserInfo(value: task.id, forKey: "taskId")
if let _ = Robin.shared.schedule(notification: notification) {
if let _ = Robin.scheduler.schedule(notification: notification) {
if saveInRealm {
RealmManager.sharedInstance.addNotification(notification: realmNotification)
}

print("notification added - \(realmNotification.identifier) - \(Config.General.dateFormatter().string(from: date))")
} else {
print("failed to add notification")
Robin.shared.printScheduled()
print(Robin.shared.scheduledCount())
Robin.scheduler.printScheduled()
print(Robin.scheduler.scheduledCount())
}
}

Expand All @@ -142,13 +143,13 @@ class Utils: NSObject {
}

func removeNotification(notification: NotificationModel) {
Robin.shared.cancel(withIdentifier: notification.identifier)
Robin.scheduler.cancel(withIdentifier: notification.identifier)
RealmManager.sharedInstance.deleteNotification(notification: notification)
print("notification removed - \(notification.identifier)")
}

private func removeAllNotifications() {
Robin.shared.cancelAll()
Robin.scheduler.cancelAll()
}

func removeAllNotificationsForTask(task: TaskModel) {
Expand Down
42 changes: 0 additions & 42 deletions Podfile

This file was deleted.

80 changes: 0 additions & 80 deletions Podfile.lock

This file was deleted.

15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ A simple To-do list app build for iPhone, iPad and Apple Watch in Swift 5 (iOS 1
## How to run

1. Clone the repo
2. Run ```pod install``` in terminal to install required pods. Make sure you have [CocoaPods](https://guides.cocoapods.org/using/getting-started.html) installed.
3. Turn on iCloud option in ```Signing & Capabilities``` and check ```CloudKit```. Turn on ```Background Modes``` and check ```Background fetch``` + ```Remote notification```.
4. Make sure to update your app group config (```Signing & Capabilities```, ```App Groups```) and id string in ```RealmManager.swift```.
5. (Optional) You might want to update or remove [Fabric](https://fabric.io/home) script located ```Build Phases```.
2. Turn on iCloud option in ```Signing & Capabilities``` and check ```CloudKit```. Turn on ```Background Modes``` and check ```Background fetch``` + ```Remote notification```.
3. Make sure to update your app group config (```Signing & Capabilities```, ```App Groups```) and id string in ```RealmManager.swift```.

## Live demo

Expand All @@ -46,9 +44,10 @@ A simple To-do list app build for iPhone, iPad and Apple Watch in Swift 5 (iOS 1
- [ ] Lockdown with FaceID/TouchID or passcode (using [BiometricAuthentication](https://github.com/rursache/BiometricAuthentication))
- [ ] Smart dates (transform "'task name' today at 10:00" into a task with a date/time of today @ 10:00)
- [ ] Rearrange tasks manually
- [ ] Marzipan support for macOS
- [ ] Catalyst support for macOS

### Improvements/To Do
- [ ] iOS 14 Widget
- [ ] watchOS complications + sync improvements
- [ ] Reload notifications after user gave push permissions if initially declined

Expand All @@ -64,9 +63,9 @@ An extensive list of acknowledgements for each external framework used for RSToD
RSToDoList is currently using:

- [LKAlertController](https://github.com/lightningkite/LKAlertController)
- [ActionSheetPicker-3.0](https://github.com/skywinder/ActionSheetPicker-3.0)
- [IceCream (own fork)](https://github.com/rursache/IceCream)
- [UnderKeyboard](https://github.com/evgenyneu/UnderKeyboard)
- [ActionSheetPicker-3.0](https://github.com/rursache/ActionSheetPicker-3.0)
- [IceCream](https://github.com/rursache/IceCream)
- [UnderKeyboard](https://github.com/rursache/UnderKeyboard)
- [ActiveLabel](https://github.com/optonaut/ActiveLabel.swift)
- [Realm & RealmSwift](https://realm.io/products/realm-database)
- [RSTextViewMaster](https://github.com/rursache/RSTextViewMaster)
Expand Down
Loading

0 comments on commit 0bbdc3f

Please sign in to comment.