Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
cmtripian committed Oct 5, 2024
0 parents commit 2c93677
Show file tree
Hide file tree
Showing 195 changed files with 11,778 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
build/
Carthage/
/.DS_Store
.DS_Store

TRPDataLayer.xcodeproj/xcuserdata/cemcaygoz.xcuserdatad/xcschemes/xcschememanagement.plist
xcuserdata/
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# git "file:///Users/evrenyasar/Xcode/ModularIOS/TRPRestKit" "api_v3"
git "https://github.com/Tripian-inc/TRPRestKit" "api_v3"
git "https://github.com/Tripian-inc/TRPFoundationKit" "master"
2 changes: 2 additions & 0 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github "Tripian-inc/TRPFoundationKit" "da5b4ecd4b958df1d4c2a3b6fbc357d37eb1e338"
github "Tripian-inc/TRPRestKit" "e0f19eb60172642c326e32d0f107a2c98353e167"
24 changes: 24 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "TRPDataLayer",
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "TRPDataLayer",
targets: ["TRPDataLayer"]),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "TRPDataLayer"),
.testTarget(
name: "TRPDataLayerTests",
dependencies: ["TRPDataLayer"]
),
]
)
2 changes: 2 additions & 0 deletions Sources/TRPDataLayer/TRPDataLayer.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// The Swift Programming Language
// https://docs.swift.org/swift-book
1,946 changes: 1,946 additions & 0 deletions TRPDataLayer.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1340"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B25D35B524C4F0020015F66C"
BuildableName = "TRPDataLayer.framework"
BlueprintName = "TRPDataLayer"
ReferencedContainer = "container:TRPDataLayer.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B25D35BE24C4F0020015F66C"
BuildableName = "TRPDataLayerTests.xctest"
BlueprintName = "TRPDataLayerTests"
ReferencedContainer = "container:TRPDataLayer.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B25D35B524C4F0020015F66C"
BuildableName = "TRPDataLayer.framework"
BlueprintName = "TRPDataLayer"
ReferencedContainer = "container:TRPDataLayer.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
12 changes: 12 additions & 0 deletions TRPDataLayer/Common/Cancellable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// Cancellable.swift
// TRPDataLayer
//
// Created by Evren Yaşar on 20.07.2020.
// Copyright © 2020 Tripian Inc. All rights reserved.
//

import Foundation
public protocol Cancellable {
func cancel()
}
12 changes: 12 additions & 0 deletions TRPDataLayer/Common/ObserverController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// ObserverController.swift
// TRPDataLayer
//
// Created by Evren Yaşar on 28.07.2020.
// Copyright © 2020 Tripian Inc. All rights reserved.
//

import Foundation
public protocol ObserverController {
func remove()
}
13 changes: 13 additions & 0 deletions TRPDataLayer/Common/UseCase.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// UseCase.swift
// TRPDataLayer
//
// Created by Evren Yaşar on 20.07.2020.
// Copyright © 2020 Tripian Inc. All rights reserved.
//

import Foundation
public protocol UseCase {
@discardableResult
func start() -> Cancellable?
}
24 changes: 24 additions & 0 deletions TRPDataLayer/Data/CoreData/City/CityLocalStorage.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// CityLocalStorage.swift
// TRPDataLayer
//
// Created by Evren Yaşar on 29.07.2020.
// Copyright © 2020 Tripian Inc. All rights reserved.
//

import Foundation
import TRPRestKit
public protocol CityLocalStorage {
func fetchLocalCity(id: Int, completion: @escaping (CityResultValue) -> Void)
}

public class TRPCityLocalStorage: CityLocalStorage {

private(set) var file = FileIO.shared

public init() {}

public func fetchLocalCity(id: Int, completion: @escaping (CityResultValue) -> Void) {

}
}
9 changes: 9 additions & 0 deletions TRPDataLayer/Data/CoreData/City/TRPCityLocalStorage.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// TRPCityLocalStorage.swift
// TRPDataLayer
//
// Created by Evren Yaşar on 29.07.2020.
// Copyright © 2020 Tripian Inc. All rights reserved.
//

import Foundation
16 changes: 16 additions & 0 deletions TRPDataLayer/Data/CoreData/Companion/CompanionLocalStorage.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// CompanionLocalStorage.swift
// TRPDataLayer
//
// Created by Evren Yaşar on 4.08.2020.
// Copyright © 2020 Tripian Inc. All rights reserved.
//

