├── .gitignore ├── BUAACal.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── roife.xcuserdatad │ │ └── IDEFindNavigatorScopes.plist └── xcuserdata │ └── roife.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── BUAACal ├── Assets.xcassets │ ├── .DS_Store │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── icon-40.png │ │ ├── icon-40@2x.png │ │ ├── icon-40@3x.png │ │ ├── icon-60@2x.png │ │ ├── icon-60@3x.png │ │ ├── icon-72.png │ │ ├── icon-72@2x.png │ │ ├── icon-76.png │ │ ├── icon-76@2x.png │ │ ├── icon-83.5@2x.png │ │ ├── icon-small-50.png │ │ ├── icon-small-50@2x.png │ │ ├── icon-small.png │ │ ├── icon-small@2x.png │ │ ├── icon-small@3x.png │ │ ├── icon.png │ │ ├── icon@2x.png │ │ ├── ios-marketing.png │ │ ├── notification-icon@2x.png │ │ ├── notification-icon@3x.png │ │ ├── notification-icon~ipad.png │ │ └── notification-icon~ipad@2x.png │ └── Contents.json ├── BUAACalApp.swift ├── ContentView.swift ├── Info.plist ├── Models │ ├── CalendarEventDataModel.swift │ ├── CalendarEventModel.swift │ └── CalendarMonthModel.swift ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json ├── Utilities │ ├── CalendarUtils.swift │ ├── DataStorage.swift │ └── ExtensionColor.swift ├── ViewModels │ ├── AddEventToCalendarViewModel.swift │ ├── EventViewModel.swift │ ├── LoginViewModel.swift │ └── UpdatingViewModel.swift └── Views │ ├── CalendarList.swift │ ├── Components │ ├── Calendar │ │ ├── CalendarMonthHeader.swift │ │ ├── CalendarMonthView.swift │ │ └── CalendarViewDay.swift │ └── EventCard │ │ ├── EventCard.swift │ │ └── EventCardDetailModal.swift │ ├── LoginSheet.swift │ └── PagerView.swift ├── LICENSE ├── README.md └── imgs ├── UI-2.png ├── UI.png ├── darkUI.png ├── detail.png ├── loading.png └── system.jpeg /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | # CocoaPods 52 | # 53 | # We recommend against adding the Pods directory to your .gitignore. However 54 | # you should judge for yourself, the pros and cons are mentioned at: 55 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 56 | # 57 | # Pods/ 58 | # 59 | # Add this line if you want to avoid checking in source code from the Xcode workspace 60 | # *.xcworkspace 61 | 62 | # Carthage 63 | # 64 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 65 | # Carthage/Checkouts 66 | 67 | Carthage/Build/ 68 | 69 | # Accio dependency management 70 | Dependencies/ 71 | .accio/ 72 | 73 | # fastlane 74 | # 75 | # It is recommended to not store the screenshots in the git repo. 76 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 77 | # For more information about the recommended setup visit: 78 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 79 | 80 | fastlane/report.xml 81 | fastlane/Preview.html 82 | fastlane/screenshots/**/*.png 83 | fastlane/test_output 84 | 85 | # Code Injection 86 | # 87 | # After new code Injection tools there's a generated folder /iOSInjectionProject 88 | # https://github.com/johnno1962/injectionforxcode 89 | 90 | iOSInjectionProject/ 91 | -------------------------------------------------------------------------------- /BUAACal.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 320865182528836900B169D3 /* BUAACalApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 320865172528836900B169D3 /* BUAACalApp.swift */; }; 11 | 3208651A2528836900B169D3 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 320865192528836900B169D3 /* ContentView.swift */; }; 12 | 3208651F2528836A00B169D3 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3208651E2528836A00B169D3 /* Preview Assets.xcassets */; }; 13 | 320865512528838400B169D3 /* PagerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 320865452528838400B169D3 /* PagerView.swift */; }; 14 | 320865522528838400B169D3 /* CalendarEventModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 320865472528838400B169D3 /* CalendarEventModel.swift */; }; 15 | 320865532528838400B169D3 /* CalendarMonthModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 320865482528838400B169D3 /* CalendarMonthModel.swift */; }; 16 | 320865542528838400B169D3 /* CalendarMonthView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3208654A2528838400B169D3 /* CalendarMonthView.swift */; }; 17 | 320865552528838400B169D3 /* CalendarMonthHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3208654B2528838400B169D3 /* CalendarMonthHeader.swift */; }; 18 | 320865562528838400B169D3 /* CalendarViewDay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3208654C2528838400B169D3 /* CalendarViewDay.swift */; }; 19 | 320865572528838400B169D3 /* CalendarList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3208654D2528838400B169D3 /* CalendarList.swift */; }; 20 | 320865592528838400B169D3 /* CalendarUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 320865502528838400B169D3 /* CalendarUtils.swift */; }; 21 | 3208658325289A7900B169D3 /* EventCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3208658225289A7900B169D3 /* EventCard.swift */; }; 22 | 320865902528A03100B169D3 /* CalendarEventDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3208658F2528A03100B169D3 /* CalendarEventDataModel.swift */; }; 23 | 328AA83C2530DC6E00A3B765 /* AddEventToCalendarViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 328AA83B2530DC6E00A3B765 /* AddEventToCalendarViewModel.swift */; }; 24 | 329BE22E2535AFE300FD14E5 /* EventCardDetailModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 329BE22D2535AFE300FD14E5 /* EventCardDetailModal.swift */; }; 25 | 32A2B8C025290F110025BDCD /* UpdatingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32A2B8BF25290F110025BDCD /* UpdatingViewModel.swift */; }; 26 | 32AB07E7253E6EC60084D727 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 32AB07E6253E6EC60084D727 /* Assets.xcassets */; }; 27 | 32C86C5B2528B7B8003E73D5 /* ExtensionColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C86C5A2528B7B8003E73D5 /* ExtensionColor.swift */; }; 28 | 32C86C632528E031003E73D5 /* LoginSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C86C622528E031003E73D5 /* LoginSheet.swift */; }; 29 | 32C86C6C2528E1AA003E73D5 /* LoginViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C86C6B2528E1AA003E73D5 /* LoginViewModel.swift */; }; 30 | 32FBBEEC253974C500459AF6 /* DataStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32FBBEEB253974C500459AF6 /* DataStorage.swift */; }; 31 | /* End PBXBuildFile section */ 32 | 33 | /* Begin PBXContainerItemProxy section */ 34 | 320865262528836A00B169D3 /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = 3208650C2528836900B169D3 /* Project object */; 37 | proxyType = 1; 38 | remoteGlobalIDString = 320865132528836900B169D3; 39 | remoteInfo = BUAACal; 40 | }; 41 | 320865312528836A00B169D3 /* PBXContainerItemProxy */ = { 42 | isa = PBXContainerItemProxy; 43 | containerPortal = 3208650C2528836900B169D3 /* Project object */; 44 | proxyType = 1; 45 | remoteGlobalIDString = 320865132528836900B169D3; 46 | remoteInfo = BUAACal; 47 | }; 48 | /* End PBXContainerItemProxy section */ 49 | 50 | /* Begin PBXFileReference section */ 51 | 320865142528836900B169D3 /* BUAACal.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BUAACal.app; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 320865172528836900B169D3 /* BUAACalApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BUAACalApp.swift; sourceTree = ""; }; 53 | 320865192528836900B169D3 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 54 | 3208651E2528836A00B169D3 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 55 | 320865202528836A00B169D3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | 320865252528836A00B169D3 /* BUAACalTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BUAACalTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 57 | 320865302528836A00B169D3 /* BUAACalUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BUAACalUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 58 | 320865452528838400B169D3 /* PagerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PagerView.swift; sourceTree = ""; }; 59 | 320865472528838400B169D3 /* CalendarEventModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalendarEventModel.swift; sourceTree = ""; }; 60 | 320865482528838400B169D3 /* CalendarMonthModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalendarMonthModel.swift; sourceTree = ""; }; 61 | 3208654A2528838400B169D3 /* CalendarMonthView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalendarMonthView.swift; sourceTree = ""; }; 62 | 3208654B2528838400B169D3 /* CalendarMonthHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalendarMonthHeader.swift; sourceTree = ""; }; 63 | 3208654C2528838400B169D3 /* CalendarViewDay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalendarViewDay.swift; sourceTree = ""; }; 64 | 3208654D2528838400B169D3 /* CalendarList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalendarList.swift; sourceTree = ""; }; 65 | 320865502528838400B169D3 /* CalendarUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CalendarUtils.swift; sourceTree = ""; }; 66 | 3208658225289A7900B169D3 /* EventCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventCard.swift; sourceTree = ""; }; 67 | 3208658F2528A03100B169D3 /* CalendarEventDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarEventDataModel.swift; sourceTree = ""; }; 68 | 328AA83B2530DC6E00A3B765 /* AddEventToCalendarViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddEventToCalendarViewModel.swift; sourceTree = ""; }; 69 | 329BE22D2535AFE300FD14E5 /* EventCardDetailModal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventCardDetailModal.swift; sourceTree = ""; }; 70 | 32A2B8BF25290F110025BDCD /* UpdatingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdatingViewModel.swift; sourceTree = ""; }; 71 | 32AB07E6253E6EC60084D727 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 72 | 32C86C5A2528B7B8003E73D5 /* ExtensionColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionColor.swift; sourceTree = ""; }; 73 | 32C86C622528E031003E73D5 /* LoginSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginSheet.swift; sourceTree = ""; }; 74 | 32C86C6B2528E1AA003E73D5 /* LoginViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewModel.swift; sourceTree = ""; }; 75 | 32FBBEEB253974C500459AF6 /* DataStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataStorage.swift; sourceTree = ""; }; 76 | /* End PBXFileReference section */ 77 | 78 | /* Begin PBXFrameworksBuildPhase section */ 79 | 320865112528836900B169D3 /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | ); 84 | runOnlyForDeploymentPostprocessing = 0; 85 | }; 86 | 320865222528836A00B169D3 /* Frameworks */ = { 87 | isa = PBXFrameworksBuildPhase; 88 | buildActionMask = 2147483647; 89 | files = ( 90 | ); 91 | runOnlyForDeploymentPostprocessing = 0; 92 | }; 93 | 3208652D2528836A00B169D3 /* Frameworks */ = { 94 | isa = PBXFrameworksBuildPhase; 95 | buildActionMask = 2147483647; 96 | files = ( 97 | ); 98 | runOnlyForDeploymentPostprocessing = 0; 99 | }; 100 | /* End PBXFrameworksBuildPhase section */ 101 | 102 | /* Begin PBXGroup section */ 103 | 3208650B2528836900B169D3 = { 104 | isa = PBXGroup; 105 | children = ( 106 | 320865162528836900B169D3 /* BUAACal */, 107 | 320865152528836900B169D3 /* Products */, 108 | ); 109 | sourceTree = ""; 110 | }; 111 | 320865152528836900B169D3 /* Products */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | 320865142528836900B169D3 /* BUAACal.app */, 115 | 320865252528836A00B169D3 /* BUAACalTests.xctest */, 116 | 320865302528836A00B169D3 /* BUAACalUITests.xctest */, 117 | ); 118 | name = Products; 119 | sourceTree = ""; 120 | }; 121 | 320865162528836900B169D3 /* BUAACal */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 32C86C6A2528E17A003E73D5 /* ViewModels */, 125 | 3208657925288C1A00B169D3 /* Views */, 126 | 3208654E2528838400B169D3 /* Utilities */, 127 | 320865462528838400B169D3 /* Models */, 128 | 320865172528836900B169D3 /* BUAACalApp.swift */, 129 | 320865192528836900B169D3 /* ContentView.swift */, 130 | 320865202528836A00B169D3 /* Info.plist */, 131 | 32AB07E6253E6EC60084D727 /* Assets.xcassets */, 132 | 3208651D2528836A00B169D3 /* Preview Content */, 133 | ); 134 | path = BUAACal; 135 | sourceTree = ""; 136 | }; 137 | 3208651D2528836A00B169D3 /* Preview Content */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 3208651E2528836A00B169D3 /* Preview Assets.xcassets */, 141 | ); 142 | path = "Preview Content"; 143 | sourceTree = ""; 144 | }; 145 | 320865462528838400B169D3 /* Models */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | 320865472528838400B169D3 /* CalendarEventModel.swift */, 149 | 3208658F2528A03100B169D3 /* CalendarEventDataModel.swift */, 150 | 320865482528838400B169D3 /* CalendarMonthModel.swift */, 151 | ); 152 | path = Models; 153 | sourceTree = ""; 154 | }; 155 | 320865492528838400B169D3 /* Components */ = { 156 | isa = PBXGroup; 157 | children = ( 158 | 3208657E25288C5500B169D3 /* EventCard */, 159 | 3208657D25288C4700B169D3 /* Calendar */, 160 | ); 161 | path = Components; 162 | sourceTree = ""; 163 | }; 164 | 3208654E2528838400B169D3 /* Utilities */ = { 165 | isa = PBXGroup; 166 | children = ( 167 | 32FBBEEB253974C500459AF6 /* DataStorage.swift */, 168 | 320865502528838400B169D3 /* CalendarUtils.swift */, 169 | 32C86C5A2528B7B8003E73D5 /* ExtensionColor.swift */, 170 | ); 171 | path = Utilities; 172 | sourceTree = ""; 173 | }; 174 | 3208657925288C1A00B169D3 /* Views */ = { 175 | isa = PBXGroup; 176 | children = ( 177 | 320865452528838400B169D3 /* PagerView.swift */, 178 | 3208654D2528838400B169D3 /* CalendarList.swift */, 179 | 32C86C622528E031003E73D5 /* LoginSheet.swift */, 180 | 320865492528838400B169D3 /* Components */, 181 | ); 182 | path = Views; 183 | sourceTree = ""; 184 | }; 185 | 3208657D25288C4700B169D3 /* Calendar */ = { 186 | isa = PBXGroup; 187 | children = ( 188 | 3208654A2528838400B169D3 /* CalendarMonthView.swift */, 189 | 3208654B2528838400B169D3 /* CalendarMonthHeader.swift */, 190 | 3208654C2528838400B169D3 /* CalendarViewDay.swift */, 191 | ); 192 | path = Calendar; 193 | sourceTree = ""; 194 | }; 195 | 3208657E25288C5500B169D3 /* EventCard */ = { 196 | isa = PBXGroup; 197 | children = ( 198 | 3208658225289A7900B169D3 /* EventCard.swift */, 199 | 329BE22D2535AFE300FD14E5 /* EventCardDetailModal.swift */, 200 | ); 201 | path = EventCard; 202 | sourceTree = ""; 203 | }; 204 | 32C86C6A2528E17A003E73D5 /* ViewModels */ = { 205 | isa = PBXGroup; 206 | children = ( 207 | 32C86C6B2528E1AA003E73D5 /* LoginViewModel.swift */, 208 | 328AA83B2530DC6E00A3B765 /* AddEventToCalendarViewModel.swift */, 209 | 32A2B8BF25290F110025BDCD /* UpdatingViewModel.swift */, 210 | ); 211 | path = ViewModels; 212 | sourceTree = ""; 213 | }; 214 | /* End PBXGroup section */ 215 | 216 | /* Begin PBXNativeTarget section */ 217 | 320865132528836900B169D3 /* BUAACal */ = { 218 | isa = PBXNativeTarget; 219 | buildConfigurationList = 320865392528836A00B169D3 /* Build configuration list for PBXNativeTarget "BUAACal" */; 220 | buildPhases = ( 221 | 320865102528836900B169D3 /* Sources */, 222 | 320865112528836900B169D3 /* Frameworks */, 223 | 320865122528836900B169D3 /* Resources */, 224 | ); 225 | buildRules = ( 226 | ); 227 | dependencies = ( 228 | ); 229 | name = BUAACal; 230 | productName = BUAACal; 231 | productReference = 320865142528836900B169D3 /* BUAACal.app */; 232 | productType = "com.apple.product-type.application"; 233 | }; 234 | 320865242528836A00B169D3 /* BUAACalTests */ = { 235 | isa = PBXNativeTarget; 236 | buildConfigurationList = 3208653C2528836A00B169D3 /* Build configuration list for PBXNativeTarget "BUAACalTests" */; 237 | buildPhases = ( 238 | 320865212528836A00B169D3 /* Sources */, 239 | 320865222528836A00B169D3 /* Frameworks */, 240 | 320865232528836A00B169D3 /* Resources */, 241 | ); 242 | buildRules = ( 243 | ); 244 | dependencies = ( 245 | 320865272528836A00B169D3 /* PBXTargetDependency */, 246 | ); 247 | name = BUAACalTests; 248 | productName = BUAACalTests; 249 | productReference = 320865252528836A00B169D3 /* BUAACalTests.xctest */; 250 | productType = "com.apple.product-type.bundle.unit-test"; 251 | }; 252 | 3208652F2528836A00B169D3 /* BUAACalUITests */ = { 253 | isa = PBXNativeTarget; 254 | buildConfigurationList = 3208653F2528836A00B169D3 /* Build configuration list for PBXNativeTarget "BUAACalUITests" */; 255 | buildPhases = ( 256 | 3208652C2528836A00B169D3 /* Sources */, 257 | 3208652D2528836A00B169D3 /* Frameworks */, 258 | 3208652E2528836A00B169D3 /* Resources */, 259 | ); 260 | buildRules = ( 261 | ); 262 | dependencies = ( 263 | 320865322528836A00B169D3 /* PBXTargetDependency */, 264 | ); 265 | name = BUAACalUITests; 266 | productName = BUAACalUITests; 267 | productReference = 320865302528836A00B169D3 /* BUAACalUITests.xctest */; 268 | productType = "com.apple.product-type.bundle.ui-testing"; 269 | }; 270 | /* End PBXNativeTarget section */ 271 | 272 | /* Begin PBXProject section */ 273 | 3208650C2528836900B169D3 /* Project object */ = { 274 | isa = PBXProject; 275 | attributes = { 276 | LastSwiftUpdateCheck = 1200; 277 | LastUpgradeCheck = 1200; 278 | TargetAttributes = { 279 | 320865132528836900B169D3 = { 280 | CreatedOnToolsVersion = 12.0.1; 281 | }; 282 | 320865242528836A00B169D3 = { 283 | CreatedOnToolsVersion = 12.0.1; 284 | TestTargetID = 320865132528836900B169D3; 285 | }; 286 | 3208652F2528836A00B169D3 = { 287 | CreatedOnToolsVersion = 12.0.1; 288 | TestTargetID = 320865132528836900B169D3; 289 | }; 290 | }; 291 | }; 292 | buildConfigurationList = 3208650F2528836900B169D3 /* Build configuration list for PBXProject "BUAACal" */; 293 | compatibilityVersion = "Xcode 9.3"; 294 | developmentRegion = en; 295 | hasScannedForEncodings = 0; 296 | knownRegions = ( 297 | en, 298 | Base, 299 | ); 300 | mainGroup = 3208650B2528836900B169D3; 301 | productRefGroup = 320865152528836900B169D3 /* Products */; 302 | projectDirPath = ""; 303 | projectRoot = ""; 304 | targets = ( 305 | 320865132528836900B169D3 /* BUAACal */, 306 | 320865242528836A00B169D3 /* BUAACalTests */, 307 | 3208652F2528836A00B169D3 /* BUAACalUITests */, 308 | ); 309 | }; 310 | /* End PBXProject section */ 311 | 312 | /* Begin PBXResourcesBuildPhase section */ 313 | 320865122528836900B169D3 /* Resources */ = { 314 | isa = PBXResourcesBuildPhase; 315 | buildActionMask = 2147483647; 316 | files = ( 317 | 32AB07E7253E6EC60084D727 /* Assets.xcassets in Resources */, 318 | 3208651F2528836A00B169D3 /* Preview Assets.xcassets in Resources */, 319 | ); 320 | runOnlyForDeploymentPostprocessing = 0; 321 | }; 322 | 320865232528836A00B169D3 /* Resources */ = { 323 | isa = PBXResourcesBuildPhase; 324 | buildActionMask = 2147483647; 325 | files = ( 326 | ); 327 | runOnlyForDeploymentPostprocessing = 0; 328 | }; 329 | 3208652E2528836A00B169D3 /* Resources */ = { 330 | isa = PBXResourcesBuildPhase; 331 | buildActionMask = 2147483647; 332 | files = ( 333 | ); 334 | runOnlyForDeploymentPostprocessing = 0; 335 | }; 336 | /* End PBXResourcesBuildPhase section */ 337 | 338 | /* Begin PBXSourcesBuildPhase section */ 339 | 320865102528836900B169D3 /* Sources */ = { 340 | isa = PBXSourcesBuildPhase; 341 | buildActionMask = 2147483647; 342 | files = ( 343 | 320865552528838400B169D3 /* CalendarMonthHeader.swift in Sources */, 344 | 32A2B8C025290F110025BDCD /* UpdatingViewModel.swift in Sources */, 345 | 320865532528838400B169D3 /* CalendarMonthModel.swift in Sources */, 346 | 320865592528838400B169D3 /* CalendarUtils.swift in Sources */, 347 | 32C86C632528E031003E73D5 /* LoginSheet.swift in Sources */, 348 | 3208658325289A7900B169D3 /* EventCard.swift in Sources */, 349 | 320865902528A03100B169D3 /* CalendarEventDataModel.swift in Sources */, 350 | 3208651A2528836900B169D3 /* ContentView.swift in Sources */, 351 | 32C86C5B2528B7B8003E73D5 /* ExtensionColor.swift in Sources */, 352 | 329BE22E2535AFE300FD14E5 /* EventCardDetailModal.swift in Sources */, 353 | 32C86C6C2528E1AA003E73D5 /* LoginViewModel.swift in Sources */, 354 | 320865562528838400B169D3 /* CalendarViewDay.swift in Sources */, 355 | 320865512528838400B169D3 /* PagerView.swift in Sources */, 356 | 320865572528838400B169D3 /* CalendarList.swift in Sources */, 357 | 320865542528838400B169D3 /* CalendarMonthView.swift in Sources */, 358 | 320865522528838400B169D3 /* CalendarEventModel.swift in Sources */, 359 | 32FBBEEC253974C500459AF6 /* DataStorage.swift in Sources */, 360 | 328AA83C2530DC6E00A3B765 /* AddEventToCalendarViewModel.swift in Sources */, 361 | 320865182528836900B169D3 /* BUAACalApp.swift in Sources */, 362 | ); 363 | runOnlyForDeploymentPostprocessing = 0; 364 | }; 365 | 320865212528836A00B169D3 /* Sources */ = { 366 | isa = PBXSourcesBuildPhase; 367 | buildActionMask = 2147483647; 368 | files = ( 369 | ); 370 | runOnlyForDeploymentPostprocessing = 0; 371 | }; 372 | 3208652C2528836A00B169D3 /* Sources */ = { 373 | isa = PBXSourcesBuildPhase; 374 | buildActionMask = 2147483647; 375 | files = ( 376 | ); 377 | runOnlyForDeploymentPostprocessing = 0; 378 | }; 379 | /* End PBXSourcesBuildPhase section */ 380 | 381 | /* Begin PBXTargetDependency section */ 382 | 320865272528836A00B169D3 /* PBXTargetDependency */ = { 383 | isa = PBXTargetDependency; 384 | target = 320865132528836900B169D3 /* BUAACal */; 385 | targetProxy = 320865262528836A00B169D3 /* PBXContainerItemProxy */; 386 | }; 387 | 320865322528836A00B169D3 /* PBXTargetDependency */ = { 388 | isa = PBXTargetDependency; 389 | target = 320865132528836900B169D3 /* BUAACal */; 390 | targetProxy = 320865312528836A00B169D3 /* PBXContainerItemProxy */; 391 | }; 392 | /* End PBXTargetDependency section */ 393 | 394 | /* Begin XCBuildConfiguration section */ 395 | 320865372528836A00B169D3 /* Debug */ = { 396 | isa = XCBuildConfiguration; 397 | buildSettings = { 398 | ALWAYS_SEARCH_USER_PATHS = NO; 399 | CLANG_ANALYZER_NONNULL = YES; 400 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 401 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 402 | CLANG_CXX_LIBRARY = "libc++"; 403 | CLANG_ENABLE_MODULES = YES; 404 | CLANG_ENABLE_OBJC_ARC = YES; 405 | CLANG_ENABLE_OBJC_WEAK = YES; 406 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 407 | CLANG_WARN_BOOL_CONVERSION = YES; 408 | CLANG_WARN_COMMA = YES; 409 | CLANG_WARN_CONSTANT_CONVERSION = YES; 410 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 411 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 412 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 413 | CLANG_WARN_EMPTY_BODY = YES; 414 | CLANG_WARN_ENUM_CONVERSION = YES; 415 | CLANG_WARN_INFINITE_RECURSION = YES; 416 | CLANG_WARN_INT_CONVERSION = YES; 417 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 418 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 419 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 420 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 421 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 422 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 423 | CLANG_WARN_STRICT_PROTOTYPES = YES; 424 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 425 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 426 | CLANG_WARN_UNREACHABLE_CODE = YES; 427 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 428 | COPY_PHASE_STRIP = NO; 429 | DEBUG_INFORMATION_FORMAT = dwarf; 430 | ENABLE_STRICT_OBJC_MSGSEND = YES; 431 | ENABLE_TESTABILITY = YES; 432 | GCC_C_LANGUAGE_STANDARD = gnu11; 433 | GCC_DYNAMIC_NO_PIC = NO; 434 | GCC_NO_COMMON_BLOCKS = YES; 435 | GCC_OPTIMIZATION_LEVEL = 0; 436 | GCC_PREPROCESSOR_DEFINITIONS = ( 437 | "DEBUG=1", 438 | "$(inherited)", 439 | ); 440 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 441 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 442 | GCC_WARN_UNDECLARED_SELECTOR = YES; 443 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 444 | GCC_WARN_UNUSED_FUNCTION = YES; 445 | GCC_WARN_UNUSED_VARIABLE = YES; 446 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 447 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 448 | MTL_FAST_MATH = YES; 449 | ONLY_ACTIVE_ARCH = YES; 450 | SDKROOT = iphoneos; 451 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 452 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 453 | }; 454 | name = Debug; 455 | }; 456 | 320865382528836A00B169D3 /* Release */ = { 457 | isa = XCBuildConfiguration; 458 | buildSettings = { 459 | ALWAYS_SEARCH_USER_PATHS = NO; 460 | CLANG_ANALYZER_NONNULL = YES; 461 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 462 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 463 | CLANG_CXX_LIBRARY = "libc++"; 464 | CLANG_ENABLE_MODULES = YES; 465 | CLANG_ENABLE_OBJC_ARC = YES; 466 | CLANG_ENABLE_OBJC_WEAK = YES; 467 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 468 | CLANG_WARN_BOOL_CONVERSION = YES; 469 | CLANG_WARN_COMMA = YES; 470 | CLANG_WARN_CONSTANT_CONVERSION = YES; 471 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 472 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 473 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 474 | CLANG_WARN_EMPTY_BODY = YES; 475 | CLANG_WARN_ENUM_CONVERSION = YES; 476 | CLANG_WARN_INFINITE_RECURSION = YES; 477 | CLANG_WARN_INT_CONVERSION = YES; 478 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 479 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 480 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 481 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 482 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 483 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 484 | CLANG_WARN_STRICT_PROTOTYPES = YES; 485 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 486 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 487 | CLANG_WARN_UNREACHABLE_CODE = YES; 488 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 489 | COPY_PHASE_STRIP = NO; 490 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 491 | ENABLE_NS_ASSERTIONS = NO; 492 | ENABLE_STRICT_OBJC_MSGSEND = YES; 493 | GCC_C_LANGUAGE_STANDARD = gnu11; 494 | GCC_NO_COMMON_BLOCKS = YES; 495 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 496 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 497 | GCC_WARN_UNDECLARED_SELECTOR = YES; 498 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 499 | GCC_WARN_UNUSED_FUNCTION = YES; 500 | GCC_WARN_UNUSED_VARIABLE = YES; 501 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 502 | MTL_ENABLE_DEBUG_INFO = NO; 503 | MTL_FAST_MATH = YES; 504 | SDKROOT = iphoneos; 505 | SWIFT_COMPILATION_MODE = wholemodule; 506 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 507 | VALIDATE_PRODUCT = YES; 508 | }; 509 | name = Release; 510 | }; 511 | 3208653A2528836A00B169D3 /* Debug */ = { 512 | isa = XCBuildConfiguration; 513 | buildSettings = { 514 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 515 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 516 | CODE_SIGN_ENTITLEMENTS = ""; 517 | CODE_SIGN_STYLE = Automatic; 518 | DEVELOPMENT_ASSET_PATHS = "\"BUAACal/Preview Content\""; 519 | DEVELOPMENT_TEAM = 9223UXXW46; 520 | ENABLE_PREVIEWS = YES; 521 | INFOPLIST_FILE = BUAACal/Info.plist; 522 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 523 | LD_RUNPATH_SEARCH_PATHS = ( 524 | "$(inherited)", 525 | "@executable_path/Frameworks", 526 | ); 527 | PRODUCT_BUNDLE_IDENTIFIER = roife.BUAACal; 528 | PRODUCT_NAME = "$(TARGET_NAME)"; 529 | SUPPORTS_MACCATALYST = NO; 530 | SWIFT_VERSION = 5.0; 531 | TARGETED_DEVICE_FAMILY = 1; 532 | }; 533 | name = Debug; 534 | }; 535 | 3208653B2528836A00B169D3 /* Release */ = { 536 | isa = XCBuildConfiguration; 537 | buildSettings = { 538 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 539 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 540 | CODE_SIGN_ENTITLEMENTS = ""; 541 | CODE_SIGN_STYLE = Automatic; 542 | DEVELOPMENT_ASSET_PATHS = "\"BUAACal/Preview Content\""; 543 | DEVELOPMENT_TEAM = 9223UXXW46; 544 | ENABLE_PREVIEWS = YES; 545 | INFOPLIST_FILE = BUAACal/Info.plist; 546 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 547 | LD_RUNPATH_SEARCH_PATHS = ( 548 | "$(inherited)", 549 | "@executable_path/Frameworks", 550 | ); 551 | PRODUCT_BUNDLE_IDENTIFIER = roife.BUAACal; 552 | PRODUCT_NAME = "$(TARGET_NAME)"; 553 | SUPPORTS_MACCATALYST = NO; 554 | SWIFT_VERSION = 5.0; 555 | TARGETED_DEVICE_FAMILY = 1; 556 | }; 557 | name = Release; 558 | }; 559 | 3208653D2528836A00B169D3 /* Debug */ = { 560 | isa = XCBuildConfiguration; 561 | buildSettings = { 562 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 563 | BUNDLE_LOADER = "$(TEST_HOST)"; 564 | CODE_SIGN_STYLE = Automatic; 565 | INFOPLIST_FILE = BUAACalTests/Info.plist; 566 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 567 | LD_RUNPATH_SEARCH_PATHS = ( 568 | "$(inherited)", 569 | "@executable_path/Frameworks", 570 | "@loader_path/Frameworks", 571 | ); 572 | PRODUCT_BUNDLE_IDENTIFIER = roife.BUAACalTests; 573 | PRODUCT_NAME = "$(TARGET_NAME)"; 574 | SWIFT_VERSION = 5.0; 575 | TARGETED_DEVICE_FAMILY = "1,2"; 576 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/BUAACal.app/BUAACal"; 577 | }; 578 | name = Debug; 579 | }; 580 | 3208653E2528836A00B169D3 /* Release */ = { 581 | isa = XCBuildConfiguration; 582 | buildSettings = { 583 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 584 | BUNDLE_LOADER = "$(TEST_HOST)"; 585 | CODE_SIGN_STYLE = Automatic; 586 | INFOPLIST_FILE = BUAACalTests/Info.plist; 587 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 588 | LD_RUNPATH_SEARCH_PATHS = ( 589 | "$(inherited)", 590 | "@executable_path/Frameworks", 591 | "@loader_path/Frameworks", 592 | ); 593 | PRODUCT_BUNDLE_IDENTIFIER = roife.BUAACalTests; 594 | PRODUCT_NAME = "$(TARGET_NAME)"; 595 | SWIFT_VERSION = 5.0; 596 | TARGETED_DEVICE_FAMILY = "1,2"; 597 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/BUAACal.app/BUAACal"; 598 | }; 599 | name = Release; 600 | }; 601 | 320865402528836A00B169D3 /* Debug */ = { 602 | isa = XCBuildConfiguration; 603 | buildSettings = { 604 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 605 | CODE_SIGN_STYLE = Automatic; 606 | INFOPLIST_FILE = BUAACalUITests/Info.plist; 607 | LD_RUNPATH_SEARCH_PATHS = ( 608 | "$(inherited)", 609 | "@executable_path/Frameworks", 610 | "@loader_path/Frameworks", 611 | ); 612 | PRODUCT_BUNDLE_IDENTIFIER = roife.BUAACalUITests; 613 | PRODUCT_NAME = "$(TARGET_NAME)"; 614 | SWIFT_VERSION = 5.0; 615 | TARGETED_DEVICE_FAMILY = "1,2"; 616 | TEST_TARGET_NAME = BUAACal; 617 | }; 618 | name = Debug; 619 | }; 620 | 320865412528836A00B169D3 /* Release */ = { 621 | isa = XCBuildConfiguration; 622 | buildSettings = { 623 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 624 | CODE_SIGN_STYLE = Automatic; 625 | INFOPLIST_FILE = BUAACalUITests/Info.plist; 626 | LD_RUNPATH_SEARCH_PATHS = ( 627 | "$(inherited)", 628 | "@executable_path/Frameworks", 629 | "@loader_path/Frameworks", 630 | ); 631 | PRODUCT_BUNDLE_IDENTIFIER = roife.BUAACalUITests; 632 | PRODUCT_NAME = "$(TARGET_NAME)"; 633 | SWIFT_VERSION = 5.0; 634 | TARGETED_DEVICE_FAMILY = "1,2"; 635 | TEST_TARGET_NAME = BUAACal; 636 | }; 637 | name = Release; 638 | }; 639 | /* End XCBuildConfiguration section */ 640 | 641 | /* Begin XCConfigurationList section */ 642 | 3208650F2528836900B169D3 /* Build configuration list for PBXProject "BUAACal" */ = { 643 | isa = XCConfigurationList; 644 | buildConfigurations = ( 645 | 320865372528836A00B169D3 /* Debug */, 646 | 320865382528836A00B169D3 /* Release */, 647 | ); 648 | defaultConfigurationIsVisible = 0; 649 | defaultConfigurationName = Release; 650 | }; 651 | 320865392528836A00B169D3 /* Build configuration list for PBXNativeTarget "BUAACal" */ = { 652 | isa = XCConfigurationList; 653 | buildConfigurations = ( 654 | 3208653A2528836A00B169D3 /* Debug */, 655 | 3208653B2528836A00B169D3 /* Release */, 656 | ); 657 | defaultConfigurationIsVisible = 0; 658 | defaultConfigurationName = Release; 659 | }; 660 | 3208653C2528836A00B169D3 /* Build configuration list for PBXNativeTarget "BUAACalTests" */ = { 661 | isa = XCConfigurationList; 662 | buildConfigurations = ( 663 | 3208653D2528836A00B169D3 /* Debug */, 664 | 3208653E2528836A00B169D3 /* Release */, 665 | ); 666 | defaultConfigurationIsVisible = 0; 667 | defaultConfigurationName = Release; 668 | }; 669 | 3208653F2528836A00B169D3 /* Build configuration list for PBXNativeTarget "BUAACalUITests" */ = { 670 | isa = XCConfigurationList; 671 | buildConfigurations = ( 672 | 320865402528836A00B169D3 /* Debug */, 673 | 320865412528836A00B169D3 /* Release */, 674 | ); 675 | defaultConfigurationIsVisible = 0; 676 | defaultConfigurationName = Release; 677 | }; 678 | /* End XCConfigurationList section */ 679 | }; 680 | rootObject = 3208650C2528836900B169D3 /* Project object */; 681 | } 682 | -------------------------------------------------------------------------------- /BUAACal.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /BUAACal.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /BUAACal.xcodeproj/project.xcworkspace/xcuserdata/roife.xcuserdatad/IDEFindNavigatorScopes.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /BUAACal.xcodeproj/xcuserdata/roife.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | BUAACal.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/.DS_Store -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "images" : [ 7 | { 8 | "filename" : "icon-40.png", 9 | "scale" : "1x", 10 | "size" : "40x40", 11 | "idiom" : "ipad" 12 | }, 13 | { 14 | "idiom" : "ipad", 15 | "size" : "40x40", 16 | "filename" : "icon-40@2x.png", 17 | "scale" : "2x" 18 | }, 19 | { 20 | "scale" : "2x", 21 | "size" : "60x60", 22 | "idiom" : "iphone", 23 | "filename" : "icon-60@2x.png" 24 | }, 25 | { 26 | "size" : "72x72", 27 | "idiom" : "ipad", 28 | "filename" : "icon-72.png", 29 | "scale" : "1x" 30 | }, 31 | { 32 | "idiom" : "ipad", 33 | "size" : "72x72", 34 | "filename" : "icon-72@2x.png", 35 | "scale" : "2x" 36 | }, 37 | { 38 | "scale" : "1x", 39 | "filename" : "icon-76.png", 40 | "idiom" : "ipad", 41 | "size" : "76x76" 42 | }, 43 | { 44 | "filename" : "icon-76@2x.png", 45 | "scale" : "2x", 46 | "idiom" : "ipad", 47 | "size" : "76x76" 48 | }, 49 | { 50 | "scale" : "1x", 51 | "size" : "50x50", 52 | "idiom" : "ipad", 53 | "filename" : "icon-small-50.png" 54 | }, 55 | { 56 | "scale" : "2x", 57 | "size" : "50x50", 58 | "filename" : "icon-small-50@2x.png", 59 | "idiom" : "ipad" 60 | }, 61 | { 62 | "filename" : "icon-small.png", 63 | "scale" : "1x", 64 | "idiom" : "iphone", 65 | "size" : "29x29" 66 | }, 67 | { 68 | "size" : "29x29", 69 | "scale" : "2x", 70 | "idiom" : "iphone", 71 | "filename" : "icon-small@2x.png" 72 | }, 73 | { 74 | "filename" : "icon.png", 75 | "size" : "57x57", 76 | "idiom" : "iphone", 77 | "scale" : "1x" 78 | }, 79 | { 80 | "scale" : "2x", 81 | "idiom" : "iphone", 82 | "size" : "57x57", 83 | "filename" : "icon@2x.png" 84 | }, 85 | { 86 | "filename" : "icon-small@3x.png", 87 | "size" : "29x29", 88 | "idiom" : "iphone", 89 | "scale" : "3x" 90 | }, 91 | { 92 | "idiom" : "iphone", 93 | "filename" : "icon-40@3x.png", 94 | "size" : "40x40", 95 | "scale" : "3x" 96 | }, 97 | { 98 | "scale" : "3x", 99 | "idiom" : "iphone", 100 | "filename" : "icon-60@3x.png", 101 | "size" : "60x60" 102 | }, 103 | { 104 | "idiom" : "iphone", 105 | "scale" : "2x", 106 | "size" : "40x40", 107 | "filename" : "icon-40@2x.png" 108 | }, 109 | { 110 | "filename" : "icon-small.png", 111 | "scale" : "1x", 112 | "idiom" : "ipad", 113 | "size" : "29x29" 114 | }, 115 | { 116 | "scale" : "2x", 117 | "filename" : "icon-small@2x.png", 118 | "size" : "29x29", 119 | "idiom" : "ipad" 120 | }, 121 | { 122 | "size" : "83.5x83.5", 123 | "scale" : "2x", 124 | "idiom" : "ipad", 125 | "filename" : "icon-83.5@2x.png" 126 | }, 127 | { 128 | "scale" : "2x", 129 | "size" : "20x20", 130 | "filename" : "notification-icon@2x.png", 131 | "idiom" : "iphone" 132 | }, 133 | { 134 | "size" : "20x20", 135 | "filename" : "notification-icon@3x.png", 136 | "idiom" : "iphone", 137 | "scale" : "3x" 138 | }, 139 | { 140 | "filename" : "notification-icon~ipad.png", 141 | "scale" : "1x", 142 | "idiom" : "ipad", 143 | "size" : "20x20" 144 | }, 145 | { 146 | "idiom" : "ipad", 147 | "size" : "20x20", 148 | "filename" : "notification-icon~ipad@2x.png", 149 | "scale" : "2x" 150 | }, 151 | { 152 | "idiom" : "ios-marketing", 153 | "filename" : "ios-marketing.png", 154 | "scale" : "1x", 155 | "size" : "1024x1024" 156 | } 157 | ] 158 | } -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/icon-40.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/icon-72.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/icon-76.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/icon-small-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/icon-small-50.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/icon-small-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/icon-small-50@2x.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/icon-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/icon-small.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/icon-small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/icon-small@2x.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/icon-small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/icon-small@3x.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/icon.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/icon@2x.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/ios-marketing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/ios-marketing.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/notification-icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/notification-icon@2x.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/notification-icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/notification-icon@3x.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/notification-icon~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/notification-icon~ipad.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/AppIcon.appiconset/notification-icon~ipad@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/BUAACal/Assets.xcassets/AppIcon.appiconset/notification-icon~ipad@2x.png -------------------------------------------------------------------------------- /BUAACal/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /BUAACal/BUAACalApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BUAACalApp.swift 3 | // BUAACal 4 | // 5 | // Created by roife on 10/3/20. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct BUAACalApp: App { 12 | var body: some Scene { 13 | WindowGroup { 14 | ContentView() 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BUAACal/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // BUAACal 4 | // 5 | // Created by roife on 10/3/20. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ContentView: View { 11 | let events = DataStorage.loadData() 12 | 13 | var body: some View { 14 | CalendarList(events: self.events) { event in 15 | EventCard(data: event.data) 16 | } 17 | } 18 | } 19 | 20 | 21 | struct ContentView_Previews: PreviewProvider { 22 | static var previews: some View { 23 | ContentView() 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /BUAACal/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSCalendarsUsageDescription 6 | BUAACal 需要您的权限才能添加课程表到系统日历 7 | CFBundleDevelopmentRegion 8 | $(DEVELOPMENT_LANGUAGE) 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIApplicationSceneManifest 26 | 27 | UIApplicationSupportsMultipleScenes 28 | 29 | 30 | UIApplicationSupportsIndirectInputEvents 31 | 32 | UILaunchScreen 33 | 34 | UIRequiredDeviceCapabilities 35 | 36 | armv7 37 | 38 | UISupportedInterfaceOrientations 39 | 40 | UIInterfaceOrientationPortrait 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UISupportedInterfaceOrientations~ipad 45 | 46 | UIInterfaceOrientationPortrait 47 | UIInterfaceOrientationPortraitUpsideDown 48 | UIInterfaceOrientationLandscapeLeft 49 | UIInterfaceOrientationLandscapeRight 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /BUAACal/Models/CalendarEventDataModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CalendarEventData.swift 3 | // BUAACal 4 | // 5 | // Created by roife on 10/3/20. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | public struct CalendarEventDataModel: Hashable & Codable { 12 | let courseID: String 13 | let eventName: String 14 | let startTime: Date 15 | let endTime: Date 16 | let weeks: String 17 | let courseType: String 18 | let credit: Double 19 | let examType: Int 20 | let lessons: String 21 | var indicatorName: String // Maybe modified 22 | let locationName: String 23 | let courseHour: String 24 | var brightColorNumber: Int 25 | var darkColorNumber: Int 26 | 27 | var getStartTimeAsString: String { 28 | let dateFormmter = DateFormatter() 29 | dateFormmter.dateFormat = "HH:mm" 30 | return "\(dateFormmter.string(from: startTime))" 31 | } 32 | 33 | var getEndTimeAsString: String { 34 | let dateFormmter = DateFormatter() 35 | dateFormmter.dateFormat = "HH:mm" 36 | return "\(dateFormmter.string(from: endTime))" 37 | } 38 | 39 | mutating func setColor(brightColor: Int, darkColor: Int) { 40 | self.brightColorNumber = brightColor 41 | self.darkColorNumber = darkColor 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /BUAACal/Models/CalendarEventModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CalendarEvent.swift 3 | // 4 | // Created by roife on 3/11/20. 5 | // 6 | 7 | import Foundation 8 | 9 | @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) 10 | public struct CalendarEvent: Hashable & Codable { 11 | public var date: Date 12 | public var data: T 13 | 14 | public var calendar: Calendar 15 | 16 | public init(calendar: Calendar = Calendar.current, date: Date, data: T) { 17 | self.calendar = calendar 18 | self.data = data 19 | self.date = calendar.date(bySettingHour: 0, minute: 0, second: 0, of: date)! 20 | } 21 | 22 | public init(calendar: Calendar = Calendar.current, dateString: String, dateFormat: String = "yyyy-MM-dd", data: T) { 23 | self.calendar = calendar 24 | self.data = data 25 | 26 | let dateFormatter = DateFormatter() 27 | dateFormatter.dateFormat = dateFormat 28 | let date = dateFormatter.date(from: dateString)! 29 | 30 | let components = calendar.dateComponents([.year, .month, .day], from: date) 31 | self.date = calendar.date(from: components)! 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BUAACal/Models/CalendarMonthModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CalendarMonth.swift 3 | // 4 | // Created by roife on 3/11/20. 5 | // 6 | 7 | import Foundation 8 | 9 | public struct CalendarMonth { 10 | public var calendar: Calendar 11 | public var actualDate: Date 12 | 13 | public var year: Int 14 | public var month: Int 15 | 16 | public var key: String { 17 | "\(year)-\(month)" 18 | } 19 | 20 | public var weeks: [[Date]] 21 | 22 | public init(calendar: Calendar, actualDate: Date, weeks: [[Date]]) { 23 | self.calendar = calendar 24 | self.actualDate = actualDate 25 | self.weeks = weeks 26 | self.year = calendar.component(.year, from: actualDate) 27 | self.month = calendar.component(.month, from: actualDate) 28 | } 29 | 30 | public func nextMonth() -> CalendarMonth { 31 | let date = calendar.date(byAdding: .month, value: 1, to: actualDate) 32 | return CalendarUtils.getCalendarMonthFor(date: date!, calendar: calendar) 33 | } 34 | 35 | public func previousMonth() -> CalendarMonth { 36 | let date = calendar.date(byAdding: .month, value: -1, to: actualDate) 37 | return CalendarUtils.getCalendarMonthFor(date: date!, calendar: calendar) 38 | } 39 | 40 | public func getSurroundingMonths() -> [CalendarMonth] { 41 | [ 42 | self.previousMonth(), 43 | CalendarMonth(calendar: self.calendar, actualDate: self.actualDate, weeks: self.weeks), 44 | self.nextMonth() 45 | ] 46 | } 47 | 48 | public func monthName() -> String { 49 | let name = calendar.shortMonthSymbols[month - 1] 50 | 51 | return name.prefix(1).uppercased() + name.dropFirst() 52 | } 53 | 54 | public func monthTitle() -> String { 55 | "\(monthName()) \(year)" 56 | } 57 | 58 | public static func getSurroundingMonths(forDate date: Date, andCalendar calendar: Calendar) -> [CalendarMonth] { 59 | let calendarMonth = CalendarUtils.getCalendarMonthFor(date: date, calendar: calendar) 60 | return [ 61 | calendarMonth.previousMonth(), 62 | calendarMonth, 63 | calendarMonth.nextMonth() 64 | ] 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /BUAACal/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /BUAACal/Utilities/CalendarUtils.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CalendarUtils.swift 3 | // 4 | // Created by roife on 3/11/20. 5 | // 6 | 7 | import Foundation 8 | 9 | public struct CalendarUtils { 10 | 11 | public static let weekdays = ["日", "一", "二", "三", "四", "五", "六"] 12 | 13 | public static func isSameDay(date1: Date, date2: Date, calendar: Calendar) -> Bool { 14 | calendar.compare(date1, to: date2, toGranularity: .day) == .orderedSame 15 | } 16 | 17 | public static func resetHourPart(of date: Date, calendar: Calendar) -> Date { 18 | calendar.date(bySettingHour: 0, minute: 0, second: 0, of: date)! 19 | } 20 | 21 | public static func getCalendarMonthFor(year: Int, month: Int, calendar: Calendar) -> CalendarMonth { 22 | var comps = DateComponents() 23 | comps.year = year 24 | comps.month = month 25 | comps.day = 1 26 | 27 | let newDate = calendar.date(from: comps)! 28 | 29 | return getCalendarMonthFor(date: newDate, calendar: calendar) 30 | } 31 | 32 | public static func getCalendarMonthFor(date: Date, calendar: Calendar) -> CalendarMonth { 33 | var comps = DateComponents() 34 | comps.year = calendar.component(.year, from: date) 35 | comps.month = calendar.component(.month, from: date) 36 | comps.day = 1 37 | 38 | let newDate = calendar.date(from: comps)! 39 | 40 | var grouped: [[Date]] = [[]] 41 | var currentGroupIndex = 0 42 | var totalDaysProcessed = 0 43 | 44 | for j in calendar.range(of: .day, in: .month, for: newDate)! { 45 | let dailyDate = calendar.date(bySetting: .day, value: j, of: newDate)! 46 | if totalDaysProcessed > 0 && 47 | calendar.component(.weekday, from: dailyDate) == calendar.firstWeekday{ 48 | currentGroupIndex += 1 49 | grouped.append([]) 50 | } 51 | grouped[currentGroupIndex].append(dailyDate) 52 | totalDaysProcessed += 1 53 | } 54 | 55 | return CalendarMonth( 56 | calendar: calendar, 57 | actualDate: newDate, 58 | weeks: grouped) 59 | } 60 | 61 | public static func getCurrentYearString() -> String { 62 | let calendar = Calendar.current 63 | let year = calendar.dateComponents([.year], from: Date()).year! 64 | return "\(year)-\(year + 1)" 65 | } 66 | 67 | public static func getCurrentTermString() -> String { 68 | let calendar = Calendar.current 69 | let month = calendar.dateComponents([.month], from: Date()).month! 70 | return "\(month <= 7 ? "2" : "1")" 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /BUAACal/Utilities/DataStorage.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DataStorage.swift 3 | // BUAACal 4 | // 5 | // Created by roife on 10/16/20. 6 | // 7 | 8 | import Foundation 9 | 10 | public struct DataStorage { 11 | public typealias dictDataType = [Date: [CalendarEvent]] 12 | 13 | public static func saveData(data: dictDataType) { 14 | let standard = UserDefaults.standard 15 | standard.set(object: data, forKey: "SavedCourses") 16 | standard.synchronize() 17 | } 18 | 19 | public static func loadData() -> dictDataType { 20 | UserDefaults.standard.object(dictDataType.self, with: "SavedCourses") ?? [:] 21 | } 22 | 23 | public static func saveUserId(userId: String) { 24 | let standard = UserDefaults.standard 25 | standard.setValue(userId, forKey: "userId") 26 | standard.synchronize() 27 | } 28 | 29 | public static func loadUserId() -> String { 30 | UserDefaults.standard.string(forKey: "userId") ?? "" 31 | } 32 | } 33 | 34 | extension UserDefaults { 35 | func object(_ type: T.Type, with key: String, usingDecoder decoder: JSONDecoder = JSONDecoder()) -> T? { 36 | guard let data = self.value(forKey: key) as? Data else { 37 | return nil 38 | } 39 | return try? decoder.decode(type.self, from: data) 40 | } 41 | 42 | func set(object: T, forKey key: String, usingEncoder encoder: JSONEncoder = JSONEncoder()) { 43 | let data = try? encoder.encode(object) 44 | self.set(data, forKey: key) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /BUAACal/Utilities/ExtensionColor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ExtensionColor.swift 3 | // BUAACal 4 | // 5 | // Created by roife on 10/3/20. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | extension UIColor { 12 | convenience init(hexString: String, alpha: CGFloat = 1.0) { 13 | let hexString: String = hexString.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) 14 | let scanner = Scanner(string: hexString) 15 | if (hexString.hasPrefix("#")) { 16 | scanner.currentIndex = scanner.string.index(after: scanner.string.startIndex) 17 | } 18 | var color: UInt64 = 0 19 | scanner.scanHexInt64(&color) 20 | let mask = 0x000000FF 21 | let r = Int(color >> 16) & mask 22 | let g = Int(color >> 8) & mask 23 | let b = Int(color) & mask 24 | let red = CGFloat(r) / 255.0 25 | let green = CGFloat(g) / 255.0 26 | let blue = CGFloat(b) / 255.0 27 | self.init(red: red, green: green, blue: blue, alpha: alpha) 28 | } 29 | 30 | func toHexString() -> String { 31 | var r: CGFloat = 0 32 | var g: CGFloat = 0 33 | var b: CGFloat = 0 34 | var a: CGFloat = 0 35 | getRed(&r, green: &g, blue: &b, alpha: &a) 36 | let rgb: Int = (Int)(r * 255) << 16 | (Int)(g * 255) << 8 | (Int)(b * 255) << 0 37 | return String(format: "#%06x", rgb) 38 | } 39 | } 40 | 41 | public let colorNumbers: [Color] = [ 42 | Color(UIColor(hexString: "#6A755C")), 43 | Color(UIColor(hexString: "#9790A4")), 44 | Color(UIColor(hexString: "#6E798C")), 45 | Color(UIColor(hexString: "#87544A")), 46 | Color(UIColor(hexString: "#3C6869")), 47 | Color(UIColor(hexString: "#25556B")), 48 | Color(UIColor(hexString: "#6080A0")), 49 | Color(UIColor(hexString: "#948365")) 50 | ] 51 | 52 | public let colorNumbersLight: [Color] = [ 53 | Color(UIColor(hexString: "#93CA76")), 54 | Color(UIColor(hexString: "#A69ABD")), 55 | Color(UIColor(hexString: "#C1D8AC")), 56 | Color(UIColor(hexString: "#A0CED8")), 57 | Color(UIColor(hexString: "#E4AB9B")), 58 | Color(UIColor(hexString: "#DBD0E6")), 59 | Color(UIColor(hexString: "#DCDDDD")), 60 | Color(UIColor(hexString: "#DDBB99")) 61 | ] 62 | 63 | //public let colorNumbersLight: [Color] = [ 64 | // Color(UIColor(hexString: "#E9EFEF")), 65 | // Color(UIColor(hexString: "#E2EFF0")), 66 | // Color(UIColor(hexString: "#BCD8Df")), 67 | // Color(UIColor(hexString: "#F8F6E6")), 68 | // Color(UIColor(hexString: "#F1CFD5")), 69 | // Color(UIColor(hexString: "#E2E5EF")), 70 | // Color(UIColor(hexString: "#D5D4D8")), 71 | // Color(UIColor(hexString: "#D0E1D7")) 72 | //] 73 | -------------------------------------------------------------------------------- /BUAACal/ViewModels/AddEventToCalendarViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AddEventToCalendarViewModel.swift 3 | // BUAACal 4 | // 5 | // Created by roife on 10/10/20. 6 | // 7 | 8 | import Foundation 9 | import EventKit 10 | 11 | class AddEventToCalendarViewModel: ObservableObject { 12 | @Published var isFinished: Bool = false 13 | private let eventStore: EKEventStore = EKEventStore() 14 | 15 | func addEventToCalendar(courses: [Date: [CalendarEvent]]) { 16 | eventStore.requestAccess(to: .event) { (granted, error) in 17 | guard granted else { 18 | return 19 | } 20 | 21 | guard error == nil else { 22 | return 23 | } 24 | 25 | let newCalendar = self.createNewCalendar(); 26 | 27 | for (_, eachDayCourse) in courses { 28 | for course in eachDayCourse { 29 | let event: EKEvent = EKEvent(eventStore: self.eventStore) 30 | event.title = course.data.eventName 31 | event.startDate = course.data.startTime 32 | event.endDate = course.data.endTime 33 | event.notes = """ 34 | 编号:\(course.data.courseID) 35 | 名称:\(course.data.eventName) 36 | 教师:\(course.data.indicatorName) 37 | 学分:\(course.data.credit) 38 | 类型:\(course.data.courseType) 39 | 课时:\(course.data.courseHour) 40 | 上课星期:\(course.data.weeks) 41 | 上课时间:\(course.data.getStartTimeAsString) ~ \(course.data.getEndTimeAsString);第 \(course.data.lessons.separate(every: 2, with: ",")) 节课 42 | 考查方式:\(course.data.examType) 43 | """ 44 | event.location = course.data.locationName 45 | event.calendar = newCalendar 46 | event.alarms = [EKAlarm(relativeOffset: -60 * 20)] 47 | 48 | do { 49 | try self.eventStore.save(event, span: .thisEvent) 50 | } catch let error { 51 | print("failed to save event with error : \(error)") 52 | } 53 | } 54 | } 55 | } 56 | self.isFinished = true 57 | } 58 | 59 | private func createNewCalendar() -> EKCalendar { 60 | self.removeExistedEvents(); 61 | 62 | let newCalendar = EKCalendar(for: .event, eventStore: self.eventStore) 63 | newCalendar.title = "BUAA Courses \(CalendarUtils.getCurrentYearString()) Term \(CalendarUtils.getCurrentTermString())" 64 | newCalendar.source = self.eventStore.defaultCalendarForNewEvents?.source 65 | do { 66 | try self.eventStore.saveCalendar(newCalendar, commit: true) 67 | } catch let error { 68 | print(error) 69 | } 70 | 71 | return newCalendar; 72 | } 73 | 74 | private func removeExistedEvents() { 75 | let calendars = eventStore.calendars(for: .event) 76 | let buaaCalTitle = "BUAA Courses \(CalendarUtils.getCurrentYearString()) Term \(CalendarUtils.getCurrentTermString())" 77 | 78 | for calendar in calendars { 79 | if calendar.title == buaaCalTitle { 80 | do { 81 | try eventStore.removeCalendar(calendar, commit: true) 82 | } catch let error { 83 | print(error) 84 | } 85 | } 86 | } 87 | } 88 | } 89 | 90 | extension String { 91 | func separate(every stride: Int = 4, with separator: Character = " ") -> String { 92 | String(enumerated().map { 93 | $0 > 0 && $0 % stride == 0 ? [separator, $1] : [$1] 94 | }.joined()) 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /BUAACal/ViewModels/EventViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EventViewModel.swift 3 | // BUAACal 4 | // 5 | // Created by 吴家焱 on 10/4/20. 6 | // 7 | 8 | import Foundation 9 | -------------------------------------------------------------------------------- /BUAACal/ViewModels/LoginViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LoginViewModel.swift 3 | // BUAACal 4 | // 5 | // Created by roife on 10/4/20. 6 | // 7 | 8 | import Foundation 9 | 10 | class LoginViewModel: ObservableObject { 11 | // MARK: Login Info 12 | @Published var currentUserId = DataStorage.loadUserId() 13 | @Published var userId: String = "" 14 | @Published var password: String = "" 15 | @Published var isLogin: Bool = false 16 | 17 | private struct EmptyStruct: Codable { 18 | } 19 | 20 | private struct resJson: Codable { 21 | let e: Int 22 | let m: String 23 | let d: EmptyStruct? 24 | } 25 | 26 | func login(loginSheet: LoginSheet) { 27 | let url = URL(string: "https://app.buaa.edu.cn/uc/wap/login/check") 28 | var request = URLRequest(url: url!) 29 | request.httpMethod = "POST" 30 | 31 | let body: [String: Any] = [ 32 | "username": userId, 33 | "password": password 34 | ] 35 | 36 | request.setValue("application/x-www-form-urlencoded; charset=utf-8", forHTTPHeaderField: "Content-Type") 37 | 38 | request.setValue( 39 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36", 40 | forHTTPHeaderField: "User-Agent") 41 | 42 | request.httpBody = body.percentEncoded() 43 | 44 | DispatchQueue.main.async { 45 | self.isLogin = true 46 | } 47 | 48 | let task = URLSession.shared.dataTask(with: request) { data, response, error in 49 | DispatchQueue.main.async { 50 | self.isLogin = false 51 | } 52 | 53 | guard let _ = data, 54 | let response = response as? HTTPURLResponse, 55 | error == nil else { // check for fundamental networking error 56 | print("error", error ?? "Unknown error") 57 | return 58 | } 59 | 60 | guard (200...299) ~= response.statusCode else { // check for http errors 61 | print("statusCode should be 2xx, but is \(response.statusCode)") 62 | print("response = \(response)") 63 | return 64 | } 65 | 66 | let responseString = String(data: data!, encoding: .utf8) 67 | guard let json = self.decodeLoginResJson(responseString: responseString) else { 68 | return 69 | } 70 | 71 | guard json.e == 0 else { 72 | print(json.e) 73 | loginSheet.loginFailed = true 74 | return 75 | } 76 | 77 | DispatchQueue.main.async { 78 | loginSheet.isUpdating.toggle() 79 | loginSheet.isLogined = true 80 | self.currentUserId = self.userId 81 | DataStorage.saveUserId(userId: self.currentUserId) 82 | } 83 | } 84 | 85 | task.resume() 86 | } 87 | 88 | private func decodeLoginResJson(responseString: String?) -> resJson? { 89 | let decoder = JSONDecoder() 90 | 91 | do { 92 | return try decoder.decode(resJson.self, 93 | from: responseString!.data(using: .utf8)!) 94 | } catch let error { 95 | print(error) 96 | return nil 97 | } 98 | } 99 | } 100 | 101 | extension Dictionary { 102 | func percentEncoded() -> Data? { 103 | return map { key, value in 104 | let escapedKey = "\(key)".addingPercentEncoding(withAllowedCharacters: .urlQueryValueAllowed) ?? "" 105 | let escapedValue = "\(value)".addingPercentEncoding(withAllowedCharacters: .urlQueryValueAllowed) ?? "" 106 | return escapedKey + "=" + escapedValue 107 | } 108 | .joined(separator: "&") 109 | .data(using: .utf8) 110 | } 111 | } 112 | 113 | extension CharacterSet { 114 | static let urlQueryValueAllowed: CharacterSet = { 115 | let generalDelimitersToEncode = ":#[]@" // does not include "?" or "/" due to RFC 3986 - Section 3.4 116 | let subDelimitersToEncode = "!$&'()*+,;=" 117 | 118 | var allowed = CharacterSet.urlQueryAllowed 119 | allowed.remove(charactersIn: "\(generalDelimitersToEncode)\(subDelimitersToEncode)") 120 | return allowed 121 | }() 122 | } 123 | -------------------------------------------------------------------------------- /BUAACal/ViewModels/UpdatingViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UpdatingViewModel.swift 3 | // BUAACal 4 | // 5 | // Created by roife on 10/4/20. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | class UpdatingViewModel: ObservableObject { 12 | @Published var isUpdating: Bool = false 13 | @Published var events: [Date: [CalendarEvent]] = [:] 14 | @Published var cntFinished: Int = 0 15 | private var courseIdSet: Set = [] 16 | 17 | //MARK: JSON TYPE 18 | private struct eachClassJson: Codable { 19 | let id: String 20 | let year: String 21 | let term: String 22 | let course_id: String 23 | let course_name: String 24 | let location: String 25 | // let weekday: Weekday 26 | let lessons: String 27 | let teacher: String 28 | let week: String 29 | let course_time: String 30 | let course_type: String 31 | let credit: String 32 | let course_hour: String 33 | let khfs: String 34 | let lessArr: [Int] 35 | let order: Int 36 | let totalLength: Int 37 | } 38 | 39 | private struct classJson: Codable { 40 | let c_1: [eachClassJson]? 41 | let c_2: [eachClassJson]? 42 | let c_3: [eachClassJson]? 43 | let c_4: [eachClassJson]? 44 | let c_5: [eachClassJson]? 45 | let c_6: [eachClassJson]? 46 | let c_7: [eachClassJson]? 47 | let c_8: [eachClassJson]? 48 | let c_9: [eachClassJson]? 49 | let c_10: [eachClassJson]? 50 | let c_11: [eachClassJson]? 51 | let c_12: [eachClassJson]? 52 | let c_13: [eachClassJson]? 53 | let c_14: [eachClassJson]? 54 | } 55 | 56 | private struct dataJson: Codable { 57 | let classes: [classJson] 58 | let weekdays: [String] 59 | } 60 | 61 | private struct resJson: Codable { 62 | let e: Int 63 | let m: String 64 | let d: dataJson? 65 | } 66 | 67 | // MARK:FUNCTIONS 68 | func updateEvents() { 69 | let cookieName = "eai-sess" 70 | guard let cookie = HTTPCookieStorage.shared.cookies?.first(where: { $0.name == cookieName })?.value else { 71 | return 72 | } 73 | 74 | let url = URL(string: "https://app.buaa.edu.cn/timetable/wap/default/get-datatmp") 75 | var request = URLRequest(url: url!) 76 | request.httpMethod = "POST" 77 | request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") 78 | request.setValue( 79 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36", 80 | forHTTPHeaderField: "User-Agent") 81 | request.setValue("\(cookieName)=\(cookie)", forHTTPHeaderField: "Cookie") 82 | 83 | cntFinished = 0; 84 | self.events = [:] 85 | courseIdSet = [] 86 | 87 | for week in 1...19 { 88 | let body: [String: Any] = [ 89 | "year": CalendarUtils.getCurrentYearString(), 90 | "term": CalendarUtils.getCurrentTermString(), 91 | "week": String(week), 92 | "type": "2" 93 | ] 94 | 95 | request.httpBody = body.percentEncoded() 96 | 97 | let task = URLSession.shared.dataTask(with: request) { [self] data, response, error in 98 | DispatchQueue.main.async { 99 | cntFinished += 1 100 | if cntFinished == 19 { 101 | setColors() 102 | self.isUpdating.toggle() 103 | DataStorage.saveData(data: events) 104 | } 105 | print(cntFinished) 106 | } 107 | 108 | guard let _ = data, 109 | let response = response as? HTTPURLResponse, 110 | error == nil else { // check for fundamental networking error 111 | print("error", error ?? "Unknown error") 112 | return 113 | } 114 | 115 | guard (200...299) ~= response.statusCode else { // check for http errors 116 | print("statusCode should be 2xx, but is \(response.statusCode)") 117 | print("response = \(response)") 118 | return 119 | } 120 | 121 | guard let aJson = decodeJson(data: data) else { 122 | return 123 | } 124 | 125 | guard let days = aJson.d?.classes, 126 | let weekdays = aJson.d?.weekdays else { 127 | return 128 | } 129 | 130 | processCourse(days: days, weekdays: weekdays) 131 | } 132 | 133 | task.resume() 134 | } 135 | } 136 | 137 | private func setColors() { 138 | let courseIdArr = Array(courseIdSet) 139 | 140 | for (date, courseArr) in events { 141 | for (index, course) in courseArr.enumerated() { 142 | self.events[date]![index] 143 | .data.setColor(brightColor: (courseIdArr.firstIndex(of: course.data.courseID) ?? 01) % colorNumbersLight.count, 144 | darkColor: (courseIdArr.firstIndex(of: course.data.courseID) ?? 01) % colorNumbers.count) 145 | } 146 | } 147 | } 148 | 149 | private func processCourse(days: [classJson], weekdays: [String]) { 150 | let dateFormatter = DateFormatter() 151 | dateFormatter.dateFormat = "yyyy-MM-dd HH:mm" 152 | 153 | for (index, day) in days.enumerated() { 154 | let c_n: [[eachClassJson]] = [ 155 | day.c_1 ?? [], 156 | day.c_2 ?? [], 157 | day.c_3 ?? [], 158 | day.c_4 ?? [], 159 | day.c_5 ?? [], 160 | day.c_6 ?? [], 161 | day.c_7 ?? [], 162 | day.c_8 ?? [], 163 | day.c_9 ?? [], 164 | day.c_10 ?? [], 165 | day.c_11 ?? [], 166 | day.c_12 ?? [], 167 | day.c_13 ?? [], 168 | day.c_14 ?? []] 169 | 170 | for c_i in c_n { 171 | for course in c_i { 172 | var courseTime = course.course_time.split(separator: "~") 173 | 174 | if courseTime.isEmpty { 175 | courseTime = ["20:40", "22:15"] 176 | } 177 | 178 | guard let startTime = dateFormatter.date(from: weekdays[index] + " " + courseTime[0]), 179 | let endTime = dateFormatter.date(from: weekdays[index] + " " + courseTime[1]) else { 180 | continue 181 | } 182 | 183 | let courseData = CalendarEventDataModel( 184 | courseID: course.course_id, 185 | eventName: course.course_name, 186 | startTime: startTime, 187 | endTime: endTime, 188 | weeks: course.week, 189 | courseType: course.course_type, 190 | credit: Double(course.credit)!, 191 | examType: Int(course.khfs)!, 192 | lessons: course.lessons, 193 | indicatorName: course.teacher, 194 | locationName: course.location, 195 | courseHour: course.course_hour, 196 | brightColorNumber: 01, 197 | darkColorNumber: 0) 198 | 199 | let event = CalendarEvent( 200 | dateString: weekdays[index], 201 | data: courseData) 202 | 203 | courseIdSet.insert(course.course_id) 204 | 205 | DispatchQueue.main.async { 206 | let date = event.date 207 | 208 | if self.events[date] == nil { 209 | self.events[date] = [event] 210 | } else if let duplicatedCourseIndex = self.events[event.date]? 211 | .firstIndex(where: { $0.data.startTime == startTime }) { 212 | if ((self.events[date]?[duplicatedCourseIndex].data.indicatorName 213 | .split(separator: ",") 214 | .first(where: { $0 == course.teacher })) == nil) { 215 | self.events[date]?[duplicatedCourseIndex].data.indicatorName += "," + course.teacher 216 | } 217 | } else { 218 | self.events[date]?.append(event) 219 | } 220 | } 221 | 222 | } 223 | } 224 | } 225 | } 226 | 227 | private func decodeJson(data: Data?) -> resJson? { 228 | let responseString = String(data: data!, encoding: .utf8) 229 | let decoder = JSONDecoder() 230 | 231 | do { 232 | return try decoder.decode(resJson.self, 233 | from: responseString!.data(using: .utf8)!) 234 | } catch let error { 235 | print(error) 236 | return nil 237 | } 238 | } 239 | } 240 | -------------------------------------------------------------------------------- /BUAACal/Views/CalendarList.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CalendarList.swift 3 | // 4 | // Created by roife on 3/11/20. 5 | // 6 | 7 | import SwiftUI 8 | 9 | @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) 10 | public struct CalendarList: View { 11 | @State private var months: [CalendarMonth] 12 | @State private var currentPage = 1 13 | 14 | @State public var selectedDate: Date = Date() 15 | 16 | @State public var isLogined = false 17 | @State public var isLoginSheetPresented = false 18 | @State public var showAlert = false 19 | @State public var showModal = false 20 | @State private var currentSelectEventData: CalendarEventDataModel? 21 | 22 | @ObservedObject var updatingVM = UpdatingViewModel() 23 | @ObservedObject var addEventVM = AddEventToCalendarViewModel() 24 | 25 | private let calendarDayHeight: CGFloat = 60 26 | private let calendar: Calendar 27 | 28 | private var viewForEventBlock: (CalendarEvent) -> Content 29 | 30 | private var selectedDateColor: Color 31 | private var todayDateColor: Color 32 | 33 | public init(initialDate: Date = Date(), 34 | calendar: Calendar = Calendar.current, 35 | events: [Date: [CalendarEvent]] = [:], 36 | selectedDateColor: Color = colorNumbersLight[1], 37 | todayDateColor: Color = colorNumbersLight[1].opacity(0.3), 38 | @ViewBuilder viewForEvent: @escaping (CalendarEvent) -> Content) { 39 | 40 | self.calendar = calendar 41 | _months = State(initialValue: CalendarMonth.getSurroundingMonths(forDate: initialDate, andCalendar: calendar)) 42 | 43 | self.viewForEventBlock = viewForEvent 44 | 45 | self.selectedDateColor = selectedDateColor 46 | self.todayDateColor = todayDateColor 47 | 48 | updatingVM.events = events 49 | } 50 | 51 | public var body: some View { 52 | ZStack { 53 | if updatingVM.isUpdating { 54 | ProgressView("正在获取课程表 (\(updatingVM.cntFinished)/19)") 55 | .progressViewStyle(CircularProgressViewStyle()) 56 | .onAppear() { 57 | updatingVM.updateEvents() 58 | } 59 | } else { 60 | NavigationView { 61 | commonBody 62 | .navigationBarTitle("\(self.months[self.currentPage].monthTitle())", displayMode: .inline) 63 | .navigationBarItems(leading: leadingButtons(), trailing: trailingButtons()) 64 | } 65 | .blur(radius: showModal ? 20 : 0) 66 | } 67 | 68 | if showModal { 69 | EventCardDetailModal(showModal: self.$showModal, 70 | data: self.currentSelectEventData!) 71 | } 72 | } 73 | } 74 | 75 | public var commonBody: some View { 76 | VStack { 77 | VStack { 78 | CalendarMonthHeader(calendar: self.months[1].calendar, calendarDayHeight: self.calendarDayHeight) 79 | 80 | HStack(alignment: .top) { 81 | PagerView(pageCount: self.months.count, currentIndex: self.$currentPage, pageChanged: self.updateMonthsAfterPagerSwipe) { 82 | ForEach(self.months, id: \.key) { month in 83 | CalendarMonthView( 84 | month: month, 85 | calendar: self.months[1].calendar, 86 | selectedDate: self.$selectedDate, 87 | showModal: self.$showModal, 88 | calendarDayHeight: self.calendarDayHeight, 89 | eventsForDate: updatingVM.events, 90 | selectedDateColor: self.selectedDateColor, 91 | todayDateColor: self.todayDateColor) 92 | } 93 | } 94 | } 95 | .frame(height: CGFloat(self.months[1].weeks.count) * self.calendarDayHeight) 96 | } 97 | 98 | Divider() 99 | 100 | List { 101 | ForEach(eventsForSelectedDate(), id: \.data) { event in 102 | self.viewForEventBlock(event) 103 | .onTapGesture { 104 | withAnimation { 105 | self.showModal.toggle() 106 | self.currentSelectEventData = event.data 107 | } 108 | } 109 | } 110 | } 111 | .listStyle(PlainListStyle()) 112 | } 113 | } 114 | 115 | func updateMonthsAfterPagerSwipe(newIndex: Int) { 116 | let newMonths = self.months[self.currentPage].getSurroundingMonths() 117 | 118 | if newIndex == 0 { 119 | self.months.remove(at: 1) 120 | self.months.remove(at: 1) 121 | } else { //newIndex == 2 122 | self.months.remove(at: 0) 123 | self.months.remove(at: 0) 124 | } 125 | 126 | self.months.insert(newMonths[0], at: 0) 127 | self.months.insert(newMonths[2], at: 2) 128 | 129 | self.currentPage = 1 130 | } 131 | 132 | func eventsForSelectedDate() -> [CalendarEvent] { 133 | let actualDay = CalendarUtils.resetHourPart(of: self.selectedDate, calendar: self.calendar) 134 | 135 | return updatingVM.events[actualDay] ?? [] 136 | } 137 | 138 | func leadingButtons() -> some View { 139 | Button(action: { 140 | guard !showModal else { 141 | return 142 | } 143 | withAnimation { 144 | self.addEventVM.addEventToCalendar(courses: updatingVM.events) 145 | } 146 | }) { 147 | Image(systemName: "calendar.badge.plus").font(.title2) 148 | } 149 | .alert(isPresented: $addEventVM.isFinished) { 150 | Alert(title: Text("添加成功"), message: Text("成功将课程同步到系统日历!"), dismissButton: .default(Text("好"))) 151 | } 152 | } 153 | 154 | func trailingButtons() -> some View { 155 | HStack { 156 | Button(action: { 157 | guard !showModal else { 158 | return 159 | } 160 | if isLogined { 161 | updatingVM.isUpdating = true 162 | updatingVM.updateEvents() 163 | } else { 164 | self.showAlert = true 165 | } 166 | }) { 167 | Image(systemName: "arrow.2.circlepath").font(.title2) 168 | } 169 | .alert(isPresented: $showAlert) { 170 | Alert(title: Text("登录"), message: Text("需要重新登录之后才能更新课表!"), dismissButton: .default(Text("好"))) 171 | } 172 | .padding(.trailing, 10) 173 | 174 | Button(action: { 175 | guard !showModal else { 176 | return 177 | } 178 | self.isLoginSheetPresented.toggle() 179 | }) { 180 | Image(systemName: "person.crop.circle").font(.title2) 181 | } 182 | .sheet(isPresented: $isLoginSheetPresented) { 183 | LoginSheet( 184 | isLoginSheetPresented: $isLoginSheetPresented, 185 | isUpdating: $updatingVM.isUpdating, 186 | isLogined: $isLogined) 187 | } 188 | } 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /BUAACal/Views/Components/Calendar/CalendarMonthHeader.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CalendarMonthHeader.swift 3 | // 4 | // Created by roife on 3/11/20. 5 | // 6 | 7 | import SwiftUI 8 | 9 | @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) 10 | struct CalendarMonthHeader: View { 11 | let calendar: Calendar 12 | let calendarDayHeight: CGFloat 13 | 14 | var body: some View { 15 | GeometryReader { geometry in 16 | VStack(spacing: 0) { 17 | Spacer() 18 | 19 | HStack(spacing: 0) { 20 | Spacer() 21 | ForEach(CalendarUtils.weekdays, id: \.self) { weekday in 22 | Text("\(weekday)") 23 | .fontWeight(.semibold) 24 | .frame(width: abs((geometry.size.width - 20) / 7), 25 | height: self.calendarDayHeight / 2) 26 | } 27 | Spacer() 28 | } 29 | } 30 | }.frame(height: self.calendarDayHeight / 2) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BUAACal/Views/Components/Calendar/CalendarMonthView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CalendarMonthView.swift 3 | // 4 | // Created by roife on 3/11/20. 5 | // 6 | 7 | import SwiftUI 8 | 9 | @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) 10 | struct CalendarMonthView: View { 11 | let month: CalendarMonth 12 | let calendar: Calendar 13 | 14 | @Binding var selectedDate: Date 15 | @Binding var showModal: Bool 16 | 17 | let calendarDayHeight: CGFloat 18 | 19 | let eventsForDate: [Date: [CalendarEvent]] 20 | 21 | let selectedDateColor: Color 22 | let todayDateColor: Color 23 | 24 | var body: some View { 25 | GeometryReader { geometry in 26 | VStack(spacing: 0) { 27 | ForEach(self.month.weeks, id: \.self) { week in 28 | HStack(spacing: 0) { 29 | if week.count < 7 && self.containsFirstDayOfMonth(week) { 30 | ForEach(1...7 - week.count, id: \.self) { num in 31 | Text("") 32 | .frame(width: abs(self.dayViewWidth(parentWidth: abs(geometry.size.width))), 33 | height: self.calendarDayHeight) 34 | 35 | } 36 | } 37 | 38 | ForEach(week, id: \.self) { day in 39 | CalendarViewDay( 40 | calendar: self.calendar, 41 | day: day, 42 | selected: CalendarUtils.isSameDay(date1: self.selectedDate, 43 | date2: day, 44 | calendar: self.calendar), 45 | hasEvents: self.dayHasEvents(day), 46 | width: self.dayViewWidth(parentWidth: geometry.size.width), 47 | height: self.calendarDayHeight, 48 | selectedDateColor: self.selectedDateColor, 49 | todayDateColor: self.todayDateColor) 50 | .onTapGesture { 51 | guard !showModal else { 52 | return 53 | } 54 | self.selectedDate = day 55 | } 56 | } 57 | 58 | if week.count < 7 && !self.containsFirstDayOfMonth(week) { 59 | ForEach(1...7 - week.count, id: \.self) { num in 60 | Text("") 61 | .frame(width: abs(self.dayViewWidth(parentWidth: abs(geometry.size.width))), 62 | height: self.calendarDayHeight) 63 | } 64 | } 65 | } 66 | 67 | .padding([.leading, .trailing], 10) 68 | } 69 | } 70 | } 71 | } 72 | 73 | func dayViewWidth(parentWidth: CGFloat) -> CGFloat { 74 | (parentWidth - 20) / 7 75 | } 76 | 77 | func containsFirstDayOfMonth(_ dates: [Date]) -> Bool { 78 | dates.contains { (date) -> Bool in 79 | calendar.component(.day, from: date) == 1 80 | } 81 | } 82 | 83 | func dayHasEvents(_ date: Date) -> Bool { 84 | let actualDay = CalendarUtils.resetHourPart(of: date, calendar: self.calendar) 85 | 86 | if let events = self.eventsForDate[actualDay] { 87 | return events.count > 0 88 | } else { 89 | return false 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /BUAACal/Views/Components/Calendar/CalendarViewDay.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CalendarViewDay.swift 3 | // 4 | // Created by roife on 3/11/20. 5 | // 6 | 7 | import SwiftUI 8 | 9 | @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) 10 | struct CalendarViewDay: View { 11 | let calendar: Calendar 12 | let day: Date 13 | let selected: Bool 14 | let hasEvents: Bool 15 | let width: CGFloat 16 | let height: CGFloat 17 | 18 | let selectedDateColor: Color 19 | let todayDateColor: Color 20 | 21 | var body: some View { 22 | 23 | ZStack(alignment: .bottom) { 24 | Text("\(self.dateFormatter().string(from: day))") 25 | .font(.body) 26 | .foregroundColor(self.selected ? Color.white : 27 | self.calendar.isDateInWeekend(self.day) ? Color.secondary : Color.primary) 28 | 29 | if hasEvents { 30 | Circle() 31 | .frame(width: 6, height: 6) 32 | .offset(x: 0, y: 18) 33 | .foregroundColor(Color.secondary) 34 | } 35 | } 36 | .padding(8) 37 | .frame(width: abs(self.width)) 38 | .background(Circle() 39 | .foregroundColor(dateColor()) 40 | .padding(0)) 41 | .padding([.top, .bottom], 10) 42 | .frame(height: self.height) 43 | } 44 | 45 | func dateColor() -> Color { 46 | if self.selected { 47 | return self.selectedDateColor 48 | } else if calendar.isDateInToday(day) { 49 | return self.todayDateColor 50 | } else { 51 | return Color.clear 52 | } 53 | } 54 | 55 | func dateFormatter() -> DateFormatter { 56 | let formatter = DateFormatter() 57 | formatter.locale = .current 58 | formatter.dateFormat = "d" 59 | return formatter 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /BUAACal/Views/Components/EventCard/EventCard.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EventCard.swift 3 | // BUAACal 4 | // 5 | // Created by roife on 10/3/20. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct EventCard: View { 11 | @Environment(\.colorScheme) var colorScheme 12 | let data: CalendarEventDataModel 13 | 14 | var body: some View { 15 | VStack { 16 | HStack(alignment: .top) { 17 | VStack(alignment: .leading) { 18 | Text(data.eventName) 19 | .font(.system(size: 22, 20 | weight: .bold, 21 | design: .rounded)) 22 | .padding(.bottom, 1) 23 | 24 | Text(data.indicatorName) 25 | .font(.system(size: 14, 26 | design: .rounded)) 27 | .padding(.bottom, 3) 28 | 29 | Text("\(data.getStartTimeAsString) ~ \(data.getEndTimeAsString)") 30 | .font(.system(size: 16, 31 | weight: .semibold, 32 | design: .rounded)) 33 | } 34 | 35 | Spacer() 36 | 37 | VStack { 38 | Text("@ \(data.locationName)") 39 | .font(.system(size: 18, 40 | design: .rounded)) 41 | } 42 | } 43 | } 44 | .padding(15) 45 | .background(colorScheme == .light ? colorNumbersLight[data.brightColorNumber] : colorNumbers[data.darkColorNumber]) 46 | .cornerRadius(15) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /BUAACal/Views/Components/EventCard/EventCardDetailModal.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EventCardDetailModal.swift 3 | // BUAACal 4 | // 5 | // Created by roife on 10/13/20. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct EventCardDetailModal: View { 11 | @Environment(\.colorScheme) var colorScheme 12 | @Binding var showModal: Bool 13 | let data: CalendarEventDataModel 14 | 15 | var body: some View { 16 | VStack { 17 | HStack(alignment: .top) { 18 | Spacer() 19 | 20 | HStack(alignment: .top) { 21 | VStack(alignment: .leading) { 22 | Text(data.eventName) 23 | .font(.system(size: 28, 24 | weight: .bold, 25 | design: .rounded)) 26 | .padding(.top, 3) 27 | 28 | Text(data.courseID) 29 | .font(.system(size: 16, 30 | weight: .light, 31 | design: .rounded)) 32 | .padding(.bottom, 3) 33 | 34 | Text("\(data.getStartTimeAsString) ~ \(data.getEndTimeAsString)") 35 | .font(.system(size: 18, 36 | weight: .semibold, 37 | design: .rounded)) 38 | .padding(.bottom, 1) 39 | 40 | Text("@ \(data.locationName)") 41 | .font(.system(size: 18, 42 | design: .rounded)) 43 | .padding([.trailing], 0) 44 | .padding(.bottom, 3) 45 | 46 | VStack(alignment: .leading) { 47 | Text("教师:\(data.indicatorName)") 48 | .font(.system(size: 17, 49 | design: .rounded)) 50 | .padding(.bottom, 1) 51 | 52 | Text("学分:\(String(format: "%.2f", data.credit))") 53 | .font(.system(size: 17, 54 | design: .rounded)) 55 | .padding(.bottom, 1) 56 | 57 | Text("类型:\(data.courseType)") 58 | .font(.system(size: 17, 59 | design: .rounded)) 60 | .padding(.bottom, 1) 61 | 62 | Text("时间:第 \(data.lessons.separate(every: 2, with: ",")) 节") 63 | .font(.system(size: 17, 64 | design: .rounded)) 65 | .padding(.bottom, 1) 66 | 67 | Text("课时:\(data.courseHour) 小时") 68 | .font(.system(size: 17, 69 | design: .rounded)) 70 | .padding(.bottom, 1) 71 | 72 | Text("上课星期:\(data.weeks)") 73 | .font(.system(size: 17, 74 | design: .rounded)) 75 | .padding(.bottom, 1) 76 | 77 | Text("考查方式:\(data.examType)") 78 | .font(.system(size: 17, 79 | design: .rounded)) 80 | .padding(.bottom, 1) 81 | } 82 | 83 | } 84 | Spacer() 85 | } 86 | .padding(15) 87 | .background(colorScheme == .light 88 | ? colorNumbersLight[data.brightColorNumber] 89 | : colorNumbers[data.darkColorNumber]) 90 | .cornerRadius(15) 91 | .shadow(radius: 10) 92 | 93 | Spacer() 94 | } 95 | 96 | HStack { 97 | Button() { 98 | withAnimation { 99 | showModal.toggle() 100 | } 101 | } label: { 102 | Spacer() 103 | Text("完成") 104 | Spacer() 105 | } 106 | .padding(15) 107 | .background(colorScheme == .light 108 | ? colorNumbersLight[data.brightColorNumber] 109 | : colorNumbers[data.darkColorNumber]) 110 | .foregroundColor(colorScheme == .light ? .black : .white) 111 | .cornerRadius(45) 112 | .frame(minWidth: 0, maxWidth: .infinity) 113 | .shadow(radius: 1) 114 | } 115 | .padding([.leading], 5) 116 | .padding([.trailing], 5) 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /BUAACal/Views/LoginSheet.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LoginSheet.swift 3 | // BUAACal 4 | // 5 | // Created by roife on 10/4/20. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct LoginSheet: View { 11 | @Binding var isLoginSheetPresented: Bool 12 | @Binding var isUpdating: Bool 13 | @Binding var isLogined: Bool 14 | @ObservedObject var loginVM = LoginViewModel() 15 | 16 | @State var loginFailed: Bool = false 17 | @State var showReloginAlert: Bool = false 18 | 19 | var body: some View { 20 | if loginVM.isLogin { 21 | ProgressView("登录中...") 22 | .progressViewStyle(CircularProgressViewStyle()) 23 | .onDisappear() { 24 | if !loginFailed { 25 | isLoginSheetPresented.toggle() 26 | 27 | } 28 | } 29 | } else { 30 | NavigationView { 31 | Form { 32 | Section(header: Text(loginVM.currentUserId.isEmpty ? "登录信息北航" 33 | : isLogined ? "当前用户:\(loginVM.currentUserId) (已登录)" 34 | : "当前用户:\(loginVM.currentUserId) (未登录)")) { 35 | TextField("学号", text: $loginVM.userId) 36 | .keyboardType(.numberPad) 37 | .disableAutocorrection(true) 38 | .autocapitalization(.none) 39 | SecureField("密码", text: $loginVM.password) 40 | } 41 | Section() { 42 | Button("登录并更新") { 43 | if isLogined { 44 | showReloginAlert = true 45 | } else { 46 | loginVM.login(loginSheet: self) 47 | } 48 | } 49 | .disabled(loginVM.userId.isEmpty || loginVM.password.isEmpty) 50 | .alert(isPresented: $showReloginAlert) { 51 | Alert(title: Text("登录提醒"), 52 | message: Text("检测到您已经登录账号,是否切换用户?"), 53 | primaryButton: .destructive(Text("确定")) { 54 | loginVM.login(loginSheet: self) 55 | }, 56 | secondaryButton: .cancel(Text("取消"))) 57 | } 58 | } 59 | } 60 | .navigationBarTitle(Text("登录"), displayMode: .inline) 61 | } 62 | .alert(isPresented: $loginFailed) { 63 | Alert(title: Text("登陆发生错误"), message: Text("请检查学号和密码是否输入正确"), dismissButton: .default(Text("好"))) 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /BUAACal/Views/PagerView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PagerView.swift 3 | // 4 | // Created by roife on 3/11/20. 5 | // Copyright © 2020 roife. All rights reserved. 6 | // 7 | // https://swiftwithmajid.com/2019/12/25/building-pager-view-in-swiftui/ 8 | // 9 | 10 | import SwiftUI 11 | 12 | @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) 13 | struct PagerView: View { 14 | let pageCount: Int 15 | @Binding var currentIndex: Int 16 | let content: Content 17 | 18 | @GestureState private var translation: CGFloat = 0 19 | 20 | var pageChanged: ((Int) -> ())? = nil 21 | 22 | init(pageCount: Int, currentIndex: Binding, pageChanged: ((Int) -> ())? = nil, @ViewBuilder content: () -> Content) { 23 | 24 | self.pageCount = pageCount 25 | self._currentIndex = currentIndex 26 | self.pageChanged = pageChanged 27 | self.content = content() 28 | } 29 | 30 | var body: some View { 31 | GeometryReader { geometry in 32 | HStack(alignment: .center, spacing: 0) { 33 | self.content.frame(width: geometry.size.width) 34 | //, alignment: .topLeading) 35 | } 36 | 37 | .frame(width: geometry.size.width, alignment: .leading) 38 | .offset(x: -CGFloat(self.currentIndex) * geometry.size.width) 39 | .offset(x: self.translation) 40 | .animation(.interactiveSpring()) 41 | .gesture( 42 | DragGesture().updating(self.$translation) { value, state, _ in 43 | state = value.translation.width 44 | }.onEnded { value in 45 | let offset = value.translation.width / geometry.size.width 46 | let newIndex = (CGFloat(self.currentIndex) - offset).rounded() 47 | 48 | let oldIndex = self.currentIndex 49 | 50 | self.currentIndex = min(max(Int(newIndex), 0), self.pageCount - 1) 51 | 52 | if oldIndex != self.currentIndex, let pageChanged = self.pageChanged { 53 | pageChanged(self.currentIndex) 54 | } 55 | 56 | } 57 | ) 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 设计目的 2 | 3 | 很多同学都依赖信息北航来查询课程,但是信息北航的课程表没有提醒上课的功能。也有些同学使用一些 App,但是这些 App 冗余信息过多,往往存在广告。 4 | 5 | 经过调研,我发现可以利用系统自带的“日历” App 来满足同学们对于课程查看和提醒的需求。为此,我开发了这个 App,用于查看课程信息,并可以将其导入系统原生的“日历” App。 6 | 7 | 本 App 使用了 SwiftUI 2.0 编写。 8 | 9 | # 界面设计 10 | 11 | App 主要可以分为三个界面,分别是主界面,“登陆”界面和“课程详细信息”界面。 12 | 13 | ## 主界面 14 | 15 | 主界面由日历头部,日历和课程列表三部分构成。 16 | 17 | ![主界面](./imgs/UI.png) 18 | 19 | ![主界面 - dark](./imgs/darkUI.png) 20 | 21 | 其中,header 包括了当前月份显示以及三个按钮,三个按钮分别用于“添加课程事项到系统日历”,“更新课程列表”和“用户登录”。 22 | 23 | 日历界面可以单击对应的日期来切换课程列表的显示;左右划动日历界面可以切换月份。当选中其他日期时,当天日期会用一个阴影来突出强调。 24 | 25 | 课程列表可以显示选中日期的课程列表。其中不同的课程会用不同的颜色来表示。点击相应的课程可以进入“课程详细信息”界面。 26 | 27 | ## 登陆界面 28 | 29 | ![登录界面](./imgs/UI-2.png) 30 | 31 | 登录界面是一个 sheet,包括四部分。 32 | 33 | 其中,最上面是提示文字,会根据不同的登录情况显示不同的信息。 34 | - 如果用户是第一次使用,则会显示“登录信息北航”。 35 | - 如果用户以前登录过,但是现在没有处于登录状态,则会显示“当前用户” + 学号 + “(未登录)” 36 | - 如果用户以前登录过,但是现在处于登录状态,则会显示“当前用户” + 学号 + “(已登录)” 37 | 38 | 接下来分别是用户输入学号(`numberPad`)和密码的输入框(`SecureField`)。 39 | 40 | 最后是一个“登录”按钮。只有当用户输入了学号和密码时,“登录”按钮才可用。 41 | 42 | 点击“登录”按钮后的界面逻辑有三种: 43 | - 当用户已经登录了账号时,点击登录按钮会显示一个 alert “检测到您已经登录账号,是否切换用户?”。 44 | - 确认登录后,如果登录不成功,则显示一个 alert “请检查学号和密码是否输入正确”。 45 | - 如果登录成功则进入一个加载界面(ProgressView),同时更新课程。 46 | 47 | ![加载课程](./imgs/loading.png) 48 | 49 | ## 课程详细信息界面 50 | 51 | 课程详细信息界面在单击课程项目时显示。 52 | 53 | 显示课程详细信息时,背景会进行高斯模糊,同时课程卡片会使用阴影来突出显示内容。 54 | 55 | ![课程详细信息界面](./imgs/detail.png) 56 | 57 | ## 配合系统“日历”使用 58 | 59 | ![系统日历](./imgs/system.jpeg) 60 | 61 | # 代码结构与介绍 62 | 63 | 项目采用 MVVM 架构。 64 | 65 | - `/ViewModels`: 存储 ViewModels 66 | + `LoginViewModel.swift`: 用于登录的逻辑 67 | + `AddEventToCalendarViewModel.swift`: 用于将课程添加到系统日历 68 | + `UpdatingViewModel.swift`: 用于更新课程操作 69 | - `/Views`: 存储 SwiftUI 描述的界面 70 | + `PagerView.swift`: 71 | + `CalendarList.swift`: 日历界面和课程列表界面 72 | + `LoginSheet.swift`: 登陆界面 73 | + `/Components`: 包括 UI 中用到的各种组件 74 | + `/EventCard`: 课程卡片的 UI 75 | + `EventCard.swift`: 课程卡片 UI 76 | + `EventCardDetailModal.swift`: 课程详细信息的 UI 77 | + `/Calendar`: 日历 UI 78 | + `CalendarMonthView.swift`: 月份 79 | + `CalendarMonthHeader.swift`: 日历头部(星期) 80 | + `CalendarViewDay.swift`: 单天的按钮 81 | - `/Utilities`: 逻辑组件 82 | + `DataStorage.swift`: 存储用户信息 83 | + `CalendarUtils.swift`: 日期时间运算 84 | + `ExtensionColor.swift`: 颜色处理 85 | - `Models`: 定义数据 Models 86 | + `CalendarEventModel.swift`: 定义某一天的时间 Model 87 | + `CalendarEventDataModel.swift`: 某个课程的信息 Model 88 | + `CalendarMonthModel.swift`: 某一个月份的数据 Model 89 | - `ContentView.swift`: 课程内容 90 | - `BUAACalApp.swift`: App 主体 91 | 92 | ### `LoginViewModel.swift` 93 | 94 | 本文件包含了一个类 `LoginViewModel`,用于存储登录的相关信息。与 `LoginSheet.swift` 相对应。 95 | 96 | - `LoginViewModel` 97 | + `@Published` 变量 98 | + `currentUserId`: 当前用户的 Id,打开 App 时会自动调用 `DataStorage.loadUserId()` 从 `UserDefaults` 中读取用户学号信息 99 | + `userId`:存储用户输入的学号 100 | + `password`:存储用户输入的密码 101 | + `isLogin`:保存用户是否登录 102 | + 函数 103 | + `login(:LoginSheet)`:传入绑定的 `LoginSheet`,进行登录 104 | 105 | ### `AddEventToCalendarViewModel.swift` 106 | 107 | 本文件包含了一个类 `AddEventToCalendarViewModel`,用于添加事件到系统日历。 108 | 109 | - `AddEventToCalendarViewModel` 110 | + `@Published` 变量 111 | + `isFinished`: 返回是否添加成功 112 | + 函数 113 | + `addEventToCalendar()[Date: [CalendarEvent]]`:添加事件到日历 114 | 115 | ### `UpdatingViewModel.swift` 116 | 117 | 本文件包含了一个类 `UpdatingViewModel`,用于更新课程列表。 118 | 119 | - `UpdatingViewModel` 120 | + `@Published` 变量 121 | + `isUpdating`:是否正在更新 122 | + `events`:存储所有的课程信息 123 | + `cntFinished`:存储当前有几个异步任务已经完成(用于判断是否所有任务都已经完成) 124 | + 函数 125 | + `updateEvents`:更新课程 126 | 127 | ## Utilities 128 | 129 | ## Models 130 | 131 | ### `CalendarEvent.swift` 132 | 133 | 本文件用于存储某一课程的数据,用于 UI 显示。 134 | 135 | - `CalendarEvent` 136 | - `date: Date`:课程所在日期 137 | - `data: T`:课程详细数据 138 | - `calendar: Calendar`:日历 139 | 140 | ### `CalendarEventDataModel.swift` 141 | 142 | 本文件用于存储某一课程的详细数据。 143 | 144 | - `CalendarEventDataModel` 145 | - `courseID: String`:课程编号 146 | - `eventName: String`:课程名称 147 | - `startTime: Date`:课程开始时间 148 | - `endTime: Date`:课程结束时间 149 | - `weeks: String`:上课的星期 150 | - `courseType: String`:课程类型 151 | - `credit: Double`:课程学分 152 | - `examType: Int`:课程考核方式 153 | - `lessons: String`:上课的节数 154 | - `indicatorName: String`:教师名称 155 | - `locationName: String`:上课地点 156 | - `courseHour: String`:上课时长 157 | - `brightColorNumber: Int`:日间模式颜色 158 | - `darkColorNumber: Int`:夜间模式颜色 159 | 160 | ## Utilities 161 | 162 | ### `DataStorage.swift` 163 | 164 | 本文件用于进行存储操作。 165 | 166 | - `DataStorage` 167 | - `saveData([Date: [CalendarEvent]])`:存储课程数据 168 | - `saveData() -> [Date: [CalendarEvent]]`:读取课程数据 169 | - `saveUserId(String)`:存储用户学号 170 | - `loadUserId() -> String`:读取用户学号 171 | -------------------------------------------------------------------------------- /imgs/UI-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/imgs/UI-2.png -------------------------------------------------------------------------------- /imgs/UI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/imgs/UI.png -------------------------------------------------------------------------------- /imgs/darkUI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/imgs/darkUI.png -------------------------------------------------------------------------------- /imgs/detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/imgs/detail.png -------------------------------------------------------------------------------- /imgs/loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/imgs/loading.png -------------------------------------------------------------------------------- /imgs/system.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roife/BUAACalendarHelper/38e55bc47fec0a2c34c5014e06e1255fb67f845d/imgs/system.jpeg --------------------------------------------------------------------------------