mirror of
https://github.com/Matte23/circolapp.git
synced 2025-12-06 07:29:10 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -8,6 +8,7 @@ target 'circolapp' do
|
||||
pod 'shared', :path => '../../shared'
|
||||
pod 'Firebase/Messaging'
|
||||
pod 'AppStorage', '~> 1.0.3'
|
||||
pod "SwiftUIRefresh"
|
||||
pod 'Carte'
|
||||
|
||||
post_install do |installer|
|
||||
|
||||
@@ -52,6 +52,7 @@ PODS:
|
||||
- GoogleUtilities/UserDefaults (7.1.1):
|
||||
- GoogleUtilities/Logger
|
||||
- HTMLKit (3.1.0)
|
||||
- Introspect (0.1.2)
|
||||
- nanopb (2.30906.0):
|
||||
- nanopb/decode (= 2.30906.0)
|
||||
- nanopb/encode (= 2.30906.0)
|
||||
@@ -60,12 +61,15 @@ PODS:
|
||||
- PromisesObjC (1.2.11)
|
||||
- shared (1.0):
|
||||
- HTMLKit (~> 3.1.0)
|
||||
- SwiftUIRefresh (0.0.3):
|
||||
- Introspect (~> 0.1.0)
|
||||
|
||||
DEPENDENCIES:
|
||||
- AppStorage (~> 1.0.3)
|
||||
- Carte
|
||||
- Firebase/Messaging
|
||||
- shared (from `../../shared`)
|
||||
- SwiftUIRefresh
|
||||
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
@@ -80,8 +84,10 @@ SPEC REPOS:
|
||||
- GoogleDataTransport
|
||||
- GoogleUtilities
|
||||
- HTMLKit
|
||||
- Introspect
|
||||
- nanopb
|
||||
- PromisesObjC
|
||||
- SwiftUIRefresh
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
shared:
|
||||
@@ -99,10 +105,12 @@ SPEC CHECKSUMS:
|
||||
GoogleDataTransport: 116c84c4bdeb76be2a7a46de51244368f9794eab
|
||||
GoogleUtilities: 3dc4ff0d5e4840e2fa8eef0889620e8c33d4218c
|
||||
HTMLKit: 4ed10a911462cbf972329ec6aaaa827208dfd70c
|
||||
Introspect: 85a29d2c5ee4d3d15469ad0b75fd8839f3e72674
|
||||
nanopb: 1bf24dd71191072e120b83dd02d08f3da0d65e53
|
||||
PromisesObjC: 8c196f5a328c2cba3e74624585467a557dcb482f
|
||||
shared: fb3154b4def038b2b13aa88e01dd9f91bb2de9b5
|
||||
SwiftUIRefresh: ca6ae2718d25aad5dd68bbf5d2ae36ef6ade98bf
|
||||
|
||||
PODFILE CHECKSUM: 7decc03927fcaa3f2209e5b0ce4ee4c86d714007
|
||||
PODFILE CHECKSUM: faad88d7c92ca3deaa3ebc5d53f6ff86592a6113
|
||||
|
||||
COCOAPODS: 1.10.0
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
950C1788258E5BD300B2DBFE /* PhoneView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950C1787258E5BD300B2DBFE /* PhoneView.swift */; };
|
||||
9512D3C1257AB4F60023C3A1 /* NewReminderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9512D3C0257AB4F60023C3A1 /* NewReminderView.swift */; };
|
||||
952DEDDF2576F8DC001DF85D /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 952DEDDE2576F8DC001DF85D /* SceneDelegate.swift */; };
|
||||
953DDE7E2580312500C457CE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 953DDE7D2580312500C457CE /* LaunchScreen.storyboard */; };
|
||||
954AF8F62588A5C300666D0C /* CircularList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954AF8F52588A5C300666D0C /* CircularList.swift */; };
|
||||
954AF8F82588A5CF00666D0C /* FavouritesList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954AF8F72588A5CF00666D0C /* FavouritesList.swift */; };
|
||||
954AF8FA2588A5DD00666D0C /* RemindersList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954AF8F92588A5DD00666D0C /* RemindersList.swift */; };
|
||||
@@ -24,7 +25,6 @@
|
||||
955B7A0E257D098C0091B1F9 /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 955B7A0D257D098C0091B1F9 /* SearchBar.swift */; };
|
||||
955B7A10257D10A70091B1F9 /* ViewControllerResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 955B7A0F257D10A70091B1F9 /* ViewControllerResolver.swift */; };
|
||||
955B984D25962C3800ED4831 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 955B984F25962C3800ED4831 /* Localizable.strings */; };
|
||||
953DDE7E2580312500C457CE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 953DDE7D2580312500C457CE /* LaunchScreen.storyboard */; };
|
||||
95906F48257508660060F5D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 95906F47257506360060F5D0 /* Assets.xcassets */; };
|
||||
95906F4D257510370060F5D0 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 95906F4C257510370060F5D0 /* GoogleService-Info.plist */; };
|
||||
95B4CE142588BC890090D5E8 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95B4CE132588BC890090D5E8 /* SettingsView.swift */; };
|
||||
@@ -64,6 +64,7 @@
|
||||
9512D3C0257AB4F60023C3A1 /* NewReminderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewReminderView.swift; sourceTree = "<group>"; };
|
||||
952C5954255C57650018C010 /* shared.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = shared.framework; path = "../../shared/build/xcode-frameworks/shared.framework"; sourceTree = "<group>"; };
|
||||
952DEDDE2576F8DC001DF85D /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
|
||||
953DDE7D2580312500C457CE /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
954AF8F52588A5C300666D0C /* CircularList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircularList.swift; sourceTree = "<group>"; };
|
||||
954AF8F72588A5CF00666D0C /* FavouritesList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavouritesList.swift; sourceTree = "<group>"; };
|
||||
954AF8F92588A5DD00666D0C /* RemindersList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemindersList.swift; sourceTree = "<group>"; };
|
||||
@@ -77,7 +78,6 @@
|
||||
955B7A0F257D10A70091B1F9 /* ViewControllerResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewControllerResolver.swift; sourceTree = "<group>"; };
|
||||
955B984E25962C3800ED4831 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
955B985025962C3B00ED4831 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
953DDE7D2580312500C457CE /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
95906F47257506360060F5D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
95906F4C257510370060F5D0 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
|
||||
959B531E25764726009AD895 /* circolapp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = circolapp.entitlements; sourceTree = "<group>"; };
|
||||
|
||||
@@ -72,7 +72,7 @@ extension AppDelegate : UNUserNotificationCenterDelegate {
|
||||
|
||||
// Handle new circular notification
|
||||
let repository = iOSRepository.getCircularRepository()
|
||||
iOSRepository.updateCirculars(circularRepository: repository)
|
||||
iOSRepository.updateCirculars(circularRepository: repository, circularUpdated: {})
|
||||
|
||||
// UI is updated automatically
|
||||
completionHandler([])
|
||||
@@ -91,7 +91,9 @@ extension AppDelegate : UNUserNotificationCenterDelegate {
|
||||
}
|
||||
|
||||
let repository = iOSRepository.getCircularRepository()
|
||||
iOSRepository.updateCirculars(circularRepository: repository)
|
||||
let url = userInfo["url"] as! String
|
||||
URLUtils.openUrl(url: url)
|
||||
iOSRepository.updateCirculars(circularRepository: repository, circularUpdated: {})
|
||||
|
||||
completionHandler()
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class iOSRepository {
|
||||
return CircularRepository(circularDao: getCircularDao(), serverAPI: serverAPI)
|
||||
}
|
||||
|
||||
public static func updateCirculars(circularRepository: CircularRepository) {
|
||||
public static func updateCirculars(circularRepository: CircularRepository, circularUpdated: @escaping () -> Void) {
|
||||
circularRepository.updateCirculars(returnNewCirculars: true, completionHandler:
|
||||
{ result, error in
|
||||
if let errorReal = error {
|
||||
@@ -50,6 +50,8 @@ class iOSRepository {
|
||||
for circular in result!.first as! Array<Circular> {
|
||||
indexToSpotlight(circular: circular)
|
||||
}
|
||||
|
||||
circularUpdated()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,6 @@ class iOSServerApi {
|
||||
UserDefaults.standard.set(newTopic, forKey: topicKey)
|
||||
}
|
||||
|
||||
iOSRepository.updateCirculars(circularRepository: CircularRepository(circularDao: iOSRepository.getCircularDao(), serverAPI: serverAPI))
|
||||
iOSRepository.updateCirculars(circularRepository: CircularRepository(circularDao: iOSRepository.getCircularDao(), serverAPI: serverAPI), circularUpdated: {})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
import SwiftUI
|
||||
import SwiftUIRefresh
|
||||
|
||||
struct CircularList: View {
|
||||
@ObservedObject var circularViewModel = CircularViewModel(repository: iOSRepository.getCircularRepository())
|
||||
@@ -27,6 +28,12 @@ struct CircularList: View {
|
||||
CircularView(circular: circular)
|
||||
}
|
||||
.navigationBarTitle(Text("Circulars"), displayMode: .large)
|
||||
.pullToRefresh() { endRefreshing in circularViewModel.updateCirculars {
|
||||
DispatchQueue.main.async {
|
||||
endRefreshing()
|
||||
}
|
||||
}
|
||||
}
|
||||
.addSearchBar(self.searchBar)
|
||||
.onReceive(searchBar.$text) {query in
|
||||
self.circularViewModel.search(query: query)
|
||||
|
||||
@@ -33,7 +33,7 @@ class CircularViewModel: ObservableObject {
|
||||
self.repository = repository
|
||||
|
||||
schoolID = UserDefaults.standard.integer(forKey: key)
|
||||
iOSRepository.updateCirculars(circularRepository: repository)
|
||||
iOSRepository.updateCirculars(circularRepository: repository, circularUpdated: {})
|
||||
|
||||
userDefaultsObserver = UserDefaults.standard.observe(\.school, options: [.initial, .new], changeHandler: { (defaults, change) in
|
||||
self.schoolID = change.newValue ?? 0
|
||||
@@ -48,6 +48,10 @@ class CircularViewModel: ObservableObject {
|
||||
userDefaultsObserver?.invalidate()
|
||||
}
|
||||
|
||||
func updateCirculars(circularUpdated: @escaping () -> Void) {
|
||||
iOSRepository.updateCirculars(circularRepository: repository, circularUpdated: circularUpdated)
|
||||
}
|
||||
|
||||
func startObservingCirculars() {
|
||||
stopObserving()
|
||||
circularWatcher = repository.circularDao.getCFlowCirculars(school: Int32(schoolID)).watch { circulars in
|
||||
|
||||
Reference in New Issue
Block a user