Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/ Demo store #1

Merged
merged 86 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 83 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
44b34bb
Initial Commit
DenielGrin Jul 3, 2024
9211412
feat/ Initial commit
DenielGrin Jul 3, 2024
b35a330
feat: Add podfile, remove IDE creating comments
DenielGrin Jul 3, 2024
0171835
Merge branch 'master' of https://github.com/rees46/demo-ios into feat…
DenielGrin Jul 3, 2024
7c173ae
fix: Rename entry points classes and files
DenielGrin Jul 3, 2024
c04a6cc
feat: Add splash screen and separate files
DenielGrin Jul 3, 2024
d82ad95
feat: Add supporting colors and themes
DenielGrin Jul 3, 2024
1ecabee
feat: Add nav images & nav items with selecting
DenielGrin Jul 4, 2024
ab5c89e
feat: Add string resources
DenielGrin Jul 4, 2024
8a66118
feat: Add toolbar view and icons
DenielGrin Jul 4, 2024
10ca312
feat: Change status bar colors in main screens
DenielGrin Jul 4, 2024
ba1d56f
feat: Add strings
DenielGrin Jul 4, 2024
24f8c95
feat: Add Rees sdk initialization
DenielGrin Jul 5, 2024
8a6da4d
feat: Add icon app
DenielGrin Jul 5, 2024
295e18b
feat: Add settings screen UI
DenielGrin Jul 5, 2024
8f76cb3
feat: Add NavigationManager.swift, SettingsScreenView.swift, changing…
DenielGrin Jul 5, 2024
beb14f3
feat: Handling visibility toolbar block
DenielGrin Jul 5, 2024
912aec4
feat: Add discover list
DenielGrin Jul 8, 2024
e8209a3
feat: Add discover and stories views
DenielGrin Jul 9, 2024
ea0073b
feat: Add stories representable for showing stories
DenielGrin Jul 9, 2024
70b1d1f
feat: Change stories code
DenielGrin Jul 9, 2024
754d34c
feat: Add reusable header
DenielGrin Jul 9, 2024
58e62a3
feat: Add getting recommendation items and models
DenielGrin Jul 9, 2024
d2fe698
feat: Add getting recommendation viewing items
DenielGrin Jul 9, 2024
c26854c
fix: Fix bug with selecting tab from another views
DenielGrin Jul 9, 2024
c46ae93
feat: Add reusable products list
DenielGrin Jul 10, 2024
8c2790e
feat: Add grid and discover moko data, reusable toolbar and list items
DenielGrin Jul 10, 2024
ccf5b8d
feat: Change loading image
DenielGrin Jul 10, 2024
2e5afb7
feat: Rename packages
DenielGrin Jul 10, 2024
9aa2f0e
feat: Add catalog image points view
DenielGrin Jul 11, 2024
ad25830
feat: Add rating and reviews
DenielGrin Jul 12, 2024
d8300a7
feat: Add price and discount
DenielGrin Jul 12, 2024
d61a560
feat: Add recommendation section in product details
DenielGrin Jul 12, 2024
b6488f5
feat: Add cart viewmodel
DenielGrin Jul 12, 2024
564debe
feat: Add cart repository
DenielGrin Jul 12, 2024
722ed61
feat: Add cart list items
DenielGrin Jul 13, 2024
2cdd209
feat: Add getting full price
DenielGrin Jul 13, 2024
0f4a0ff
feat: Add quantity and cart buttons for purchase handling
DenielGrin Jul 15, 2024
82395f9
feat: Add recommendation and empty states screen
DenielGrin Jul 15, 2024
e2ce8ae
feat: Add loading
DenielGrin Jul 15, 2024
9335cab
fix: Reformat code and change cart string key
DenielGrin Jul 15, 2024
a89cced
refactor: Rename home tab and add search view and search view model
DenielGrin Jul 16, 2024
2100ce9
feat: Add search screen with items and search history
DenielGrin Jul 16, 2024
cebdb1b
feat: Add detekting total count
DenielGrin Jul 16, 2024
5030d5d
feat: Add detekting total count
DenielGrin Jul 16, 2024
9b705e8
feat: Add clicking on search history and alignment progress view
DenielGrin Jul 16, 2024
41d1166
feat: Navigation to search result
DenielGrin Jul 16, 2024
00a208a
fix: Add logs only in debug flavor
DenielGrin Jul 16, 2024
52d29e0
feat: Add search result model and showing search result screen
DenielGrin Jul 16, 2024
552eebc
feat: Add frameworks like a modules
DenielGrin Jul 16, 2024
cd6c6da
feat: Add search result screen list, navigation and texts
DenielGrin Jul 16, 2024
2bd3301
feat: Add packages and move files to directories
DenielGrin Jul 18, 2024
37a26d3
refactor: Delete AppDelegate.swift, move models in data layer
DenielGrin Jul 18, 2024
d48ee5f
refactor: Remove unused testing packages and classes
DenielGrin Jul 18, 2024
32df8d0
refactor: Change injecting sdk manager
DenielGrin Jul 18, 2024
ef4c5d8
feat: Add home and cart resolvers
DenielGrin Jul 18, 2024
e548326
refactor: remove useless testing files and packages
DenielGrin Jul 19, 2024
471b3ee
feat: Add visitor protocol for navigation
DenielGrin Jul 19, 2024
a521b4b
feat: Separete data from bottom nav.view
DenielGrin Jul 19, 2024
70875bf
feat: Simplify navigation with overloaded `navigateTo` methods
DenielGrin Jul 21, 2024
cf4d4e7
feat: Add timer, navigation component, change set background in conte…
DenielGrin Jul 21, 2024
36001dd
feat: Add timer to others screens
DenielGrin Jul 21, 2024
970aa18
fix: Remove useless func
DenielGrin Jul 21, 2024
9bddc9c
refactor: Remove comments
DenielGrin Jul 21, 2024
bbcd377
refactor: The location of files in the project directory has been cha…
DenielGrin Jul 23, 2024
7c56c1a
refactor: Change data classes location and add func for initializing …
DenielGrin Jul 23, 2024
7ae3750
refactor: Add environments and move utils in package
DenielGrin Jul 23, 2024
ce88549
refactor: Move struct in package model
DenielGrin Jul 23, 2024
b18ade3
refactor: Add actual resolver, initialization view models,use cases a…
DenielGrin Jul 24, 2024
af49e86
chore: Add resolver in pods
DenielGrin Jul 24, 2024
534ebd7
chore: Add product blocks code in config variables
DenielGrin Jul 24, 2024
f27be8f
chore: Add localizable strings
DenielGrin Jul 24, 2024
4d008f2
chore(pods): Update sdk version
DenielGrin Jul 29, 2024
e9bf81d
feat(core): Revert sdk initialization classes and update sdk version
DenielGrin Jul 29, 2024
d112b9f
refactor(app): Add suffix for structs and protocols
DenielGrin Aug 2, 2024
270b971
refactor(app): Remove logs and hardcode products id
DenielGrin Aug 2, 2024
f6cf400
refactor(navigation): Optimized navigation to screens
DenielGrin Aug 2, 2024
b22aa29
refactor(home): Optimized loading recommendation products
DenielGrin Aug 2, 2024
71b62e0
refactor(core): Add colors and sizes structs
DenielGrin Aug 2, 2024
8519d1b
refactor(feature): Added generalized size values
DenielGrin Aug 5, 2024
cf58441
refactor(app): Add colors and sizes from constants
DenielGrin Aug 5, 2024
35291d5
refactor(app): Separate product view
DenielGrin Aug 5, 2024
dcd81d0
refactor(app): Separate cart view and cart items & add reusable sizes
DenielGrin Aug 5, 2024
e78dd61
refactor(app): Moved sizes, colors & typography in app module
DenielGrin Aug 7, 2024
9292243
refactor(app): Remove hardcode sizes from toolbar
DenielGrin Aug 7, 2024
f30e211
refactor(cart): Rename cart views and used sizes from constants
DenielGrin Aug 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
152 changes: 102 additions & 50 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,42 @@
# Created by https://www.gitignore.io/api/xcode,swift,macos,objective-c

