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

Implement network-layer package #1

Merged
merged 26 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c009a95
Generate an initial project structure
ns-vasilev Oct 20, 2023
78755ce
Create `RequestProcessor` & `DataRequestHandler`
ns-vasilev Nov 1, 2023
8bcf0e0
Add `HTTPMethod` & `Response` models
ns-vasilev Nov 7, 2023
a5e93f3
Implement a retry policy
ns-vasilev Nov 13, 2023
7a28851
Wrap a property using `@Atomic` property wrapper
ns-vasilev Nov 13, 2023
c94cbd6
Add code comments to all public interfaces
ns-vasilev Nov 13, 2023
e296b96
Implement the methods of the `URLSessionDataDelegate` & `URLSessionTa…
ns-vasilev Nov 14, 2023
2fd716a
Refactor method arguments
ns-vasilev Nov 14, 2023
c8c6ab3
Implement `RequestProcessorDelegate`
ns-vasilev Nov 15, 2023
9f7218b
Implement `AuthenticatorInterceptor`
ns-vasilev Nov 18, 2023
bafb5d7
Implement authentication logic
ns-vasilev Nov 19, 2023
e98a648
Implement `RequestBuilder`
ns-vasilev Nov 20, 2023
2ca026e
Implement `UnitTests`
ns-vasilev Nov 20, 2023
a4e64d8
Add comments
ns-vasilev Nov 20, 2023
948ee38
Return a `Response<T>` object instead of `<T>`
ns-vasilev Nov 20, 2023
86d8aa0
Integrate `CodeCov`
ns-vasilev Nov 20, 2023
dc625ec
Implement tests
ns-vasilev Nov 30, 2023
91c3b8f
Update `README.md`
ns-vasilev Nov 30, 2023
4eff40d
Change scheme name
ns-vasilev Nov 30, 2023
adf3317
Update `Package.swift`
ns-vasilev Dec 1, 2023
eddfbfb
Update `schemes`
ns-vasilev Dec 1, 2023
102b484
Update `xcscheme`
ns-vasilev Dec 1, 2023
aad6553
Implement documentation
ns-vasilev Dec 4, 2023
d6133ec
Update `README.md`
ns-vasilev Dec 4, 2023
3db2559
Update `CHANGELOG.md`
ns-vasilev Dec 4, 2023
f4d9370
Add a `Dependencies` section to `README.md`
ns-vasilev Dec 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: "🐛 Bug Report"
about: Report a reproducible bug or regression.
title: 'Bug: '
labels: 'bug'

---

<!--
Please provide a clear and concise description of what the bug is. Include
screenshots if needed. Please test using the latest version of the relevant
React packages to make sure your issue has not already been fixed.
-->

Application version:

## Steps To Reproduce

1.
2.

<!--
Your bug will get fixed much faster if we can run your code and it doesn't
have dependencies other than React. Issues without reproduction steps or
code examples may be immediately closed as not actionable.
-->

Link to code example:

<!--
Please provide a CodeSandbox (https://codesandbox.io/s/new), a link to a
repository on GitHub, or provide a minimal code example that reproduces the
problem. You may provide a screenshot of the application if you think it is
relevant to your bug report. Here are some tips for providing a minimal
example: https://stackoverflow.com/help/mcve.
-->

## The current behavior


## The expected behavior
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: 🛠 Feature request
about: If you have a feature request for the network-layer, file it here.
labels: 'type: enhancement'
---

**Feature description**
Clearly and concisely describe the feature.

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/bug_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Bug description
Clearly and concisely describe the problem.

## Solution description
Describe your code changes in detail for reviewers. Explain the technical solution you have provided and how it fixes the issue case.

## Covered unit test cases
- [x] yes
- [x] no
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/feature_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Feature description
Clearly and concisely describe the feature.

## Solution description
Describe your code changes in detail for reviewers.

## Areas affected and ensured
List out the areas affected by your code changes.

## Covered unit test cases
- [x] yes
- [x] no
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: network-layer

on:
push:
branches:
- main
- dev
pull_request:
paths:
- '.swiftlint.yml'
- ".github/workflows/**"
- "Package.swift"
- "Source/**"
- "Tests/**"
jobs:
SwiftLint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: GitHub Action for SwiftLint
uses: norio-nomura/action-swiftlint@3.2.1
with:
args: --strict
env:
DIFF_BASE: ${{ github.base_ref }}
Latest:
name: Test Latest (iOS, macOS, tvOS, watchOS)
runs-on: macOS-12
env:
DEVELOPER_DIR: "/Applications/Xcode_14.1.app/Contents/Developer"
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- destination: "OS=16.1,name=iPhone 14 Pro"
name: "iOS"
scheme: "NetworkLayer"
sdk: iphonesimulator
- destination: "OS=16.1,name=Apple TV"
name: "tvOS"
scheme: "NetworkLayer"
sdk: appletvsimulator
- destination: "OS=9.1,name=Apple Watch Series 8 (45mm)"
name: "watchOS"
scheme: "NetworkLayer"
sdk: watchsimulator
- destination: "platform=macOS"
name: "macOS"
scheme: "NetworkLayer"
sdk: macosx
steps:
- uses: actions/checkout@v3
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "./${{ matrix.sdk }}.xcresult"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: "./${{ matrix.sdk }}.xcresult"

31 changes: 31 additions & 0 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Danger

on:
pull_request:
types: [synchronize, opened, reopened, labeled, unlabeled, edited]

env:
LC_CTYPE: en_US.UTF-8
LANG: en_US.UTF-8

jobs:
run-danger:
runs-on: ubuntu-latest
steps:
- name: ruby setup
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: Checkout code
uses: actions/checkout@v2
- name: Setup gems
run: |
gem install bundler
bundle install --clean --path vendor/bundle
- name: danger
env:

DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}

run: bundle exec danger --verbose
95 changes: 7 additions & 88 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,90 +1,9 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
.DS_Store
/.build
/Packages
/*.xcodeproj
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/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

## Obj-C/Swift specific
*.hmap

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

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# 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

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build/

# Accio dependency management
Dependencies/
.accio/

# 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/screenshots/**/*.png
fastlane/test_output

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

iOSInjectionProject/
.swiftpm/config/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
64 changes: 64 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Stream rules

--swiftversion 5.3

# Use 'swiftformat --options' to list all of the possible options

--header "\nnetwork-layer\nCopyright © {created.year} Space Code. All rights reserved.\n//"

--enable blankLinesBetweenScopes
--enable blankLinesAtStartOfScope
--enable blankLinesAtEndOfScope
--enable blankLinesAroundMark
--enable anyObjectProtocol
--enable consecutiveBlankLines
--enable consecutiveSpaces
--enable duplicateImports
--enable elseOnSameLine
--enable emptyBraces
--enable initCoderUnavailable
--enable leadingDelimiters
--enable numberFormatting
--enable preferKeyPath
--enable redundantBreak
--enable redundantExtensionACL
--enable redundantFileprivate
--enable redundantGet
--enable redundantInit
--enable redundantLet
--enable redundantLetError
--enable redundantNilInit
--enable redundantObjc
--enable redundantParens
--enable redundantPattern
--enable redundantRawValues
--enable redundantReturn
--enable redundantSelf
--enable redundantVoidReturnType
--enable semicolons
--enable sortImports
--enable sortSwitchCases
--enable spaceAroundBraces
--enable spaceAroundBrackets
--enable spaceAroundComments
--enable spaceAroundGenerics
--enable spaceAroundOperators
--enable spaceInsideBraces
--enable spaceInsideBrackets
--enable spaceInsideComments
--enable spaceInsideGenerics
--enable spaceInsideParens
--enable strongOutlets
--enable strongifiedSelf
--enable todos
--enable trailingClosures
--enable unusedArguments
--enable void
--enable markTypes
--enable isEmpty

# format options

--wraparguments before-first
--wrapcollections before-first
--maxwidth 140
Loading
Loading