This repository has been archived by the owner on Feb 12, 2021. It is now read-only.
-
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
108 changed files
with
2,618 additions
and
739 deletions.
There are no files selected for viewing
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
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
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,17 @@ | ||
// | ||
// Color.swift | ||
// vulcan WatchKit Extension | ||
// | ||
// Created by royal on 04/06/2020. | ||
// Copyright © 2020 shameful. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
// MARK: - Color | ||
extension Color { | ||
static var mainColor: Color = Color("mainColor", bundle: Bundle(identifier: "Colors")) | ||
static func fromScheme(value: Int) -> Color { | ||
return Color("ColorSchemes/\(UserDefaults.user.colorScheme)/\(value)", bundle: Bundle(identifier: "Colors")) | ||
} | ||
} |
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
File renamed without changes.
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,60 @@ | ||
// | ||
// UserDefaults.swift | ||
// vulcan | ||
// | ||
// Created by royal on 08/05/2020. | ||
// Copyright © 2020 shameful. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
extension UserDefaults { | ||
static let group = UserDefaults(suiteName: Bundle.main.object(forInfoDictionaryKey: "GroupIdentifier") as? String ?? "")! | ||
|
||
struct user { | ||
static var launchedBefore: Bool { | ||
get { return UserDefaults.group.bool(forKey: "launchedBefore") } | ||
set { UserDefaults.group.set(newValue, forKey: "launchedBefore") } | ||
} | ||
|
||
static var isLoggedIn: Bool { | ||
get { return UserDefaults.group.bool(forKey: "isLoggedIn") } | ||
set { UserDefaults.group.set(newValue, forKey: "isLoggedIn") } | ||
} | ||
|
||
static var userGroup: Int { | ||
get { return UserDefaults.group.integer(forKey: "userGroup") } | ||
set { UserDefaults.group.set(newValue, forKey: "userGroup") } | ||
} | ||
|
||
static var savedUserData: Data? { | ||
get { return UserDefaults.group.data(forKey: "savedUserData") } | ||
set { UserDefaults.group.set(newValue, forKey: "savedUserData") } | ||
} | ||
|
||
static var readMessageOnOpen: Bool { | ||
get { return UserDefaults.group.bool(forKey: "readMessageOnOpen") } | ||
set { UserDefaults.group.set(newValue, forKey: "readMessageOnOpen") } | ||
} | ||
|
||
static var hapticFeedback: Bool { | ||
get { return UserDefaults.group.bool(forKey: "hapticFeedback") } | ||
set { UserDefaults.group.set(newValue, forKey: "hapticFeedback") } | ||
} | ||
|
||
static var colorScheme: String { | ||
get { return UserDefaults.group.string(forKey: "colorScheme") ?? "Default" } | ||
set { UserDefaults.group.set(newValue, forKey: "colorScheme") } | ||
} | ||
|
||
static var colorizeGrades: Bool { | ||
get { return UserDefaults.group.bool(forKey: "colorizeGrades") } | ||
set { UserDefaults.group.set(newValue, forKey: "colorizeGrades") } | ||
} | ||
|
||
static var colorizeGradeBackground: Bool { | ||
get { return UserDefaults.group.bool(forKey: "colorizeGradeBackground") } | ||
set { UserDefaults.group.set(newValue, forKey: "colorizeGradeBackground") } | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
...e.xcdatamodeld/Model.xcdatamodel/contents → ...e.xcdatamodeld/Model.xcdatamodel/contents
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
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
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,60 @@ | ||
// | ||
// DataModel.swift | ||
// vulcan Today Extension | ||
// | ||
// Created by royal on 03/06/2020. | ||
// Copyright © 2020 shameful. All rights reserved. | ||
// | ||
|
||
import CoreData | ||
import Combine | ||
|
||
final class DataModel: ObservableObject { | ||
static let shared = DataModel() | ||
|
||
// MARK: - Core Data stack | ||
/// Core Data container | ||
lazy var persistentContainer: NSPersistentContainer = { | ||
let container: NSPersistentContainer = NSPersistentContainer(name: "VulcanStore") | ||
|
||
let storeURL: URL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: Bundle.main.object(forInfoDictionaryKey: "GroupIdentifier") as? String ?? "")!.appendingPathComponent("vulcan.sqlite") | ||
let description: NSPersistentStoreDescription = NSPersistentStoreDescription() | ||
description.shouldInferMappingModelAutomatically = true | ||
description.shouldMigrateStoreAutomatically = true | ||
description.url = storeURL | ||
|
||
container.persistentStoreDescriptions = [description] | ||
container.loadPersistentStores(completionHandler: { (storeDescription, error) in | ||
if let error = error { | ||
print("[!] (CoreData) Could not load store: \(error.localizedDescription)") | ||
return | ||
} | ||
|
||
print("[*] (CoreData) Store loaded!") | ||
}) | ||
|
||
return container | ||
}() | ||
|
||
// @Published var grades: [Vulcan.SubjectGrades] = [] | ||
@Published var schedule: [Vulcan.Day] = [] | ||
// @Published var tasks: Vulcan.Tasks = Vulcan.Tasks(exams: [], homework: []) | ||
// @Published var messages: Vulcan.Messages = Vulcan.Messages(received: [], sent: [], deleted: []) | ||
// @Published var notes: [Vulcan.Note] = [] | ||
// @Published var endOfTermGrades: Vulcan.TermGrades = Vulcan.TermGrades(anticipated: [], final: []) | ||
|
||
private init() { | ||
// Load cached data | ||
let vulcanStored = try? self.persistentContainer.viewContext.fetch(VulcanStored.fetchRequest() as NSFetchRequest) | ||
if let stored: VulcanStored = vulcanStored?.last as? VulcanStored { | ||
let decoder = JSONDecoder() | ||
|
||
// Schedule | ||
if let storedSchedule = stored.schedule { | ||
if let decoded = try? decoder.decode([Vulcan.Day].self, from: storedSchedule) { | ||
self.schedule = decoded | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.