### macOS ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Objective-C ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
## Build generated
build/
DerivedData/
*.moved-aside

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
Expand All @@ -21,15 +45,59 @@ DerivedData/
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint

## Obj-C/Swift specific
*.hmap

## App packaging
*.ipa
*.dSYM.zip
*.dSYM

# CocoaPods - Refactored to standalone file


# Carthage - Refactored to standalone file

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/test_output
fastlane/Match/
.env.default

# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

### Objective-C Patch ###

### Swift ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated

## Various settings

## Other

## Obj-C/Swift specific

## Playgrounds
timeline.xctimeline
playground.xcworkspace
Expand All @@ -39,52 +107,36 @@ playground.xcworkspace
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
# *.xcodeproj
#
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
# .swiftpm

.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace
# CocoaPods - Refactored to standalone file

# Carthage
# Carthage - Refactored to standalone file

### Xcode ###
# Xcode
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

Carthage/Build/
## Build generated

# Accio dependency management
Dependencies/
.accio/
## Various settings

# fastlane
#
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control
## Other

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output
### Xcode Patch ###
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcworkspace/contents.xcworkspacedata
*.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
/*.gcno
*.xcworkspacedata
*.xcuserdata

# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode
## Cocoapods ##
Pods/

iOSInjectionProject/
# End of https://www.gitignore.io/api/xcode,swift,macos,objective-c
/fastlane/fastlane/Appfile
/Gemfile.lock
6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

21 changes: 21 additions & 0 deletions App/DemoStoreApp.struct.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import SwiftUI

@main
struct DemoStoreApp: App {
@StateObject private var appState = AppState()

init() {
DependenciesInitialization.initialize()
}

var body: some Scene {
WindowGroup {
if appState.showSplash {
SplashScreenView()
.environmentObject(appState)
} else {
ContentView()
}
}
}
}
23 changes: 23 additions & 0 deletions App/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?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>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

<key>UIRequiresPersistentWiFi</key>
<false/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

</dict>

</plist>
10 changes: 10 additions & 0 deletions App/Models/RootScreenType.enum.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

import Foundation

enum RootScreenType {
case home
case products
case cart
case settings
case none
}
8 changes: 8 additions & 0 deletions App/Models/TabItem.struct.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import SwiftUI

struct TabItem: Identifiable {
let id = UUID()
let image: String
let screen: ScreenWrapper
let type: RootScreenType
}
7 changes: 7 additions & 0 deletions App/Models/ViewState.enum.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Foundation

enum ViewState {
case loading
case error(String)
case data
}
5 changes: 5 additions & 0 deletions App/Navigation/Protocols/ScreenTypeProviderProtocol.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

protocol ScreenTypeProvider {
static var screenType: RootScreenType { get }
}
6 changes: 6 additions & 0 deletions App/Preview Content/Preview Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
5 changes: 5 additions & 0 deletions App/ViewModels/AppState.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import SwiftUI

class AppState: ObservableObject {
@Published var showSplash: Bool = true
}
60 changes: 60 additions & 0 deletions App/ViewModels/NavigationManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import SwiftUI

class NavigationManager: ObservableObject {

@Published var currentScreen: ScreenWrapper
@Published var isToolbarHidden: Bool = false
@Published var isBottomBarHidden: Bool = false
@Published var currentRootScreenType: RootScreenType = .home
@Published var selectedTab: RootScreenType? = .home

private var screenHistory: [ScreenWrapper] = []

private let rootScreenInitializers: [RootScreenType: () -> AnyView] = [
.home: { AnyView(HomeScreenView()) },
.products: { AnyView(ProductsScreenView()) },
.cart: { AnyView(CartScreenView()) },
.settings: { AnyView(SettingsScreenView()) }
]

init(initialScreen: ScreenWrapper) {
self.currentScreen = initialScreen
self.setStartDestinationScreen(initialScreen: initialScreen)
}

private func setStartDestinationScreen(initialScreen: ScreenWrapper) {
self.currentScreen = initialScreen
self.currentRootScreenType = initialScreen.type ?? .home
self.screenHistory.append(self.currentScreen)
}

func navigateToRootScreen(screen: ScreenWrapper, selectedTab: RootScreenType? = .home) {
self.currentScreen = screen
self.selectedTab = selectedTab
self.screenHistory.append(screen)
self.currentRootScreenType = screen.type ?? .home
}

func navigateBack() {
if screenHistory.count > 1 {
screenHistory.removeLast()
if let previousScreen = screenHistory.last {
self.currentScreen = previousScreen
}
}
}

func navigateToScreen(_ view: any View) {
let secondaryScreen = ScreenWrapper(
screen: AnyView(view),
type: nil
)
self.currentScreen = secondaryScreen
self.screenHistory.append(secondaryScreen)
}

func setVisibility(hideToolbar: Bool, hideBottomBar: Bool) {
self.isToolbarHidden = hideToolbar
self.isBottomBarHidden = hideBottomBar
}
}
31 changes: 31 additions & 0 deletions App/Views/BottomBar/BottomBarView.struct.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import SwiftUI

struct BottomBarView: View {

@EnvironmentObject var navigationManager: NavigationManager

private let tabs: [TabItem] = [
TabItem(image: "MainTab", screen: ScreenWrapper(screen: HomeScreenView()), type: .home),
TabItem(image: "CatalogTab", screen: ScreenWrapper(screen: ProductsScreenView()), type: .products),
TabItem(image: "CartTab", screen: ScreenWrapper(screen: CartScreenView()), type: .cart),
TabItem(image: "SettingsTab", screen: ScreenWrapper(screen: SettingsScreenView()), type: .settings)
]

var body: some View {
VStack {
Spacer()
if !navigationManager.isBottomBarHidden {
HStack(spacing: 0) {
ForEach(tabs) { tab in
TabBarButton(image: tab.image, isSelected: navigationManager.selectedTab == tab.type)
.onTapGesture {
navigationManager.selectedTab = tab.type
navigationManager.navigateToRootScreen(screen: tab.screen, selectedTab: tab.type)
}
.frame(maxWidth: .infinity)
}
}
}
}
}
}
Loading