Skip to content

Commit

Permalink
refactor: rename class
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir committed Jan 15, 2024
1 parent 370d2c7 commit 8d28140
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 16 deletions.
8 changes: 4 additions & 4 deletions Discovery/Discovery.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
E0B9F6A42B4D59E000168366 /* CourseDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0B9F6A32B4D59E000168366 /* CourseDetails.swift */; };
E0B9F6A62B4D620100168366 /* Data_CourseDetailsResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0B9F6A52B4D620100168366 /* Data_CourseDetailsResponse.swift */; };
E0B9F6AB2B4E718F00168366 /* CourseDetailsViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0B9F6AA2B4E718F00168366 /* CourseDetailsViewModelTests.swift */; };
E0D586202B300095009B4BA7 /* DiscoverWebviewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0D5861E2B300095009B4BA7 /* DiscoverWebviewModel.swift */; };
E0D586202B300095009B4BA7 /* DiscoveryWebviewViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0D5861E2B300095009B4BA7 /* DiscoveryWebviewViewModel.swift */; };
E0D586212B300095009B4BA7 /* DiscoveryWebview.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0D5861F2B300095009B4BA7 /* DiscoveryWebview.swift */; };
E0D586232B3000AD009B4BA7 /* DiscoveryURIDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0D586222B3000AD009B4BA7 /* DiscoveryURIDetails.swift */; };
E0D586252B300134009B4BA7 /* URL+PathExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0D586242B300134009B4BA7 /* URL+PathExtension.swift */; };
Expand Down Expand Up @@ -102,7 +102,7 @@
E0B9F6A52B4D620100168366 /* Data_CourseDetailsResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Data_CourseDetailsResponse.swift; sourceTree = "<group>"; };
E0B9F6AA2B4E718F00168366 /* CourseDetailsViewModelTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CourseDetailsViewModelTests.swift; sourceTree = "<group>"; };
E0D586132B29F25A009B4BA7 /* Authorization.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Authorization.framework; sourceTree = BUILT_PRODUCTS_DIR; };
E0D5861E2B300095009B4BA7 /* DiscoverWebviewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DiscoverWebviewModel.swift; sourceTree = "<group>"; };
E0D5861E2B300095009B4BA7 /* DiscoveryWebviewViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DiscoveryWebviewViewModel.swift; sourceTree = "<group>"; };
E0D5861F2B300095009B4BA7 /* DiscoveryWebview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DiscoveryWebview.swift; sourceTree = "<group>"; };
E0D586222B3000AD009B4BA7 /* DiscoveryURIDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiscoveryURIDetails.swift; sourceTree = "<group>"; };
E0D586242B300134009B4BA7 /* URL+PathExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+PathExtension.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -315,7 +315,7 @@
E0D5861D2B300095009B4BA7 /* WebDiscovery */ = {
isa = PBXGroup;
children = (
E0D5861E2B300095009B4BA7 /* DiscoverWebviewModel.swift */,
E0D5861E2B300095009B4BA7 /* DiscoveryWebviewViewModel.swift */,
E0D5861F2B300095009B4BA7 /* DiscoveryWebview.swift */,
E0D586222B3000AD009B4BA7 /* DiscoveryURIDetails.swift */,
E0D586242B300134009B4BA7 /* URL+PathExtension.swift */,
Expand Down Expand Up @@ -553,7 +553,7 @@
029242EB2AE6AB7B00A940EC /* UpdateNotificationView.swift in Sources */,
02EF39DC28D86BEF0058F6BD /* Strings.swift in Sources */,
E0B9F69C2B4D57F800168366 /* SearchView.swift in Sources */,
E0D586202B300095009B4BA7 /* DiscoverWebviewModel.swift in Sources */,
E0D586202B300095009B4BA7 /* DiscoveryWebviewViewModel.swift in Sources */,
02F1752F2A4DA3B60019CD70 /* DiscoveryAnalytics.swift in Sources */,
E0D586212B300095009B4BA7 /* DiscoveryWebview.swift in Sources */,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public struct DiscoveryWebview: View {
@State private var searchQuery: String = ""
@State private var isLoading: Bool = true

@ObservedObject private var viewModel: DiscoveryWebviewModel
@ObservedObject private var viewModel: DiscoveryWebviewViewModel
private var router: DiscoveryRouter
private var discoveryType: DiscoveryWebviewType
private var pathID: String
Expand Down Expand Up @@ -64,7 +64,7 @@ public struct DiscoveryWebview: View {
}

public init(
viewModel: DiscoveryWebviewModel,
viewModel: DiscoveryWebviewViewModel,
router: DiscoveryRouter,
searchQuery: String? = nil,
discoveryType: DiscoveryWebviewType = .discovery,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
//
// DiscoverWebviewModel.swift
// DiscoveryWebviewViewModel.swift
// Discovery
//
// Created by SaeedBashir on 12/16/23.
//

import Foundation
import Core
import WebKit
import SwiftUI
import Swinject

public class DiscoveryWebviewModel: ObservableObject {
public class DiscoveryWebviewViewModel: ObservableObject {
@Published var courseDetails: CourseDetails?
@Published private(set) var showProgress = false
@Published var showError: Bool = false
Expand Down Expand Up @@ -111,7 +109,7 @@ public class DiscoveryWebviewModel: ObservableObject {
}
}

extension DiscoveryWebviewModel: WebViewNavigationDelegate {
extension DiscoveryWebviewViewModel: WebViewNavigationDelegate {
public func webView(
_ webView: WKWebView,
shouldLoad request: URLRequest,
Expand Down
4 changes: 2 additions & 2 deletions OpenEdX/DI/ScreenAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ class ScreenAssembly: Assembly {
)
}

container.register(DiscoveryWebviewModel.self) { r, sourceScreen in
DiscoveryWebviewModel(
container.register(DiscoveryWebviewViewModel.self) { r, sourceScreen in
DiscoveryWebviewViewModel(
router: r.resolve(DiscoveryRouter.self)!,
config: r.resolve(ConfigProtocol.self)!,
interactor: r.resolve(DiscoveryInteractorProtocol.self)!,
Expand Down
4 changes: 2 additions & 2 deletions OpenEdX/Router.swift
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public class Router: AuthorizationRouter,
) {
let view = DiscoveryWebview(
viewModel: Container.shared.resolve(
DiscoveryWebviewModel.self,
DiscoveryWebviewViewModel.self,
argument: sourceScreen)!,
router: Container.shared.resolve(DiscoveryRouter.self)!,
discoveryType: discoveryType,
Expand Down Expand Up @@ -252,7 +252,7 @@ public class Router: AuthorizationRouter,
} else if config?.discovery.type == .webview {
let view = DiscoveryWebview(
viewModel: Container.shared.resolve(
DiscoveryWebviewModel.self,
DiscoveryWebviewViewModel.self,
argument: sourceScreen
)!,
router: Container.shared.resolve(DiscoveryRouter.self)!,
Expand Down
2 changes: 1 addition & 1 deletion OpenEdX/View/MainScreenView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct MainScreenView: View {
} else if config?.discovery.type == .webview {
DiscoveryWebview(
viewModel: Container.shared.resolve(
DiscoveryWebviewModel.self,
DiscoveryWebviewViewModel.self,
argument: viewModel.sourceScreen)!,
router: Container.shared.resolve(DiscoveryRouter.self)!
)
Expand Down

0 comments on commit 8d28140

Please sign in to comment.