# HG changeset patch # User Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> # Date 1615407583 -3600 # Node ID 2d7ad67a3e95b4a53ec8725e9e86a03cfec5e819 # Parent 35be981ccb31781ad457937fb5bf2a7fa9283caa Rename files diff -r 35be981ccb31 -r 2d7ad67a3e95 LazyBear.xcodeproj/project.pbxproj --- a/LazyBear.xcodeproj/project.pbxproj Wed Mar 10 21:19:28 2021 +0100 +++ b/LazyBear.xcodeproj/project.pbxproj Wed Mar 10 21:19:43 2021 +0100 @@ -19,7 +19,7 @@ 950B674F25E9A0AE00BF8593 /* IconModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950B674E25E9A0AE00BF8593 /* IconModel.swift */; }; 9517626025EEB37E00733235 /* PriceModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9517625F25EEB37E00733235 /* PriceModel.swift */; }; 9517626325EEBD3800733235 /* IexAttribution.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9517626225EEBD3800733235 /* IexAttribution.swift */; }; - 9520C26F25F4D43D0070DD71 /* TranDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9520C26E25F4D43D0070DD71 /* TranDetail.swift */; }; + 9520C26F25F4D43D0070DD71 /* TransactionDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9520C26E25F4D43D0070DD71 /* TransactionDetail.swift */; }; 9549D63325E1903F0085C3CD /* Charts in Frameworks */ = {isa = PBXBuildFile; productRef = 9549D63225E1903F0085C3CD /* Charts */; }; 9549D63625E191520085C3CD /* Normalize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9549D63525E191520085C3CD /* Normalize.swift */; }; 95672B8F25DDA54700DCBE4A /* LazyBearApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95672B8E25DDA54700DCBE4A /* LazyBearApp.swift */; }; @@ -29,7 +29,7 @@ 95672B9825DDA54700DCBE4A /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95672B9725DDA54700DCBE4A /* Persistence.swift */; }; 95672B9B25DDA54800DCBE4A /* LazyBear.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 95672B9925DDA54800DCBE4A /* LazyBear.xcdatamodeld */; }; 957B816825F2A02C0005E5C0 /* InsiderTranModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 957B816725F2A02C0005E5C0 /* InsiderTranModel.swift */; }; - 957B816D25F2A35D0005E5C0 /* TransRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 957B816C25F2A35D0005E5C0 /* TransRow.swift */; }; + 957B816D25F2A35D0005E5C0 /* TransactionRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 957B816C25F2A35D0005E5C0 /* TransactionRow.swift */; }; 957B817025F2A4290005E5C0 /* SideColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 957B816F25F2A4290005E5C0 /* SideColor.swift */; }; 958A733A25E00C3100FD7ECA /* Company+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 958A733825E00C3100FD7ECA /* Company+CoreDataClass.swift */; }; 958A733B25E00C3100FD7ECA /* Company+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 958A733925E00C3100FD7ECA /* Company+CoreDataProperties.swift */; }; @@ -50,16 +50,17 @@ 95B3E09F25E127D7007EFDE3 /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95B3E09E25E127D7007EFDE3 /* Request.swift */; }; 95B3E0A625E1318D007EFDE3 /* SwiftlySearch in Frameworks */ = {isa = PBXBuildFile; productRef = 95B3E0A525E1318D007EFDE3 /* SwiftlySearch */; }; 95BB43C025EA667700B6C965 /* DateSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95BB43BF25EA667700B6C965 /* DateSelection.swift */; }; - 95BFAE4B25E2AEA000A70EC3 /* HUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95BFAE4A25E2AEA000A70EC3 /* HUD.swift */; }; - 95BFAE4E25E2B0C200A70EC3 /* HUDManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95BFAE4D25E2B0C200A70EC3 /* HUDManager.swift */; }; + 95BFAE4B25E2AEA000A70EC3 /* Notification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95BFAE4A25E2AEA000A70EC3 /* Notification.swift */; }; + 95BFAE4E25E2B0C200A70EC3 /* HudManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95BFAE4D25E2B0C200A70EC3 /* HudManager.swift */; }; 95BFAE5425E2C52300A70EC3 /* HistoricalPriceModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95BFAE5325E2C52300A70EC3 /* HistoricalPriceModel.swift */; }; 95BFAE5825E2C5A700A70EC3 /* ChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95BFAE5725E2C5A700A70EC3 /* ChartView.swift */; }; 95D34C2125EFD319006F4A81 /* DetailNew.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95D34C2025EFD319006F4A81 /* DetailNew.swift */; }; 95D34C2725EFD5FE006F4A81 /* SDWebImageSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = 95D34C2625EFD5FE006F4A81 /* SDWebImageSwiftUI */; }; 95DED9D525F2A752000DFCBA /* transactionCodes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95DED9D425F2A752000DFCBA /* transactionCodes.swift */; }; 95DED9D825F2B1EF000DFCBA /* TopInsiderModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95DED9D725F2B1EF000DFCBA /* TopInsiderModel.swift */; }; - 95DED9DB25F2B268000DFCBA /* InsiderSum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95DED9DA25F2B268000DFCBA /* InsiderSum.swift */; }; + 95DED9DB25F2B268000DFCBA /* InsiderSummary.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95DED9DA25F2B268000DFCBA /* InsiderSummary.swift */; }; 95DED9E425F2B4D6000DFCBA /* SwiftUICharts in Frameworks */ = {isa = PBXBuildFile; productRef = 95DED9E325F2B4D6000DFCBA /* SwiftUICharts */; }; + 95E9D09725F6AA0400A947A1 /* ActionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E9D09625F6AA0400A947A1 /* ActionView.swift */; }; 95F045FB25E96A58006A5A17 /* newsLanguages.json in Resources */ = {isa = PBXBuildFile; fileRef = 95F045FA25E96A58006A5A17 /* newsLanguages.json */; }; 95F045FE25E96AA1006A5A17 /* NewsLanguageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F045FD25E96AA1006A5A17 /* NewsLanguageModel.swift */; }; 95F0460425E96DBB006A5A17 /* UserSettings+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F0460225E96DBB006A5A17 /* UserSettings+CoreDataClass.swift */; }; @@ -68,7 +69,7 @@ 95F0460B25E970DB006A5A17 /* LanguagePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F0460A25E970DB006A5A17 /* LanguagePicker.swift */; }; 95F0461025E976B5006A5A17 /* SettingRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F0460F25E976B5006A5A17 /* SettingRow.swift */; }; 95F0462825E98376006A5A17 /* default.png in Resources */ = {isa = PBXBuildFile; fileRef = 95F0462625E98376006A5A17 /* default.png */; }; - 95F90AB825F280190023A4B0 /* InsiderTrans.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F90AB725F280190023A4B0 /* InsiderTrans.swift */; }; + 95F90AB825F280190023A4B0 /* InsiderTransactions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F90AB725F280190023A4B0 /* InsiderTransactions.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -86,7 +87,7 @@ 950BA46C25E944FC00D065EF /* Sandbox.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Sandbox.xcconfig; sourceTree = ""; }; 9517625F25EEB37E00733235 /* PriceModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PriceModel.swift; sourceTree = ""; }; 9517626225EEBD3800733235 /* IexAttribution.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IexAttribution.swift; sourceTree = ""; }; - 9520C26E25F4D43D0070DD71 /* TranDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TranDetail.swift; sourceTree = ""; }; + 9520C26E25F4D43D0070DD71 /* TransactionDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionDetail.swift; sourceTree = ""; }; 9549D63525E191520085C3CD /* Normalize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Normalize.swift; sourceTree = ""; }; 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 = ""; }; @@ -97,7 +98,7 @@ 95672B9A25DDA54800DCBE4A /* LazyBear.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = LazyBear.xcdatamodel; sourceTree = ""; }; 95672B9C25DDA54800DCBE4A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 957B816725F2A02C0005E5C0 /* InsiderTranModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InsiderTranModel.swift; sourceTree = ""; }; - 957B816C25F2A35D0005E5C0 /* TransRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransRow.swift; sourceTree = ""; }; + 957B816C25F2A35D0005E5C0 /* TransactionRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionRow.swift; sourceTree = ""; }; 957B816F25F2A4290005E5C0 /* SideColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SideColor.swift; sourceTree = ""; }; 958A733825E00C3100FD7ECA /* Company+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Company+CoreDataClass.swift"; sourceTree = ""; }; 958A733925E00C3100FD7ECA /* Company+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Company+CoreDataProperties.swift"; sourceTree = ""; }; @@ -118,14 +119,15 @@ 95ACB5AE25E03AA100A3CCC8 /* ThemeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemeModel.swift; sourceTree = ""; }; 95B3E09E25E127D7007EFDE3 /* Request.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Request.swift; sourceTree = ""; }; 95BB43BF25EA667700B6C965 /* DateSelection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateSelection.swift; sourceTree = ""; }; - 95BFAE4A25E2AEA000A70EC3 /* HUD.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUD.swift; sourceTree = ""; }; - 95BFAE4D25E2B0C200A70EC3 /* HUDManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUDManager.swift; sourceTree = ""; }; + 95BFAE4A25E2AEA000A70EC3 /* Notification.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Notification.swift; sourceTree = ""; }; + 95BFAE4D25E2B0C200A70EC3 /* HudManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HudManager.swift; sourceTree = ""; }; 95BFAE5325E2C52300A70EC3 /* HistoricalPriceModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoricalPriceModel.swift; sourceTree = ""; }; 95BFAE5725E2C5A700A70EC3 /* ChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChartView.swift; sourceTree = ""; }; 95D34C2025EFD319006F4A81 /* DetailNew.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailNew.swift; sourceTree = ""; }; 95DED9D425F2A752000DFCBA /* transactionCodes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = transactionCodes.swift; sourceTree = ""; }; 95DED9D725F2B1EF000DFCBA /* TopInsiderModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopInsiderModel.swift; sourceTree = ""; }; - 95DED9DA25F2B268000DFCBA /* InsiderSum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InsiderSum.swift; sourceTree = ""; }; + 95DED9DA25F2B268000DFCBA /* InsiderSummary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InsiderSummary.swift; sourceTree = ""; }; + 95E9D09625F6AA0400A947A1 /* ActionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionView.swift; sourceTree = ""; }; 95F045FA25E96A58006A5A17 /* newsLanguages.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = newsLanguages.json; sourceTree = ""; }; 95F045FD25E96AA1006A5A17 /* NewsLanguageModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsLanguageModel.swift; sourceTree = ""; }; 95F0460225E96DBB006A5A17 /* UserSettings+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserSettings+CoreDataClass.swift"; sourceTree = ""; }; @@ -134,7 +136,7 @@ 95F0460A25E970DB006A5A17 /* LanguagePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LanguagePicker.swift; sourceTree = ""; }; 95F0460F25E976B5006A5A17 /* SettingRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingRow.swift; sourceTree = ""; }; 95F0462625E98376006A5A17 /* default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = default.png; sourceTree = ""; }; - 95F90AB725F280190023A4B0 /* InsiderTrans.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InsiderTrans.swift; sourceTree = ""; }; + 95F90AB725F280190023A4B0 /* InsiderTransactions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InsiderTransactions.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -192,7 +194,7 @@ 95672B9225DDA54700DCBE4A /* Assets.xcassets */, 95672B8E25DDA54700DCBE4A /* LazyBearApp.swift */, 95672B9025DDA54700DCBE4A /* ContentView.swift */, - 95BFAE4D25E2B0C200A70EC3 /* HUDManager.swift */, + 95BFAE4D25E2B0C200A70EC3 /* HudManager.swift */, 95672B9725DDA54700DCBE4A /* Persistence.swift */, 95B1874925DDAC4D0068A364 /* UI */, 95B1874825DDAC470068A364 /* Models */, @@ -266,11 +268,12 @@ 950B674825E99FA900BF8593 /* IconPicker.swift */, 95F0460F25E976B5006A5A17 /* SettingRow.swift */, 9517626225EEBD3800733235 /* IexAttribution.swift */, - 95BFAE4A25E2AEA000A70EC3 /* HUD.swift */, - 95F90AB725F280190023A4B0 /* InsiderTrans.swift */, - 957B816C25F2A35D0005E5C0 /* TransRow.swift */, - 9520C26E25F4D43D0070DD71 /* TranDetail.swift */, - 95DED9DA25F2B268000DFCBA /* InsiderSum.swift */, + 95BFAE4A25E2AEA000A70EC3 /* Notification.swift */, + 95F90AB725F280190023A4B0 /* InsiderTransactions.swift */, + 957B816C25F2A35D0005E5C0 /* TransactionRow.swift */, + 9520C26E25F4D43D0070DD71 /* TransactionDetail.swift */, + 95DED9DA25F2B268000DFCBA /* InsiderSummary.swift */, + 95E9D09625F6AA0400A947A1 /* ActionView.swift */, ); path = UI; sourceTree = ""; @@ -406,7 +409,7 @@ 950B674F25E9A0AE00BF8593 /* IconModel.swift in Sources */, 958A733B25E00C3100FD7ECA /* Company+CoreDataProperties.swift in Sources */, 9517626325EEBD3800733235 /* IexAttribution.swift in Sources */, - 95F90AB825F280190023A4B0 /* InsiderTrans.swift in Sources */, + 95F90AB825F280190023A4B0 /* InsiderTransactions.swift in Sources */, 95ACB5AF25E03AA100A3CCC8 /* ThemeModel.swift in Sources */, 95672B8F25DDA54700DCBE4A /* LazyBearApp.swift in Sources */, 9517626025EEB37E00733235 /* PriceModel.swift in Sources */, @@ -416,20 +419,21 @@ 957B816825F2A02C0005E5C0 /* InsiderTranModel.swift in Sources */, 95672B9B25DDA54800DCBE4A /* LazyBear.xcdatamodeld in Sources */, 95F0460B25E970DB006A5A17 /* LanguagePicker.swift in Sources */, + 95E9D09725F6AA0400A947A1 /* ActionView.swift in Sources */, 95D34C2125EFD319006F4A81 /* DetailNew.swift in Sources */, 95ABDD3125E1602D00310776 /* PriceView.swift in Sources */, - 95BFAE4B25E2AEA000A70EC3 /* HUD.swift in Sources */, + 95BFAE4B25E2AEA000A70EC3 /* Notification.swift in Sources */, 95F0460525E96DBB006A5A17 /* UserSettings+CoreDataProperties.swift in Sources */, - 95DED9DB25F2B268000DFCBA /* InsiderSum.swift in Sources */, + 95DED9DB25F2B268000DFCBA /* InsiderSummary.swift in Sources */, 958A733A25E00C3100FD7ECA /* Company+CoreDataClass.swift in Sources */, - 957B816D25F2A35D0005E5C0 /* TransRow.swift in Sources */, + 957B816D25F2A35D0005E5C0 /* TransactionRow.swift in Sources */, 95ACB5A925E0397B00A3CCC8 /* CompanyView.swift in Sources */, 958A734225E00C9900FD7ECA /* Watchlist.swift in Sources */, - 9520C26F25F4D43D0070DD71 /* TranDetail.swift in Sources */, + 9520C26F25F4D43D0070DD71 /* TransactionDetail.swift in Sources */, 95BB43C025EA667700B6C965 /* DateSelection.swift in Sources */, 957B817025F2A4290005E5C0 /* SideColor.swift in Sources */, 95DED9D825F2B1EF000DFCBA /* TopInsiderModel.swift in Sources */, - 95BFAE4E25E2B0C200A70EC3 /* HUDManager.swift in Sources */, + 95BFAE4E25E2B0C200A70EC3 /* HudManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff -r 35be981ccb31 -r 2d7ad67a3e95 LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate Binary file LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed diff -r 35be981ccb31 -r 2d7ad67a3e95 LazyBear/UI/HUD.swift --- a/LazyBear/UI/HUD.swift Wed Mar 10 21:19:28 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -// -// HUD.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 21/2/21. -// - -import SwiftUI - -struct HUD: View { - var text: String - var image: String - - var body: some View { - Label(text, systemImage: image) - .foregroundColor(.gray) - .padding(.horizontal, 10) - .padding(14) - .background( - Blur(style: .systemMaterial) - .clipShape(Capsule()) - .shadow(color: Color(.black).opacity(0.22), radius: 12, x: 0, y: 5) - ) - } -} - -struct Blur: UIViewRepresentable { - var style: UIBlurEffect.Style - - func makeUIView(context: Context) -> UIVisualEffectView { - return UIVisualEffectView(effect: UIBlurEffect(style: style)) - } - - func updateUIView(_ uiView: UIVisualEffectView, context: Context) { - uiView.effect = UIBlurEffect(style: style) - } -} diff -r 35be981ccb31 -r 2d7ad67a3e95 LazyBear/UI/InsiderSum.swift --- a/LazyBear/UI/InsiderSum.swift Wed Mar 10 21:19:28 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -// -// InsiderSum.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 5/3/21. -// - -import SwiftUI -import SwiftUICharts - -struct InsiderSum: View { - var symbol: String - @State private var dataPoints = [DataPoint]() - - @FetchRequest(entity: UserSettings.entity(), sortDescriptors: [NSSortDescriptor(keyPath: \UserSettings.changedAt, ascending: false)]) - var userSettings: FetchedResults - - var body: some View { - VStack(alignment: .leading) { - if !dataPoints.isEmpty { - HStack { - Image(systemName: "star.fill") - .renderingMode(.original) - .imageScale(.large) - - Text("Top insiders") - .font(.title2) - .fontWeight(.semibold) - - Spacer() - } - } - - HorizontalBarChartView(dataPoints: dataPoints) - } - .padding() - .onAppear { - // Empty array in case there is data already - if !dataPoints.isEmpty { - self.dataPoints = [DataPoint]() - } - - generateChart() - } - } - - private func getUrl() -> String { - let baseUrl = Bundle.main.infoDictionary?["IEX_URL"] as? String ?? "Empty url" - let apiKey = Bundle.main.infoDictionary?["IEX_API"] as? String ?? "Empty key" - let url = "\(baseUrl)/stock/\(symbol)/insider-roster?token=\(apiKey)" - - return url - } - - private func generateChart() { - request(url: getUrl(), model: [TopInsiderModel].self) { topInsiders in - let theme = userSettings.first?.theme?.lowercased() ?? "default" - // Loop over the response - var insiderNumber = 0 - for insider in topInsiders { - insiderNumber += 1 - if insiderNumber < 5 { - if let net = insider.position { - let index = topInsiders.firstIndex(of: insider) // Get number (indice) of the item in the list - let rowNumber = index! % 5 // Get row color name - let color = Color("\(theme)Row\(rowNumber)") // Define color - let label = LocalizedStringKey(insider.entityName.capitalized) // Define label - let legend = Legend(color: color, label: label) // Define legend SwiftUICharts - let dataPoint = DataPoint(value: Double(net), label: LocalizedStringKey(String(net)), legend: legend) - - dataPoints.append(dataPoint) - } - } - } - } - } -} - -struct InsiderSum_Previews: PreviewProvider { - static var previews: some View { - InsiderSum(symbol: "aapl") - } -} diff -r 35be981ccb31 -r 2d7ad67a3e95 LazyBear/UI/InsiderSummary.swift --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LazyBear/UI/InsiderSummary.swift Wed Mar 10 21:19:43 2021 +0100 @@ -0,0 +1,83 @@ +// +// InsiderSummary.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 5/3/21. +// + +import SwiftUI +import SwiftUICharts + +struct InsiderSummary: View { + var symbol: String + @State private var dataPoints = [DataPoint]() + + @FetchRequest(entity: UserSettings.entity(), sortDescriptors: [NSSortDescriptor(keyPath: \UserSettings.changedAt, ascending: false)]) + var userSettings: FetchedResults + + var body: some View { + VStack(alignment: .leading) { + if !dataPoints.isEmpty { + HStack { + Image(systemName: "star.fill") + .renderingMode(.original) + .imageScale(.large) + + Text("Top insiders") + .font(.title2) + .fontWeight(.semibold) + + Spacer() + } + } + + HorizontalBarChartView(dataPoints: dataPoints) + } + .padding() + .onAppear { + // Empty array in case there is data already + if !dataPoints.isEmpty { + self.dataPoints = [DataPoint]() + } + + generateChart() + } + } + + private func getUrl() -> String { + let baseUrl = Bundle.main.infoDictionary?["IEX_URL"] as? String ?? "Empty url" + let apiKey = Bundle.main.infoDictionary?["IEX_API"] as? String ?? "Empty key" + let url = "\(baseUrl)/stock/\(symbol)/insider-roster?token=\(apiKey)" + + return url + } + + private func generateChart() { + request(url: getUrl(), model: [TopInsiderModel].self) { topInsiders in + let theme = userSettings.first?.theme?.lowercased() ?? "default" + // Loop over the response + var insiderNumber = 0 + for insider in topInsiders { + insiderNumber += 1 + if insiderNumber < 5 { + if let net = insider.position { + let index = topInsiders.firstIndex(of: insider) // Get number (indice) of the item in the list + let rowNumber = index! % 5 // Get row color name + let color = Color("\(theme)Row\(rowNumber)") // Define color + let label = LocalizedStringKey(insider.entityName.capitalized) // Define label + let legend = Legend(color: color, label: label) // Define legend SwiftUICharts + let dataPoint = DataPoint(value: Double(net), label: LocalizedStringKey(String(net)), legend: legend) + + dataPoints.append(dataPoint) + } + } + } + } + } +} + +struct InsiderSummary_Previews: PreviewProvider { + static var previews: some View { + InsiderSummary(symbol: "aapl") + } +} diff -r 35be981ccb31 -r 2d7ad67a3e95 LazyBear/UI/InsiderTrans.swift --- a/LazyBear/UI/InsiderTrans.swift Wed Mar 10 21:19:28 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -// -// InsidersView.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 5/3/21. -// - -import SwiftUI - -struct InsiderTrans: View { - var symbol: String - @State private var transactions = [InsiderTranModel]() - - var body: some View { - VStack(alignment: .leading) { - if !transactions.isEmpty { - HStack { - Image(systemName: "dollarsign.circle.fill") - .foregroundColor(Color(.systemGreen)) - .imageScale(.large) - - Text("Latest transactions") - .font(.title2) - .fontWeight(.semibold) - .padding(.horizontal) - - Spacer() - } - .padding(.horizontal) - } - - ForEach(transactions.reversed(), id: \.self) { trans in - TransRow(transaction: trans) - .padding(.horizontal) - .padding(.vertical, 5) - - Divider() - } - } - .onAppear { - request(url: getUrl(), model: [InsiderTranModel].self) { self.transactions = $0 } - } - } - - private func getUrl() -> String { - let baseUrl = Bundle.main.infoDictionary?["IEX_URL"] as? String ?? "Empty url" - let apiKey = Bundle.main.infoDictionary?["IEX_API"] as? String ?? "Empty key" - let url = "\(baseUrl)/stock/\(symbol)/insider-transactions?token=\(apiKey)" - - return url - } -} - -struct InsiderTrans_Previews: PreviewProvider { - static var previews: some View { - InsiderTrans(symbol: "aapl") - } -} diff -r 35be981ccb31 -r 2d7ad67a3e95 LazyBear/UI/InsiderTransactions.swift --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LazyBear/UI/InsiderTransactions.swift Wed Mar 10 21:19:43 2021 +0100 @@ -0,0 +1,57 @@ +// +// InsiderTransactions.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 5/3/21. +// + +import SwiftUI + +struct InsiderTransactions: View { + var symbol: String + @State private var transactions = [InsiderTranModel]() + + var body: some View { + VStack(alignment: .leading) { + if !transactions.isEmpty { + HStack { + Image(systemName: "dollarsign.square.fill") + .foregroundColor(Color(.systemGreen)) + .imageScale(.large) + + Text("Latest transactions") + .font(.title2) + .fontWeight(.semibold) + + Spacer() + } + .padding(.horizontal) + } + + ForEach(transactions.reversed(), id: \.self) { trans in + TransactionRow(transaction: trans) + .padding(.horizontal) + .padding(.vertical, 5) + + Divider() + } + } + .onAppear { + request(url: getUrl(), model: [InsiderTranModel].self) { self.transactions = $0 } + } + } + + private func getUrl() -> String { + let baseUrl = Bundle.main.infoDictionary?["IEX_URL"] as? String ?? "Empty url" + let apiKey = Bundle.main.infoDictionary?["IEX_API"] as? String ?? "Empty key" + let url = "\(baseUrl)/stock/\(symbol)/insider-transactions?token=\(apiKey)" + + return url + } +} + +struct InsiderTransactions_Previews: PreviewProvider { + static var previews: some View { + InsiderTransactions(symbol: "aapl") + } +} diff -r 35be981ccb31 -r 2d7ad67a3e95 LazyBear/UI/NewsRow.swift --- a/LazyBear/UI/NewsRow.swift Wed Mar 10 21:19:28 2021 +0100 +++ b/LazyBear/UI/NewsRow.swift Wed Mar 10 21:19:43 2021 +0100 @@ -45,6 +45,8 @@ .opacity(0.5) } } + + Spacer() } } .foregroundColor(colorScheme == .dark ? .white: .black) diff -r 35be981ccb31 -r 2d7ad67a3e95 LazyBear/UI/NewsView.swift --- a/LazyBear/UI/NewsView.swift Wed Mar 10 21:19:28 2021 +0100 +++ b/LazyBear/UI/NewsView.swift Wed Mar 10 21:19:43 2021 +0100 @@ -17,7 +17,7 @@ if !news.isEmpty { HStack { Image(systemName: "newspaper.fill") - .foregroundColor(Color(.systemYellow)) + .foregroundColor(Color(.systemTeal)) .imageScale(.large) Text("Recent news") diff -r 35be981ccb31 -r 2d7ad67a3e95 LazyBear/UI/Notification.swift --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LazyBear/UI/Notification.swift Wed Mar 10 21:19:43 2021 +0100 @@ -0,0 +1,37 @@ +// +// Notification.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 21/2/21. +// + +import SwiftUI + +struct Notification: View { + var text: String + var image: String + + var body: some View { + Label(text, systemImage: image) + .foregroundColor(.gray) + .padding(.horizontal, 10) + .padding(14) + .background( + Blur(style: .systemMaterial) + .clipShape(Capsule()) + .shadow(color: Color(.black).opacity(0.22), radius: 12, x: 0, y: 5) + ) + } +} + +struct Blur: UIViewRepresentable { + var style: UIBlurEffect.Style + + func makeUIView(context: Context) -> UIVisualEffectView { + return UIVisualEffectView(effect: UIBlurEffect(style: style)) + } + + func updateUIView(_ uiView: UIVisualEffectView, context: Context) { + uiView.effect = UIBlurEffect(style: style) + } +} diff -r 35be981ccb31 -r 2d7ad67a3e95 LazyBear/UI/Search.swift --- a/LazyBear/UI/Search.swift Wed Mar 10 21:19:28 2021 +0100 +++ b/LazyBear/UI/Search.swift Wed Mar 10 21:19:43 2021 +0100 @@ -9,7 +9,7 @@ import SwiftlySearch struct Search: View { - @ObservedObject var hudManager: HUDManager + @ObservedObject var hudManager: HudManager @State private var company = String() @State private var companies = [CompanyModel]() @@ -59,6 +59,6 @@ struct Search_Previews: PreviewProvider { static var previews: some View { - Search(hudManager: HUDManager()) + Search(hudManager: HudManager()) } } diff -r 35be981ccb31 -r 2d7ad67a3e95 LazyBear/UI/TranDetail.swift --- a/LazyBear/UI/TranDetail.swift Wed Mar 10 21:19:28 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -// -// TranDetail.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 7/3/21. -// - -import SwiftUI - -struct TranDetail: View { - var transaction: InsiderTranModel - - var body: some View { - NavigationView { - Form { - Section(header: Text("Insider information")) { - HStack { - Image(systemName: "person.fill") - Text(transaction.fullName?.capitalized ?? "-") - } - - if let postShares = transaction.postShares { - HStack { - Image(systemName: "number") - Text("\(postShares) shares owned") - } - } - } - - Section(header: Text("Transaction information")) { - HStack { - Image(systemName: "calendar") - Text(transaction.transactionDate ?? "-") - } - - let direcIndirect = transaction.directIndirect ?? "-" - if direcIndirect == "D" { - Text("Direct transaction") - } else if direcIndirect == "I" { - Text("Indirect transaction") - } - - if let tranPrice = transaction.transactionPrice { - Text(String(format: "Price per share: $%.2f", tranPrice)) - } - - if let tranShares = transaction.transactionShares { - Text("Shares transacted: \(tranShares)") - } - - if let tranValue = transaction.transactionValue { - Text(String(format: "Transaction value: $%.2f", tranValue)) - } - } - - if let tranType = transactionCodes[transaction.transactionCode ?? "-"] { - Section(header: Text("Transaction type")) { - Text(tranType) - } - } - } - .navigationTitle("Transaction detail") - } - } -} - -struct TranDetail_Previews: PreviewProvider { - static var previews: some View { - TranDetail(transaction: InsiderTranModel(directIndirect: "D", transactionDate: "2020-02-04", fullName: "WAGNER SUSAN", postShares: 886126, transactionCode: "M", transactionPrice: 13.20, transactionShares: 12345, transactionValue: 123456.50)) - } -} diff -r 35be981ccb31 -r 2d7ad67a3e95 LazyBear/UI/TransRow.swift --- a/LazyBear/UI/TransRow.swift Wed Mar 10 21:19:28 2021 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -// -// InsiderRow.swift -// LazyBear -// -// Created by Dennis Concepción Martín on 5/3/21. -// - -import SwiftUI - -struct TransRow: View { - var transaction: InsiderTranModel - @State private var showingDetail = false - @Environment(\.colorScheme) var colorScheme // Detect dark mode - - var body: some View { - Button(action: { self.showingDetail = true }) { - HStack(alignment: .top) { - VStack(alignment: .leading) { - Text(transaction.fullName?.capitalized ?? "-") - .fontWeight(.semibold) - - if let date = transaction.transactionDate { - Text(date) - } - } - - Spacer() - if let shares = transaction.transactionShares ?? 0 { - Text("\(shares)") - .foregroundColor(shares < 0 ? Color(.systemRed): Color(.systemGreen)) - .fontWeight(.semibold) - } - } - } - .foregroundColor(colorScheme == .dark ? .white: .black) - .sheet(isPresented: $showingDetail) { - TranDetail(transaction: transaction) - } - } -} - -struct TransRow_Previews: PreviewProvider { - static var previews: some View { - TransRow(transaction: InsiderTranModel(directIndirect: "D", transactionDate: "2020-02-04", fullName: "WAGNER SUSAN", postShares: 886126, transactionCode: "M", transactionPrice: 13.20, transactionShares: 12345, transactionValue: 123456.50)) - } -} diff -r 35be981ccb31 -r 2d7ad67a3e95 LazyBear/UI/TransactionDetail.swift --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LazyBear/UI/TransactionDetail.swift Wed Mar 10 21:19:43 2021 +0100 @@ -0,0 +1,71 @@ +// +// TransactionDetail.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 7/3/21. +// + +import SwiftUI + +struct TransactionDetail: View { + var transaction: InsiderTranModel + + var body: some View { + NavigationView { + Form { + Section(header: Text("Insider information")) { + HStack { + Image(systemName: "person.fill") + Text(transaction.fullName?.capitalized ?? "-") + } + + if let postShares = transaction.postShares { + HStack { + Image(systemName: "number") + Text("\(postShares) shares owned") + } + } + } + + Section(header: Text("Transaction information")) { + HStack { + Image(systemName: "calendar") + Text(transaction.transactionDate ?? "-") + } + + let direcIndirect = transaction.directIndirect ?? "-" + if direcIndirect == "D" { + Text("Direct transaction") + } else if direcIndirect == "I" { + Text("Indirect transaction") + } + + if let tranPrice = transaction.transactionPrice { + Text(String(format: "Price per share: $%.2f", tranPrice)) + } + + if let tranShares = transaction.transactionShares { + Text("Shares transacted: \(tranShares)") + } + + if let tranValue = transaction.transactionValue { + Text(String(format: "Transaction value: $%.2f", tranValue)) + } + } + + if let tranType = transactionCodes[transaction.transactionCode ?? "-"] { + Section(header: Text("Transaction type")) { + Text(tranType) + } + } + } + .navigationTitle("Transaction detail") + } + } +} + +struct TransactionDetail_Previews: PreviewProvider { + static var previews: some View { + TransactionDetail(transaction: InsiderTranModel(directIndirect: "D", transactionDate: "2020-02-04", fullName: "WAGNER SUSAN", postShares: 886126, transactionCode: "M", transactionPrice: 13.20, transactionShares: 12345, transactionValue: 123456.50)) + } +} diff -r 35be981ccb31 -r 2d7ad67a3e95 LazyBear/UI/TransactionRow.swift --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LazyBear/UI/TransactionRow.swift Wed Mar 10 21:19:43 2021 +0100 @@ -0,0 +1,46 @@ +// +// TransactionRow.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 5/3/21. +// + +import SwiftUI + +struct TransactionRow: View { + var transaction: InsiderTranModel + @State private var showingDetail = false + @Environment(\.colorScheme) var colorScheme // Detect dark mode + + var body: some View { + Button(action: { self.showingDetail = true }) { + HStack(alignment: .top) { + VStack(alignment: .leading) { + Text(transaction.fullName?.capitalized ?? "-") + .fontWeight(.semibold) + + if let date = transaction.transactionDate { + Text(date) + } + } + + Spacer() + if let shares = transaction.transactionShares ?? 0 { + Text("\(shares)") + .foregroundColor(shares < 0 ? Color(.systemRed): Color(.systemGreen)) + .fontWeight(.semibold) + } + } + } + .foregroundColor(colorScheme == .dark ? .white: .black) + .sheet(isPresented: $showingDetail) { + TransactionDetail(transaction: transaction) + } + } +} + +struct TransactionRow_Previews: PreviewProvider { + static var previews: some View { + TransactionRow(transaction: InsiderTranModel(directIndirect: "D", transactionDate: "2020-02-04", fullName: "WAGNER SUSAN", postShares: 886126, transactionCode: "M", transactionPrice: 13.20, transactionShares: 12345, transactionValue: 123456.50)) + } +} diff -r 35be981ccb31 -r 2d7ad67a3e95 LazyBear/UI/Watchlist.swift --- a/LazyBear/UI/Watchlist.swift Wed Mar 10 21:19:28 2021 +0100 +++ b/LazyBear/UI/Watchlist.swift Wed Mar 10 21:19:43 2021 +0100 @@ -9,7 +9,7 @@ import CoreData struct Watchlist: View { - @ObservedObject var hudManager: HUDManager + @ObservedObject var hudManager: HudManager @Environment(\.managedObjectContext) private var moc @FetchRequest(entity: Company.entity(), sortDescriptors: []) var companies: FetchedResults @@ -51,6 +51,6 @@ struct Watchlist_Previews: PreviewProvider { static var previews: some View { - Watchlist(hudManager: HUDManager()) + Watchlist(hudManager: HudManager()) } }