diff --git a/Multiplatform/Shared/Article/ArticleContainerView.swift b/Multiplatform/Shared/Article/ArticleContainerView.swift new file mode 100644 index 000000000..021c39d62 --- /dev/null +++ b/Multiplatform/Shared/Article/ArticleContainerView.swift @@ -0,0 +1,31 @@ +// +// ArticleContainerView.swift +// NetNewsWire +// +// Created by Maurice Parker on 7/2/20. +// Copyright © 2020 Ranchero Software. All rights reserved. +// + +import SwiftUI +import Articles + +struct ArticleContainerView: View { + + @EnvironmentObject private var sceneModel: SceneModel + @StateObject private var articleModel = ArticleModel() + var article: Article? = nil + + @ViewBuilder var body: some View { + if let article = article { + ArticleView() + .environmentObject(articleModel) + .onAppear { + sceneModel.articleModel = articleModel + articleModel.delegate = sceneModel + } + } else { + EmptyView() + } + } + +} diff --git a/Multiplatform/Shared/Article/ArticleModel.swift b/Multiplatform/Shared/Article/ArticleModel.swift new file mode 100644 index 000000000..7e2248d0b --- /dev/null +++ b/Multiplatform/Shared/Article/ArticleModel.swift @@ -0,0 +1,25 @@ +// +// ArticleModel.swift +// NetNewsWire +// +// Created by Maurice Parker on 7/2/20. +// Copyright © 2020 Ranchero Software. All rights reserved. +// + +import Foundation + +import Foundation +import RSCore +import Account +import Articles + +protocol ArticleModelDelegate: class { + func timelineRequestedWebFeedSelection(_: TimelineModel, webFeed: WebFeed) +} + +class ArticleModel: ObservableObject { + + weak var delegate: ArticleModelDelegate? + +} + diff --git a/Multiplatform/Shared/Article/ArticleView.swift b/Multiplatform/Shared/Article/ArticleView.swift new file mode 100644 index 000000000..309551225 --- /dev/null +++ b/Multiplatform/Shared/Article/ArticleView.swift @@ -0,0 +1,21 @@ +// +// ArticleView.swift +// NetNewsWire +// +// Created by Maurice Parker on 7/2/20. +// Copyright © 2020 Ranchero Software. All rights reserved. +// + +import SwiftUI + +struct ArticleView: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct ArticleView_Previews: PreviewProvider { + static var previews: some View { + ArticleView() + } +} diff --git a/Multiplatform/Shared/SceneModel.swift b/Multiplatform/Shared/SceneModel.swift index f09b48f6d..e199ac11c 100644 --- a/Multiplatform/Shared/SceneModel.swift +++ b/Multiplatform/Shared/SceneModel.swift @@ -13,6 +13,7 @@ final class SceneModel: ObservableObject { var sidebarModel: SidebarModel? var timelineModel: TimelineModel? + var articleModel: ArticleModel? } @@ -35,3 +36,10 @@ extension SceneModel: TimelineModelDelegate { } } + +// MARK: ArticleModelDelegate + +extension SceneModel: ArticleModelDelegate { + + +} diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index 80aa4a972..eabc431a0 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -265,6 +265,12 @@ 51A1699D235E10D700EB091F /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A16993235E10D600EB091F /* SettingsViewController.swift */; }; 51A1699F235E10D700EB091F /* AboutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A16995235E10D600EB091F /* AboutViewController.swift */; }; 51A169A0235E10D700EB091F /* FeedbinAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A16996235E10D700EB091F /* FeedbinAccountViewController.swift */; }; + 51A5769624AE617200078888 /* ArticleContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A5769524AE617200078888 /* ArticleContainerView.swift */; }; + 51A5769724AE617200078888 /* ArticleContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A5769524AE617200078888 /* ArticleContainerView.swift */; }; + 51A576BB24AE621800078888 /* ArticleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A576BA24AE621800078888 /* ArticleModel.swift */; }; + 51A576BC24AE621800078888 /* ArticleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A576BA24AE621800078888 /* ArticleModel.swift */; }; + 51A576BE24AE637400078888 /* ArticleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A576BD24AE637400078888 /* ArticleView.swift */; }; + 51A576BF24AE637400078888 /* ArticleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A576BD24AE637400078888 /* ArticleView.swift */; }; 51A66685238075AE00CB272D /* AddWebFeedDefaultContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A66684238075AE00CB272D /* AddWebFeedDefaultContainer.swift */; }; 51A9A5E12380C4FE0033AADF /* AppDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C45255226507D200C03939 /* AppDefaults.swift */; }; 51A9A5E42380C8880033AADF /* ShareFolderPickerAccountCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 51A9A5E32380C8870033AADF /* ShareFolderPickerAccountCell.xib */; }; @@ -1865,6 +1871,9 @@ 51A16993235E10D600EB091F /* SettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = ""; }; 51A16995235E10D600EB091F /* AboutViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AboutViewController.swift; sourceTree = ""; }; 51A16996235E10D700EB091F /* FeedbinAccountViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedbinAccountViewController.swift; sourceTree = ""; }; + 51A5769524AE617200078888 /* ArticleContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleContainerView.swift; sourceTree = ""; }; + 51A576BA24AE621800078888 /* ArticleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleModel.swift; sourceTree = ""; }; + 51A576BD24AE637400078888 /* ArticleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleView.swift; sourceTree = ""; }; 51A66684238075AE00CB272D /* AddWebFeedDefaultContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddWebFeedDefaultContainer.swift; sourceTree = ""; }; 51A9A5E32380C8870033AADF /* ShareFolderPickerAccountCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ShareFolderPickerAccountCell.xib; sourceTree = ""; }; 51A9A5E52380C8B20033AADF /* ShareFolderPickerFolderCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ShareFolderPickerFolderCell.xib; sourceTree = ""; }; @@ -2671,6 +2680,16 @@ path = Activity; sourceTree = ""; }; + 51A576B924AE617B00078888 /* Article */ = { + isa = PBXGroup; + children = ( + 51A5769524AE617200078888 /* ArticleContainerView.swift */, + 51A576BA24AE621800078888 /* ArticleModel.swift */, + 51A576BD24AE637400078888 /* ArticleView.swift */, + ); + path = Article; + sourceTree = ""; + }; 51B5C85A23F22A7A00032075 /* CommonExtension */ = { isa = PBXGroup; children = ( @@ -2729,6 +2748,7 @@ 51E499D724A912C200B667CB /* SceneModel.swift */, 51E49A0224A91FF600B667CB /* SceneNavigationView.swift */, 51C0513824A77DF800194D5E /* Assets.xcassets */, + 51A576B924AE617B00078888 /* Article */, 51919FB124AAB95300541E64 /* Images */, 514E6BFD24AD252400AC6F6E /* Previews */, 51E499FB24A9135A00B667CB /* Sidebar */, @@ -4787,11 +4807,13 @@ 51E4995424A8734D00B667CB /* ExtensionPointIdentifer.swift in Sources */, 51E4996924A8760C00B667CB /* ArticleStylesManager.swift in Sources */, 51E498F324A8085D00B667CB /* PseudoFeed.swift in Sources */, + 51A5769624AE617200078888 /* ArticleContainerView.swift in Sources */, 51E4996B24A8762D00B667CB /* ArticleExtractor.swift in Sources */, 51E49A0324A91FF600B667CB /* SceneNavigationView.swift in Sources */, 51E4990124A808BB00B667CB /* FaviconURLFinder.swift in Sources */, 51E4991D24A8092100B667CB /* NSAttributedString+NetNewsWire.swift in Sources */, 51E499FD24A9137600B667CB /* SidebarModel.swift in Sources */, + 51A576BE24AE637400078888 /* ArticleView.swift in Sources */, 51E4995324A8734D00B667CB /* RedditFeedProvider-Extensions.swift in Sources */, 172199C924AB228900A31D04 /* SettingsView.swift in Sources */, 51E4994224A8713C00B667CB /* ArticleStatusSyncTimer.swift in Sources */, @@ -4816,6 +4838,7 @@ 51E4991324A808FB00B667CB /* AddWebFeedDefaultContainer.swift in Sources */, 51E4993C24A8709900B667CB /* AppDelegate.swift in Sources */, 51E498F924A8085D00B667CB /* SmartFeed.swift in Sources */, + 51A576BB24AE621800078888 /* ArticleModel.swift in Sources */, 51E4995124A8734D00B667CB /* ExtensionPointManager.swift in Sources */, 51E4990C24A808C500B667CB /* AuthorAvatarDownloader.swift in Sources */, 51E4992124A8095000B667CB /* RSImage-Extensions.swift in Sources */, @@ -4888,6 +4911,7 @@ 51919FB424AAB97900541E64 /* FeedIconImageLoader.swift in Sources */, 51E4994A24A8734C00B667CB /* ExtensionPointManager.swift in Sources */, 514E6C0324AD29A300AC6F6E /* TimelineItemStatusView.swift in Sources */, + 51A576BC24AE621800078888 /* ArticleModel.swift in Sources */, 51E4996D24A8762D00B667CB /* ArticleExtractor.swift in Sources */, 51E4994024A8713B00B667CB /* AccountRefreshTimer.swift in Sources */, 51E49A0424A91FF600B667CB /* SceneNavigationView.swift in Sources */, @@ -4906,6 +4930,7 @@ 51E4996E24A8764C00B667CB /* ActivityManager.swift in Sources */, 51E4995A24A873F900B667CB /* ErrorHandler.swift in Sources */, 51E4991F24A8094300B667CB /* RSImage-AppIcons.swift in Sources */, + 51A5769724AE617200078888 /* ArticleContainerView.swift in Sources */, 51E4991224A808FB00B667CB /* AddWebFeedDefaultContainer.swift in Sources */, 51E4993E24A870F900B667CB /* UserNotificationManager.swift in Sources */, 51E4992E24A8676300B667CB /* FetchRequestQueue.swift in Sources */, @@ -4929,6 +4954,7 @@ 51E4992D24A8676300B667CB /* FetchRequestOperation.swift in Sources */, 51E4992424A8098400B667CB /* SmartFeedPasteboardWriter.swift in Sources */, 51E4991424A808FF00B667CB /* ArticleStringFormatter.swift in Sources */, + 51A576BF24AE637400078888 /* ArticleView.swift in Sources */, 51E4991024A808DE00B667CB /* SmallIconProvider.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0;