Skip to content

Commit

Permalink
Merge pull request #44 from levibostian/old-style-teller
Browse files Browse the repository at this point in the history
Changes to the API. Thread safety and bug fixes.
  • Loading branch information
levibostian authored Feb 3, 2019
2 parents 93838cc + f0a65d8 commit 4188262
Show file tree
Hide file tree
Showing 70 changed files with 4,269 additions and 1,394 deletions.
41 changes: 41 additions & 0 deletions .overcommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Use this file to configure the Overcommit hooks you wish to use. This will
# extend the default configuration defined in:
# https://github.com/brigade/overcommit/blob/master/config/default.yml
#
# At the topmost level of this YAML file is a key representing type of hook
# being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
# customize each hook, such as whether to only run it on certain files (via
# `include`), whether to only display output if it fails (via `quiet`), etc.
#
# For a complete list of hooks, see:
# https://github.com/brigade/overcommit/tree/master/lib/overcommit/hook
#
# For a complete list of options that you can use to customize hooks, see:
# https://github.com/brigade/overcommit#configuration
#
# Uncomment the following lines to make the configuration take effect.

#PreCommit:
# RuboCop:
# enabled: true
# on_warn: fail # Treat all warnings as failures
#
# TrailingWhitespace:
# enabled: true
# exclude:
# - '**/db/structure.sql' # Ignore trailing whitespace in generated files
#
#PostCheckout:
# ALL: # Special hook name that customizes all hooks of this type
# quiet: true # Change all post-checkout hooks to only display output on failure
#
# IndexTags:
# enabled: true # Generate a tags file with `ctags` each time HEAD changes

PrePush:
TellerTests:
description: "Running tests"
quiet: false
enabled: true
command: ['ruby', 'bin/run_unit_tests.rb']

1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.5.3
34 changes: 20 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# references:
# * https://www.objc.io/issues/6-build-tools/travis-ci/
# * https://github.com/supermarin/xcpretty#usage

osx_image: xcode7.3
language: objective-c
# cache: cocoapods
# podfile: Example/Podfile
# before_install:
# - gem install cocoapods # Since Travis is not always on latest version
# - pod install --project-directory=Example
script:
- set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/Teller.xcworkspace -scheme Teller-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty
- pod lib lint
os: osx
osx_image: xcode10.1
language: swift
before_install:
- gem install cocoapods --pre # update cocoapods to newest version.
install:
- bundle install
- cd Teller/Example; bundle exec pod check || (bundle exec pod install --repo-update) # use () to group commands together to run if `pod check` returns false
cache:
directories:
- $HOME/.rvm/gems
- $HOME/.cocoapods
jobs:
include:
- stage: pull-request
script: ruby bin/run_unit_tests.rb

stages:
- name: pull-request
if: type IN (pull_request)
32 changes: 31 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
## [0.2.0-alpha] - 2-3-2019

Changes to the API. Thread safety and bug fixes.

### Changed
- **Breaking Change** `OnlineRepository`'s `sync()` has been renamed to `refresh()`.
- **Breaking Change** `OnlineDataState.FetchingFreshDataState` has been renamed to `OnlineDataState.NoCacheState`.
- **Breaking Change** A few of the properties in `OnlineDataState` have been renamed. Even though it's best practice to use `OnlineDatatState.___State` to parse it, you can access the properties manually if you wish.
- **Breaking Change** `OnlineRepositoryDataSource.observeCachedData()` and `OnlineRepositoryDataSource.isDataEmpty()` gets called on UI thread. `OnlineRepositoryDataSource.saveData()` gets called on background thread. https://github.com/levibostian/Teller-iOS/issues/28
- `OnlineRepository.observe()` and `LocalRepository.observe()` no longer `throws`. Observe anytime you wish and receive event updates through all changes of the repository.
- `OnlineRepository.refresh()` calls are shared in the same `OnlineRepository` instance. This saves on the amount of network calls performed. `OnlineRepository.observe()` observers are all notified when `OnlineRepository.refresh()` actions are performed. https://github.com/levibostian/Teller-iOS/issues/24
- `OnlineRepository` is thread safe.

### Added
- `OnlineRepository` now supports observing 2+ queries, as long as it's the same type of data. https://github.com/levibostian/Teller-iOS/issues/38
- Delete Teller data for development purposes or when someone logs out of your app and the data is cleared. https://github.com/levibostian/Teller-iOS/issues/19

# Contributors changelog

### Changed
- `OnlineDataState` has been refactored to using a finite state machine implementation. See `OnlineDataStateStateMachine`. It's a immutable object that represents an immutable `OnlineDataState` instance.
- Fetching fresh cache data and the state of the cache data have been decoupled in `OnlineDataState`. Each of these 2 different states (fetching and cache) are updated independently from each other in the `OnlineRepository` so decoupling them fixes bugs that have been reported.

### Fixed
- Fixed memory leak's in the Rx observables inside of `LocalRepository` and `OnlineRepository`. This also fixes the repositories being able to `deinit` now which results in the internal observables being disposed (the intended behavior).
- Fixed https://github.com/levibostian/Teller-iOS/issues/20
- Fixed https://github.com/levibostian/Teller-iOS/issues/41
- Fixed https://github.com/levibostian/Teller-iOS/issues/32
- Fixed https://github.com/levibostian/Teller-iOS/issues/29

## [0.1.0-alpha] - 2018-10-04

First release of Teller!
Expand All @@ -6,4 +36,4 @@ First release of Teller!
- `LocalRepository` for saving and querying locally cached data.
- `OnlineRepository` for saving, querying, and fetching remote data that is cached locally.
- Unit tests for all parts of the library.
- README.md documentation on status of project and how to use it.
- README.md documentation on status of project and how to use it.
4 changes: 2 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PODS:
- RxSwift (4.2.0)
- RxTest (4.3.0):
- RxSwift (~> 4.0)
- Teller (0.1.0):
- Teller (0.1.0-alpha):
- RxSwift (~> 4.0)

DEPENDENCIES:
Expand Down Expand Up @@ -46,7 +46,7 @@ SPEC CHECKSUMS:
RxCocoa: 78763c7b07d02455598d9fc3c1ad091a28b73635
RxSwift: 99e10317ddfcc7fbe01356aafd118fde4a0be104
RxTest: 831444848ac3c5efdd7d80ff5dc4b50ba08877a9
Teller: 0d23a75e793e3e192d7b236a91b659672e799e93
Teller: 38793db6d82e18eb291c33c312f6af8812657101

PODFILE CHECKSUM: 9c8b91a084bd21c7084bebc2191ace7a87dc3674

Expand Down
5 changes: 3 additions & 2 deletions Example/Pods/Local Podspecs/Teller.podspec.json

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

4 changes: 2 additions & 2 deletions Example/Pods/Manifest.lock

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

Loading

0 comments on commit 4188262

Please sign in to comment.