Skip to content
This repository has been archived by the owner on Feb 12, 2021. It is now read-only.

Commit

Permalink
✨ v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rrroyal committed Jun 4, 2020
1 parent 6eb130a commit aae27d0
Show file tree
Hide file tree
Showing 108 changed files with 2,618 additions and 739 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ Open-source UONET+ app for Apple devices.
## Installation
### Manual
1. Clone the repo.
2. Replace every `please.change.me` occurrence with your designated Bundle ID.
3. Compile and run.
2. Replace every `please.change.me` occurrence with your designated Bundle ID (`grep -r "please.change.me" ./`).
3. Set the app groups in the Xcode project.
4. Compile and run.

### Automatic
You might want to look into [AltStore](https://altstore.io) or (if you're jailbroken) [ReProvision](https://github.com/Matchstic/ReProvision).
Expand All @@ -25,24 +26,25 @@ You might want to look into [AltStore](https://altstore.io) or (if you're jailbr
### Core
- [x] iOS app
- [x] iPadOS app
- [ ] watchOS app
- [x] watchOS app
- [ ] macOS app
- [ ] Today widget
- [x] Multi window
- [x] Background refresh
- [x] Today widget
- [x] Quick actions (somewhat done)
- [ ] Cursor support
- [ ] Siri shortcuts/intents (*Handoff?*)
- [ ] Notifications
- [ ] Spotlight indexing

## FAQ
### Why the app isn't in the App Store?
**TL;DR:** I'm broke. Give me 99$ and it will be there.
**Slightly longer answer:** Uploading apps on the App Store requires being a member of the [Apple Developer Program](https://developer.apple.com/programs/), which costs 99$ per year. If someone is generous enough to pay for that, then I'm more than happy to upload the app to the App Store.
Uploading apps on the App Store requires being a member of the [Apple Developer Program](https://developer.apple.com/programs/), which costs 99$ per year. If someone is generous enough to pay for that, then I'm more than happy to upload the app to the App Store.

### Is it safe to use?
### Will I get banned if I use this app?
**I have no idea. You are using this app on your own responsibility.**

## Technical stuff
- There's no profiling, ads, weird libraries or other bullshit.
- There's no analytics, ads, weird libraries or other bullshit.
- The app is built using [SwiftUI](https://developer.apple.com/xcode/swiftui/), so the interface may sometimes be buggy. There's not much I can do about that.
- API is based on [uonet-api-docs](https://gitlab.com/erupcja/uonet-api-docs) and my own analysis.
- Network requests are made with [Combine](https://developer.apple.com/documentation/combine).
Expand Down
6 changes: 6 additions & 0 deletions Shared/Colors.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x34",
"green" : "0x3C",
"red" : "0xFF"
"blue" : "0.204",
"green" : "0.235",
"red" : "1.000"
}
},
"idiom" : "universal"
Expand All @@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x32",
"green" : "0x47",
"red" : "0xFF"
"blue" : "0.196",
"green" : "0.278",
"red" : "1.000"
}
},
"idiom" : "universal"
Expand Down
17 changes: 17 additions & 0 deletions Shared/Extensions+Modifiers/Color.swift
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"))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ extension Date {
return hello
}

var relativeString: String {
let dateFormatter = DateFormatter()
dateFormatter.timeStyle = .none
dateFormatter.dateStyle = .long
dateFormatter.doesRelativeDateFormatting = true
return dateFormatter.string(from: self)
}

var timestampString: String? {
let formatter = DateComponentsFormatter()
formatter.unitsStyle = .abbreviated
Expand All @@ -67,6 +75,17 @@ extension Date {
return dateFormatter.string(from: self)
}

var startOfDay: Date {
return Calendar.current.startOfDay(for: self)
}

var endOfDay: Date {
var components = DateComponents()
components.day = 1
components.second = -1
return Calendar.current.date(byAdding: components, to: startOfDay)!
}

var startOfWeek: Date? {
let calendar = Calendar(identifier: .gregorian)
guard let sunday = calendar.date(from: calendar.dateComponents([.yearForWeekOfYear, .weekOfYear], from: self)) else { return nil }
Expand Down
60 changes: 60 additions & 0 deletions Shared/Extensions+Modifiers/UserDefaults.swift
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") }
}
}
}
58 changes: 0 additions & 58 deletions Shared/UserDefaults.swift

This file was deleted.

20 changes: 16 additions & 4 deletions Shared/Vulcan Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,11 @@ enum Vulcan {
self.strikethrough = strikethrough
self.bold = bold
self.userSchedule = userSchedule
self.hasPassed = dateEnds < Date()
self.actualGroup = Int(String(group?.prefix(1) ?? "0")) ?? 0
if (group != nil) {
self.actualGroup = Int(String(group?.prefix(1) ?? "0")) ?? 0
} else {
self.actualGroup = nil
}
}

let id: UUID = UUID()
Expand All @@ -276,14 +279,23 @@ enum Vulcan {
let lesson: Vulcan.Lesson // Parsed NumerLekcji
let subject: Vulcan.Subject // Parsed IdPrzedmiot
let group: String? // PodzialSkrot
let actualGroup: Int // Parsed from `group`
let actualGroup: Int? // Parsed from `group`
let room: String // Sala
let teacher: Vulcan.Teacher // Parsed IdPracownik
let note: String // AdnotacjaOZmianie
let strikethrough: Bool // PrzekreslonaNazwa
let bold: Bool // PogrubionaNazwa
let userSchedule: Bool // PlanUcznia
var hasPassed: Bool // dateEnds < Date()
var hasPassed: Bool {
get {
return Date() > self.dateEnds
}
}
var isCurrent: Bool {
get {
return Date() > self.dateStarts && Date() < self.dateEnds
}
}
}

// MARK: - Tasks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="16119" systemVersion="19E2269" minimumToolsVersion="Automatic" sourceLanguage="Swift" usedWithCloudKit="YES" userDefinedModelVersionIdentifier="">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="16119" systemVersion="19E287" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="VulcanDictionary" representedClassName=".VulcanDictionary" syncable="YES" codeGenerationType="class">
<attribute name="employees" optional="YES" attributeType="String"/>
<attribute name="gradeCategories" optional="YES" attributeType="String"/>
Expand Down
10 changes: 8 additions & 2 deletions vulcan Today Extension/Base.lproj/MainInterface.storyboard
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="M4Y-Lb-cyx">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="M4Y-Lb-cyx">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
Expand All @@ -9,7 +9,7 @@
<!--Hosting View-->
<scene sceneID="cwh-vc-ff4">
<objects>
<viewController id="M4Y-Lb-cyx" customClass="HostingView" customModule="vulcan" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="M4Y-Lb-cyx" customClass="HostingView" customModule="vulcan_Schedule" customModuleProvider="target" sceneMemberID="viewController">
<containerView key="view" opaque="NO" contentMode="scaleToFill" id="whD-gd-U5s">
<rect key="frame" x="0.0" y="0.0" width="320" height="37"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
Expand All @@ -34,4 +34,10 @@
<point key="canvasLocation" x="113" y="73"/>
</scene>
</scenes>
<color key="tintColor" name="mainColor"/>
<resources>
<namedColor name="mainColor">
<color red="1" green="0.23529411764705882" blue="0.20392156862745098" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
60 changes: 60 additions & 0 deletions vulcan Today Extension/DataModel.swift
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
}
}
}
}
}
Loading

0 comments on commit aae27d0

Please sign in to comment.