Mercurial > public > lazybear
changeset 321:8f8d5ad3dfa0
Preparing backend requests
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Sun, 28 Mar 2021 20:54:58 +0200 |
parents | e828c2b0764c |
children | d8002291e670 |
files | LazyBear.xcodeproj/project.pbxproj LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate LazyBear.xcodeproj/xcshareddata/xcschemes/LazyBear.xcscheme LazyBear/Assets.xcassets/Avatars/Colors/Contents.json LazyBear/Assets.xcassets/Avatars/Colors/customColor1.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Colors/customColor2.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Colors/customColor3.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Colors/customColor4.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Colors/customColor5.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Colors/customColor6.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Colors/customColor7.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Colors/customColor8.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Hair Colors/Contents.json LazyBear/Assets.xcassets/Avatars/Hair Colors/hairColor1.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Hair Colors/hairColor2.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Hair Colors/hairColor3.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Hair Colors/hairColor4.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Hair Colors/hairColor5.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Hair Colors/hairColor6.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Hair Colors/hairColor7.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Skin Tones/Contents.json LazyBear/Assets.xcassets/Avatars/Skin Tones/skinTone1.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Skin Tones/skinTone2.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Skin Tones/skinTone3.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Skin Tones/skinTone4.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Skin Tones/skinTone5.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Skin Tones/skinTone6.colorset/Contents.json LazyBear/Assets.xcassets/Avatars/Skin Tones/skinTone7.colorset/Contents.json LazyBear/ContentView.swift LazyBear/Global functions/ConvertEpoch.swift LazyBear/Global functions/Request.swift LazyBear/LazyBearApp.swift LazyBear/Models/CompanyRowModel.swift LazyBear/Models/SectorPerformanceModel.swift LazyBear/Views/Home/HomeView.swift LazyBear/Views/Onboarding/Helpers/Avatar.swift LazyBear/Views/Onboarding/Helpers/AvatarCreator.swift LazyBear/Views/Onboarding/Helpers/FirstAvatar.swift LazyBear/Views/Onboarding/SignUpView.swift LazyBear/Views/Onboarding/WelcomeView.swift LazyBear/Views/Onboarding/WhatsNewView.swift LazyBear/Views/Welcome/WelcomeView.swift |
diffstat | 42 files changed, 187 insertions(+), 1416 deletions(-) [+] |
line wrap: on
line diff
--- a/LazyBear.xcodeproj/project.pbxproj Sat Mar 27 20:32:45 2021 +0100 +++ b/LazyBear.xcodeproj/project.pbxproj Sun Mar 28 20:54:58 2021 +0200 @@ -10,12 +10,14 @@ 950C36E3260FB6180081CF53 /* HapticsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950C36E2260FB6180081CF53 /* HapticsManager.swift */; }; 950C36E8260FBB550081CF53 /* UserSettings+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950C36E6260FBB550081CF53 /* UserSettings+CoreDataClass.swift */; }; 950C36E9260FBB550081CF53 /* UserSettings+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950C36E7260FBB550081CF53 /* UserSettings+CoreDataProperties.swift */; }; - 950C36EF260FBBEB0081CF53 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950C36EE260FBBEB0081CF53 /* HomeView.swift */; }; - 95201A2F260C9CAF007D5300 /* SignUpView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95201A2E260C9CAF007D5300 /* SignUpView.swift */; }; + 951490552610BD2B00BDEEB5 /* WelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 951490542610BD2B00BDEEB5 /* WelcomeView.swift */; }; + 952045112610C6CD00A76362 /* SectorPerformanceModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 952045102610C6CD00A76362 /* SectorPerformanceModel.swift */; }; + 952045152610C7C600A76362 /* ConvertEpoch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 952045142610C7C600A76362 /* ConvertEpoch.swift */; }; + 952045182610C83600A76362 /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = 952045172610C83600A76362 /* Request.swift */; }; + 952045242610FD7F00A76362 /* CompanyRowModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 952045232610FD7F00A76362 /* CompanyRowModel.swift */; }; 954D7EA7260BBA6600A13C50 /* WatchlistCompany+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954D7EA5260BBA6600A13C50 /* WatchlistCompany+CoreDataClass.swift */; }; 954D7EA8260BBA6600A13C50 /* WatchlistCompany+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954D7EA6260BBA6600A13C50 /* WatchlistCompany+CoreDataProperties.swift */; }; 954D7EC2260BE70C00A13C50 /* SwiftlySearch in Frameworks */ = {isa = PBXBuildFile; productRef = 954D7EC1260BE70C00A13C50 /* SwiftlySearch */; }; - 95531C79260CBECC00F0916A /* FirstAvatar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95531C78260CBECC00F0916A /* FirstAvatar.swift */; }; 95672B8F25DDA54700DCBE4A /* LazyBearApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95672B8E25DDA54700DCBE4A /* LazyBearApp.swift */; }; 95672B9325DDA54700DCBE4A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 95672B9225DDA54700DCBE4A /* Assets.xcassets */; }; 95672B9625DDA54700DCBE4A /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 95672B9525DDA54700DCBE4A /* Preview Assets.xcassets */; }; @@ -23,10 +25,6 @@ 95672B9B25DDA54800DCBE4A /* LazyBear.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 95672B9925DDA54800DCBE4A /* LazyBear.xcdatamodeld */; }; 958A735225E0170900FD7ECA /* CloudKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 958A735125E0170900FD7ECA /* CloudKit.framework */; }; 95AD4A2D26078C1400498079 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95AD4A2C26078C1400498079 /* ContentView.swift */; }; - 95AD4A38260794A800498079 /* WhatsNewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95AD4A37260794A800498079 /* WhatsNewView.swift */; }; - 95BF36AC260E954F00B29E41 /* Avatar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95BF36AB260E954F00B29E41 /* Avatar.swift */; }; - 95BF36AF260E9D4100B29E41 /* AvatarCreator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95BF36AE260E9D4100B29E41 /* AvatarCreator.swift */; }; - 95E512D32607B42200C283E0 /* WelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E512D22607B42200C283E0 /* WelcomeView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -35,11 +33,13 @@ 950C36E2260FB6180081CF53 /* HapticsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HapticsManager.swift; sourceTree = "<group>"; }; 950C36E6260FBB550081CF53 /* UserSettings+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserSettings+CoreDataClass.swift"; sourceTree = "<group>"; }; 950C36E7260FBB550081CF53 /* UserSettings+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserSettings+CoreDataProperties.swift"; sourceTree = "<group>"; }; - 950C36EE260FBBEB0081CF53 /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = "<group>"; }; - 95201A2E260C9CAF007D5300 /* SignUpView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignUpView.swift; sourceTree = "<group>"; }; + 951490542610BD2B00BDEEB5 /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = "<group>"; }; + 952045102610C6CD00A76362 /* SectorPerformanceModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectorPerformanceModel.swift; sourceTree = "<group>"; }; + 952045142610C7C600A76362 /* ConvertEpoch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConvertEpoch.swift; sourceTree = "<group>"; }; + 952045172610C83600A76362 /* Request.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Request.swift; sourceTree = "<group>"; }; + 952045232610FD7F00A76362 /* CompanyRowModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompanyRowModel.swift; sourceTree = "<group>"; }; 954D7EA5260BBA6600A13C50 /* WatchlistCompany+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WatchlistCompany+CoreDataClass.swift"; sourceTree = "<group>"; }; 954D7EA6260BBA6600A13C50 /* WatchlistCompany+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WatchlistCompany+CoreDataProperties.swift"; sourceTree = "<group>"; }; - 95531C78260CBECC00F0916A /* FirstAvatar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstAvatar.swift; sourceTree = "<group>"; }; 95672B8B25DDA54700DCBE4A /* LazyBear.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LazyBear.app; sourceTree = BUILT_PRODUCTS_DIR; }; 95672B8E25DDA54700DCBE4A /* LazyBearApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LazyBearApp.swift; sourceTree = "<group>"; }; 95672B9225DDA54700DCBE4A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; @@ -50,10 +50,6 @@ 958A734E25E016FD00FD7ECA /* LazyBear.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = LazyBear.entitlements; sourceTree = "<group>"; }; 958A735125E0170900FD7ECA /* CloudKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CloudKit.framework; path = System/Library/Frameworks/CloudKit.framework; sourceTree = SDKROOT; }; 95AD4A2C26078C1400498079 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; }; - 95AD4A37260794A800498079 /* WhatsNewView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WhatsNewView.swift; sourceTree = "<group>"; }; - 95BF36AB260E954F00B29E41 /* Avatar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Avatar.swift; sourceTree = "<group>"; }; - 95BF36AE260E9D4100B29E41 /* AvatarCreator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AvatarCreator.swift; sourceTree = "<group>"; }; - 95E512D22607B42200C283E0 /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -69,6 +65,14 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 951490572610BD3000BDEEB5 /* Welcome */ = { + isa = PBXGroup; + children = ( + 951490542610BD2B00BDEEB5 /* WelcomeView.swift */, + ); + path = Welcome; + sourceTree = "<group>"; + }; 95201A36260CAD36007D5300 /* Tests */ = { isa = PBXGroup; children = ( @@ -76,14 +80,13 @@ path = Tests; sourceTree = "<group>"; }; - 95201A40260CB50A007D5300 /* Helpers */ = { + 952045132610C7A200A76362 /* Global functions */ = { isa = PBXGroup; children = ( - 95531C78260CBECC00F0916A /* FirstAvatar.swift */, - 95BF36AB260E954F00B29E41 /* Avatar.swift */, - 95BF36AE260E9D4100B29E41 /* AvatarCreator.swift */, + 952045142610C7C600A76362 /* ConvertEpoch.swift */, + 952045172610C83600A76362 /* Request.swift */, ); - path = Helpers; + path = "Global functions"; sourceTree = "<group>"; }; 954D7E9D260BBA5200A13C50 /* Models */ = { @@ -93,6 +96,8 @@ 950C36E7260FBB550081CF53 /* UserSettings+CoreDataProperties.swift */, 954D7EA5260BBA6600A13C50 /* WatchlistCompany+CoreDataClass.swift */, 954D7EA6260BBA6600A13C50 /* WatchlistCompany+CoreDataProperties.swift */, + 952045102610C6CD00A76362 /* SectorPerformanceModel.swift */, + 952045232610FD7F00A76362 /* CompanyRowModel.swift */, ); path = Models; sourceTree = "<group>"; @@ -100,7 +105,6 @@ 954D7EAA260BBB0E00A13C50 /* Home */ = { isa = PBXGroup; children = ( - 950C36EE260FBBEB0081CF53 /* HomeView.swift */, 954D7EAF260BBBD500A13C50 /* Helpers */, ); path = Home; @@ -144,6 +148,7 @@ 95672B9725DDA54700DCBE4A /* Persistence.swift */, 950C36E2260FB6180081CF53 /* HapticsManager.swift */, 95B1874925DDAC4D0068A364 /* Views */, + 952045132610C7A200A76362 /* Global functions */, 954D7E9D260BBA5200A13C50 /* Models */, 95201A36260CAD36007D5300 /* Tests */, 95672B9425DDA54700DCBE4A /* Preview Content */, @@ -170,23 +175,12 @@ 95B1874925DDAC4D0068A364 /* Views */ = { isa = PBXGroup; children = ( - 95CE9467260AA60700C27556 /* Onboarding */, + 951490572610BD3000BDEEB5 /* Welcome */, 954D7EAA260BBB0E00A13C50 /* Home */, ); path = Views; sourceTree = "<group>"; }; - 95CE9467260AA60700C27556 /* Onboarding */ = { - isa = PBXGroup; - children = ( - 95E512D22607B42200C283E0 /* WelcomeView.swift */, - 95201A2E260C9CAF007D5300 /* SignUpView.swift */, - 95AD4A37260794A800498079 /* WhatsNewView.swift */, - 95201A40260CB50A007D5300 /* Helpers */, - ); - path = Onboarding; - sourceTree = "<group>"; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -263,21 +257,19 @@ buildActionMask = 2147483647; files = ( 950C36E3260FB6180081CF53 /* HapticsManager.swift in Sources */, + 952045242610FD7F00A76362 /* CompanyRowModel.swift in Sources */, + 952045182610C83600A76362 /* Request.swift in Sources */, 950C36E8260FBB550081CF53 /* UserSettings+CoreDataClass.swift in Sources */, - 95201A2F260C9CAF007D5300 /* SignUpView.swift in Sources */, 95672B9825DDA54700DCBE4A /* Persistence.swift in Sources */, 950C36E9260FBB550081CF53 /* UserSettings+CoreDataProperties.swift in Sources */, 954D7EA8260BBA6600A13C50 /* WatchlistCompany+CoreDataProperties.swift in Sources */, - 95BF36AC260E954F00B29E41 /* Avatar.swift in Sources */, - 95E512D32607B42200C283E0 /* WelcomeView.swift in Sources */, - 95BF36AF260E9D4100B29E41 /* AvatarCreator.swift in Sources */, - 95AD4A38260794A800498079 /* WhatsNewView.swift in Sources */, 95672B8F25DDA54700DCBE4A /* LazyBearApp.swift in Sources */, + 952045112610C6CD00A76362 /* SectorPerformanceModel.swift in Sources */, + 951490552610BD2B00BDEEB5 /* WelcomeView.swift in Sources */, 954D7EA7260BBA6600A13C50 /* WatchlistCompany+CoreDataClass.swift in Sources */, 95672B9B25DDA54800DCBE4A /* LazyBear.xcdatamodeld in Sources */, - 950C36EF260FBBEB0081CF53 /* HomeView.swift in Sources */, - 95531C79260CBECC00F0916A /* FirstAvatar.swift in Sources */, 95AD4A2D26078C1400498079 /* ContentView.swift in Sources */, + 952045152610C7C600A76362 /* ConvertEpoch.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };
Binary file LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed
--- a/LazyBear.xcodeproj/xcshareddata/xcschemes/LazyBear.xcscheme Sat Mar 27 20:32:45 2021 +0100 +++ b/LazyBear.xcodeproj/xcshareddata/xcschemes/LazyBear.xcscheme Sun Mar 28 20:54:58 2021 +0200 @@ -31,7 +31,7 @@ </Testables> </TestAction> <LaunchAction - buildConfiguration = "Debug" + buildConfiguration = "Release" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" launchStyle = "0"
--- a/LazyBear/Assets.xcassets/Avatars/Colors/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Colors/customColor1.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0xFF", - "green" : "0x6D", - "red" : "0x45" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "display-p3", - "components" : { - "alpha" : "1.000", - "blue" : "0.615", - "green" : "0.264", - "red" : "0.190" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Colors/customColor2.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0xFF", - "green" : "0x45", - "red" : "0x5A" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "display-p3", - "components" : { - "alpha" : "1.000", - "blue" : "0.517", - "green" : "0.146", - "red" : "0.181" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Colors/customColor3.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x58", - "green" : "0xBB", - "red" : "0x6D" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "display-p3", - "components" : { - "alpha" : "1.000", - "blue" : "0.232", - "green" : "0.428", - "red" : "0.293" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Colors/customColor4.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x3A", - "green" : "0xB6", - "red" : "0xF3" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "display-p3", - "components" : { - "alpha" : "1.000", - "blue" : "0.209", - "green" : "0.468", - "red" : "0.589" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Colors/customColor5.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0xC7", - "green" : "0xD7", - "red" : "0x54" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "display-p3", - "components" : { - "alpha" : "1.000", - "blue" : "0.469", - "green" : "0.500", - "red" : "0.286" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Colors/customColor6.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x53", - "green" : "0x45", - "red" : "0xE2" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "display-p3", - "components" : { - "alpha" : "1.000", - "blue" : "0.235", - "green" : "0.221", - "red" : "0.575" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Colors/customColor7.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0xCA", - "green" : "0x55", - "red" : "0x75" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "display-p3", - "components" : { - "alpha" : "1.000", - "blue" : "0.551", - "green" : "0.242", - "red" : "0.314" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Colors/customColor8.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x81", - "green" : "0x5D", - "red" : "0xF5" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "display-p3", - "components" : { - "alpha" : "1.000", - "blue" : "0.318", - "green" : "0.249", - "red" : "0.558" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Hair Colors/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Hair Colors/hairColor1.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x47", - "green" : "0x2C", - "red" : "0x36" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Hair Colors/hairColor2.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x65", - "green" : "0x9C", - "red" : "0xF2" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Hair Colors/hairColor3.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0xF5", - "green" : "0xE1", - "red" : "0xDE" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Hair Colors/hairColor4.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x65", - "green" : "0x7D", - "red" : "0xF2" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Hair Colors/hairColor5.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x45", - "green" : "0x45", - "red" : "0x6C" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Hair Colors/hairColor6.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x81", - "green" : "0x63", - "red" : "0xE1" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Hair Colors/hairColor7.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x66", - "green" : "0x5C", - "red" : "0xE1" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Skin Tones/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Skin Tones/skinTone1.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0xA4", - "green" : "0xB4", - "red" : "0xEE" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Skin Tones/skinTone2.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x91", - "green" : "0xA3", - "red" : "0xE7" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Skin Tones/skinTone3.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x7E", - "green" : "0xA0", - "red" : "0xE5" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Skin Tones/skinTone4.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x74", - "green" : "0x87", - "red" : "0xD7" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Skin Tones/skinTone5.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x5B", - "green" : "0x6A", - "red" : "0xB1" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Skin Tones/skinTone6.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x4B", - "green" : "0x59", - "red" : "0x92" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/Assets.xcassets/Avatars/Skin Tones/skinTone7.colorset/Contents.json Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x36", - "green" : "0x3D", - "red" : "0x62" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -}
--- a/LazyBear/ContentView.swift Sat Mar 27 20:32:45 2021 +0100 +++ b/LazyBear/ContentView.swift Sun Mar 28 20:54:58 2021 +0200 @@ -8,6 +8,8 @@ import SwiftUI struct ContentView: View { + @State private var showWelcome = false + var body: some View { TabView { HomeView() @@ -26,7 +28,20 @@ Text("Third") } } +// .onAppear { isAppAlreadyLaunchedOnce() } + .sheet(isPresented: $showWelcome) { + + } } + +// private func isAppAlreadyLaunchedOnce() { +// let defaults = UserDefaults.standard +// +// if let isAppAlreadyLaunchedOnce = defaults.string(forKey: "IsAppAlreadyLaunchedOnce") { +// print("App already launched : \(isAppAlreadyLaunchedOnce)") +// self.showWelcome = true +// } +// } } struct ContentView_Previews: PreviewProvider {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LazyBear/Global functions/ConvertEpoch.swift Sun Mar 28 20:54:58 2021 +0200 @@ -0,0 +1,20 @@ +// +// ConvertEpoch.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 28/3/21. +// + +import SwiftUI + +// Convert Epoch time to human date +func convertEpoch(_ miliseconds: Int) -> String { + let now = Date() // Current date + // TimeInterval() function must be in seconds, not in miliseconds + let articlePublished = Date(timeIntervalSince1970: TimeInterval(miliseconds/1000)) + let formatter = DateComponentsFormatter() + formatter.unitsStyle = .abbreviated + let humanDate = formatter.string(from: articlePublished, to: now)! + + return humanDate +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LazyBear/Global functions/Request.swift Sun Mar 28 20:54:58 2021 +0200 @@ -0,0 +1,36 @@ +// +// Request.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 28/3/21. +// + +import Foundation + +// Network request +func request<T: Decodable>(url: String, model: T.Type, completion: @escaping (_ result: T) -> Void) { + // We take some model data T.Type + guard let url = URL(string: url) else { + print("Invalid URL") + return + } + let request = URLRequest(url: url) + URLSession.shared.dataTask(with: request) { data, response, error in + if let data = data { + do { + // Decode response with the model passed + let decodedResponse = try JSONDecoder().decode(model, from: data) + DispatchQueue.main.async { + completion(decodedResponse) + } + return + } catch { + // Return error regarding the escaping code + print(error) + } + } + // Error with the request + print("Fetch failed: \(error?.localizedDescription ?? "Unknown error")") + } + .resume() +}
--- a/LazyBear/LazyBearApp.swift Sat Mar 27 20:32:45 2021 +0100 +++ b/LazyBear/LazyBearApp.swift Sun Mar 28 20:54:58 2021 +0200 @@ -10,32 +10,11 @@ @main struct LazyBearApp: App { let persistenceController = PersistenceController.shared // Core Data init - @ObservedObject var hapticsManager = HapticsManager() var body: some Scene { WindowGroup { - if isAppAlreadyLaunchedOnce() { ContentView() .environment(\.managedObjectContext, persistenceController.container.viewContext) - .environmentObject(hapticsManager) - - } else { - WelcomeView() - .environment(\.managedObjectContext, persistenceController.container.viewContext) - .environmentObject(hapticsManager) - } - } - } - - private func isAppAlreadyLaunchedOnce() -> Bool { - let defaults = UserDefaults.standard - - if let isAppAlreadyLaunchedOnce = defaults.string(forKey: "IsAppAlreadyLaunchedOnce") { - print("App already launched : \(isAppAlreadyLaunchedOnce)") - - return true - } else { - return false } } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LazyBear/Models/CompanyRowModel.swift Sun Mar 28 20:54:58 2021 +0200 @@ -0,0 +1,15 @@ +// +// CompanyRowModel.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 28/3/21. +// + +import SwiftUI + +struct CompanyRowModel: Codable, Hashable { + var symbol: String + var companyName: String + var latestPrice: Double + var changePercent: Double +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LazyBear/Models/SectorPerformanceModel.swift Sun Mar 28 20:54:58 2021 +0200 @@ -0,0 +1,14 @@ +// +// SectorPerformanceModel.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 28/3/21. +// + +import SwiftUI + +struct SectorPerformanceModel: Codable, Hashable { + var name: String + var performance: Double + var lastUpdated: Int +}
--- a/LazyBear/Views/Home/HomeView.swift Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -// -// HomeView.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 27/3/21. -// - -import SwiftUI - -struct HomeView: View { - var body: some View { - Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) - } -} - -struct HomeView_Previews: PreviewProvider { - static var previews: some View { - HomeView() - } -}
--- a/LazyBear/Views/Onboarding/Helpers/Avatar.swift Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -// -// Avatar.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 26/3/21. -// - -import SwiftUI - -struct Avatar: View { - @EnvironmentObject var firstAvatar: FirstAvatar - - var body: some View { - VStack { - Image("head") - .componentModifier() - .overlay( - ZStack { - Image(firstAvatar.body) - .componentModifier() - .colorMultiply(Color(firstAvatar.bodyColor)) - - Image(firstAvatar.hair) - .componentModifier() - .colorMultiply(Color(firstAvatar.hairColor)) - - Image(firstAvatar.eyes) - .componentModifier() - - Image(firstAvatar.nose) - .componentModifier() - - Image(firstAvatar.mouth) - .componentModifier() - } - ) - } - .padding() - } -} -extension Image { - func componentModifier() -> some View { - self - .resizable() - .aspectRatio(contentMode: .fit) - } -} - -struct Avatar_Previews: PreviewProvider { - static var previews: some View { - Avatar() - .environmentObject(FirstAvatar()) - } -}
--- a/LazyBear/Views/Onboarding/Helpers/AvatarCreator.swift Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,282 +0,0 @@ -// -// AvatarCreator.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 26/3/21. -// - -import SwiftUI - -enum AvatarComponent { - case hair, eyes, mouth, body -} - -struct AvatarCreator: View { - var components = ["Hair", "Eyes", "Mouth", "Body"] - @State private var selectedComponent = "Hair" - @Environment(\.presentationMode) var avatarGeneratorPresentation - @EnvironmentObject var firstAvatar: FirstAvatar - - var body: some View { - NavigationView { - VStack { - Avatar() - .shadow(color: Color.gray.opacity(0.2), radius: 10) - .background( - Circle() - .foregroundColor(Color(firstAvatar.background)) - ) - .padding(.top) - - Picker("Select a component", selection: $selectedComponent) { - ForEach(components, id: \.self) { - Text($0) - } - } - .pickerStyle(SegmentedPickerStyle()) - .padding() - - Divider() - ScrollView { - if selectedComponent == "Hair" { showAvatar(component: .hair) } - if selectedComponent == "Eyes" { showAvatar(component: .eyes) } - if selectedComponent == "Mouth" { showAvatar(component: .mouth) } - if selectedComponent == "Body" { showAvatar(component: .body) } - } - } - .navigationTitle("Create your avatar") - .navigationBarTitleDisplayMode(.inline) - .toolbar { - ToolbarItem(placement: .navigationBarTrailing) { - Button(action: { avatarGeneratorPresentation.wrappedValue.dismiss() }) { - Text("Done") - } - } - } - } - } - - private func showAvatar(component: AvatarComponent) -> AnyView { - switch component { - case .hair: - return AnyView(ComponentView(component: .hair)) - case .eyes: - return AnyView(ComponentView(component: .eyes)) - case .mouth: - return AnyView(ComponentView(component: .mouth)) - case .body: - return AnyView(ComponentView(component: .body)) - } - } -} - -struct AvatarCreator_Previews: PreviewProvider { - static var previews: some View { - AvatarCreator() - .environmentObject(FirstAvatar()) - } -} - -struct ComponentView: View { - @EnvironmentObject var firstAvatar: FirstAvatar - @EnvironmentObject var hapticsManager: HapticsManager - var component: AvatarComponent - let columns = [GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())] - - var body: some View { - let (componentName, maxColors, maxComponents) = getComponentInfo() - VStack { - // COLOR SELECTOR - if maxColors != nil { - ScrollView(.horizontal, showsIndicators: false) { - VStack { - HStack(spacing: 20) { - ForEach((1..<maxColors!)) { index in - Button(action: { - assignSelection(componentName: "\(componentName)Color", index: index, isColor: true) - self.hapticsManager.complexSuccess() - }) { - ColorItem(component: component, componentName: componentName, index: index) - } - } - } - .padding(.leading) - } - } - } - - // COMPONENT SELECTOR - LazyVGrid(columns: columns, spacing: 20) { - ForEach((1..<maxComponents)) { index in - Button(action: { - assignSelection(componentName: componentName, index: index, isColor: false) - self.hapticsManager.complexSuccess() - }) { - ComponentItem(component: component, componentName: componentName, index: index) - } - } - } - } - } - - // If I need to add more items, I'll need to make this better. Maybe reading directly - // a JSON file instead of manually write down the number of items and names - private func getComponentInfo() -> (String, Int?, Int) { - switch component { - case .body: - let componentName = "body" - let maxColors = 8 - let maxComponents = 4 - return (componentName, maxColors, maxComponents) - case .eyes: - let componentName = "eyes" - let maxComponents = 6 - return (componentName, nil, maxComponents) - case .hair: - let componentName = "hair" - let maxColors = 8 - let maxComponents = 20 - return (componentName, maxColors, maxComponents) - case .mouth: - let componentName = "mouth" - let maxComponents = 6 - return (componentName, nil, maxComponents) - } - } - - private func assignSelection(componentName: String, index: Int, isColor: Bool) { - switch component { - case .body: - if isColor { - let colorName = "customColor\(index)" - self.firstAvatar.bodyColor = colorName - } - else { - self.firstAvatar.body = "\(componentName)\(index)" - } - case .eyes: - self.firstAvatar.eyes = "\(componentName)\(index)" - case .hair: - if isColor { - self.firstAvatar.hairColor = "\(componentName)\(index)" - } else { - self.firstAvatar.hair = "\(componentName)\(index)" - } - case .mouth: - self.firstAvatar.mouth = "\(componentName)\(index)" - } - } -} - -struct ColorItem: View { - @EnvironmentObject var firstAvatar: FirstAvatar - var component: AvatarComponent - var componentName: String - var index: Int - - var body: some View { - let componentColor = "\(componentName)Color\(index)" - Circle() - .frame(width: 50, height: 50) - .foregroundColor(component == .body ? Color("customColor\(index)"): Color(componentColor)) - .padding(5) - .background(firstAvatar.hairColor == componentColor ? - Circle() - .stroke(lineWidth: 3) - .foregroundColor(.gray) - : - nil - ) - .padding(.vertical) - } -} - -struct ComponentItem: View { - @EnvironmentObject var firstAvatar: FirstAvatar - var component: AvatarComponent - var componentName: String - var index: Int - - var body: some View { - PreviewAvatar(stringComponent: "\(componentName)\(index)", component: component) - .frame(height: 100) - .background(checkItemSelected(componentName: "\(componentName)\(index)") ? - RoundedRectangle(cornerRadius: 20) - .stroke(lineWidth: 3) - .foregroundColor(.gray) - : - nil - ) - .padding(.vertical) - } - - private func checkItemSelected(componentName: String) -> Bool { - if component == .body { - if firstAvatar.body == componentName { return true } - } - else if component == .eyes { - if firstAvatar.eyes == componentName { return true } - } - else if component == .hair { - if firstAvatar.hair == componentName { return true } - } - else if component == .mouth { - if firstAvatar.mouth == componentName { return true } - } - return false - } -} - - -struct PreviewAvatar: View { - @EnvironmentObject var firstAvatar: FirstAvatar - var stringComponent: String - var component: AvatarComponent - - var body: some View { - Image("head") - .componentModifier() - .overlay( - ZStack { - if component == .body { - Image(stringComponent) - .componentModifier() - .colorMultiply(Color(firstAvatar.bodyColor)) - } else { - Image(firstAvatar.body) - .componentModifier() - .colorMultiply(Color(firstAvatar.bodyColor)) - } - - if component == .hair { - Image(stringComponent) - .componentModifier() - .colorMultiply(Color(firstAvatar.hairColor)) - } else { - Image(firstAvatar.hair) - .componentModifier() - .colorMultiply(Color(firstAvatar.hairColor)) - } - - if component == .eyes { - Image(stringComponent) - .componentModifier() - } else { - Image(firstAvatar.eyes) - .componentModifier() - } - - Image(firstAvatar.nose) - .componentModifier() - - if component == .mouth { - Image(stringComponent) - .componentModifier() - } else { - Image(firstAvatar.mouth) - .componentModifier() - } - } - ) - } -}
--- a/LazyBear/Views/Onboarding/Helpers/FirstAvatar.swift Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -// -// EnvironmentSignUp.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 25/3/21. -// - -import SwiftUI - -class FirstAvatar: ObservableObject { - @Published var username = "" - @Published var body = "body1" - @Published var bodyColor = "customColor3" - @Published var eyes = "eyes2" - @Published var facialHair = "facialHair3" - @Published var hair = "hair2" - @Published var hairColor = "hairColor1" - @Published var mouth = "mouth1" - @Published var nose = "nose1" - @Published var skinTone = "skinTone1" - @Published var background = "default" -}
--- a/LazyBear/Views/Onboarding/SignUpView.swift Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -// -// SignUpView.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 25/3/21. -// - -import SwiftUI - -struct SignUpView: View { - @Environment(\.managedObjectContext) private var moc - @EnvironmentObject var firstAvatar: FirstAvatar - @EnvironmentObject var hapticsManager: HapticsManager - @State private var showingAvatarGenerator = false - @State private var usernameIsEmptyAlert = false - @State private var showContentView = false - - var body: some View { - if showContentView { - ContentView() - } else { - NavigationView { - VStack(alignment: .leading) { - ProfileAvatar(showingAvatarGenerator: $showingAvatarGenerator) - .padding(.bottom) - - UserNameTextfield(username: $firstAvatar.username) - .padding(.bottom) - - Spacer() - Button(action: {checkAndSave()}) { - NextButton(text: "Continue") - } - HStack { - Spacer() - Text("We do not sell your data to third parties.") - .opacity(0.6) - Spacer() - } - .font(.caption) - .padding(.bottom, 30) - } - .padding() - .navigationTitle("Sign Up") - .navigationBarTitleDisplayMode(.inline) - .toolbar { - ToolbarItem(placement: .navigationBarTrailing) { - Button(action: { self.showingAvatarGenerator = true; self.hapticsManager.simpleSuccess() }) { - Text("Edit avatar") - } - } - } - } - .alert(isPresented: $usernameIsEmptyAlert) { - Alert(title: Text("Select a username"), message: Text("Need ideas? Try Stockmaster, or Financial lover"), dismissButton: .default(Text("Got it!"))) - } - .sheet(isPresented: $showingAvatarGenerator) { - AvatarCreator() - .environmentObject(firstAvatar) - .environmentObject(hapticsManager) - } - .onAppear { self.hapticsManager.simpleSuccess() } - } - } - - private func checkAndSave() { - if firstAvatar.username.isEmpty { - self.usernameIsEmptyAlert = true - hapticsManager.simpleError() - } else { - // Save settings to CLOUDKIT - let userSettings = UserSettings(context: moc) - userSettings.username = firstAvatar.username - userSettings.body = firstAvatar.body - userSettings.bodyColor = firstAvatar.bodyColor - userSettings.eyes = firstAvatar.eyes - userSettings.facialHair = firstAvatar.facialHair - userSettings.mouth = firstAvatar.mouth - userSettings.nose = firstAvatar.nose - userSettings.skinTone = firstAvatar.skinTone - userSettings.background = firstAvatar.background - // Save AppIsAlreadyLaunched - let defaults = UserDefaults.standard - defaults.setValue(true, forKey: "IsAppAlreadyLaunchedOnce") - do { - try moc.save() - print("User saved") - self.showContentView = true - } catch { - print(error.localizedDescription) - } - } - } -} - -struct SignUpView_Previews: PreviewProvider { - static var previews: some View { - SignUpView() - .environmentObject(FirstAvatar()) - } -} - -struct ProfileAvatar: View { - @Binding var showingAvatarGenerator: Bool - @EnvironmentObject var firstAvatar: FirstAvatar - @EnvironmentObject var hapticsManager: HapticsManager - - var body: some View { - HStack { - Spacer() - ZStack(alignment: .topTrailing) { - Button(action: { self.showingAvatarGenerator = true; self.hapticsManager.simpleSuccess()}) { - Avatar() - .shadow(color: Color.gray.opacity(0.2), radius: 10) - .background( - Circle() - .foregroundColor(Color(firstAvatar.background)) - ) - - } - } - - Spacer() - } - } -} - - -struct UserNameTextfield: View { - @EnvironmentObject var firstAvatar: FirstAvatar - @Binding var username: String - - var body: some View { - VStack(alignment: .leading) { - Text("Choose your username") - .font(.headline) - - TextField("Username", text: $username) - .padding(10) - .background( - RoundedRectangle(cornerRadius: 10) - .foregroundColor(Color(.systemGray6)) - ) - } - } -} - -struct NextButton: View { - var text: String - - var body: some View { - RoundedRectangle(cornerRadius: 10) - .foregroundColor(Color("default")) - .frame(height: 50) - .overlay( - Text(text) - .foregroundColor(.white) - ) - } -}
--- a/LazyBear/Views/Onboarding/WelcomeView.swift Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -// -// WelcomeView.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 21/3/21. -// - -import SwiftUI - -struct WelcomeView: View { - @EnvironmentObject var hapticsManager: HapticsManager - @FetchRequest(entity: UserSettings.entity(), sortDescriptors: []) var userSettings: FetchedResults<UserSettings> - @ObservedObject var environmentSignUp = FirstAvatar() - @State private var showingNextView = false - @State private var showingProgressView = false - - var body: some View { - if showingNextView { - if userSettings.isEmpty { - SignUpView() - .environmentObject(environmentSignUp) - } else { - ContentView() - .environmentObject(environmentSignUp) - } - - } else { - GeometryReader { geo in - VStack(alignment: .leading) { - Spacer() - Image("default") - .resizable() - .frame(width: geo.size.width * 0.25, height: geo.size.width * 0.25) - .cornerRadius(25) - .shadow(color: Color.black.opacity(0.2), radius: 10) - - Group { - Text("Welcome to") - .fontWeight(.black) - Text("Lazybear") - .fontWeight(.black) - .foregroundColor(Color("default")) - } - .font(.largeTitle) - - - Text("Easily follow your stocks and the markets in real-time.") - .padding(.top, 5) - - HStack { - if self.showingProgressView { - Spacer() - ProgressView() - Spacer() - } - } - .padding() - .frame(height: 30) - - Spacer() - } - .padding(geo.size.width * 0.15) - .onAppear { - DispatchQueue.main.asyncAfter(deadline: .now() + 5) { - self.showingNextView = true - } - DispatchQueue.main.asyncAfter(deadline: .now() + 1) { - self.showingProgressView = true - } - self.hapticsManager.prepareHaptics() - } - } - } - } -} - -struct WelcomeView_Previews: PreviewProvider { - static var previews: some View { - WelcomeView() - } -}
--- a/LazyBear/Views/Onboarding/WhatsNewView.swift Sat Mar 27 20:32:45 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +0,0 @@ -// -// WhatsNewView.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 21/3/21. -// - -import SwiftUI - -extension Animation { - static func ripple(index: Int) -> Animation { - Animation.spring(dampingFraction: 0.5) - .speed(2) - .delay(0.03 * Double(index)) - } -} - -class WhatsNewRowItems { - var icons = ["heart.fill", "chart.bar.fill", "paintbrush.fill"] - var iconColors: [Color] = [.red, .blue, .green] - var headlines = ["Your stocks at a glance", "Interactive charts", "New design"] - var bodyTexts = ["Easily create watchlists with your favourite companies.", "Long press, drag, tap and have fun with the charts.", "Modern, clean and neat without losing simplicty."] -} -struct WhatsNewView: View { - let whatsNewRowItems = WhatsNewRowItems() - @State private var showingButton = false - @State private var showingRows = false - @State var showingContentView = false - - var body: some View { - if !showingContentView { - GeometryReader { geo in - VStack(alignment: .leading) { - Text("What's new") - .font(.system(size: 50, weight: .black)) - .padding(.bottom) - .opacity(showingRows ? 1: 0) - .animation(.easeInOut) - - ForEach((0..<3), id: \.self) { index in - if showingRows { - WhatsNewRow(icon: whatsNewRowItems.icons[index], iconColor: whatsNewRowItems.iconColors[index], headline: whatsNewRowItems.headlines[index], bodyText: whatsNewRowItems.bodyTexts[index], position: index+1) - .transition(.slide) - .animation(.ripple(index: index)) - } - } - Spacer() - WhatsNewButton(showContentView: $showingContentView) - .offset(y: showingButton ? 0 : 200) - .animation(.easeInOut) - - } - .onAppear { - DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { - self.showingButton = true - } - DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { - self.showingRows = true - } - } - .padding(geo.size.width * 0.15) - } - } else { - ContentView() - .transition(.asymmetric(insertion: .scale, removal: .opacity)) - } - } -} - -struct WhatsNewView_Previews: PreviewProvider { - static var previews: some View { - WhatsNewView() - } -} - -struct WhatsNewRow: View { - var icon: String - var iconColor: Color - var headline: String - var bodyText: String - var position: Int - - let columns = [GridItem(.flexible())] - - var body: some View { - HStack(alignment: .center) { - Image(systemName: icon) - .foregroundColor(iconColor) - .frame(width: 40) - .font(.system(size: 35)) - .padding(.trailing) - - VStack(alignment: .leading) { - Text(headline) - .font(.headline) - - Text(bodyText) - } - } - .padding(.bottom) - } -} - -struct WhatsNewButton: View { - @Binding var showContentView: Bool - - var body: some View { - HStack { - Spacer() - Button(action: { -// writeUserDefaults() - withAnimation { - self.showContentView = true - - } - }) { - RoundedRectangle(cornerRadius: 10) - .foregroundColor(.blue) - .frame(height: 50) - .overlay( - Text("Continue") - .foregroundColor(.white) - ) - } - - Spacer() - } - } - - func writeUserDefaults() { - let defaults = UserDefaults.standard - defaults.setValue(true, forKey: "IsAppAlreadyLaunchedOnce") - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LazyBear/Views/Welcome/WelcomeView.swift Sun Mar 28 20:54:58 2021 +0200 @@ -0,0 +1,55 @@ +// +// WelcomeView.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 28/3/21. +// + +import SwiftUI + +struct WelcomeView: View { + @Environment(\.presentationMode) var welcomeView + + var body: some View { + GeometryReader { proxy in + NavigationView { + VStack { + Image("default") + .resizable() + .frame(width: proxy.size.width*0.3, height: proxy.size.width*0.3) + .cornerRadius(25) + .shadow(color: Color.black.opacity(0.3), radius: 10) + .padding(.vertical) + + Text("Lazybear") + .font(.largeTitle) + .fontWeight(.bold) + .padding(.bottom) + + Text("Create watchlists, add companies, and follow the markets in real time.") + .font(.title3) + .fontWeight(.semibold) + .multilineTextAlignment(.center) + } + .padding(.horizontal) + .navigationBarTitleDisplayMode(.inline) + .toolbar { + ToolbarItem(placement: .navigationBarTrailing) { + Button("Done", action: { dismissWelcome() }) + } + } + } + } + } + + private func dismissWelcome() { + UserDefaults.standard.set(true, forKey: "IsAppAlreadyLaunchedOnce") + welcomeView.wrappedValue.dismiss() + } +} + +struct WelcomeView_Previews: PreviewProvider { + static var previews: some View { + WelcomeView() + } +}