ios-app/show-search-details #57

Manually merged
Ghost merged 32 commits from ios-app/show-search-details into master 2020-03-05 11:05:08 +01:00
61 changed files with 4234 additions and 510 deletions
+146 -28
View File
@@ -10,7 +10,7 @@
2C2CA271237304E200529274 /* MowestaApi in Frameworks */ = {isa = PBXBuildFile; productRef = 2C2CA270237304E200529274 /* MowestaApi */; };
2C7846D52372F44300766694 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C7846D42372F44300766694 /* AppDelegate.swift */; };
2C7846D72372F44300766694 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C7846D62372F44300766694 /* SceneDelegate.swift */; };
2C7846D92372F44300766694 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C7846D82372F44300766694 /* ContentView.swift */; };
2C7846D92372F44300766694 /* MainTabView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C7846D82372F44300766694 /* MainTabView.swift */; };
2C7846DB2372F44400766694 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2C7846DA2372F44400766694 /* Assets.xcassets */; };
2C7846DE2372F44400766694 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2C7846DD2372F44400766694 /* Preview Assets.xcassets */; };
2C7846E12372F44400766694 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2C7846DF2372F44400766694 /* LaunchScreen.storyboard */; };
@@ -58,8 +58,8 @@
9E86187E23D2254F00957CBE /* ActivityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E86187D23D2254F00957CBE /* ActivityIndicator.swift */; };
9E8C8C4E23C1FB0500FF8E6D /* LocationsExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E8C8C4D23C1FB0500FF8E6D /* LocationsExtensions.swift */; };
9E9F89F123D85DB10014CE69 /* WeatherStationDetailsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E9F89F023D85DB10014CE69 /* WeatherStationDetailsView.swift */; };
9E9F89F623D86B3A0014CE69 /* DateExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E9F89F523D86B3A0014CE69 /* DateExtensions.swift */; };
9E9F89FA23D899060014CE69 /* StringExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E9F89F923D899060014CE69 /* StringExtensions.swift */; };
9E9F89F623D86B3A0014CE69 /* Date+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E9F89F523D86B3A0014CE69 /* Date+Extensions.swift */; };
9E9F89FA23D899060014CE69 /* String+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E9F89F923D899060014CE69 /* String+Extensions.swift */; };
9E9F89FC23D899390014CE69 /* KeychainKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E9F89FB23D899390014CE69 /* KeychainKeys.swift */; };
9E9F8A0D23D8AEA30014CE69 /* Day.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E9F8A0C23D8AEA30014CE69 /* Day.swift */; };
9EA0816D240D595C007C53F5 /* OSLogExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EA0816C240D595C007C53F5 /* OSLogExtension.swift */; };
@@ -69,7 +69,7 @@
9EA8C18C23D1FFB200E54919 /* LoginService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EA8C18B23D1FFB200E54919 /* LoginService.swift */; };
9EAEFDF023E59C7D002B6DE1 /* DataManager+DeviceExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EAEFDEF23E59C7D002B6DE1 /* DataManager+DeviceExtension.swift */; };
9EB08D7C23DA4128004AFE51 /* OwnDeviceDetailsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EB08D7B23DA4128004AFE51 /* OwnDeviceDetailsView.swift */; };
9EB08D8423DC56A6004AFE51 /* DeviceOsExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EB08D8323DC56A6004AFE51 /* DeviceOsExtension.swift */; };
9EB08D8423DC56A6004AFE51 /* DeviceOs+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EB08D8323DC56A6004AFE51 /* DeviceOs+Extension.swift */; };
9EB08D8A23DC7A20004AFE51 /* AccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EB08D8923DC7A20004AFE51 /* AccountView.swift */; };
9EB7823923EEC50900757709 /* CoordinateExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EB7823823EEC50900757709 /* CoordinateExtension.swift */; };
9EB7823B23EEC67B00757709 /* CityExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EB7823A23EEC67B00757709 /* CityExtension.swift */; };
@@ -86,11 +86,11 @@
9EBA34EB23CD1A260013E2AB /* Card.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EBA34EA23CD1A260013E2AB /* Card.swift */; };
9EBBE38F23E5A7D40025AB37 /* CDevice+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EBBE38D23E5A7D40025AB37 /* CDevice+CoreDataClass.swift */; };
9EBBE39023E5A7D40025AB37 /* CDevice+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EBBE38E23E5A7D40025AB37 /* CDevice+CoreDataProperties.swift */; };
9ED3243223DF045D00ABBEB7 /* UIDeviceExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ED3243123DF045D00ABBEB7 /* UIDeviceExtensions.swift */; };
9ED3243023DF03D500ABBEB7 /* Coordinate+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ED3242F23DF03D500ABBEB7 /* Coordinate+Extensions.swift */; };
9ED3243223DF045D00ABBEB7 /* UIDevice+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ED3243123DF045D00ABBEB7 /* UIDevice+Extensions.swift */; };
9EE4770C23C36363003BA29C /* SearchResults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EE4770B23C36363003BA29C /* SearchResults.swift */; };
9EE4770E23C363F6003BA29C /* ViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EE4770D23C363F6003BA29C /* ViewExtensions.swift */; };
9EE4770E23C363F6003BA29C /* View+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EE4770D23C363F6003BA29C /* View+Extensions.swift */; };
9EE4771423C37158003BA29C /* SearchResultRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EE4771323C37158003BA29C /* SearchResultRow.swift */; };
9EE4771A23C3C77F003BA29C /* FavoriteLocations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EE4771923C3C77F003BA29C /* FavoriteLocations.swift */; };
9EE67EDF23E23C6600D99940 /* CDCoordinate+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EE67EDD23E23C6600D99940 /* CDCoordinate+CoreDataClass.swift */; };
9EEAF94D23C1F3DC000AAB49 /* SearchTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EEAF94B23C1F3DC000AAB49 /* SearchTab.swift */; };
9EEAF94E23C1F3DC000AAB49 /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EEAF94C23C1F3DC000AAB49 /* SearchBar.swift */; };
@@ -110,9 +110,33 @@
BC1A86B723CBB755005DE4F5 /* LocationHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC1A86B623CBB755005DE4F5 /* LocationHeaderView.swift */; };
BC241EC323CB8B0600F4C0CC /* FavoriteCity.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC241EC223CB8B0600F4C0CC /* FavoriteCity.swift */; };
BC26444123CB835300330645 /* WeatherConditionExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC26444023CB835300330645 /* WeatherConditionExtension.swift */; };
BC2A355E240DD018004710DD /* LocationServiceView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC2A355D240DD018004710DD /* LocationServiceView.swift */; };
BC33403F23E8C3F40076663E /* SwiftUICharts in Frameworks */ = {isa = PBXBuildFile; productRef = BC33403E23E8C3F40076663E /* SwiftUICharts */; };
BC3BFA8023FAF0B400686E49 /* CDWeatherCondition+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC3BFA7E23FAF0B400686E49 /* CDWeatherCondition+CoreDataClass.swift */; };
BC3BFA8123FAF0B400686E49 /* CDWeatherCondition+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC3BFA7F23FAF0B400686E49 /* CDWeatherCondition+CoreDataProperties.swift */; };
BC3C82BF2411032900C038E3 /* FavoriteListEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC3C82BE2411032900C038E3 /* FavoriteListEmptyView.swift */; };
BC4281C423FBE94200B8B318 /* WeatherForecast+BackgroundService.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC4281C323FBE94200B8B318 /* WeatherForecast+BackgroundService.swift */; };
BC4281C623FBF3DD00B8B318 /* DataManager+CDLocationExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC4281C523FBF3DD00B8B318 /* DataManager+CDLocationExtension.swift */; };
BC4281C823FBF55F00B8B318 /* DataManager+CDWeatherforecastExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC4281C723FBF55F00B8B318 /* DataManager+CDWeatherforecastExtension.swift */; };
BC4281CA23FD40AE00B8B318 /* WeatherMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC4281C923FD40AE00B8B318 /* WeatherMock.swift */; };
BC48919023E36D0F00D7D962 /* Double+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC48918F23E36D0F00D7D962 /* Double+Extension.swift */; };
BC48919223E3720D00D7D962 /* City+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC48919123E3720D00D7D962 /* City+Extension.swift */; };
BC4BF34A240D2AFD00792A3E /* TermsOfServiceView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC4BF349240D2AFD00792A3E /* TermsOfServiceView.swift */; };
BC4BF34C240D824700792A3E /* AppRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC4BF34B240D824700792A3E /* AppRootView.swift */; };
BC4D856A23E2FB9400FA61A9 /* LocationMapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC4D856923E2FB9400FA61A9 /* LocationMapView.swift */; };
BC4D856C23E31AD800FA61A9 /* CityCurrentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC4D856B23E31AD800FA61A9 /* CityCurrentView.swift */; };
BC71C16F23D9B7B800BBA56E /* NewFavoriteLocations.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC71C16E23D9B7B800BBA56E /* NewFavoriteLocations.swift */; };
BC90508023DB315500414C73 /* Mowesta.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = BC90507E23DB315500414C73 /* Mowesta.xcdatamodeld */; };
BC90508223DB451D00414C73 /* FavoriteListItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC90508123DB451D00414C73 /* FavoriteListItemView.swift */; };
BC95FD33240FCEB400162423 /* BackgroundServiceView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC95FD32240FCEB400162423 /* BackgroundServiceView.swift */; };
BC95FD35240FD8DB00162423 /* NavigationStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC95FD34240FD8DB00162423 /* NavigationStack.swift */; };
BC95FD37240FD92F00162423 /* AuthState.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC95FD36240FD92F00162423 /* AuthState.swift */; };
BC95FD39240FDF6A00162423 /* DailyPrediction.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC95FD38240FDF6A00162423 /* DailyPrediction.swift */; };
BC9AAB0D240DA67000026E87 /* RegistrationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC9AAB0C240DA67000026E87 /* RegistrationView.swift */; };
BC9AAB0F240DAA1D00026E87 /* TermsRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC9AAB0E240DAA1D00026E87 /* TermsRootView.swift */; };
BC9AAB11240DBC7C00026E87 /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC9AAB10240DBC7C00026E87 /* LoginView.swift */; };
BCD031C423FADAEF00A53C98 /* CDWeatherForecast+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCD031C223FADAEF00A53C98 /* CDWeatherForecast+CoreDataClass.swift */; };
BCD031C523FADAEF00A53C98 /* CDWeatherForecast+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCD031C323FADAEF00A53C98 /* CDWeatherForecast+CoreDataProperties.swift */; };
BCEE929023CCEDD80029CC73 /* LocationDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCEE928F23CCEDD80029CC73 /* LocationDetailView.swift */; };
BCEE929223CCF7B60029CC73 /* LocationForecastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCEE929123CCF7B60029CC73 /* LocationForecastView.swift */; };
BCFAD1F923CB4BEC0032455B /* FavoriteSearchResults.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCFAD1F823CB4BEC0032455B /* FavoriteSearchResults.swift */; };
@@ -139,7 +163,7 @@
2C7846D12372F44300766694 /* MoWeSta.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MoWeSta.app; sourceTree = BUILT_PRODUCTS_DIR; };
2C7846D42372F44300766694 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
2C7846D62372F44300766694 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
2C7846D82372F44300766694 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
2C7846D82372F44300766694 /* MainTabView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabView.swift; sourceTree = "<group>"; };
2C7846DA2372F44400766694 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
2C7846DD2372F44400766694 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
2C7846E22372F44400766694 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -193,8 +217,8 @@
9E86187D23D2254F00957CBE /* ActivityIndicator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityIndicator.swift; sourceTree = "<group>"; };
9E8C8C4D23C1FB0500FF8E6D /* LocationsExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationsExtensions.swift; sourceTree = "<group>"; };
9E9F89F023D85DB10014CE69 /* WeatherStationDetailsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherStationDetailsView.swift; sourceTree = "<group>"; };
9E9F89F523D86B3A0014CE69 /* DateExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateExtensions.swift; sourceTree = "<group>"; };
9E9F89F923D899060014CE69 /* StringExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringExtensions.swift; sourceTree = "<group>"; };
9E9F89F523D86B3A0014CE69 /* Date+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Extensions.swift"; sourceTree = "<group>"; };
9E9F89F923D899060014CE69 /* String+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extensions.swift"; sourceTree = "<group>"; };
9E9F89FB23D899390014CE69 /* KeychainKeys.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainKeys.swift; sourceTree = "<group>"; };
9E9F8A0C23D8AEA30014CE69 /* Day.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Day.swift; sourceTree = "<group>"; };
9EA0816C240D595C007C53F5 /* OSLogExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSLogExtension.swift; sourceTree = "<group>"; };
@@ -204,7 +228,7 @@
9EA8C18B23D1FFB200E54919 /* LoginService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginService.swift; sourceTree = "<group>"; };
9EAEFDEF23E59C7D002B6DE1 /* DataManager+DeviceExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DataManager+DeviceExtension.swift"; sourceTree = "<group>"; };
9EB08D7B23DA4128004AFE51 /* OwnDeviceDetailsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OwnDeviceDetailsView.swift; sourceTree = "<group>"; };
9EB08D8323DC56A6004AFE51 /* DeviceOsExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceOsExtension.swift; sourceTree = "<group>"; };
9EB08D8323DC56A6004AFE51 /* DeviceOs+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DeviceOs+Extension.swift"; sourceTree = "<group>"; };
9EB08D8923DC7A20004AFE51 /* AccountView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountView.swift; sourceTree = "<group>"; };
9EB7823823EEC50900757709 /* CoordinateExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoordinateExtension.swift; sourceTree = "<group>"; };
9EB7823A23EEC67B00757709 /* CityExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CityExtension.swift; sourceTree = "<group>"; };
@@ -221,11 +245,11 @@
9EBA34EA23CD1A260013E2AB /* Card.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Card.swift; sourceTree = "<group>"; };
9EBBE38D23E5A7D40025AB37 /* CDevice+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CDevice+CoreDataClass.swift"; sourceTree = SOURCE_ROOT; };
9EBBE38E23E5A7D40025AB37 /* CDevice+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CDevice+CoreDataProperties.swift"; sourceTree = SOURCE_ROOT; };
9ED3243123DF045D00ABBEB7 /* UIDeviceExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIDeviceExtensions.swift; sourceTree = "<group>"; };
9ED3242F23DF03D500ABBEB7 /* Coordinate+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Coordinate+Extensions.swift"; sourceTree = "<group>"; };
9ED3243123DF045D00ABBEB7 /* UIDevice+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIDevice+Extensions.swift"; sourceTree = "<group>"; };
9EE4770B23C36363003BA29C /* SearchResults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchResults.swift; sourceTree = "<group>"; };
9EE4770D23C363F6003BA29C /* ViewExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewExtensions.swift; sourceTree = "<group>"; };
9EE4770D23C363F6003BA29C /* View+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Extensions.swift"; sourceTree = "<group>"; };
9EE4771323C37158003BA29C /* SearchResultRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchResultRow.swift; sourceTree = "<group>"; };
9EE4771923C3C77F003BA29C /* FavoriteLocations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteLocations.swift; sourceTree = "<group>"; };
9EE67EDD23E23C6600D99940 /* CDCoordinate+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CDCoordinate+CoreDataClass.swift"; sourceTree = "<group>"; };
9EEAF94B23C1F3DC000AAB49 /* SearchTab.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchTab.swift; sourceTree = "<group>"; };
9EEAF94C23C1F3DC000AAB49 /* SearchBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBar.swift; sourceTree = "<group>"; };
@@ -245,9 +269,32 @@
BC1A86B623CBB755005DE4F5 /* LocationHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationHeaderView.swift; sourceTree = "<group>"; };
BC241EC223CB8B0600F4C0CC /* FavoriteCity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteCity.swift; sourceTree = "<group>"; };
BC26444023CB835300330645 /* WeatherConditionExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherConditionExtension.swift; sourceTree = "<group>"; };
BC2A355D240DD018004710DD /* LocationServiceView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationServiceView.swift; sourceTree = "<group>"; };
BC3BFA7E23FAF0B400686E49 /* CDWeatherCondition+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CDWeatherCondition+CoreDataClass.swift"; sourceTree = "<group>"; };
BC3BFA7F23FAF0B400686E49 /* CDWeatherCondition+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CDWeatherCondition+CoreDataProperties.swift"; sourceTree = "<group>"; };
BC3C82BE2411032900C038E3 /* FavoriteListEmptyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteListEmptyView.swift; sourceTree = "<group>"; };
BC4281C323FBE94200B8B318 /* WeatherForecast+BackgroundService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WeatherForecast+BackgroundService.swift"; sourceTree = "<group>"; };
BC4281C523FBF3DD00B8B318 /* DataManager+CDLocationExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DataManager+CDLocationExtension.swift"; sourceTree = "<group>"; };
BC4281C723FBF55F00B8B318 /* DataManager+CDWeatherforecastExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DataManager+CDWeatherforecastExtension.swift"; sourceTree = "<group>"; };
BC4281C923FD40AE00B8B318 /* WeatherMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherMock.swift; sourceTree = "<group>"; };
BC48918F23E36D0F00D7D962 /* Double+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Double+Extension.swift"; sourceTree = "<group>"; };
BC48919123E3720D00D7D962 /* City+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "City+Extension.swift"; sourceTree = "<group>"; };
BC4BF349240D2AFD00792A3E /* TermsOfServiceView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TermsOfServiceView.swift; sourceTree = "<group>"; };
BC4BF34B240D824700792A3E /* AppRootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppRootView.swift; sourceTree = "<group>"; };
BC4D856923E2FB9400FA61A9 /* LocationMapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationMapView.swift; sourceTree = "<group>"; };
BC4D856B23E31AD800FA61A9 /* CityCurrentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CityCurrentView.swift; sourceTree = "<group>"; };
BC71C16E23D9B7B800BBA56E /* NewFavoriteLocations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewFavoriteLocations.swift; sourceTree = "<group>"; };
BC90507F23DB315500414C73 /* Mowesta.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Mowesta.xcdatamodel; sourceTree = "<group>"; };
BC90508123DB451D00414C73 /* FavoriteListItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteListItemView.swift; sourceTree = "<group>"; };
BC95FD32240FCEB400162423 /* BackgroundServiceView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundServiceView.swift; sourceTree = "<group>"; };
BC95FD34240FD8DB00162423 /* NavigationStack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationStack.swift; sourceTree = "<group>"; };
BC95FD36240FD92F00162423 /* AuthState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthState.swift; sourceTree = "<group>"; };
BC95FD38240FDF6A00162423 /* DailyPrediction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyPrediction.swift; sourceTree = "<group>"; };
BC9AAB0C240DA67000026E87 /* RegistrationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegistrationView.swift; sourceTree = "<group>"; };
BC9AAB0E240DAA1D00026E87 /* TermsRootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TermsRootView.swift; sourceTree = "<group>"; };
BC9AAB10240DBC7C00026E87 /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = "<group>"; };
BCD031C223FADAEF00A53C98 /* CDWeatherForecast+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CDWeatherForecast+CoreDataClass.swift"; sourceTree = "<group>"; };
BCD031C323FADAEF00A53C98 /* CDWeatherForecast+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CDWeatherForecast+CoreDataProperties.swift"; sourceTree = "<group>"; };
BCEE928F23CCEDD80029CC73 /* LocationDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationDetailView.swift; sourceTree = "<group>"; };
BCEE929123CCF7B60029CC73 /* LocationForecastView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationForecastView.swift; sourceTree = "<group>"; };
BCFAD1F823CB4BEC0032455B /* FavoriteSearchResults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteSearchResults.swift; sourceTree = "<group>"; };
@@ -261,6 +308,7 @@
9E6D641223CCC2600002CBCF /* Socket in Frameworks */,
9E0D267223AD2E7D00BE14F5 /* AuthenticationServices.framework in Frameworks */,
9E6D640623CC73320002CBCF /* NetworkExtension.framework in Frameworks */,
BC33403F23E8C3F40076663E /* SwiftUICharts in Frameworks */,
9E3BCD3623ACED50002F2D8F /* KeychainSwift in Frameworks */,
2C2CA271237304E200529274 /* MowestaApi in Frameworks */,
);
@@ -325,7 +373,8 @@
9E73B48B23CF733C000FADF3 /* View */,
2C7846D42372F44300766694 /* AppDelegate.swift */,
2C7846D62372F44300766694 /* SceneDelegate.swift */,
2C7846D82372F44300766694 /* ContentView.swift */,
BC4BF34B240D824700792A3E /* AppRootView.swift */,
2C7846D82372F44300766694 /* MainTabView.swift */,
2C7846DA2372F44400766694 /* Assets.xcassets */,
2C7846DF2372F44400766694 /* LaunchScreen.storyboard */,
2C7846E22372F44400766694 /* Info.plist */,
@@ -371,6 +420,7 @@
9E0C988723A78341001EA11E /* CurrentWeatherData.swift */,
9E8C8C4D23C1FB0500FF8E6D /* LocationsExtensions.swift */,
BC26444023CB835300330645 /* WeatherConditionExtension.swift */,
BC95FD38240FDF6A00162423 /* DailyPrediction.swift */,
);
path = Data;
sourceTree = "<group>";
@@ -389,6 +439,7 @@
BC11C1C423DF411B008F9E7A /* FavoriteTodayView.swift */,
BC11C1C623DF4868008F9E7A /* FavoritesNextDaysView.swift */,
BC11C1C823DF776F008F9E7A /* FavoriteNextDaysDayView.swift */,
BC3C82BE2411032900C038E3 /* FavoriteListEmptyView.swift */,
);
path = Favorite;
sourceTree = "<group>";
@@ -419,7 +470,6 @@
isa = PBXGroup;
children = (
9EA0D16123C911790068F739 /* Mock */,
9EE4771923C3C77F003BA29C /* FavoriteLocations.swift */,
BC71C16E23D9B7B800BBA56E /* NewFavoriteLocations.swift */,
);
path = Environment;
@@ -428,6 +478,7 @@
9E73B48B23CF733C000FADF3 /* View */ = {
isa = PBXGroup;
children = (
BC4BF348240D2AE400792A3E /* ToS */,
9E73B48D23CF7452000FADF3 /* Custom */,
9E9BD25823A7A6EF008FF0DF /* Account */,
9E3CA3F223A52813003873E8 /* Favorite */,
@@ -447,6 +498,8 @@
9EAEFDF123E59D64002B6DE1 /* DataManager */,
9E73B48E23CF75CA000FADF3 /* Services */,
9E6D641523CCDF900002CBCF /* Error.swift */,
BC95FD34240FD8DB00162423 /* NavigationStack.swift */,
BC95FD36240FD92F00162423 /* AuthState.swift */,
9E9F8A0C23D8AEA30014CE69 /* Day.swift */,
);
path = Business;
@@ -471,6 +524,7 @@
9EA6238F23D5B48700BFA8B9 /* LocationService.swift */,
9EA6239123D5C8E900BFA8B9 /* AltimeterService.swift */,
9E6D640223CC730D0002CBCF /* WeatherStationPairingService.swift */,
BC4281C323FBE94200B8B318 /* WeatherForecast+BackgroundService.swift */,
);
path = Services;
sourceTree = "<group>";
@@ -487,6 +541,8 @@
BC1A86B623CBB755005DE4F5 /* LocationHeaderView.swift */,
BCEE928F23CCEDD80029CC73 /* LocationDetailView.swift */,
BCEE929123CCF7B60029CC73 /* LocationForecastView.swift */,
BC4D856923E2FB9400FA61A9 /* LocationMapView.swift */,
BC4D856B23E31AD800FA61A9 /* CityCurrentView.swift */,
);
path = Location;
sourceTree = "<group>";
@@ -534,12 +590,15 @@
9E9F89F823D898F50014CE69 /* Extensions */ = {
isa = PBXGroup;
children = (
9E9F89F923D899060014CE69 /* StringExtensions.swift */,
9E9F89F923D899060014CE69 /* String+Extensions.swift */,
9E36A81E23E23ECB00D06184 /* DoubleExtension.swift */,
9E9F89F523D86B3A0014CE69 /* DateExtensions.swift */,
9EE4770D23C363F6003BA29C /* ViewExtensions.swift */,
9EB08D8323DC56A6004AFE51 /* DeviceOsExtension.swift */,
9ED3243123DF045D00ABBEB7 /* UIDeviceExtensions.swift */,
9E9F89F523D86B3A0014CE69 /* Date+Extensions.swift */,
9EE4770D23C363F6003BA29C /* View+Extensions.swift */,
9EB08D8323DC56A6004AFE51 /* DeviceOs+Extension.swift */,
9ED3242F23DF03D500ABBEB7 /* Coordinate+Extensions.swift */,
9ED3243123DF045D00ABBEB7 /* UIDevice+Extensions.swift */,
BC48918F23E36D0F00D7D962 /* Double+Extension.swift */,
BC48919123E3720D00D7D962 /* City+Extension.swift */,
9EB7824C23F0666D00757709 /* MeasurementExtension.swift */,
9EA0816C240D595C007C53F5 /* OSLogExtension.swift */,
);
@@ -565,6 +624,7 @@
isa = PBXGroup;
children = (
9EA0D16223C9118C0068F739 /* LocationMock.swift */,
BC4281C923FD40AE00B8B318 /* WeatherMock.swift */,
);
path = Mock;
sourceTree = "<group>";
@@ -575,6 +635,8 @@
9E799CC323E2337E00062A6D /* DataManager.swift */,
9EAEFDEF23E59C7D002B6DE1 /* DataManager+DeviceExtension.swift */,
9E2438F023E6E04E00FD5E5C /* DataManager+MeasurementExtension.swift */,
BC4281C523FBF3DD00B8B318 /* DataManager+CDLocationExtension.swift */,
BC4281C723FBF55F00B8B318 /* DataManager+CDWeatherforecastExtension.swift */,
9EB7824A23F0623A00757709 /* DataManager+PlacemarkLocationExtension.swift */,
);
path = DataManager;
@@ -594,6 +656,10 @@
BC11C1BB23DF0862008F9E7A /* CoreData */ = {
isa = PBXGroup;
children = (
BC3BFA7E23FAF0B400686E49 /* CDWeatherCondition+CoreDataClass.swift */,
BC3BFA7F23FAF0B400686E49 /* CDWeatherCondition+CoreDataProperties.swift */,
BCD031C223FADAEF00A53C98 /* CDWeatherForecast+CoreDataClass.swift */,
BCD031C323FADAEF00A53C98 /* CDWeatherForecast+CoreDataProperties.swift */,
9EBBE38D23E5A7D40025AB37 /* CDevice+CoreDataClass.swift */,
9EBBE38E23E5A7D40025AB37 /* CDevice+CoreDataProperties.swift */,
9EE67EDD23E23C6600D99940 /* CDCoordinate+CoreDataClass.swift */,
@@ -611,6 +677,19 @@
path = CoreData;
sourceTree = "<group>";
};
BC4BF348240D2AE400792A3E /* ToS */ = {
isa = PBXGroup;
children = (
BC4BF349240D2AFD00792A3E /* TermsOfServiceView.swift */,
BC9AAB0C240DA67000026E87 /* RegistrationView.swift */,
BC9AAB0E240DAA1D00026E87 /* TermsRootView.swift */,
BC9AAB10240DBC7C00026E87 /* LoginView.swift */,
BC2A355D240DD018004710DD /* LocationServiceView.swift */,
BC95FD32240FCEB400162423 /* BackgroundServiceView.swift */,
);
path = ToS;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -632,6 +711,7 @@
2C2CA270237304E200529274 /* MowestaApi */,
9E3BCD3523ACED50002F2D8F /* KeychainSwift */,
9E6D641123CCC2600002CBCF /* Socket */,
BC33403E23E8C3F40076663E /* SwiftUICharts */,
);
productName = app;
productReference = 2C7846D12372F44300766694 /* MoWeSta.app */;
@@ -709,6 +789,7 @@
packageReferences = (
9E3BCD3423ACED50002F2D8F /* XCRemoteSwiftPackageReference "keychain-swift" */,
9E6D641023CCC2600002CBCF /* XCRemoteSwiftPackageReference "BlueSocket" */,
BC33403D23E8C3F40076663E /* XCRemoteSwiftPackageReference "ChartView" */,
);
productRefGroup = 2C7846D22372F44300766694 /* Products */;
projectDirPath = "";
@@ -755,6 +836,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BC2A355E240DD018004710DD /* LocationServiceView.swift in Sources */,
BC48919223E3720D00D7D962 /* City+Extension.swift in Sources */,
BC4281CA23FD40AE00B8B318 /* WeatherMock.swift in Sources */,
BC1A86B723CBB755005DE4F5 /* LocationHeaderView.swift in Sources */,
BC11C1B923DF07FC008F9E7A /* CDLocation+CoreDataClass.swift in Sources */,
9E2438E723E5B95700FD5E5C /* MeasurementAll.swift in Sources */,
@@ -765,6 +849,8 @@
BCEE929023CCEDD80029CC73 /* LocationDetailView.swift in Sources */,
9E6D640D23CC798F0002CBCF /* WeatherStationPairRow.swift in Sources */,
9EE4770C23C36363003BA29C /* SearchResults.swift in Sources */,
BC3BFA8123FAF0B400686E49 /* CDWeatherCondition+CoreDataProperties.swift in Sources */,
BC4D856A23E2FB9400FA61A9 /* LocationMapView.swift in Sources */,
2C7846D52372F44300766694 /* AppDelegate.swift in Sources */,
9EB7823F23EEC7FB00757709 /* CountryExtension.swift in Sources */,
9E6D640F23CC7BBD0002CBCF /* Register.swift in Sources */,
@@ -775,17 +861,23 @@
9E6D640B23CC77800002CBCF /* AboutMe.swift in Sources */,
9EA8C18C23D1FFB200E54919 /* LoginService.swift in Sources */,
BC11C1C923DF776F008F9E7A /* FavoriteNextDaysDayView.swift in Sources */,
BC48919023E36D0F00D7D962 /* Double+Extension.swift in Sources */,
9EB7823923EEC50900757709 /* CoordinateExtension.swift in Sources */,
9E81DC9223A7DECE00568CF4 /* UserData.swift in Sources */,
9EE67EDF23E23C6600D99940 /* CDCoordinate+CoreDataClass.swift in Sources */,
9EB7824B23F0623A00757709 /* DataManager+PlacemarkLocationExtension.swift in Sources */,
BC04DC0B23CB3BE7006D0767 /* FavoriteSearch.swift in Sources */,
9EEAF94D23C1F3DC000AAB49 /* SearchTab.swift in Sources */,
BC4D856C23E31AD800FA61A9 /* CityCurrentView.swift in Sources */,
9E9F89F123D85DB10014CE69 /* WeatherStationDetailsView.swift in Sources */,
BC4BF34C240D824700792A3E /* AppRootView.swift in Sources */,
9E9F89F123D85DB10014CE69 /* WeatherStationDetailsView.swift in Sources */,
9E2438E823E5B95700FD5E5C /* MeasurementDay.swift in Sources */,
9E9F89FA23D899060014CE69 /* StringExtensions.swift in Sources */,
9E9F89FA23D899060014CE69 /* String+Extensions.swift in Sources */,
9E2438EB23E5B95700FD5E5C /* MeasurementDetailDevice.swift in Sources */,
BC95FD35240FD8DB00162423 /* NavigationStack.swift in Sources */,
BC241EC323CB8B0600F4C0CC /* FavoriteCity.swift in Sources */,
BC95FD37240FD92F00162423 /* AuthState.swift in Sources */,
9E86187E23D2254F00957CBE /* ActivityIndicator.swift in Sources */,
BC11C1C123DF2F79008F9E7A /* FavoriteDetail.swift in Sources */,
9EB7824523EEEADC00757709 /* MeasurementDetailCalculated.swift in Sources */,
@@ -802,6 +894,8 @@
9EB7824F23F0676B00757709 /* MeasurementService.swift in Sources */,
BC11C1C323DF3851008F9E7A /* FavoriteHeaderView.swift in Sources */,
9EFDEF9A23C215A9006EB4B4 /* AlertFactory.swift in Sources */,
BCD031C523FADAEF00A53C98 /* CDWeatherForecast+CoreDataProperties.swift in Sources */,
BC9AAB11240DBC7C00026E87 /* LoginView.swift in Sources */,
9E2438EF23E5B9CE00FD5E5C /* CDMeasurement+CoreDataProperties.swift in Sources */,
BC11C1BF23DF0ABD008F9E7A /* CDNamesDictionary+CoreDataProperties.swift in Sources */,
9EB7824323EED68100757709 /* CDDataDictionary+CoreDataProperties.swift in Sources */,
@@ -809,7 +903,8 @@
9EEAF94E23C1F3DC000AAB49 /* SearchBar.swift in Sources */,
9EB7824923F05DE000757709 /* CDPlacemarkLocation+CoreDataProperties.swift in Sources */,
9E6D641423CCD2080002CBCF /* WeatherStationPairView.swift in Sources */,
9EE4770E23C363F6003BA29C /* ViewExtensions.swift in Sources */,
BC9AAB0D240DA67000026E87 /* RegistrationView.swift in Sources */,
9EE4770E23C363F6003BA29C /* View+Extensions.swift in Sources */,
9E2438EA23E5B95700FD5E5C /* MeasurementDetails.swift in Sources */,
9E78A74A23C91B3D00D8A27D /* StateDetail.swift in Sources */,
9E2438E923E5B95700FD5E5C /* MeasurementDetailRow.swift in Sources */,
@@ -817,33 +912,43 @@
9EAEFDF023E59C7D002B6DE1 /* DataManager+DeviceExtension.swift in Sources */,
9E8334A423AD003E00B191A3 /* Login.swift in Sources */,
BCEE929223CCF7B60029CC73 /* LocationForecastView.swift in Sources */,
9EE4771A23C3C77F003BA29C /* FavoriteLocations.swift in Sources */,
BC95FD33240FCEB400162423 /* BackgroundServiceView.swift in Sources */,
BC11C1BA23DF07FC008F9E7A /* CDLocation+CoreDataProperties.swift in Sources */,
9E2438F123E6E04E00FD5E5C /* DataManager+MeasurementExtension.swift in Sources */,
2C7846D92372F44300766694 /* ContentView.swift in Sources */,
2C7846D92372F44300766694 /* MainTabView.swift in Sources */,
9E2438EE23E5B9CE00FD5E5C /* CDMeasurement+CoreDataClass.swift in Sources */,
9E3CA3F423A52ABF003873E8 /* FavoriteList.swift in Sources */,
BC4281C823FBF55F00B8B318 /* DataManager+CDWeatherforecastExtension.swift in Sources */,
9EB08D8A23DC7A20004AFE51 /* AccountView.swift in Sources */,
9E6D641623CCDF900002CBCF /* Error.swift in Sources */,
BC95FD39240FDF6A00162423 /* DailyPrediction.swift in Sources */,
9E6D640323CC730D0002CBCF /* WeatherStationPairingService.swift in Sources */,
BC4BF34A240D2AFD00792A3E /* TermsOfServiceView.swift in Sources */,
9ED3243023DF03D500ABBEB7 /* Coordinate+Extensions.swift in Sources */,
9EA0816D240D595C007C53F5 /* OSLogExtension.swift in Sources */,
9E3CA3F123A5278E003873E8 /* FavoriteRow.swift in Sources */,
BC11C1C523DF411B008F9E7A /* FavoriteTodayView.swift in Sources */,
BC3BFA8023FAF0B400686E49 /* CDWeatherCondition+CoreDataClass.swift in Sources */,
BC11C1C723DF4868008F9E7A /* FavoritesNextDaysView.swift in Sources */,
BC4281C423FBE94200B8B318 /* WeatherForecast+BackgroundService.swift in Sources */,
BCD031C423FADAEF00A53C98 /* CDWeatherForecast+CoreDataClass.swift in Sources */,
BC9AAB0F240DAA1D00026E87 /* TermsRootView.swift in Sources */,
BC90508023DB315500414C73 /* Mowesta.xcdatamodeld in Sources */,
9E78A74823C918C600D8A27D /* CityDetail.swift in Sources */,
9E9F89FC23D899390014CE69 /* KeychainKeys.swift in Sources */,
9EB08D8423DC56A6004AFE51 /* DeviceOsExtension.swift in Sources */,
9EB08D8423DC56A6004AFE51 /* DeviceOs+Extension.swift in Sources */,
9E2438E523E5B95700FD5E5C /* MeasurementDetailValues.swift in Sources */,
BC04DC0D23CB4104006D0767 /* FavoriteSearchResultRow.swift in Sources */,
BC4281C623FBF3DD00B8B318 /* DataManager+CDLocationExtension.swift in Sources */,
9E78A74623C916CF00D8A27D /* LocationDetail.swift in Sources */,
9EBBE39023E5A7D40025AB37 /* CDevice+CoreDataProperties.swift in Sources */,
9E9F8A0D23D8AEA30014CE69 /* Day.swift in Sources */,
9E0C988823A78341001EA11E /* CurrentWeatherData.swift in Sources */,
9ED3243223DF045D00ABBEB7 /* UIDeviceExtensions.swift in Sources */,
9ED3243223DF045D00ABBEB7 /* UIDevice+Extensions.swift in Sources */,
BC3C82BF2411032900C038E3 /* FavoriteListEmptyView.swift in Sources */,
9E799CC423E2337E00062A6D /* DataManager.swift in Sources */,
9E86187423D21CD900957CBE /* WeatherStationDetailsRow.swift in Sources */,
9E9F89F623D86B3A0014CE69 /* DateExtensions.swift in Sources */,
9E9F89F623D86B3A0014CE69 /* Date+Extensions.swift in Sources */,
9EB7823D23EEC7BB00757709 /* StateExtension.swift in Sources */,
9E2438E623E5B95700FD5E5C /* MeasurementDetailContext.swift in Sources */,
9EBA34EB23CD1A260013E2AB /* Card.swift in Sources */,
@@ -1225,6 +1330,14 @@
minimumVersion = 1.0.52;
};
};
BC33403D23E8C3F40076663E /* XCRemoteSwiftPackageReference "ChartView" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/AppPear/ChartView";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.4.7;
};
};
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
@@ -1246,6 +1359,11 @@
package = 9E6D641023CCC2600002CBCF /* XCRemoteSwiftPackageReference "BlueSocket" */;
productName = Socket;
};
BC33403E23E8C3F40076663E /* SwiftUICharts */ = {
isa = XCSwiftPackageProductDependency;
package = BC33403D23E8C3F40076663E /* XCRemoteSwiftPackageReference "ChartView" */;
productName = SwiftUICharts;
};
/* End XCSwiftPackageProductDependency section */
/* Begin XCVersionGroup section */
+8 -7
View File
@@ -15,8 +15,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
NSLog("didLaunchApplication")
LocationService.shared.askUser()
BackgroundService.shared.registerMeasurementService()
WeatherForecastService.shared.registerWeatherforecastBackgroundService()
let userDefaults = UserDefaults.standard
if !userDefaults.bool(forKey: KeychainKeys.hasRunBefore) {
UserData.shared.reset()
@@ -28,14 +29,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
//print(urls[urls.count-1] as URL)
return true
}
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
NSLog("new scene session created");
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
@@ -44,7 +45,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}
func applicationDidEnterBackground(_ application: UIApplication) {
WeatherForecastService.shared.scheduleWeatherforecastBackgroundService()
}
// MARK: - Core Data stack
@@ -62,7 +63,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
if let error = error as NSError? {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
/*
Typical reasons for an error here include:
* The parent directory does not exist, cannot be created, or disallows writing.
@@ -76,9 +77,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
})
return container
}()
// MARK: - Core Data Saving support
func saveContext () {
let context = persistentContainer.viewContext
if context.hasChanges {
+29
View File
@@ -0,0 +1,29 @@
//
// AppRootView.swift
// app
//
// Created by Tobias Stottrop on 02.03.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import SwiftUI
struct AppRootView: View {
@EnvironmentObject var user: UserData
var body: some View {
return Group {
if (user.agreedToS) {
MainTabView()
} else {
TermsRootView()
}
}
}
}
struct AppRootView_Previews: PreviewProvider {
static var previews: some View {
AppRootView()
}
}
+18
View File
@@ -0,0 +1,18 @@
//
// AuthState.swift
// app
//
// Created by Tobias Stottrop on 04.03.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import Foundation
enum AuthState {
case ToSScreen
case LoginScreen
case RegistrationScreen
case LocationScreen
case BackgroundScreen
case Finished
}
@@ -22,5 +22,6 @@ struct KeychainKeys {
static let humanName: String = "MoWeSta.user.humanName"
static let password: String = "MoWeSta.user.password"
static let loggedIn: String = "MoWeSta.user.loggedIn"
static let agreedToS: String = "Nowesta.user.agreedToS"
}
}
@@ -25,15 +25,17 @@ class UserData: ObservableObject {
@Published var humanName: String? = nil
@Published var password: String = ""
@Published var loggedIn: Bool = false
@Published var agreedToS: Bool = false
var filledIn : Bool { get { return loginName != "" && password != "" } }
let keyChain = KeychainSwift()
private init(loginName: String? = nil, password: String? = nil, humanName: String? = nil, loggedIn: Bool? = nil) {
private init(loginName: String? = nil, password: String? = nil, humanName: String? = nil, loggedIn: Bool? = nil, agreedToS: Bool? = nil) {
self.loginName = loginName ?? keyChain.get(KeychainKeys.user.loginName) ?? self.loginName
self.humanName = humanName ?? keyChain.get(KeychainKeys.user.humanName) ?? self.humanName
self.password = password ?? keyChain.get(KeychainKeys.user.password) ?? self.password
self.loggedIn = loggedIn ?? keyChain.getBool(KeychainKeys.user.loggedIn) ?? self.loggedIn
self.agreedToS = agreedToS ?? keyChain.getBool(KeychainKeys.user.agreedToS) ?? self.agreedToS
os_log("initial load with name: %@", log: .userData, type: .info, "\(self.loginName)")
}
@@ -66,6 +68,16 @@ class UserData: ObservableObject {
reset()
}
func agreeToS() {
agreedToS = true
self.persist()
}
func disagreeToS() {
agreedToS = false
self.persist()
}
func pairDevice() {
if loggedIn {
if !DeviceData.shared.created {
@@ -123,6 +135,7 @@ class UserData: ObservableObject {
keyChain.set(self.humanName!, forKey: KeychainKeys.user.humanName)
keyChain.set(self.password, forKey: KeychainKeys.user.password)
keyChain.set(self.loggedIn, forKey: KeychainKeys.user.loggedIn)
keyChain.set(self.agreedToS, forKey: KeychainKeys.user.agreedToS)
LoginService.shared.toggle()
os_log("persisted", log: .userData, type: .info)
}
@@ -132,6 +145,7 @@ class UserData: ObservableObject {
humanName = ""
password = ""
loggedIn = false
agreedToS = false
os_log("deleted", log: .userData, type: .info)
persist()
}
@@ -0,0 +1,80 @@
//
// DataManager+CDLocationExtension.swift
// app
//
// Created by Tobias Stottrop on 18.02.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import Foundation
import MowestaApi
import CoreData
import UIKit
extension DataManager {
typealias MowestaState = MowestaApi.State
struct Holder {
static var _processedLocation: CDLocation = CDLocation()
}
var processedLocation:CDLocation {
get {
return Holder._processedLocation
}
set(newValue) {
Holder._processedLocation = newValue
}
}
func updateLocation(for city: City) -> CDLocation? {
guard let managedContext = getContext() else { return nil}
let location = CDLocation(context: managedContext, city: city)
self.processedLocation = location
WeatherAPI.getCityForecast(_id: location.id, completion: updateWeatherForecast)
do {
try managedContext.save()
} catch let error as NSError {
print("Failed to update city! \(error): \(error.userInfo)")
return nil
}
return location
}
func deleteAllLocations() {
guard let managedContext = getContext() else { return }
let fetchRequest: NSFetchRequest<CDLocation> = CDLocation.fetchRequest()
do {
let items = try managedContext.fetch(fetchRequest)
for item in items {
managedContext.delete(item)
}
try managedContext.save()
} catch {
}
}
func updateLocation(for state: MowestaState) -> CDLocation? {
guard let managedContext = getContext() else { return nil}
let location = CDLocation(context: managedContext, state: state)
do {
try managedContext.save()
} catch let error as NSError {
print("Failed to update State! \(error): \(error.userInfo)")
return nil
}
return location
}
}
#if DEBUG
extension DataManager {
static var locationMock: CDLocation {
let moc = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
let cdlocation = CDLocation(context: moc)
cdlocation.id = 48264
return cdlocation
}
}
#endif
@@ -0,0 +1,42 @@
//
// DataManager+CDWeatherforecastExtension.swift
// app
//
// Created by Tobias Stottrop on 18.02.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import Foundation
import MowestaApi
import CoreData
extension DataManager {
func updateWeatherForecast(forecast: WeatherForecast?, error: Error?) {
if (error != nil) {
//maybe handle
}
if (forecast != nil) {
guard let managedContext = getContext() else { return}
if (self.processedLocation.forecast != nil) {
deleteForecast(self.processedLocation.forecast!)
}
let cdWeatherForecast = CDWeatherForecast(context: managedContext, forecast: forecast!)
cdWeatherForecast.location = self.processedLocation
do {
try managedContext.save()
} catch let error as NSError {
print("Could not save. \(error), \(error.userInfo)")
}
}
}
public func deleteForecast(_ forecast: CDWeatherForecast) {
guard let managedContext = getContext() else { return}
managedContext.delete(forecast)
}
}
#if DEBUG
#endif
@@ -24,6 +24,7 @@ class DataManager {
deleteAllDevices()
deleteAllMeasurements()
deleteAllPlacemarkLocations()
deleteAllLocations()
}
}
+12 -1
View File
@@ -8,8 +8,9 @@
import Foundation
import SwiftUI
import CoreData
struct Day {
struct Day : Hashable, Identifiable{
let id: Int
let date: Date
@@ -23,6 +24,16 @@ struct Day {
return toDayArray(dates: result)
}
static func getDayList(conditions: NSSet) -> [Day] {
var result = [Date]()
for condition in conditions {
result = addDay(timestamp: Date(milliseconds: (condition as! CDWeatherCondition).time), days: result)
}
return toDayArray(dates: result)
}
static func toDayArray(dates: [Date]) -> [Day] {
var result = [Day]()
let sortedDates = dates.sorted(by: { $0.compare($1) == .orderedDescending })
@@ -0,0 +1,32 @@
//
// NavigationStack.swift
// app
//
// Created by Tobias Stottrop on 04.03.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import Foundation
import Combine
class NavigationStack: ObservableObject {
let objectWillChange = ObservableObjectPublisher()
@Published var list = [AuthState]() {
willSet {
objectWillChange.send()
}
}
init(firstState: AuthState) {
self.push(state: firstState)
}
public func push(state: AuthState) {
list.append(state)
}
public func pop() {
list.removeLast()
}
}
@@ -16,6 +16,7 @@ import CoreMotion
class BackgroundService {
private let measurementIdentifier = "com.mowesta.measurement"
private let forecastUpdateIdentifier = "com.mowesta.bg.forecast"
static var shared = BackgroundService()
private init() { }
@@ -0,0 +1,59 @@
//
// WeatherForecast+BackgroundService.swift
// app
//
// Created by Tobias Stottrop on 18.02.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import Foundation
import BackgroundTasks
import UIKit
import CoreData
import MowestaApi
class WeatherForecastService {
static var shared = WeatherForecastService()
private let identifier = "com.mowesta.bg.weatherforecast"
private init() { }
func registerWeatherforecastBackgroundService() {
BGTaskScheduler.shared.register(forTaskWithIdentifier: identifier, using: nil) { task in
self.handleWeatherforecastBackgroundTask(task: task as! BGAppRefreshTask)
}
}
func scheduleWeatherforecastBackgroundService() {
let request = BGAppRefreshTaskRequest(identifier: identifier)
request.earliestBeginDate = Date(timeIntervalSinceNow: 3600) // App refresh every hour.
do {
try BGTaskScheduler.shared.submit(request)
} catch {
print("Could not schedule app refresh: \(error)")
}
}
func handleWeatherforecastBackgroundTask(task: BGAppRefreshTask) {
scheduleWeatherforecastBackgroundService()
task.expirationHandler = {
task.setTaskCompleted(success: false)
}
do {
let appDelegate = UIApplication.shared.delegate as! AppDelegate;
let managedContext = appDelegate.persistentContainer.viewContext
let fetch = NSFetchRequest<CDLocation>(entityName: "CDLocation")
let fetchedCDLocations = try managedContext.fetch(fetch)
for location in fetchedCDLocations {
DataManager.shared.processedLocation = location
WeatherAPI.getCityForecast(_id: location.id, completion: DataManager.shared.updateWeatherForecast)
}
} catch {
NSLog("\(error)")
task.setTaskCompleted(success: true)
}
task.setTaskCompleted(success: true)
}
}
@@ -9,8 +9,45 @@
import Foundation
import CoreData
import MowestaApi
@objc(CDLocation)
public class CDLocation: NSManagedObject {
convenience init(context: NSManagedObjectContext, city: MowestaApi.City) {
self.init(context: context)
self.capital = city.capital
self.creationTime = city.creationTime ?? -1
self.id = city._id!
self.markedDeleted = city.deleted ?? false
self.modificationTime = city.modificationTime ?? -1
self.population = Int64(city.population ?? -1)
self.timezone = city.timezone
self.type = city.type.rawValue
self.wikipedia = city.wikipedia ?? ""
for (key, value) in city.names {
let cdNamesDictionary = CDNamesDictionary(context: context, key: key, value: value)
self.addToNames(cdNamesDictionary)
}
}
convenience init(context: NSManagedObjectContext, state: MowestaApi.State) {
self.init(context: context)
self.capital = false
self.id = state._id!
self.creationTime = state.creationTime ?? -1
self.markedDeleted = state.deleted ?? false
self.modificationTime = state.modificationTime ?? -1
self.population = Int64(state.population ?? -1)
self.timezone = state.timezone
self.type = "STATE"
self.wikipedia = state.wikipedia ?? ""
for (key, value) in state.names {
let cdNamesDictionary = CDNamesDictionary(context: context, key: key, value: value)
self.addToNames(cdNamesDictionary)
}
}
}
@@ -12,5 +12,11 @@ import CoreData
@objc(CDNamesDictionary)
public class CDNamesDictionary: NSManagedObject {
convenience init (context: NSManagedObjectContext, key: String, value: String) {
self.init(context: context)
self.key = key
self.value = value
}
}
@@ -0,0 +1,34 @@
//
// CDWeatherCondition+CoreDataClass.swift
// app
//
// Created by Tobias Stottrop on 17.02.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
//
import Foundation
import CoreData
import MowestaApi
@objc(CDWeatherCondition)
public class CDWeatherCondition: NSManagedObject {
convenience init(context: NSManagedObjectContext, condition: WeatherCondition) {
self.init(context: context)
self.cloudCoverage = condition.cloudCoverage
self.cloudDepth = condition.cloudDepth
self.duration = Int64(condition.duration)
self.hour = Int64(condition.hour)
self.humidity = condition.humidity
self.precipitation = condition.precipitation
self.pressure = condition.pressure
self.snowDepth = condition.snowDepth
self.source = condition.source.rawValue
self.temperature = condition.temperature
self.time = condition.time
self.type = condition.getWeatherTypeImageName()
self.windDirection = condition.getWindDirectionImageName()
self.windSpeed = condition.windSpeed
//NSLog("condition temperature: \(condition.temperature) ::: coredata temperature: \(self.temperature)")
}
}
@@ -0,0 +1,36 @@
//
// CDWeatherCondition+CoreDataProperties.swift
// app
//
// Created by Tobias Stottrop on 17.02.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
//
import Foundation
import CoreData
extension CDWeatherCondition {
@nonobjc public class func fetchRequest() -> NSFetchRequest<CDWeatherCondition> {
return NSFetchRequest<CDWeatherCondition>(entityName: "CDWeatherCondition")
}
@NSManaged public var cloudCoverage: Double
@NSManaged public var cloudDepth: Double
@NSManaged public var duration: Int64
@NSManaged public var hour: Int64
@NSManaged public var humidity: Double
@NSManaged public var precipitation: Double
@NSManaged public var pressure: Double
@NSManaged public var snowDepth: Double
@NSManaged public var source: String?
@NSManaged public var temperature: Double
@NSManaged public var time: Int64
@NSManaged public var type: String?
@NSManaged public var windDirection: String?
@NSManaged public var windSpeed: Double
@NSManaged public var forecast: CDWeatherForecast?
}
@@ -0,0 +1,33 @@
//
// CDWeatherForecast+CoreDataClass.swift
// app
//
// Created by Tobias Stottrop on 17.02.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
//
import Foundation
import CoreData
import MowestaApi
@objc(CDWeatherForecast)
public class CDWeatherForecast: NSManagedObject {
convenience init(context: NSManagedObjectContext, forecast: WeatherForecast) {
self.init(context: context)
self.creationTime = forecast.creationTime ?? -1
self.id = forecast._id!
self.markedDeleted = forecast.deleted ?? false
self.modificationTime = forecast.modificationTime ?? -1
self.plantCoverage = forecast.plantCoverage
self.soilType = forecast.soilType.rawValue
self.source = forecast.source.rawValue
self.surfaceHeight = forecast.surfaceHeight
for condition in forecast.conditions {
let cdCondition = CDWeatherCondition(context: context, condition: condition)
self.addToConditions(cdCondition)
}
}
}
@@ -0,0 +1,49 @@
//
// CDWeatherForecast+CoreDataProperties.swift
// app
//
// Created by Tobias Stottrop on 17.02.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
//
import Foundation
import CoreData
extension CDWeatherForecast {
@nonobjc public class func fetchRequest() -> NSFetchRequest<CDWeatherForecast> {
return NSFetchRequest<CDWeatherForecast>(entityName: "CDWeatherForecast")
}
@NSManaged public var creationTime: Int64
@NSManaged public var id: Int64
@NSManaged public var markedDeleted: Bool
@NSManaged public var modificationTime: Int64
@NSManaged public var plantCoverage: Double
@NSManaged public var soilType: String?
@NSManaged public var source: String?
@NSManaged public var surfaceHeight: Double
@NSManaged public var conditions: NSSet?
@NSManaged public var location: CDLocation?
}
// MARK: Generated accessors for conditions
extension CDWeatherForecast {
@objc(addConditionsObject:)
@NSManaged public func addToConditions(_ value: CDWeatherCondition)
@objc(removeConditionsObject:)
@NSManaged public func removeFromConditions(_ value: CDWeatherCondition)
@objc(addConditions:)
@NSManaged public func addToConditions(_ values: NSSet)
@objc(removeConditions:)
@NSManaged public func removeFromConditions(_ values: NSSet)
}
+30
View File
@@ -0,0 +1,30 @@
//
// DailyPrediction.swift
// app
//
// Created by Tobias Stottrop on 04.03.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import Foundation
struct DailyPrediction : Hashable {
static func == (lhs: DailyPrediction, rhs: DailyPrediction) -> Bool {
return lhs.day.id == rhs.day.id && lhs.day.date == rhs.day.date && lhs.rawConditions.count == rhs.rawConditions.count && lhs.minTemperature == rhs.minTemperature && lhs.maxTemperature == rhs.maxTemperature && lhs.symbol == rhs.symbol
}
init(min: Double, max: Double, symbol: String, day: Day, rawConditions: [CDWeatherCondition]) {
self.minTemperature = min
self.maxTemperature = max
self.symbol = symbol
self.day = day
self.rawConditions = rawConditions
}
var minTemperature: Double = -1
var maxTemperature: Double = -1
var symbol: String = "unknown"
var day: Day
var rawConditions: [CDWeatherCondition] = [CDWeatherCondition]()
}
@@ -1,54 +0,0 @@
//
// FavoriteLocations.swift
// app
//
// Created by Sebastian Pobel on 06.01.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import Foundation
import MowestaApi
import SwiftUI
class FavoriteLocations : ObservableObject {
//The PassthroughSubject provides a convenient way to adapt existing imperative code to the Combine model.
// var objectWillChange = PassthroughSubject<Void,Never>()
@Published var locations = [LocationHierarchy]() {
willSet {
objectWillChange.send()
}
}
@Published var currentWeathers = [Int64 : CurrentWeatherData]()
@Published var weatherForecasts = [Int64 : WeatherForecast]()
init(locations: [LocationHierarchy]) {
self.locations = locations
// for location in locations {
// currentWeathers[location._id!] = CurrentWeatherData(temperature: 10, icon: "sun.max")
// weatherForecasts[location._id!] = forecast
// }
}
public func toggleLocation(_ location: LocationHierarchy) {
guard let pos = locations.firstIndex(where: {$0._id == location._id}) else {
locations.append(location)
WeatherAPI.getForecast(_id: location._id!, completion: self.addWeatherForecast)
return
}
locations.remove(at: pos)
}
func addWeatherForecast(weatherforecast: WeatherForecast?, error: Error?) {
if (error != nil) {
//maybe handle
}
if (weatherforecast != nil) {
NSLog("Forecast with id: \(String(describing: weatherforecast?._id)) loaded")
weatherForecasts[(weatherforecast?._id)!] = weatherforecast
}
}
}
@@ -28,7 +28,7 @@ let berlin = City(_id: 5, creationTime: 0, modificationTime: 0, deleted: false,
let rain4 = CurrentWeatherData(temperature: 4, icon: "sun")
let condition = WeatherCondition(source: WeatherCondition.Source.cosmoEurope, time: 1578787200000, hour: 0, duration: 1, type: WeatherCondition.ModelType.clearSky, temperature: 23, windDirection: WeatherCondition.WindDirection.east, windSpeed: 6, cloudCoverage: 12, cloudDepth: 22, pressure: 22, precipitation: 32, snowDepth: 0, humidity: 32)
let condition = WeatherCondition(source: WeatherCondition.Source.cosmoEurope, time: 0, hour: 0, duration: 0, type: WeatherCondition.ModelType.unknown, temperature: 0, windDirection: WeatherCondition.WindDirection.unknown, windSpeed: 0, cloudCoverage: 0, cloudDepth: 0, pressure: 0, precipitation: 0, snowDepth: 0, humidity: 0)
let weatherforecast = WeatherForecast(_id: 8022, creationTime: 1578852215818, modificationTime: 1578852215818, deleted: false, coordinate: Coordinate(latitude: 7.0243988037109375, longitude: 50.9375), source: WeatherForecast.Source.iconEurope, surfaceHeight: -0.02880859375, plantCoverage: 0, soilType: WeatherForecast.SoilType.clay, conditions: [condition])
@@ -38,6 +38,5 @@ func loadTestData() -> [City] {
let bonnMowestaFavorite = SavedMowestaFavorites(id: 13334, type: "CITY")
let bonnCDLocation = CDLocation()
let citiesData: [City] = loadTestData()
File diff suppressed because it is too large Load Diff
@@ -15,12 +15,13 @@ import CoreData
class NewFavoriteLocation: ObservableObject {
typealias MowestaState = MowestaApi.State
let objectWillChange = ObservableObjectPublisher()
static var shared: NewFavoriteLocation = NewFavoriteLocation()
//let objectWillChange = ObservableObjectPublisher()
public static let shared = NewFavoriteLocation()
private static var identifier: String = "com.mowesta.favorites"
private var currentPorcessedLocation: CDLocation?
let appDelegate = UIApplication.shared.delegate as! AppDelegate;
private let appDelegate = UIApplication.shared.delegate as! AppDelegate;
@Published var savedFavorites: [SavedMowestaFavorites] {
didSet {
@@ -54,6 +55,11 @@ class NewFavoriteLocation: ObservableObject {
managedContext.delete(location)
}
public func deleteForecast(_ forecast: CDWeatherForecast) {
let managedContext = appDelegate.persistentContainer.viewContext
managedContext.delete(forecast)
}
public func deleteLocation(_ location: LocationHierarchy) {
// TODO Delete on CD
guard let index = try? self.savedFavorites.firstIndex(where: {$0.id == location._id})
@@ -64,7 +70,14 @@ class NewFavoriteLocation: ObservableObject {
}
public func update(_ location: CDLocation) {
WeatherAPI.getForecast(_id: location.id, completion: self.addWeatherForecast)
//NSLog("called update Location")
currentPorcessedLocation = location
/* if (location.forecast != nil)
{
deleteForecast(location.forecast!)
}*/
DataManager.shared.processedLocation = location
WeatherAPI.getCityForecast(_id: location.id, completion: DataManager.shared.updateWeatherForecast)
}
public func deleteLocation(at index: Int) {
@@ -84,34 +97,12 @@ class NewFavoriteLocation: ObservableObject {
//maybe handle
}
if (city != nil) {
let managedContext = appDelegate.persistentContainer.viewContext
let addloc = CDLocation(context: managedContext)
addloc.capital = city?.capital ?? false
addloc.creationTime = city?.creationTime ?? 0
addloc.id = city!._id!
addloc.markedDeleted = city?.deleted ?? false
addloc.modificationTime = city?.modificationTime ?? 0
addloc.population = Int64(city?.population ?? 0)
addloc.timezone = city?.timezone ?? "+0"
addloc.type = city!.type.rawValue
addloc.wikipedia = city?.wikipedia ?? ""
for (key, value) in city!.names {
createCDNamesDictionary(for: key, with: value, in: addloc)
}
do {
try managedContext.save()
currentPorcessedLocation = addloc
WeatherAPI.getForecast(_id: addloc.id, completion: self.addWeatherForecast)
} catch let error as NSError {
print("Could not save. \(error), \(error.userInfo)")
}
DataManager.shared.updateLocation(for: city!)
}
}
private func createCDWeatherCondition(for condidtion: WeatherCondition, in forecast: CDWeatherForecast) -> CDWeatherCondition {
let managedContext = appDelegate.persistentContainer.viewContext
let managedContext = appDelegate.persistentContainer.viewContext
let cond = CDWeatherCondition(context: managedContext)
cond.cloudCoverage = condidtion.cloudCoverage
cond.cloudDepth = condidtion.cloudDepth
@@ -137,73 +128,16 @@ class NewFavoriteLocation: ObservableObject {
named.key = key
named.value = value
named.location = location
NSLog(named.description);
//NSLog(named.description);
return named
}
private func addWeatherForecast(forecast: WeatherForecast?, error: Error?) {
if (error != nil) {
//maybe handle
}
if (forecast != nil) {
//get Context
let managedContext = appDelegate.persistentContainer.viewContext
let fore = CDWeatherForecast(context: managedContext)
fore.creationTime = forecast?.creationTime ?? 0
fore.id = forecast!._id!
fore.markedDeleted = forecast?.deleted ?? false
fore.modificationTime = forecast?.modificationTime ?? 0
fore.plantCoverage = forecast?.plantCoverage ?? 0
fore.soilType = forecast?.soilType.rawValue ?? ""
fore.source = forecast?.source.rawValue ?? ""
fore.surfaceHeight = forecast?.surfaceHeight ?? 0
fore.location = currentPorcessedLocation
currentPorcessedLocation?.forecast = fore
for condition in forecast!.conditions {
createCDWeatherCondition(for: condition, in: fore)
}
do {
try managedContext.save()
self.objectWillChange.send()
// NSLog(currentPorcessedLocation?.forecast?.conditions?.description ?? "")
} catch let error as NSError {
print("Could not save. \(error), \(error.userInfo)")
}
}
}
private func addLocation(state: MowestaState?, error: Error?) {
if (error != nil) {
//maybe handle
}
if (state != nil) {
let managedContext = appDelegate.persistentContainer.viewContext
let addloc = CDLocation(context: managedContext)
addloc.capital = false
addloc.id = state!._id!
addloc.creationTime = state?.creationTime ?? 0
addloc.markedDeleted = state?.deleted ?? false
addloc.modificationTime = state?.modificationTime ?? 0
addloc.population = Int64(state?.population ?? 0)
addloc.timezone = state?.timezone ?? "+0"
addloc.type = "STATE"
addloc.wikipedia = state?.wikipedia ?? ""
do {
try managedContext.save()
currentPorcessedLocation = addloc
WeatherAPI.getForecast(_id: addloc.id, completion: self.addWeatherForecast)
} catch let error as NSError {
print("Could not save. \(error), \(error.userInfo)")
}
DataManager.shared.updateLocation(for: state!)
}
}
@@ -229,22 +163,22 @@ class NewFavoriteLocation: ObservableObject {
public func toggleLocation(_ location: CDLocation) {
if let index = savedFavorites.firstIndex(where: { $0.id == location.id}) {
// TODO Delete on CD
savedFavorites.remove(at: index)
} else {
// TODO Delete on CD
savedFavorites.remove(at: index)
} else {
switch location.type {
case LocationHierarchy.ModelType.city.rawValue:
LocationAPI.getCity(_id: location.id, completion: self.addLocation)
case LocationHierarchy.ModelType.state.rawValue:
case LocationHierarchy.ModelType.city.rawValue:
LocationAPI.getCity(_id: location.id, completion: self.addLocation)
case LocationHierarchy.ModelType.state.rawValue:
LocationAPI.getState(_id: location.id, completion: self.addLocation)
case LocationHierarchy.ModelType.country.rawValue: break
default:
break
break
}
savedFavorites.append(SavedMowestaFavorites(id: location.id, type: location.type!))
}
}
}
}
}
class SavedMowestaFavorites: Codable, Identifiable {
@@ -21,29 +21,6 @@ enum Language : String {
case DEFAULT
}
extension City : Hashable, LocationName {
public static func == (lhs: City, rhs: City) -> Bool {
return lhs._id == rhs._id
}
public func hash(into hasher: inout Hasher) {
hasher.combine(names)
hasher.combine(coordinate.longitude)
hasher.combine(coordinate.latitude)
}
public func getMillisecondsFromGMT() -> Int {
NSLog("The timezone: \(self.timezone)")
switch self.timezone {
case "+1":
return 3600 * 1000
default:
return 0
}
}
}
extension State : Hashable, LocationName {
public static func == (lhs: State, rhs: State) -> Bool {
+140
View File
@@ -0,0 +1,140 @@
//
// UserData.swift
// app
//
// Created by Sebastian Pobel on 16.12.19.
// Copyright © 2019 Marcus Handte. All rights reserved.
//
import Foundation
import KeychainSwift
import MowestaApi
/*
This class provides user information like name and password.
This credentials are needed for accessing mowesta server.
As this information must be kept secret, it is encrypted and secured in the keychain.
@author Sebastian.Pobel
*/
class UserData: ObservableObject {
static let shared = UserData()
@Published var loginName: String = ""
@Published var humanName: String? = nil
@Published var password: String = ""
@Published var loggedIn: Bool = false
@Published var agreedToS: Bool = false
let keyChain = KeychainSwift()
private init(loginName: String? = nil, password: String? = nil, humanName: String? = nil, loggedIn: Bool? = nil, agreedToS: Bool? = nil) {
self.loginName = loginName ?? keyChain.get(PropertyKey.user.loginName) ?? self.loginName
self.humanName = humanName ?? keyChain.get(PropertyKey.user.humanName) ?? self.humanName
self.password = password ?? keyChain.get(PropertyKey.user.password) ?? self.password
self.loggedIn = loggedIn ?? keyChain.getBool(PropertyKey.user.loggedIn) ?? self.loggedIn
self.agreedToS = loggedIn ?? keyChain.getBool(PropertyKey.user.agreedToS) ?? self.agreedToS
NSLog("load user \(self.loginName)")
}
func login(onSuccess: @escaping () -> Void, onError: @escaping () -> Void) {
NSLog("try login user")
// 1. no usercredentials?
if (loginName == "" || password == "") {
return onError()
}
// 2. set credentials for user login
SwaggerApi.shared.loginUser(self)
// 3. test if credentials are ok
UserAPI.getCurrentUser(completion: {
self.didLogin(user: $0, error: $1, onSuccess: onSuccess, onError: onError)
})
}
func agreeToS() {
self.agreedToS = true
self.persist()
}
func disagreeToS() {
self.agreedToS = false
self.persist()
}
func logout() {
NSLog("user logout")
DataManager.shared.deleteAllDevices()
SwaggerApi.shared.logoutUser()
self.reset()
}
func pairDevice() {
if loggedIn && DeviceData.shared.created {
DeviceAPI.setCurrentDeviceUser(completion: {d, err in
if let error = err {
NSLog("\(error)")
}
DataManager.shared.loadDevicesFromServer()
})
}
}
func register(registration: UserRegistration, onSuccess: @escaping () -> Void, onError: @escaping () -> Void) {
UserAPI.registerUser(body: registration, completion: {
self.didLogin(user: $0, error: $1, onSuccess: onSuccess, onError: onError)
})
}
private func didLogin(user: User?, error: Error?, onSuccess: @escaping () -> Void, onError: @escaping () -> Void) {
if let u = user {
self.humanName = u.name
self.loggedIn = true
self.persist()
NSLog("user login successful")
onSuccess()
DataManager.shared.loadDevicesFromServer()
return
} else {
SwaggerApi.shared.logoutUser()
if error != nil {
NSLog("\(error!)")
onError()
}
}
}
private func persist() {
keyChain.set(self.loginName, forKey: PropertyKey.user.loginName)
keyChain.set(self.humanName!, forKey: PropertyKey.user.humanName)
keyChain.set(self.password, forKey: PropertyKey.user.password)
keyChain.set(self.loggedIn, forKey: PropertyKey.user.loggedIn)
keyChain.set(self.agreedToS, forKey: PropertyKey.user.agreedToS)
NSLog("persisted user \(self.loginName)")
}
private func reset() {
keyChain.delete(PropertyKey.user.loginName)
keyChain.delete(PropertyKey.user.humanName)
keyChain.delete(PropertyKey.user.password)
keyChain.delete(PropertyKey.user.loggedIn)
keyChain.delete(PropertyKey.user.agreedToS)
loginName = ""
humanName = nil
password = ""
loggedIn = false
agreedToS = false
NSLog("reseted user")
}
}
#if DEBUG
extension UserData {
static let mockLoggedOut = UserData(loggedIn: false)
static let mockLoggedIn = UserData(loggedIn: true)
static let mockEmpty = UserData()
static let adminUser = UserData(loginName: "admin", password: "admin", humanName: "Administrator", loggedIn: true)
}
#endif
@@ -0,0 +1,43 @@
//
// City+Extension.swift
// app
//
// Created by Tobias Stottrop on 30.01.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import Foundation
import MowestaApi
extension City : Hashable, LocationName {
public static func == (lhs: City, rhs: City) -> Bool {
return lhs._id == rhs._id
}
public func hash(into hasher: inout Hasher) {
hasher.combine(names)
hasher.combine(coordinate.longitude)
hasher.combine(coordinate.latitude)
}
func getSubName() -> String {
var subname = ""
if (self.state != nil) {
subname.append(contentsOf: (state?.getName())!)
subname.append(contentsOf: " · ")
}
subname.append(contentsOf: self.country.getName())
return subname;
}
public func getMillisecondsFromGMT() -> Int {
NSLog("The timezone: \(self.timezone)")
switch self.timezone {
case "+1":
return 3600 * 1000
default:
return 0
}
}
}
@@ -0,0 +1,31 @@
//
// CoordinateExtensions.swift
// app
//
// Created by Sebastian Pobel on 27.01.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import Foundation
import MowestaApi
extension Coordinate: Hashable {
public func equal2dezimals(coordinate: Coordinate) -> Bool {
return self.twoDezimals() == coordinate.twoDezimals()
}
public func twoDezimals() -> Coordinate {
Coordinate(latitude: Double(round(100 * self.latitude) / 100), longitude: Double(round(100 * self.longitude) / 100))
}
public static func == (lhs: Coordinate, rhs: Coordinate) -> Bool {
return lhs.longitude == rhs.longitude
&& lhs.latitude == rhs.latitude
}
public func hash(into hasher: inout Hasher) {
hasher.combine(longitude)
hasher.combine(latitude)
}
}
@@ -0,0 +1,24 @@
//
// Double+Extension.swift
// app
//
// Created by Tobias Stottrop on 30.01.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import Foundation
extension Double {
func round(to places: Int) -> Double {
let divisor = pow(10.0, Double(places))
return (self * divisor).rounded() / divisor
}
func removeZerosFromEnd() -> String {
let formatter = NumberFormatter()
let number = NSNumber(value: self)
formatter.minimumFractionDigits = 0
formatter.maximumFractionDigits = 16 //maximum digits in Double after dot (maximum precision)
return String(formatter.string(from: number) ?? "")
}
}
@@ -32,6 +32,10 @@ extension View {
func resignKeyboardOnDragGesture() -> some View {
return modifier(ResignKeyboardOnDragGesture())
}
func eraseToAnyView () -> AnyView {
AnyView(self)
}
}
extension Font {
@@ -8,7 +8,7 @@
import SwiftUI
struct ContentView: View {
struct MainTabView: View {
@UIState private var selectedTab = 1
var body: some View {
@@ -26,14 +26,14 @@ struct ContentView: View {
Group {
Image(systemName: selectedTab == 1
? "heart.fill" : "heart")
Text("Favorites")
Text("Favorite_NavigationBarTitle")
}.font(Font.system(size: 25))
}.tag(1)
SearchTab()
.tabItem{
Group {
Image(systemName: "magnifyingglass")
Text("Search")
Text("Search_NavigationBarTitle")
}.font(Font.system(size: 25))
}.tag(2)
}
@@ -45,8 +45,8 @@ struct ContentView: View {
struct ContentView_Previews : PreviewProvider {
static var previews: some View {
ContentView()
.environmentObject(FavoriteLocations(locations: [locationEssen]))
MainTabView()
//.environmentObject(FavoriteLocations(locations: [locationEssen]))
.environmentObject(UserData.mockEmpty)
}
}
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="15702" systemVersion="19D76" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="15702" systemVersion="19C57" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="CDCoordinate" representedClassName="CDCoordinate" syncable="YES" codeGenerationType="category">
<attribute name="latitude" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES"/>
<attribute name="longitude" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES"/>
@@ -66,17 +66,17 @@
<relationship name="location" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="CDLocation" inverseName="names" inverseEntity="CDLocation"/>
</entity>
<entity name="CDPlacemarkLocation" representedClassName="CDPlacemarkLocation" syncable="YES">
<attribute name="latitude" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="longitude" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="name" attributeType="String"/>
<uniquenessConstraints>
<uniquenessConstraint>
<constraint value="longitude"/>
<constraint value="latitude"/>
</uniquenessConstraint>
</uniquenessConstraints>
<attribute name="latitude" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="longitude" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="name" attributeType="String"/>
<uniquenessConstraints>
<uniquenessConstraint>
<constraint value="longitude"/>
<constraint value="latitude"/>
</uniquenessConstraint>
</uniquenessConstraints>
</entity>
<entity name="CDWeatherCondition" representedClassName="CDWeatherCondition" syncable="YES" codeGenerationType="class">
<entity name="CDWeatherCondition" representedClassName="CDWeatherCondition" syncable="YES">
<attribute name="cloudCoverage" optional="YES" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES"/>
<attribute name="cloudDepth" optional="YES" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES"/>
<attribute name="duration" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
@@ -93,7 +93,7 @@
<attribute name="windSpeed" optional="YES" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES"/>
<relationship name="forecast" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="CDWeatherForecast" inverseName="conditions" inverseEntity="CDWeatherForecast"/>
</entity>
<entity name="CDWeatherForecast" representedClassName="CDWeatherForecast" syncable="YES" codeGenerationType="class">
<entity name="CDWeatherForecast" representedClassName="CDWeatherForecast" syncable="YES">
<attribute name="creationTime" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="id" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="markedDeleted" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
@@ -113,7 +113,7 @@
<element name="CDMeasurement" positionX="-53.98046875" positionY="179.52734375" width="128" height="28"/>
<element name="CDNamesDictionary" positionX="122.83984375" positionY="235.515625" width="128" height="88"/>
<element name="CDWeatherCondition" positionX="-227.6640625" positionY="303.65625" width="128" height="268"/>
<element name="CDWeatherForecast" positionX="-685.04296875" positionY="288.8203125" width="128" height="28"/>
<element name="CDWeatherForecast" positionX="-685.04296875" positionY="288.8203125" width="128" height="193"/>
<element name="CDPlacemarkLocation" positionX="-477" positionY="153" width="128" height="88"/>
</elements>
</model>
</model>
+11 -9
View File
@@ -14,7 +14,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
let favorites = FavoriteLocations(locations: [locationEssen])
//let favorites = FavoriteLocations(locations: [locationEssen])
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
@@ -30,16 +30,18 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// logout user if not possible due to wrong credentials
// in fact of no connection 404 etc. we should show error screen to start later
UserData.shared.login(onSuccess: {}, onError: {})
let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
// Create the SwiftUI view that provides the window content
let contentView = ContentView()
.environment(\.managedObjectContext, context)
.environmentObject(NewFavoriteLocation.shared)
.environmentObject(UserData.shared)
.environmentObject(DeviceData.shared)
.environmentObject(favorites)
let state = NavigationStack(firstState: AuthState.ToSScreen)
let contentView = AppRootView()
.environment(\.managedObjectContext, context)
.environmentObject(NewFavoriteLocation.shared)
.environmentObject(UserData.shared)
.environmentObject(DeviceData.shared)
.environmentObject(state)
//.environmentObject(favorites)
// Use a UIHostingController as window root view controller.
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
+30 -48
View File
@@ -10,25 +10,7 @@ import SwiftUI
struct FavoriteDetail: View {
@EnvironmentObject var favorites: NewFavoriteLocation
var location: CDLocation?
private func getCurrentCDWeatherCondition() -> some View {
guard ((location?.forecast?.conditions) != nil)
else {
return FavoriteHeaderView()
}
for case let item as CDWeatherCondition in (location?.forecast!.conditions)! {
let epochInMS = Date().timeIntervalSince1970 * 1000;
let withGMT = epochInMS + (self.location?.getMillisecondsFromGMT() ?? 0 )
if (Int64(withGMT) > item.time && Int64(withGMT) <= ((item.time + Int64(item.duration * 3600 * 1000)))) {
return FavoriteHeaderView(condition: item)
}
}
return FavoriteHeaderView()
}
var location: CDLocation
func getTodayView() -> some View {
return FavoriteTodayView(location: location)
@@ -41,57 +23,57 @@ struct FavoriteDetail: View {
var body: some View {
ScrollView {
VStack(alignment: .leading) {
ScrollView {
VStack(alignment: .leading) {
Text("Now")
.font(.headline)
.padding(10)
Card {
self.getCurrentCDWeatherCondition()
FavoriteHeaderView(location: self.location)
}.padding(10)
}
VStack(alignment: .leading) {
}
VStack(alignment: .leading) {
Text("Today")
.font(.headline)
.padding(10)
Card {
self.getTodayView()
}.padding(10)
}
}
VStack(alignment: .leading) {
VStack(alignment: .leading) {
Text("Next Days")
.font(.headline)
.padding(10)
Card {
self.getNextDaysView()
FavoritesNextDaysView(location: self.location)
}.padding(10)
}
}
.navigationBarTitle(location?.getName() ?? "N/A")
.navigationBarItems(trailing:
VStack {
Button(action: {
if (self.location != nil) {
self.favorites.toggleLocation(self.location!)
}
}) {
Image(systemName: (self.favorites.savedFavorites.first(where: {$0.id == location?.id}) != nil) ? "heart.fill" : "heart")
.foregroundColor(Color.red)
.font(Font.system(size: 25))
}
.navigationBarTitle(location.getName() ?? "N/A")
.navigationBarItems(trailing:
VStack {
Button(action: {
if (self.location != nil) {
self.favorites.toggleLocation(self.location)
}
})
.onAppear(perform: self.fetch)
}) {
Image(systemName: (self.favorites.savedFavorites.first(where: {$0.id == location.id}) != nil) ? "heart.fill" : "heart")
.foregroundColor(Color.red)
.font(Font.system(size: 25))
}
})
.onAppear(perform: self.fetch)
}
private func fetch() {
if (location != nil) {
favorites.update(location!)
}
// NSLog("FavoriteDetail: \(location)")
favorites.update(location)
}
}
@@ -5,46 +5,109 @@
// Created by Tobias Stottrop on 27.01.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import SwiftUI
import MowestaApi
struct FavoriteHeaderView: View {
var condition: CDWeatherCondition?
var location: CDLocation
@UIState var condition: WeatherCondition = moc_condition_empty
func getDateAsString() -> String {
let formatter = DateFormatter()
formatter.locale = Locale(identifier: "de_DE")
formatter.dateStyle = .medium
formatter.timeStyle = .short
func getWeatherCondition(condition: WeatherCondition?, error: Error?) {
if (condition != nil) {
let unixTime = Double(condition!.time)/1000
let date = Date(timeIntervalSince1970: unixTime)
return formatter.string(from: date)
//NSLog("condition: \(condition)")
self.condition = condition!
}
return formatter.string(from: Date())
}
func updateCondition() {
//NSLog("update condition: \(location.id)")
WeatherAPI.getCityCondition(_id: location.id, completion: getWeatherCondition)
}
var body: some View {
VStack(alignment: .leading) {
Text(getDateAsString())
VStack (alignment: .leading) {
HStack {
Image(systemName: condition.getWeatherTypeImageName())
Spacer()
HStack(alignment: .center, spacing: 16) {
Image(systemName: condition?.type ?? "questionmark")
.font(.largeTitle)
Text("\(String(Int(condition?.temperature ?? 0)))°")
.font(.largeTitle)
}
Spacer()
Text("Aktuelles Wetter")
.font(.title)
.bold()
}
HStack {
Image(systemName: "wind")
Image(systemName: condition?.windDirection ?? "questionmark")
Spacer()
Text("\(condition?.windSpeed ?? 0) km/h")
}
HStack {
Text("Temperatur")
.font(.subheadline)
.bold()
Spacer()
Text("\(condition.temperature.round(to: 0).removeZerosFromEnd())°C / \((condition.temperature*(9/5)+32).round(to: 0).removeZerosFromEnd())°F")
.font(.caption)
.bold()
}
HStack {
Text("Windstärke")
.font(.subheadline)
.bold()
Spacer()
Image(systemName: condition.getWindDirectionImageName())
Text("\(condition.windSpeed.round(to: 0).removeZerosFromEnd()) m/s")
.font(.caption)
.bold()
}
HStack {
Text("Luftfeuchtigkeit")
.font(.subheadline)
.bold()
Spacer()
Text("\(condition.humidity.round(to: 0).removeZerosFromEnd()) %")
.font(.caption)
.bold()
}
HStack {
Text("Schneetiefe")
.font(.subheadline)
.bold()
Spacer()
Text("\(condition.snowDepth.round(to: 2).removeZerosFromEnd()) m")
.font(.caption)
.bold()
}
HStack {
Text("Wolkendichte")
.font(.subheadline)
.bold()
Spacer()
Text("\(condition.cloudCoverage.round(to: 2).removeZerosFromEnd()) %")
.font(.caption)
.bold()
}
HStack {
Text("Niederschlagsmenge")
.font(.subheadline)
.bold()
Spacer()
Text("\(condition.precipitation.round(to: 2).removeZerosFromEnd()) kg/hm²")
.font(.caption)
.bold()
}
HStack {
Text("Luftdruck")
.font(.subheadline)
.bold()
Spacer()
Text("\(condition.pressure.round(to: 2).removeZerosFromEnd()) hPa")
.font(.caption)
.bold()
}
}
.padding()
.onAppear(perform: self.updateCondition)
}
}
struct FavoriteHeaderView_Previews: PreviewProvider {
static var previews: some View {
FavoriteHeaderView(location: DataManager.locationMock, condition: moc_condition_wolfsburg)
}
}
+30 -21
View File
@@ -8,54 +8,65 @@
import SwiftUI
import MowestaApi
import SwiftUICharts
struct FavoriteList: View {
@EnvironmentObject var favorites: FavoriteLocations
@EnvironmentObject var newFavoriteLocation: NewFavoriteLocation
@FetchRequest(
entity: CDLocation.entity(),
sortDescriptors: []
) var allLocations: FetchedResults<CDLocation>
@EnvironmentObject var favorites: NewFavoriteLocation
@EnvironmentObject var user: UserData
@UIState private var refreshing = false
@UIState private var searchFavorites = false;
private var didSave = NotificationCenter.default.publisher(for: .NSManagedObjectContextDidSave)
private func deleteItem(at indexSet: IndexSet) {
self.favorites.locations.remove(atOffsets: indexSet)
favorites.deleteLocation(at: indexSet)
}
private func setFavoriteListItemView (for location: SavedMowestaFavorites) -> some View {
let loc = allLocations.first(where: {
$0.id == location.id
})
return NavigationLink(destination: FavoriteDetail(location: loc)) {FavoriteListItemView(cdLocation: loc)}
//NSLog("location: \(loc ?? nil)")
if (loc != nil) {
return NavigationLink(destination: FavoriteDetail(location: loc!)) {FavoriteListItemView(cdLocation: loc)}
} else {
return NavigationLink(destination: FavoriteDetail(location: moc_cd_location_wolfsburg)) {FavoriteListItemView(cdLocation: loc)}
}
}
var body: some View {
NavigationView {
List {
ForEach(newFavoriteLocation.savedFavorites) { location in
self.setFavoriteListItemView(for: location)
return NavigationView {
VStack {
if favorites.savedFavorites.count > 0 {
List {
ForEach(favorites.savedFavorites) { location in
self.setFavoriteListItemView(for: location)
}
.onDelete(perform: favorites.deleteLocation)
.onMove(perform: favorites.move)
}
.listStyle(GroupedListStyle())
} else {
FavoriteListEmptyView()
}
.onDelete(perform: self.newFavoriteLocation.deleteLocation)
.onMove(perform: self.newFavoriteLocation.move)
}
.listStyle(GroupedListStyle())
.navigationBarTitle("Favorites", displayMode: .automatic)
.navigationBarTitle("Favorite_NavigationBarTitle", displayMode: .automatic)
.navigationBarItems(leading: EditButton(), trailing:
Button(action: {
self.searchFavorites = true
}){
Text("Add")
Text("FVAdd")
})
}.sheet(isPresented: $searchFavorites) {
FavoriteSearch(isPresented: self.$searchFavorites)
.environmentObject(self.favorites)
.environmentObject(self.newFavoriteLocation)
}
}
}
@@ -63,8 +74,6 @@ struct FavoriteList: View {
struct FavoriteList_Previews: PreviewProvider {
static var previews: some View {
FavoriteList()
.environmentObject(FavoriteLocations(locations: [locationEssen]))
.environmentObject(NewFavoriteLocation.shared)
}
}
@@ -0,0 +1,125 @@
//
// FavoriteListEmptyView.swift
// app
//
// Created by Tobias Stottrop on 05.03.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import SwiftUI
struct FavoriteListEmptyView: View {
var body: some View {
ZStack {
HStack{
Spacer()
VStack {
Spacer()
Image(systemName: "cloud.fill")
.font(.system(size: 80))
.padding(.trailing, 80)
.padding(.bottom, 30)
.opacity(0.2)
Spacer()
}
Spacer()
}
HStack{
Spacer()
VStack {
Spacer()
Image(systemName: "sun.haze")
.font(.system(size: 40))
.padding(.leading, 120)
.padding(.top, 70)
.opacity(0.2)
Spacer()
}
Spacer()
}
HStack{
Spacer()
VStack {
Spacer()
Image(systemName: "moon.stars")
.font(.system(size: 25))
.padding(.leading, 300)
.padding(.top, 50)
.opacity(0.2)
Spacer()
}
Spacer()
}
HStack{
Spacer()
VStack {
Spacer()
Text("FVNoContent")
.font(.headline)
.padding(.bottom, 150)
.opacity(0.4)
Spacer()
}
Spacer()
}
HStack{
Spacer()
VStack {
VStack {
Image(systemName: "arrow.turn.right.up")
Text("FVAddFavorie")
}
.frame(minWidth: 0, maxWidth: 100)
.padding(.trailing, 5)
.opacity(0.2)
Spacer()
}
}
HStack{
Spacer()
VStack {
Spacer()
VStack {
Text("FVSearch")
Image(systemName: "arrow.down")
}
.frame(minWidth: 0, maxWidth: 120)
.padding(.trailing, 5)
.padding(.bottom, 15)
.opacity(0.2)
}
}
HStack{
VStack {
Spacer()
VStack {
Text("FVStations")
Image(systemName: "arrow.down")
}
.frame(minWidth: 0, maxWidth: 120)
.padding(.leading, 15)
.padding(.bottom, 15)
.opacity(0.2)
}
Spacer()
}
}
}
}
struct FavoriteListEmptyView_Previews: PreviewProvider {
static var previews: some View {
FavoriteListEmptyView()
}
}
@@ -11,14 +11,13 @@ import CoreData
struct FavoriteListItemView: View {
var cdLocation: CDLocation?
let currentDate: Date = Date()
func getCurrentValues() -> some View {
func setupView() -> some View {
let content = HStack{
Image(systemName: "sun.min")
Text("0")
}
guard ((cdLocation?.forecast?.conditions) != nil)
@@ -32,35 +31,31 @@ struct FavoriteListItemView: View {
return HStack {
Image(systemName: item.type!)
Text("\(Int(item.temperature))°")
}
}
}
/*let startForecast = Date(timeIntervalSince1970: Double(item.time))
let durationInMs = item.duration * 3600 * 1000
let endForecast = Date(timeIntervalSince1970: Double(item.time + durationInMs))
if (startForecast > currentDate && endForecast < currentDate) {
return HStack {
Image(systemName: item.type!)
Text("\(item.temperature)")
}
}
}*/
}
/*let startForecast = Date(timeIntervalSince1970: Double(item.time))
let durationInMs = item.duration * 3600 * 1000
let endForecast = Date(timeIntervalSince1970: Double(item.time + durationInMs))
if (startForecast > currentDate && endForecast < currentDate) {
return HStack {
Image(systemName: item.type!)
Text("\(item.temperature)")
}
}
}*/
return content;
}
var body: some View {
HStack {
Text(cdLocation?.getName() ?? "N/A")
Spacer()
getCurrentValues()
Text(cdLocation?.getName() ?? "N/A")
Spacer()
setupView()
}
}
}
@@ -9,21 +9,94 @@
import SwiftUI
struct FavoriteNextDaysDayView: View {
var date: String
var temp: String
var type: String
var conditions: [CDWeatherCondition]
var body: some View {
HStack {
Text(date)
Spacer()
Image(systemName: type)
Text(temp)
let sorted = conditions.sorted(by: {
$0.time < $1.time
})
return List {
ForEach(sorted, id: \.hour) {cond in
Card {
VStack {
HStack{
Text("\(Date(milliseconds: cond.time).localLongString):")
Spacer()
Image(systemName: cond.type ?? "unknown")
}.padding(.bottom)
HStack {
Text("Temperature")
Spacer()
Text("\(cond.temperature.round(to: 0).removeZerosFromEnd())°C / \((cond.temperature*(9/5)+32).round(to: 0).removeZerosFromEnd())°F")
}
HStack {
Text("Cloud Coverage")
Spacer()
Text("\(cond.cloudCoverage.round(to: 2).removeZerosFromEnd())%")
}
HStack {
Text("Cloud Depth")
Spacer()
Text("\(cond.cloudDepth.round(to: 2).removeZerosFromEnd())%")
}
HStack {
Text("humidity")
Spacer()
Text("\(cond.humidity.round(to: 2).removeZerosFromEnd())%")
}
HStack {
Text("precipitation")
Spacer()
Text("\(cond.precipitation.round(to: 2).removeZerosFromEnd()) kg/hm²")
}
HStack {
Text("precipitation")
Spacer()
Text("\(cond.precipitation.round(to: 2).removeZerosFromEnd()) hPa")
}
HStack {
Text("pressure")
Spacer()
Text("\(cond.pressure.round(to: 2).removeZerosFromEnd()) hPa")
}
HStack {
Text("snowDepth")
Spacer()
Text("\(cond.snowDepth.round(to: 2).removeZerosFromEnd()) m")
}
HStack {
Text("windSpeed")
Spacer()
Image(systemName: cond.windDirection ?? "unknown")
Text("\(cond.windSpeed.round(to: 2).removeZerosFromEnd()) m/s")
}
}
}.padding(.bottom)
}
}
.navigationBarTitle("Alle Vorhersagen")
}
}
struct FavoriteNextDaysDayView_Previews: PreviewProvider {
static var previews: some View {
FavoriteNextDaysDayView(date: "Montag,12:44 Uhr", temp: "22", type:"sun")
}
}
/*
self.cloudCoverage = condition.cloudCoverage
self.cloudDepth = condition.cloudDepth
self.duration = Int64(condition.duration)
self.hour = Int64(condition.hour)
self.humidity = condition.humidity
self.precipitation = condition.precipitation
self.pressure = condition.pressure
self.snowDepth = condition.snowDepth
self.source = condition.source.rawValue
self.temperature = condition.temperature
self.time = condition.time
self.type = condition.getWeatherTypeImageName()
self.windDirection = condition.getWindDirectionImageName()
self.windSpeed = condition.windSpeed
*/
//struct FavoriteNextDaysDayView_Previews: PreviewProvider {
// static var previews: some View {
// FavoriteNextDaysDayView(date: "Montag,12:44 Uhr", temp: "22", type:"sun")
// }
//}
@@ -22,7 +22,7 @@ struct FavoriteSearch: View {
VStack {
SearchBar(text: self.$searchText, onChanged: self.searchTextChanged, onCanceled: self.canceled, onSearch: self.search)
FavoriteSearchResults(searchProgress: self.$searchProgress, locations: self.$locations, isPresented: self.$isPresented)
.navigationBarTitle(Text("Add Favorites"), displayMode: .inline)
.navigationBarTitle(Text("SVTitle"), displayMode: .inline)
.navigationBarItems(trailing: Button(action: {
self.isPresented = false
}){
@@ -11,9 +11,7 @@ import MowestaApi
struct FavoriteSearchResultRow: View {
var location: LocationHierarchy
@EnvironmentObject var favorites: FavoriteLocations
@EnvironmentObject var newFavoriteLocation: NewFavoriteLocation
@EnvironmentObject var favorites: NewFavoriteLocation
@UIState private var reload = false
var delimeter: String {
@@ -90,12 +88,11 @@ struct FavoriteSearchResultRow: View {
}
Button(action: {
self.newFavoriteLocation.toggleLocation(self.location)
self.favorites.toggleLocation(self.location)
self.reload = !self.reload
}) {
Image(systemName: (newFavoriteLocation.savedFavorites.firstIndex(where: {$0.id == location._id}) != nil) ? "heart.fill" : "heart").foregroundColor(Color.red)
.font(Font.system(size: 25))
Image(systemName: ( self.favorites.savedFavorites.firstIndex(where: {$0.id == location._id}) != nil) ? "heart.fill" : "heart").foregroundColor(Color.red)
.font(Font.system(size: 25))
}
}
@@ -112,7 +109,7 @@ struct FavoriteSearchResultRow_Previews: PreviewProvider {
//FavoriteSearchResultRow(isPresented: .constant(true), location: locationNrw)
//FavoriteSearchResultRow(isPresented: .constant(true), location: locationDeutschland)
}
.environmentObject(FavoriteLocations(locations: [locationEssen]))
.environmentObject(NewFavoriteLocation())
.previewLayout(.fixed(width: 300, height:70))
}
}
@@ -10,31 +10,50 @@ import SwiftUI
struct FavoriteTodayView: View {
var location: CDLocation?
private let date = Date()
private let calendar = Calendar.current
func getSortedConditions() -> [CDWeatherCondition] {
guard ((location?.forecast?.conditions) != nil)
else {
return []
}
else {
return []
}
var content = (location?.forecast?.conditions as! Set<CDWeatherCondition>).sorted(by: { $0.hour < $1.hour })
content.removeAll(where: {$0.hour > 24})
return content
}
func displaySortetdCondition(cond: CDWeatherCondition) -> some View {
let currentHour = calendar.component(.hour, from: date)
if (currentHour == cond.hour) {
return VStack(spacing: 8) {
Text("\(cond.hour) Uhr")
.font(.footnote)
Image(systemName: cond.type ?? "questionmark")
.font(.body)
Text("\(cond.temperature.round(to: 0).removeZerosFromEnd())°")
.font(.headline)
}.foregroundColor(Color("mowesta-green")).frame(width: 50).eraseToAnyView()
} else {
return VStack(spacing: 8) {
Text("\(cond.hour) Uhr")
.font(.footnote)
Image(systemName: cond.type ?? "questionmark")
.font(.body)
Text("\(String(Int(cond.temperature )))°")
.font(.headline)
}.frame(width: 50).eraseToAnyView()
}
}
var body: some View {
ScrollView(.horizontal){
HStack(spacing: 8) {
ForEach(getSortedConditions(), id: \.hour) { cond in
VStack(spacing: 8) {
Text("\(cond.hour) Uhr")
.font(.footnote)
Image(systemName: cond.type ?? "questionmark")
.font(.body)
Text("\(String(Int(cond.temperature )))°")
.font(.headline)
}.frame(width: 40)
}
ForEach(getSortedConditions(), id: \.hour) { cond in
self.displaySortetdCondition(cond: cond)
}
}
}
}
@@ -10,6 +10,8 @@ import SwiftUI
struct FavoritesNextDaysView: View {
var location: CDLocation?
@UIState var dailyPredictions: [DailyPrediction] = [DailyPrediction]()
//@UIState var rawConditions = [Day : [CDWeatherCondition]]()
func getDay(value: Int) -> String {
switch value {
@@ -32,16 +34,49 @@ struct FavoritesNextDaysView: View {
}
}
func mostFrequent(array: [CDWeatherCondition]) -> (value: String, count: Int)? {
var counts = [String: Int]()
array.forEach { counts[$0.type ?? "unknown"] = (counts[$0.type ?? "unknown"] ?? 0) + 1 }
if let (value, count) = counts.max(by: {$0.1 < $1.1}) {
return (value, count)
}
// array was empty
return nil
}
func getCurrentValues() {
let list = Day.getDayList(conditions: location?.forecast?.conditions ?? NSSet())
for item in list {
let filtered = location?.forecast?.conditions?.filter { (Date(milliseconds:($0 as! CDWeatherCondition).time) > item.date) && (Date(milliseconds:($0 as! CDWeatherCondition).time ) < item.date.addingTimeInterval(86400))}
//rawConditions[item] = (filtered as! [CDWeatherCondition])
let highest = (filtered as! [CDWeatherCondition]).max { $0.temperature < $1.temperature }?.temperature ?? -1
let lowest = (filtered as! [CDWeatherCondition]).max { $0.temperature > $1.temperature }?.temperature ?? -1
let symbol = mostFrequent(array: (filtered as! [CDWeatherCondition]))?.value ?? "unknown"
let prediction = DailyPrediction(min: lowest, max: highest, symbol: symbol, day: item, rawConditions: (filtered as! [CDWeatherCondition]))
if (!dailyPredictions.contains(prediction)) {
dailyPredictions.append(DailyPrediction(min: lowest, max: highest, symbol: symbol, day: item, rawConditions: (filtered as! [CDWeatherCondition])))
}
}
}
func groupedEpisodesByDay(_ episodes: [CDWeatherCondition]) -> [Date: [CDWeatherCondition]] {
let empty: [Date: [CDWeatherCondition]] = [:]
return episodes.reduce(into: empty) { acc, cur in
let unixTime = Double(cur.time)/1000
let fromdate = Date(timeIntervalSince1970: unixTime)
let components = Calendar.current.dateComponents([.day], from: fromdate)
let date = Calendar.current.date(from: components)!
let existing = acc[date] ?? []
acc[date] = existing + [cur]
}
let empty: [Date: [CDWeatherCondition]] = [:]
return episodes.reduce(into: empty) { acc, cur in
let unixTime = Double(cur.time)/1000
let fromdate = Date(timeIntervalSince1970: unixTime)
let components = Calendar.current.dateComponents([.day], from: fromdate)
let date = Calendar.current.date(from: components)!
let existing = acc[date] ?? []
acc[date] = existing + [cur]
}
}
func getDayOfWeek(_ today: Int64) -> String {
@@ -57,18 +92,56 @@ struct FavoritesNextDaysView: View {
func getDays() -> [CDWeatherCondition] {
guard ((location?.forecast?.conditions) != nil)
else {
return []
}
else {
return []
}
return (location?.forecast?.conditions as! Set<CDWeatherCondition>).sorted(by: { $0.time < $1.time })
//print("\(groupedEpisodesByDay(content))"
}
var body: some View {
VStack {
ForEach(self.getDays(), id: \.self) {item in
FavoriteNextDaysDayView(date: self.getDayOfWeek(item.time), temp: "\(Int(item.temperature))°C", type: item.type ?? "questionmark")
//let keys = dailyPredictions.map{$0.key}.sorted(by: {$0.date < $1.date})
//let values = dailyPredictions.map {$0.value}
//let days = Day.getDayList(conditions: location?.forecast?.conditions ?? NSSet())
//NSLog("\(days)")
let sorted = dailyPredictions.sorted(by: {$0.day.date < $1.day.date})
return VStack {
ForEach(sorted, id: \.self) { item in
NavigationLink(destination: FavoriteNextDaysDayView(conditions: item.rawConditions)) {
HStack{
Text("\(item.day.date.localDayLongString)")
Spacer()
Text("\(item.minTemperature.round(to:0).removeZerosFromEnd())")
Text("\(item.maxTemperature.round(to:0).removeZerosFromEnd())")
Image(systemName: item.symbol)
}
}
}
}
}.onAppear(perform: {
self.getCurrentValues()
})
/*return VStack {
ForEach(days, id: \.id) {index in
NavigationLink(destination: FavoriteNextDaysDayView(conditions: self.rawConditions[keys[index]])) {
HStack {
Text("\(keys[index].date.localDayShortString)")
Spacer()
Text("\(values[index].minTemperature)")
Text("\(values[index].maxTemperatur)")
Image("\(values[index].symbol)")
}
}
}
ForEach(keys, id: \.self) { day in
NavigationLink(destination: FavoriteNextDaysDayView(conditions: self.rawConditions[day])) {
HStack{
Text("\(self.dailyPredictions[day]!.maxTemperatur)")
Spacer()
Text("\(self.dailyPredictions[day]!.minTemperature)")
}
}
}*/
}
}
@@ -0,0 +1,98 @@
//
// CityCurrentView.swift
// app
//
// Created by Tobias Stottrop on 30.01.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import SwiftUI
import MowestaApi
struct CityCurrentView: View {
@Binding var currentWeatherCondition: WeatherCondition
var body: some View {
VStack (alignment: .leading) {
HStack {
Image(systemName: currentWeatherCondition.getWeatherTypeImageName())
Spacer()
Text("Aktuelles Wetter")
.font(.title)
.bold()
}
Spacer()
HStack {
Text("Temperatur")
.font(.subheadline)
.bold()
Spacer()
Text("\(Int(currentWeatherCondition.temperature))°C / \(Int((currentWeatherCondition.temperature*(9/5))+32))°F")
.font(.caption)
.bold()
}
HStack {
Text("Windstärke")
.font(.subheadline)
.bold()
Spacer()
Image(systemName: currentWeatherCondition.getWindDirectionImageName())
Text("\(Int(currentWeatherCondition.windSpeed)) m/s")
.font(.caption)
.bold()
}
HStack {
Text("Luftfeuchtigkeit")
.font(.subheadline)
.bold()
Spacer()
Text("\(Int(currentWeatherCondition.humidity)) %")
.font(.caption)
.bold()
}
HStack {
Text("Schneetiefe")
.font(.subheadline)
.bold()
Spacer()
Text("\(currentWeatherCondition.snowDepth.round(to: 2)) m")
.font(.caption)
.bold()
}
HStack {
Text("Wolkendichte")
.font(.subheadline)
.bold()
Spacer()
Text("\(currentWeatherCondition.cloudCoverage.round(to: 2)) %")
.font(.caption)
.bold()
}
HStack {
Text("Niederschlagsmenge")
.font(.subheadline)
.bold()
Spacer()
Text("\(currentWeatherCondition.precipitation.rounded()) kg/hm²")
.font(.caption)
.bold()
}
HStack {
Text("Luftdruck")
.font(.subheadline)
.bold()
Spacer()
Text("\(currentWeatherCondition.pressure.round(to: 2)) hPa")
.font(.caption)
.bold()
}
}
.padding()
}
}
struct CityCurrentView_Previews: PreviewProvider {
static var previews: some View {
CityCurrentView(currentWeatherCondition: .constant(condition))
}
}
+22 -62
View File
@@ -8,78 +8,38 @@
import SwiftUI
import MowestaApi
import MapKit
import SwiftUICharts
struct CityDetail: View {
@EnvironmentObject var favorites : FavoriteLocations
@UIState private var location: LocationHierarchy = locationEssen
@UIState private var city: City = essen
@UIState private var forecast: WeatherForecast = weatherforecast
@UIState private var current: WeatherCondition = condition
@UIState private var currentType: String = "sun.min"
private var currentTime : Int = Int(Date().timeIntervalSince1970)
func setLocation(_ location: LocationHierarchy) -> some View {
self.location = location
NSLog("\(self.city.getMillisecondsFromGMT())")
LocationAPI.getCity(_id: location._id!, completion: { c, err in
if let city = c {
self.city = city
//NSLog("\(city)")
}
})
WeatherAPI.getForecast(_id: location._id!, completion: {f, err in
if let fore = f {
self.forecast = fore
let epochInMS = self.currentTime * 1000;
let withGMT = epochInMS + self.city.getMillisecondsFromGMT()
for item in fore.conditions {
//NSLog("Current stamp: \(Int(epochInMS) + self.city.getMillisecondsFromGMT())")
//NSLog("First stamp: \(item.time)")
//NSLog("withGMT : \(withGMT)")
//NSLog("First stamp: \(item.time)")
//NSLog("Last stamp: \((item.time + Int64(item.duration * 3600 * 1000)))")
if (withGMT > item.time && withGMT <= ((item.time + Int64(item.duration * 3600 * 1000)))) {
//NSLog("CALLLLLLLLED")
//NSLog("\(item.type)")
self.currentType = item.getWeatherTypeImageName()
self.current = item as WeatherCondition
NSLog("after setting: \(self.$current)")
NSLog("after setting: \(item)")
}
}
}
})
return self
}
@Binding var location: City
@Binding var currentWeatherCondition: WeatherCondition
@UIState private var centerCoordinate = CLLocationCoordinate2D()
var body: some View {
List {
Section(header: Text("Now")) {
LocationHeaderView(city: $city, weatherType: $current)
}
Section(header: Text("Today")) {
LocationDetailView(conditions: forecast.conditions)
}
Section(header: Text("Next days")) {
LocationForecastView()
ScrollView {
VStack {
LocationMapView(centerCoordinate: self.$location)
.frame(height: 300)
Card {
CityCurrentView(currentWeatherCondition: self.$currentWeatherCondition)
}
.frame(height: 200)
.padding(.leading, 20)
.padding(.trailing, 20)
.padding(.bottom, 20)
.offset(y: -100)
}
}
}
func updateWeather() {
favorites.currentWeathers[city._id!]?.temperature = 40
.edgesIgnoringSafeArea(.top)
}
}
struct CityDetail_Previews: PreviewProvider {
static var previews: some View {
CityDetail()
//.environment(\.locale, .init(identifier: "de"))
.environmentObject(FavoriteLocations(locations: [locationEssen]))
CityDetail(location: .constant(essen), currentWeatherCondition: .constant(moc_condition_wolfsburg))
//.environment(\.locale, .init(identifier: "de"))
// .environmentObject(FavoriteLocations(locations: [locationEssen]))
}
}
+23 -23
View File
@@ -11,7 +11,7 @@ import MowestaApi
struct FavoriteCity: View {
var location: LocationHierarchy
@EnvironmentObject var favorites: FavoriteLocations
//@EnvironmentObject var favorites: FavoriteLocations
var body: some View {
VStack(spacing: 10){
@@ -20,25 +20,25 @@ struct FavoriteCity: View {
.fontWeight(Font.Weight.heavy)
.font(Font.system(size: 30))
Image(systemName: favorites.currentWeathers[location._id!]?.icon ?? "sun.min")
.resizable()
.foregroundColor(Color.white)
.frame(width: 100, height: 100)
.aspectRatio(contentMode: .fit)
Image(systemName: "sun.min")
.resizable()
.foregroundColor(Color.white)
.frame(width: 100, height: 100)
.aspectRatio(contentMode: .fit)
VStack{ Text("\(favorites.currentWeathers[location._id!]?.temperature ?? 0)°")
.foregroundColor(Color.white)
.font(.title)
HStack {
Text("22°C")
VStack{ Text("0°")
.foregroundColor(Color.white)
.font( Font.system(size: 14))
.opacity(0.5)
Text("33°C")
.foregroundColor(Color.white)
.font( Font.system(size: 14))
.opacity(1)
}
.font(.title)
HStack {
Text("22°C")
.foregroundColor(Color.white)
.font( Font.system(size: 14))
.opacity(0.5)
Text("33°C")
.foregroundColor(Color.white)
.font( Font.system(size: 14))
.opacity(1)
}
}
}
}
@@ -47,10 +47,10 @@ struct FavoriteCity: View {
struct FavoriteCity_Previews: PreviewProvider {
static var previews: some View {
FavoriteCity(location: locationEssen)
.frame(minWidth: 0 , maxWidth: .infinity)
.background(Color.blue)
.cornerRadius(CGFloat(20))
.padding()
.shadow(color: Color.blue, radius: CGFloat(20), x: CGFloat(10), y: CGFloat(10))
.frame(minWidth: 0 , maxWidth: .infinity)
.background(Color.blue)
.cornerRadius(CGFloat(20))
.padding()
.shadow(color: Color.blue, radius: CGFloat(20), x: CGFloat(10), y: CGFloat(10))
}
}
+55 -7
View File
@@ -10,8 +10,54 @@ import SwiftUI
import MowestaApi
struct LocationDetail: View {
@EnvironmentObject var favorites : FavoriteLocations
typealias MowestaState = MowestaApi.State
@EnvironmentObject var favorites : NewFavoriteLocation
var location: LocationHierarchy
@UIState private var city: City = essen
@UIState private var mowestastate: MowestaState = nrwState
@UIState private var currentWeatherCondition: WeatherCondition = moc_condition_empty
func getWeatherCondition(condition: WeatherCondition?, error: Error?) {
if (error != nil) {
// do something
}
if (condition != nil) {
self.currentWeatherCondition = condition!
}
}
func getCity(city: City?, error: Error?) {
if (error != nil) {
//maybe handle
}
if (city != nil) {
self.city = city!
WeatherAPI.getCityCondition(_id: city!._id!, completion: self.getWeatherCondition)
}
}
func getState(state: MowestaState?, error: Error?) {
if (error != nil) {
self.mowestastate = state!
//maybe handle
}
if (state != nil) {
self.mowestastate = state!
}
}
func loadData() {
switch location.type {
case .city:
LocationAPI.getCity(_id: self.location._id!, completion: self.getCity)
case .state:
LocationAPI.getState(_id: self.location._id!, completion: self.getState)
case.country:
break
}
}
var body: some View {
VStack {
@@ -23,18 +69,20 @@ struct LocationDetail: View {
Button(action: {
self.favorites.toggleLocation(self.location)
}) {
Image(systemName: favorites.locations.contains{ element in
return element == location
} ? "heart.fill" : "heart")
.font(Font.system(size: 25))
Image(systemName: NewFavoriteLocation.shared.savedFavorites.contains{ element in
return element.id == location._id
} ? "heart.fill" : "heart")
.font(Font.system(size: 25))
.foregroundColor(.red)
}
})
.onAppear(perform: loadData)
}
@ViewBuilder
func builder() -> some View {
if (self.location.type == .city) {
CityDetail().setLocation(location)
CityDetail(location: self.$city, currentWeatherCondition: self.$currentWeatherCondition)
} else if (self.location.type == .state) {
StateDetail().setLocation(location)
} else {
@@ -46,6 +94,6 @@ struct LocationDetail: View {
struct LocationDetail_Previews: PreviewProvider {
static var previews: some View {
LocationDetail(location: locationEssen)
.environmentObject(FavoriteLocations(locations: [locationEssen]))
.environmentObject(NewFavoriteLocation.shared)
}
}
@@ -0,0 +1,47 @@
//
// LocationMapView.swift
// app
//
// Created by Tobias Stottrop on 30.01.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import SwiftUI
import MapKit
import MowestaApi
struct LocationMapView: UIViewRepresentable {
@Binding var centerCoordinate: City
func makeUIView(context: Context) -> MKMapView {
MKMapView(frame: .zero)
}
func updateUIView(_ view: MKMapView, context: Context) {
// create coordinate for pin
let coordinate = CLLocationCoordinate2D(
latitude: centerCoordinate.coordinate.latitude, longitude: centerCoordinate.coordinate.longitude)
// create pin with city-name
let annotation = MKPointAnnotation()
annotation.title = "\(centerCoordinate.getName())"
annotation.subtitle = "\(centerCoordinate.getSubName())"
annotation.coordinate = coordinate
// create a span to be shown by a region
let span = MKCoordinateSpan(latitudeDelta: 1.0, longitudeDelta: 1.0)
// alter latitude that pin appears in upper third
// coordinate.latitude -= view.region.span.latitudeDelta * 0.2;
let region = MKCoordinateRegion(center: coordinate, span: span)
view.setRegion(region, animated: true)
view.addAnnotation(annotation)
}
}
struct LocationMapView_Previews: PreviewProvider {
static var previews: some View {
LocationMapView(centerCoordinate: .constant(essen))
}
}
@@ -0,0 +1,101 @@
//
// BackgroundServiceView.swift
// app
//
// Created by Tobias Stottrop on 04.03.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import SwiftUI
struct BackgroundServiceView: View {
@EnvironmentObject var state: NavigationStack
@Binding var agreedBGMeasurement: Bool
var body: some View {
NavigationView {
VStack {
Text("TVAskBackground").padding(.top, 20)
Spacer()
HStack(spacing: 0) {
Button(action: {
self.toggleAgreedBGMeasurement()
}){ Image(systemName: agreedBGMeasurement ? "checkmark.square" : "square")
.foregroundColor(Color("mowesta-orange")) }
.padding(.trailing, 10)
Text("TVBGCheckBody")
.foregroundColor(.gray)
}.padding(.bottom)
Spacer()
ZStack {
HStack {
Button(action: {
self.state.pop()
}) {
Image(systemName: "chevron.left")
Text("TVBack")
}
Spacer()
}
HStack {
Spacer()
Circle()
.fill(Color("mowesta-green"))
.opacity(0.5)
.frame(width: 5, height: 5)
Circle()
.fill(Color("mowesta-green"))
.frame(width: 5, height: 5)
.opacity(0.5)
Circle()
.fill(Color("mowesta-green"))
.frame(width: 5, height: 5)
.opacity(0.5)
Circle()
.fill(Color("mowesta-green"))
.frame(width: 5, height: 5)
Spacer()
}
HStack {
Spacer()
Button(action: {
self.state.push(state: AuthState.Finished)
}) {
HStack {
Text("TVFinished")
.fontWeight(.semibold)
Image(systemName: "arrow.turn.up.right")
}
.padding()
.foregroundColor(.white)
.background(Color("mowesta-green"))
.cornerRadius(40)
.animation(.default)
}
}
}
}
.navigationBarTitle("TVLocationTitle")
.padding()
}
}
func toggleAgreedBGMeasurement() {
agreedBGMeasurement = !agreedBGMeasurement
}
}
struct BackgroundServiceView_Previews: PreviewProvider {
static var previews: some View {
BackgroundServiceView(agreedBGMeasurement: .constant(false))
}
}
@@ -0,0 +1,91 @@
//
// LocationServiceView.swift
// app
//
// Created by Tobias Stottrop on 03.03.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import SwiftUI
struct LocationServiceView: View {
@EnvironmentObject var state: NavigationStack
@Binding var agreedBGMeasurement: Bool
var body: some View {
NavigationView {
VStack {
Text("TVLocationBody").padding(.top, 20)
Spacer()
ZStack {
HStack {
Button(action: {
self.state.pop()
}) {
Image(systemName: "chevron.left")
Text("TVBack")
}
Spacer()
}
HStack {
Spacer()
Circle()
.fill(Color("mowesta-green"))
.opacity(0.5)
.frame(width: 5, height: 5)
Circle()
.fill(Color("mowesta-green"))
.frame(width: 5, height: 5)
.opacity(0.5)
Circle()
.fill(Color("mowesta-green"))
.frame(width: 5, height: 5)
Circle()
.fill(Color("mowesta-green"))
.opacity(0.5)
.frame(width: 5, height: 5)
Spacer()
}
HStack {
Spacer()
Button(action: {
LocationService.shared.askUser()
self.state.push(state: AuthState.BackgroundScreen)
}) {
HStack {
Text("TVNext")
.fontWeight(.semibold)
Image(systemName: "chevron.right")
}
.padding()
.foregroundColor(.white)
.background(Color("mowesta-green"))
.cornerRadius(40)
.animation(.default)
}
}
}
}
.padding()
.navigationBarTitle("TVAlmost")
}
}
func toggleAgreedBGMeasurement() {
agreedBGMeasurement = !agreedBGMeasurement
}
}
struct LocationServiceView_Previews: PreviewProvider {
static var previews: some View {
LocationServiceView(agreedBGMeasurement: .constant(false))
}
}
+186
View File
@@ -0,0 +1,186 @@
//
// LoginView.swift
// app
//
// Created by Tobias Stottrop on 02.03.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import SwiftUI
import MowestaApi
struct LoginView: View {
@EnvironmentObject var user: UserData
@EnvironmentObject var state: NavigationStack
@Binding var showProgress: Bool
@UIState private var alertWrongCredentials = false
@Binding var loginName: String
@Binding var password: String
var body: some View {
NavigationView {
VStack() {
VStack{
TextField("AccountName", text: self.$loginName)
.padding()
.foregroundColor(Color("mowesta-orange"))
.background(Color("mowesta-textfield"))
.cornerRadius(10)
.textContentType(.username)
SecureField("password", text: self.$password)
.padding()
.foregroundColor(Color("mowesta-orange"))
.background(Color("mowesta-textfield"))
.cornerRadius(10)
.textContentType(.password)
HStack {
Spacer()
Button(action: {
self.state.push(state: .RegistrationScreen)
}) {
Text("No account?")
}
}
HStack {
Spacer()
Button(action: {
self.resetPwd()
}) {
Text("Forgot password?")
}
}
HStack {
Spacer()
Button(action: {
self.state.push(state: .LocationScreen)
}) {
HStack {
Text("TVSkip")
.font(.footnote)
Image(systemName: "chevron.right")
.font(.footnote)
}
.foregroundColor(.gray)
}
}
}.padding()
Spacer()
ZStack {
HStack {
Button(action: {
self.state.pop()
}) {
Image(systemName: "chevron.left")
Text("TVBack")
}
Spacer()
}
HStack {
Spacer()
Circle()
.fill(Color("mowesta-green"))
.opacity(0.5)
.frame(width: 5, height: 5)
Circle()
.fill(Color("mowesta-green"))
.frame(width: 5, height: 5)
Circle()
.fill(Color("mowesta-green"))
.opacity(0.5)
.frame(width: 5, height: 5)
Circle()
.fill(Color("mowesta-green"))
.opacity(0.5)
.frame(width: 5, height: 5)
Spacer()
}
HStack {
Spacer()
Button(action: {
self.login()
}) {
HStack {
Text("TVLogin")
.fontWeight(.semibold)
Image(systemName: "chevron.right")
}
.padding()
.foregroundColor(.white)
.background(buttonColor)
.cornerRadius(40)
.animation(.default)
}.disabled(!(loginName.count > 3 && password.count > 3))
}
}
.padding()
.navigationBarTitle("TVLogin")
}
}
.alert(isPresented: self.$alertWrongCredentials) {
Alert(title: Text("Username or password is wrong."))
}
}
var buttonColor: Color {
return loginName.count > 3 && password.count > 3 ? Color("mowesta-green") : .gray
}
func resetPwd() {
let alert = MoWeStaAlert(title: "ResetPassword", message: "EnterAccount")
alert.addTextField(placeholder: "AccountName", inputText: self.loginName)
alert.addOkAction(onOk: { textFields in
if let loginName = textFields?[0].text {
UserAPI.resetUser(login: loginName) { _,_ in
let succesAlert = MoWeStaAlert(title: "MailSent", message: "SentMail")
succesAlert.addOkAction()
succesAlert.fire()
}
}
})
alert.addCancelAction()
alert.fire()
}
func login() {
NSLog("login called");
showProgress = true
user.loginName = loginName
user.password = password
user.login(onSuccess: { self.showProgress = false; self.state.push(state: .LocationScreen) },
onError: { self.showProgress = false
self.alertWrongCredentials = true })
}
}
struct LoginView_Previews: PreviewProvider {
static var previews: some View {
Group {
Login(showProgress: .constant(false), showRegister: .constant(true))
.environmentObject(UserData.adminUser)
}
.previewLayout(.fixed(width: 300, height: 400))
}
}
+144
View File
@@ -0,0 +1,144 @@
//
// RegistrationView.swift
// app
//
// Created by Tobias Stottrop on 02.03.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import SwiftUI
import MowestaApi
struct RegistrationView: View {
@EnvironmentObject var state: NavigationStack
@EnvironmentObject var user: UserData
@Binding var showProgress: Bool
@Binding var name: String
@Binding var mail: String
@Binding var loginName: String
@Binding var password: String
@UIState private var alertWrongCredentials = false
var buttonColor: Color {
return loginName.count > 3 && password.count > 3 && name.count > 3 && mail.count > 5 ? Color("mowesta-green") : .gray
}
var body: some View {
NavigationView {
VStack {
TextField("name", text: self.$name)
.padding()
.foregroundColor(Color("mowesta-orange"))
.background(Color("mowesta-textfield"))
.cornerRadius(10)
.textContentType(.name)
TextField("mail", text: self.$mail)
.padding()
.foregroundColor(Color("mowesta-orange"))
.background(Color("mowesta-textfield"))
.cornerRadius(10)
.textContentType(.emailAddress)
TextField("AccountName", text: self.$loginName)
.padding()
.foregroundColor(Color("mowesta-orange"))
.background(Color("mowesta-textfield"))
.cornerRadius(10)
.textContentType(.username)
SecureField("password", text: self.$password)
.padding()
.foregroundColor(Color("mowesta-orange"))
.background(Color("mowesta-textfield"))
.cornerRadius(10)
.textContentType(.newPassword)
Spacer()
ZStack {
HStack {
Button(action: {
self.state.pop()
}) {
Image(systemName: "chevron.left")
Text("TVBack")
}
Spacer()
}
HStack {
Spacer()
Circle()
.fill(Color("mowesta-green"))
.opacity(0.5)
.frame(width: 5, height: 5)
Circle()
.fill(Color("mowesta-green"))
.frame(width: 5, height: 5)
Circle()
.fill(Color("mowesta-green"))
.opacity(0.5)
.frame(width: 5, height: 5)
Circle()
.fill(Color("mowesta-green"))
.opacity(0.5)
.frame(width: 5, height: 5)
Spacer()
}
HStack {
Spacer()
Button(action: {
self.register()
}) {
HStack {
Text("TVRegistration")
.fontWeight(.semibold)
Image(systemName: "chevron.right")
}
.padding()
.foregroundColor(.white)
.background(buttonColor)
.cornerRadius(40)
.animation(.default)
}.disabled(!(loginName.count > 3 && password.count > 3 && name.count > 3 && mail.count > 5))
}
}
}
.alert(isPresented: self.$alertWrongCredentials) {
Alert(title: Text("Registration not possible with that credentials."))
}
.padding()
.navigationBarTitle("TVRegistration")
}
}
func register() {
self.showProgress = true
let userReg = UserRegistration(password: self.password, login: self.loginName, name: self.name, email: self.mail)
user.register(registration: userReg,
onSuccess: { self.showProgress = false; self.state.push(state: .LocationScreen) },
onError: { self.showProgress = false
self.alertWrongCredentials = true }
)
}
}
struct RegistrationView_Previews: PreviewProvider {
static var previews: some View {
RegistrationView(showProgress: .constant(false), name: .constant("Tobi"), mail: .constant("tobi@mail.de"), loginName: .constant("Tobi"), password: .constant("***"))
}
}
@@ -0,0 +1,163 @@
//
// TermsOfServiceView.swift
// app
//
// Created by Tobias Stottrop on 02.03.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import SwiftUI
import Foundation
struct TermsOfServiceView: View {
@EnvironmentObject var user: UserData
@EnvironmentObject var state: NavigationStack
@Binding var agreedToS: Bool
@Binding var agreedDSGVO: Bool
var agreedBoth: Bool {
return agreedToS && agreedDSGVO
}
private let tos_url: String = "https://www.mowesta.com/terms-of-service/"
private let privacy_url: String = "https://www.uni-due.de/en/privacy-policy.php"
var body: some View {
NavigationView {
VStack(alignment: .leading) {
Text("TVAgreement").padding(.top, 20)
Spacer()
HStack(spacing: 0) {
Button(action: {
self.toggleDSGVO()
}){
Image(systemName: agreedDSGVO ? "checkmark.square" : "square")
.foregroundColor(Color("mowesta-orange"))
}
.padding(.trailing, 10)
Text("TVPrivacy0")
.foregroundColor(.gray)
Text("TVPrivacy1")
.foregroundColor(Color("mowesta-orange"))
.underline()
.onTapGesture {
let url = URL.init(string: self.privacy_url)
guard let privacyUrl = url, UIApplication.shared.canOpenURL(privacyUrl) else { return }
UIApplication.shared.open(privacyUrl)
}
Text("TVPrivacy2")
.foregroundColor(.gray)
}.padding(.bottom)
HStack(spacing: 0) {
Button(action: {
self.toggleToS()
}){
Image(systemName: agreedToS ? "checkmark.square" : "square")
.foregroundColor(Color("mowesta-orange")) }
.padding(.trailing, 10)
Text("TVToS0")
.foregroundColor(.gray)
Text("TVToS1")
.foregroundColor(Color("mowesta-orange"))
.underline()
.onTapGesture {
let url = URL.init(string: self.tos_url)
guard let tosUrl = url, UIApplication.shared.canOpenURL(tosUrl) else { return }
UIApplication.shared.open(tosUrl)
}
Text("TVToS2")
.foregroundColor(.gray)
}
Spacer()
ZStack {
HStack {
Button(action: {
self.cancelAgreement()
}) {
Text("TVCancel")
}
Spacer()
}
HStack {
Spacer()
Circle()
.fill(Color("mowesta-green"))
.frame(width: 5, height: 5)
Circle()
.fill(Color("mowesta-green"))
.frame(width: 5, height: 5)
.opacity(0.5)
Circle()
.fill(Color("mowesta-green"))
.opacity(0.5)
.frame(width: 5, height: 5)
Circle()
.fill(Color("mowesta-green"))
.opacity(0.5)
.frame(width: 5, height: 5)
Spacer()
}
HStack {
Spacer()
Button(action: {
self.state.push(state: AuthState.LoginScreen)
}) {
HStack {
Text("TVNext")
.fontWeight(.semibold)
Image(systemName: "chevron.right")
}
.padding()
.foregroundColor(.white)
.background(buttonColor)
.cornerRadius(40)
.animation(.default)
}.disabled(!agreedBoth)
}
}
}
.padding()
.navigationBarTitle("TVWelcome")
}
}
var buttonColor: Color {
return agreedBoth ? Color("mowesta-green") : .gray
}
func cancelAgreement() {
let alert = MoWeStaAlert(title: "TVCancelHeadline", message: "TVCancelBody")
alert.addOkAction(onOk: {_ in
exit(0)
})
alert.addCancelAction()
alert.fire()
}
func toggleToS(){agreedToS = !agreedToS}
func toggleDSGVO(){agreedDSGVO = !agreedDSGVO}
}
struct TermsOfServiceView_Previews: PreviewProvider {
static var previews: some View {
TermsOfServiceView(agreedToS: .constant(false), agreedDSGVO: .constant(false))
}
}
+82
View File
@@ -0,0 +1,82 @@
//
// TermsRootView.swift
// app
//
// Created by Tobias Stottrop on 02.03.20.
// Copyright © 2020 Marcus Handte. All rights reserved.
//
import SwiftUI
struct TermsRootView: View {
@EnvironmentObject var state: NavigationStack
@EnvironmentObject var user: UserData
@UIState private var aligment = Alignment.leading
@UIState var agreedToS: Bool = false
@UIState var agreedDSGVO: Bool = false
@UIState var agreedBGMeasurement: Bool = false
@UIState private var loginName = ""
@UIState private var password = ""
@UIState private var name = ""
@UIState private var mail = ""
@UIState var showProgress: Bool = false
fileprivate func CurrentView() -> some View {
switch state.list.last {
case .ToSScreen:
return TermsOfServiceView(agreedToS: $agreedToS, agreedDSGVO: $agreedDSGVO).eraseToAnyView().environmentObject(state)
case .LoginScreen:
return LoginView(showProgress: $showProgress, loginName: $loginName, password: $password).eraseToAnyView().environmentObject(state)
case .RegistrationScreen:
return RegistrationView(showProgress: $showProgress, name: $name, mail: $mail, loginName: $loginName, password: $password).eraseToAnyView().environmentObject(state)
case .LocationScreen:
return LocationServiceView(agreedBGMeasurement: $agreedBGMeasurement).eraseToAnyView().environmentObject(state)
case .none:
return TermsOfServiceView(agreedToS: $agreedToS, agreedDSGVO: $agreedDSGVO).eraseToAnyView().environmentObject(state)
case .BackgroundScreen:
return BackgroundServiceView(agreedBGMeasurement: $agreedBGMeasurement).eraseToAnyView().environmentObject(state)
case .Finished:
if (agreedBGMeasurement) {
DeviceData.shared.bgMeasurement = true
} else { DeviceData.shared.bgMeasurement = false }
user.agreeToS()
return TermsOfServiceView(agreedToS: $agreedToS, agreedDSGVO: $agreedDSGVO).eraseToAnyView().environmentObject(state)
}
}
var body: some View {
Loading(isShowing: self.$showProgress, infoText: "Processing...") {
GeometryReader { geometry in
self.CurrentView()
.animation(.easeIn)
.frame(width: geometry.size.width, height: geometry.size.height, alignment: self.aligment)
.onAppear {
withAnimation() {
switch self.state.list.last {
case .ToSScreen:
fallthrough
case .none:
self.aligment = Alignment.leading
case .BackgroundScreen:
self.aligment = Alignment.trailing
case .LocationScreen:
fallthrough
case .RegistrationScreen:
fallthrough
default:
self.aligment = Alignment.center
}
}
}
}
}
}
}
struct TermsRootView_Previews: PreviewProvider {
static var previews: some View {
TermsRootView()
}
}
@@ -15,6 +15,18 @@ struct WeatherStationsTab: View {
@FetchRequest(fetchRequest: CDevice.fetchRequestWithout(id: DeviceData.shared.idInt64)) var devices: FetchedResults<CDevice>
@UIState private var showLoginView = false
func alertResetApplication() {
let alert = MoWeStaAlert(title: "TVResetAppTitle", message: "TVResetAppBody")
alert.addOkAction(onOk: {_ in
NewFavoriteLocation.shared.savedFavorites = []
DataManager.shared.deleteAllData()
UserData.shared.logout()
UserData.shared.disagreeToS()
})
alert.addCancelAction()
alert.fire()
}
var body: some View {
NavigationView {
List {
@@ -37,14 +49,16 @@ struct WeatherStationsTab: View {
}
.listStyle(GroupedListStyle())
.navigationBarTitle("WVWeatherStations")
.navigationBarItems(trailing: Button(action: { self.showLoginView.toggle() }) { Image(systemName: self.user.loggedIn ? "person.crop.circle.badge.checkmark" : "person.crop.circle.badge.plus")
.navigationBarItems(leading: Button(action: { self.alertResetApplication()}) { Image(systemName: "trash")
.font(Font.system(size: 24))
}, trailing: Button(action: { self.showLoginView.toggle() }) { Image(systemName: self.user.loggedIn ? "person.crop.circle.badge.checkmark" : "person.crop.circle.badge.plus")
.font(Font.system(size: 25))
})
.environment(\.horizontalSizeClass, .regular)
.sheet(isPresented: self.$showLoginView, content: {
AccountView()
.environmentObject(self.user)
})
.environment(\.horizontalSizeClass, .regular)
.sheet(isPresented: self.$showLoginView, content: {
AccountView()
.environmentObject(self.user)
})
}
}
}
+43
View File
@@ -7,6 +7,8 @@
*/
"Cancel" = "Abbrechen";
"Done" = "Fertig";
"Stationen" = "Stationen";
/* Account View */
"Hello %@" = "Hallo %@";
@@ -31,6 +33,8 @@
/* Search View */
"SVSearchLocations" = "Suche Orte";
"Search_NavigationBarTitle" = "Suchen";
"SVTitle" = "Favoriten hinzufügen";
/* Favorites View */
"Favorite_NavigationBarTitle" = "Favoriten";
@@ -108,3 +112,42 @@
"MVModel" = "Modell";
"MVDevice" = "Hardwareversion";
"MVOs" = "Softwareversion";
/* ToS View */
"TVWelcome" = "Hallo!";
"TVAgreement" = "Wir heißen dich herzlich willkommen bei MoWeSta, deiner neuen Wetter-App. Um unsere Services nutzen zu können, musst du unseren Nutzungsbedingungen und unserer Datenschutzverordnung zustimmen.";
"TVPrivacy0" = "Ich habe die ";
"TVPrivacy1" = "DSGVO-Hinweise";
"TVPrivacy2" = " gelesen.";
"TVToS0" = "Ich habe die ";
"TVToS1" = "Nutzungsbedingungen";
"TVToS2" = " gelesen.";
"TVNext" = "Weiter";
"TVCancel" = "Abbrechen";
"TVCancelHeadline" = "Zustimmung benötigt";
"TVCancelBody" = "Für die Nutzung dieser App musst du den Nutzungsbedingungen und der Datenschutzverordnung zustimmen. Bei Bestätigung dieses Dialoges wird die App geschlossen.";
"TVRegistration" = "Registrieren";
"TVRegistrationBack" = "Zurück";
"TVAlmost" = "Fast fertig!";
"TVResetAppTitle" = "Möchtest du wirklich die App zurücksetzen?";
"TVResetAppBody" = "Dadurch gehen Daten dauerhaft verloren. Bei dem nächsten Start wird ei Applikation wieder mit der Begrüßung gestartet. Dadurch wird dein Account nicht gelöscht, sondern lediglich ausgeloggt.";
"TVLogin" = "Login";
"TVBack" = "Zurück";
"TVSkip" = "Überspringen";
"TVLocationBody" = "Die App benötigt, um optimal zu funktionieren, Zugriff auf deine Positionsdaten. Bitte bestätige dies in der folgenden Benachrichtigung.";
"TVLocationTitle" = "Noch eine Sekunde!";
"TVAskBackground" = "Die App besitzt die Möglichkeit, Wetterspezifische Daten auszulesen und diese im Hintergrund an unsere Server für die Auswertung durch den Deutschen Wetterdienst zu senden. Dadurch wird ermöglicht, die Genauigkeit von Wettervorhersagen zu verbessern. Bitte bestötige, dass du mit der Sendung dieser Daten im Hintergrund einverstanden bist.";
"TVBGCheckBody" = "Ich bin damit einverstanden, dass im Hintergrund Wetterspezifische Daten gesendet werden.";
"TVFinished" = "Fertig👌";
"FVNoContent" = "Wie es aussieht, hast du noch keine Favoriten angelegt!";
"FVAddFavorie" = "Füge doch hier deinen ersten Favoriten hinzu!";
"FVSearch" = "Oder schaue dir erstmal ein paar Ortschaften an..";
"FVStations" = "Hier kannst du dir deinen Account ansehen, deine Geräte verwalten und dir deine Messungen anschauen.";
"FVAdd" = "Hinzufügen";
+44
View File
@@ -7,6 +7,8 @@
*/
"Cancel" = "Cancel";
"Done" = "Done";
"Stationen" = "Stations";
/* Account View */
"Hello %@" = "Hello %@";
@@ -31,6 +33,8 @@
/* Search View */
"SVSearchLocations" = "Search Locations";
"Search_NavigationBarTitle" = "Search";
"SVTitle" = "Add Favorite";
/* Favorites View */
"Favorite_NavigationBarTitle" = "Favorites";
@@ -108,3 +112,43 @@
"MVModel" = "Model";
"MVDevice" = "Hardware Version";
"MVOs" = "Software Version";
/* ToS View */
"TVWelcome" = "Hello!";
"TVAgreement" = "We welcome you to MoWeSta, your new weather app. To use our services you have to agree to our terms of use and our privacy policy.";
"TVPrivacy0" = "I have read the ";
"TVPrivacy1" = "privacy policy";
"TVPrivacy2" = ".";
"TVToS0" = "I have read the ";
"TVToS1" = "terms and conditions";
"TVToS2" = ".";
"TVNext" = "Next";
"TVCancel" = "Cancel";
"TVCancelHeadline" = "Agreement is needed";
"TVCancelBody" = "In order to use this app, you must agree to the terms of use and privacy policy. If you confirm this dialog the app will be closed.";
"TVRegistration" = "Register";
"TVRegistrationBack" = "Back";
"TVAlmost" = "Nearly finished!";
"TVResetAppTitle" = "You really want to reset the app?";
"TVResetAppBody" = "As a result, data is permanently lost. The next time the application is started, it will be restarted with the greeting. This will not delete your account, but only log you out.";
"TVLogin" = "Login";
"TVBack" = "Back";
"TVSkip" = "Skip";
"TVLocationTitle" = "Just one Second!";
"TVLocationBody" = "The app needs access to your location data to work optimally. Please confirm this in the following notification";
"TVAskBackground" = "The app has the possibility to read weather specific data and send them to our servers for evaluation by the German Weather Service. This makes it possible to improve the accuracy of weather forecasts. Please confirm that you agree with the sending of this data in the background.";
"TVBGCheckBody" = "I agree that weather specific data is sent in the background.";
"TVFinished" = "Finished👌";
"FVNoContent" = "It looks like you haven't created any favorites yet!";
"FVAddFavorie" = "You can add favorites here!";
"FVSearch" = "Or check out some places first..";
"FVStations" = "Here you can view your account, manage your devices and view your measurements.";
"FVAdd" = "Add";