Skip to content

Commit

Permalink
Merge pull request #31 from BottleRocketStudios/feature/githubActions
Browse files Browse the repository at this point in the history
Feature/GitHub actions
  • Loading branch information
wmcginty committed Jan 11, 2022
2 parents cef1afa + fc41c0a commit 574cd3e
Show file tree
Hide file tree
Showing 11 changed files with 351 additions and 353 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Main

on:
push:
branches: [ main, release/*]
pull_request:

jobs:
Build:
runs-on: macos-11
env:
workspace: "SessionTools.xcworkspace"
strategy:
fail-fast: false
matrix:
name: ["iOS", "tvOS", "watchOS", "macOS"]
include:
- name: "iOS"
scheme: "SessionTools-iOS"
destination: "platform=iOS Simulator,OS=15.0,name=iPhone 12 Pro"
test: true
lint: true

- name: "tvOS"
scheme: "SessionTools-tvOS"
destination: "platform=tvOS Simulator,OS=15.0,name=Apple TV 4K"
test: false
lint: false

- name: "watchOS"
scheme: "SessionTools-watchOS"
destination: "platform=watchOS Simulator,OS=8.0,name=Apple Watch Series 6 - 44mm"
test: false
lint: false

- name: "macOS"
scheme: "SessionTools-macOS"
destination: "arch=x86_64"
test: false
lint: false

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache
uses: actions/cache@v1
id: dependency-cache
with:
path: Carthage
key: ${{ runner.os }}-dependencies-${{ hashFiles('**/Cartfile.resolved') }}

- name: Dependencies
if: steps.dependency-cache.outputs.cache-hit != 'true'
run: carthage bootstrap --use-xcframeworks --no-use-binaries --cache-builds --verbose

- name: Build and Test
run: >
if [[ ${{ matrix.test }} == true ]]; then
xcodebuild test \
-workspace ${{ env.workspace }} \
-scheme "${{ matrix.scheme }}" \
-destination "${{ matrix.destination }}" \
ONLY_ACTIVE_ARCH=NO -enableCodeCoverage YES || exit 1
else
xcodebuild \
-workspace ${{ env.workspace }} \
-scheme "${{ matrix.scheme }}" \
-destination "${{ matrix.destination }}" \
ONLY_ACTIVE_ARCH=NO || exit 1
fi
- name: Lint
run: >
if [[ ${{ matrix.lint }} == true ]]; then
pod lib lint
fi
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ DerivedData
.bundle

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

Carthage/Build

Expand Down
56 changes: 0 additions & 56 deletions .travis.yml

This file was deleted.

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>
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SessionTools

[![CI Status](http://img.shields.io/travis/BottleRocketStudios/iOS-SessionTools.svg?style=flat)](https://travis-ci.org/BottleRocketStudios/iOS-SessionTools)
![CI Status](https://github.com/BottleRocketStudios/iOS-SessionTools/actions/workflows/main.yml/badge.svg)
[![Version](https://img.shields.io/cocoapods/v/SessionTools.svg?style=flat)](http://cocoapods.org/pods/SessionTools)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![License](https://img.shields.io/cocoapods/l/SessionTools.svg?style=flat)](http://cocoapods.org/pods/SessionTools)
Expand Down Expand Up @@ -44,21 +44,21 @@ struct Model: Codable {

##### 2. Create a `KeychainContainerConfig` supplied with a `keychainName`.

The default container configuration uses an unmanaged keychain container. This means the framework will make no attempt to remove the session's data on your behalf and you will be responsible for removing this session's data by calling `Session.deleteItem()` when needed. Because of differences between OS versions, we cannot make any guarantees on how long the data will persist in the keychain beyond the current install. For more discussion, see [below.](#keychain-discussion)
The default container configuration uses an unmanaged keychain container. This means the framework will make no attempt to remove the session's data on your behalf and you will be responsible for removing this session's data by calling `Session.deleteItem()` when needed. Because of differences between OS versions, we cannot make any guarantees on how long the data will persist in the keychain beyond the current install. For more discussion, see [below.](#keychain-discussion)

``` swift
let config = KeychainContainerConfig(keychainName: "your.keychain.name")
```

If you only want the session's data to persist for the current installation, instantiate your `KeychainContainerConfig` with lifecycle `KeychainLifecycle.currentInstall()` and pass in an installation identifier. This identifier should remain stable for the current installation but change between installations.

This installation indentifier is prepended to the keychain name before running keychain operations. Because the identifier changes between installations the previous key will no longer match. You could theoretically still get that key back if you reuse a previous installation identifier, but because of differences between OS versions, we cannot make any guarantees on how long the data will persist in the keychain beyond the current install. For more discussion, see [below.](#keychain-discussion)
This installation indentifier is prepended to the keychain name before running keychain operations. Because the identifier changes between installations the previous key will no longer match. You could theoretically still get that key back if you reuse a previous installation identifier, but because of differences between OS versions, we cannot make any guarantees on how long the data will persist in the keychain beyond the current install. For more discussion, see [below.](#keychain-discussion)

``` swift
let managedConfig = KeychainContainerConfig(keychainName: "com.app.name", lifecycle: .currentInstall(identifier: installationIdentifier))
```

##### 3. Create a `KeychainStorageContainer` supplied with your `KeychainContainerConfig`.
##### 3. Create a `KeychainStorageContainer` supplied with your `KeychainContainerConfig`.
``` swift
let container = KeychainStorageContainer<Model>(config: config)
```
Expand All @@ -68,15 +68,15 @@ struct MyStorageContainer: SessionContainer {
func hasItem(forIdentifier identifier: String) -> Bool {
// ...
}

func item(forIdentifier identifier: String, jsonDecoder: JSONDecoder) throws -> Item? {
// ...
}

func removeItem(forIdentifier identifier: String) throws {
// ...
}

func storeItem(_ item: Item, forIdentifier identifier: String, jsonEncoder: JSONEncoder) throws {
// ...
}
Expand Down Expand Up @@ -154,7 +154,7 @@ Access the `userSessionState` property on the notification to easily get the sta
``` swift
@objc private func didUpdateUser(_ notification: Notification) {
guard let sessionState = notification.userSessionState else { return }

// Do something with the state
switch sessionState {
case .loggedIn:
Expand Down
Loading

0 comments on commit 574cd3e

Please sign in to comment.