import Foundation
public protocol CompanionLocalStorage {}

public class TRPCompanionLocalStorage: CompanionLocalStorage {

public init() {}

}
14 changes: 14 additions & 0 deletions TRPDataLayer/Data/CoreData/Favorite/FavoriteLocalStorage.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// FavoriteLocalStorage.swift
// TRPDataLayer
//
// Created by Evren Yaşar on 27.07.2020.
// Copyright © 2020 Tripian Inc. All rights reserved.
//

import Foundation
public protocol FavoriteLocalStorage {
func fetchLocalPoi(completion: @escaping (FavoriteResultsValue) -> Void)

func saveFavorites(cityId: String, data: [TRPFavorite])
}
35 changes: 35 additions & 0 deletions TRPDataLayer/Data/CoreData/Favorite/TRPFavoriteLocalStorage.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// TRPFavoriteLocalStorage.swift
// TRPDataLayer
//
// Created by Evren Yaşar on 27.07.2020.
// Copyright © 2020 Tripian Inc. All rights reserved.
//

import Foundation
import TRPRestKit
public class TRPFavoriteLocalStorage: FavoriteLocalStorage {

private(set) var file = FileIO.shared

public init() {}

public func fetchLocalPoi(completion: @escaping (FavoriteResultsValue) -> Void) {
do {
let city = CruiseDataHolderUseCase.shared.cityId ?? 0
let json = try file.read([TRPFavorite].self, "city_favorite_\(city)", false)
completion(.success(json))
}catch let error {
completion(.failure(error))
}
}

public func saveFavorites(cityId: String, data: [TRPFavorite]) {
do {
let fileName = "city_favorite_\(cityId)"
try file.write(data, fileName)
}catch let _error {
print("[ERROR] \(_error)")
}
}
}
34 changes: 34 additions & 0 deletions TRPDataLayer/Data/CoreData/Poi/PoiLocalStorage.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// PoiLocalStorage.swift
// TRPDataLayer
//
// Created by Evren Yaşar on 17.08.2020.
// Copyright © 2020 Tripian Inc. All rights reserved.
//

import Foundation
import TRPRestKit
public protocol PoiLocalStorage {
func fetchLocalPoi(completion: @escaping (PoiResultsValue) -> Void)
}

public class TRPPoiLocalStorage: PoiLocalStorage {
private(set) var file = FileIO.shared

public init() {}

public func fetchLocalPoi(completion: @escaping (PoiResultsValue) -> Void) {
do {
let city = CruiseDataHolderUseCase.shared.cityId ?? 0
//TODO: - CİTYID GELECEK
let json = try file.read(TRPGenericParser<[TRPPoiInfoModel]>.self, "city_\(city)", true)
if let result = json.data {
let converted = PoiMapper().map(result)
completion((.success(converted), nil))
}
}catch let error {
print("[Offline] \(error)")
completion((.failure(error), nil))
}
}
}
10 changes: 10 additions & 0 deletions TRPDataLayer/Data/CoreData/Questions/QuestionLocalStorage.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// QuestionLocalStorage.swift
// TRPDataLayer
//
// Created by Evren Yaşar on 30.07.2020.
// Copyright © 2020 Tripian Inc. All rights reserved.
//

import Foundation
public protocol QuestionLocalStorage {}
12 changes: 12 additions & 0 deletions TRPDataLayer/Data/CoreData/Questions/TRPQuestionLocalStorage.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// TRPQuestionLocalStorage.swift
// TRPDataLayer
//
// Created by Evren Yaşar on 30.07.2020.
// Copyright © 2020 Tripian Inc. All rights reserved.
//

import Foundation
public class TRPQuestionLocalStorage: QuestionLocalStorage {
public init() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// UserReservationLocalStorage.swift
// TRPDataLayer
//
// Created by Evren Yaşar on 25.08.2020.
// Copyright © 2020 Tripian Inc. All rights reserved.
//

import Foundation
public protocol UserReservationLocalStorage {}

public class TRPUserReservationLocalStorage: UserReservationLocalStorage {

public init() {}

}
Loading

0 comments on commit 2c93677

Please sign in to comment.