Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

Commit

Permalink
Start implementing device linking UI
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsandriesse committed Sep 20, 2019
1 parent 9784419 commit 1e949da
Show file tree
Hide file tree
Showing 59 changed files with 13,860 additions and 9,049 deletions.
8 changes: 7 additions & 1 deletion Manifest.lock
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ PODS:
- Mantle/extobjc (= 2.1.0)
- Mantle/extobjc (2.1.0)
- Mixpanel (3.4.7)
- NVActivityIndicatorView (4.7.0):
- NVActivityIndicatorView/Presenter (= 4.7.0)
- NVActivityIndicatorView/Presenter (4.7.0)
- PromiseKit (6.5.3):
- PromiseKit/CorePromise (= 6.5.3)
- PromiseKit/Foundation (= 6.5.3)
Expand Down Expand Up @@ -220,6 +223,7 @@ DEPENDENCIES:
- IGIdenticon
- Mantle (from `https://github.com/signalapp/Mantle`, branch `signal-master`)
- Mixpanel (~> 3.4)
- NVActivityIndicatorView (~> 4.7)
- PromiseKit (= 6.5.3)
- PureLayout
- Reachability
Expand Down Expand Up @@ -249,6 +253,7 @@ SPEC REPOS:
- IGIdenticon
- libPhoneNumber-iOS
- Mixpanel
- NVActivityIndicatorView
- PromiseKit
- PureLayout
- Reachability
Expand Down Expand Up @@ -331,6 +336,7 @@ SPEC CHECKSUMS:
libPhoneNumber-iOS: e444379ac18bbfbdefad571da735b2cd7e096caa
Mantle: 2fa750afa478cd625a94230fbf1c13462f29395b
Mixpanel: 696e0a1c7f2685aa06bb23829b7a58ab7203d6c7
NVActivityIndicatorView: b19ddab2576f805cbe0fb2306cba3476e09a1dea
PromiseKit: c609029bdd801f792551a504c695c7d3098b42cd
PureLayout: f08c01b8dec00bb14a1fefa3de4c7d9c265df85e
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
Expand All @@ -345,6 +351,6 @@ SPEC CHECKSUMS:
YapDatabase: b418a4baa6906e8028748938f9159807fd039af4
YYImage: 1e1b62a9997399593e4b9c4ecfbbabbf1d3f3b54

PODFILE CHECKSUM: 1240a47686acf0d2d7e61e6ec3a925fbded184fa
PODFILE CHECKSUM: ff66104e65cc960ed08a74b71c27f5caf59f4239

COCOAPODS: 1.5.3
21 changes: 21 additions & 0 deletions NVActivityIndicatorView/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Vinh Nguyen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
240 changes: 240 additions & 0 deletions NVActivityIndicatorView/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
NVActivityIndicatorView
=======================

[![Build Status](https://travis-ci.org/ninjaprox/NVActivityIndicatorView.svg?branch=master)](https://travis-ci.org/ninjaprox/NVActivityIndicatorView)
[![Cocoapods Compatible](https://img.shields.io/cocoapods/v/NVActivityIndicatorView.svg)](https://img.shields.io/cocoapods/v/NVActivityIndicatorView.svg)
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)

## Introduction
`NVActivityIndicatorView` is a collection of awesome loading animations.

This is original a fork from [DGActivityIndicatorView](https://github.com/gontovnik/DGActivityIndicatorView), inspired by [Loaders.css](https://github.com/ConnorAtherton/loaders.css), written in Swift with full implementation of animations, plus more.

You can also find Objective-C version of this [here](https://github.com/ninjaprox/DGActivityIndicatorView).

## Demo
![alt tag](https://raw.githubusercontent.com/ninjaprox/NVActivityIndicatorView/master/Demo.gif)

For first-hand experience, just open the project and run it.

## Animation types

| Type | Type | Type | Type |
|---|---|---|---|
|1. ballPulse | 2. ballGridPulse | 3. ballClipRotate | 4. squareSpin|
|5. ballClipRotatePulse | 6. ballClipRotateMultiple | 7. ballPulseRise | 8. ballRotate|
|9. cubeTransition | 10. ballZigZag | 11. ballZigZagDeflect | 12. ballTrianglePath|
|13. ballScale | 14. lineScale | 15. lineScaleParty | 16. ballScaleMultiple|
|17. ballPulseSync | 18. ballBeat | 19. lineScalePulseOut | 20. lineScalePulseOutRapid|
|21. ballScaleRipple | 22. ballScaleRippleMultiple | 23. ballSpinFadeLoader | 24. lineSpinFadeLoader|
|25. triangleSkewSpin | 26. pacman | 27. ballGridBeat | 28. semiCircleSpin|
|29. ballRotateChase | 30. orbit | 31. audioEqualizer | 32. circleStrokeSpin|

## Installation

### Cocoapods

Install [Cocoapods](https://cocoapods.org/#install) if need be.

```bash
$ gem install cocoapods
```

Add `NVActivityIndicatorView` in your `Podfile`.

```ruby
use_frameworks!

pod 'NVActivityIndicatorView'
```

If you're using `NVActivityIndicatorView` in an app extension, use `NVActivityIndicatorView/AppExtension` instead.

```ruby
use_frameworks!

pod 'NVActivityIndicatorView/AppExtension'
```

Then, run the following command.

```bash
$ pod install
```

_**Note:** Please refer to the migration note for version [`3.7.0`](#version-370) below._

### Carthage

Install [Carthage](https://github.com/Carthage/Carthage#installing-carthage) if need be.

```bash
$ brew update
$ brew install carthage
```

Add `NVActivityIndicatorView` in your `Cartfile`.

```ruby
github "ninjaprox/NVActivityIndicatorView"
```

Run `carthage` to build the framework and drag the built `NVActivityIndicatorView.framework` in the folder appropriateto the platform, e.g. iOS, tvOS, into your Xcode project.

_**Note:** You might encounter compile issue, if so please use `carthage` branch instead. Check issue [#101](https://github.com/ninjaprox/NVActivityIndicatorView/issues/101) for more information._

### Manual

Copy `NVActivityIndicatorView` folder to your project. That's it.

_**Note:** Make sure that all files in `NVActivityIndicatorView` included in Compile Sources in Build Phases._

_**Note:** If you encounter issues while uploading the app to iTunes Connect, remove the `Info.plist` file in `NVActivityIndicatorView`. Check issue [#129](https://github.com/ninjaprox/NVActivityIndicatorView/issues/129) for more information._

## Migration

### Version 4.4.0

This version requires Xcode 10.1 and Swift 4.2.

### Version 4.0.0

This version requires Xcode 9.0 and Swift 4.

### Version 3.7.0

This version splits `NVActivityIndicatorView` pod to 2 subpods `NVActivityIndicatorView/Presenter` and `NVActivityIndicatorView/AppExtension`. There is no need to change `pod NVActivityIndicatorView` to `pod NVActivityIndicatorView/Presenter` since it will be installed by default if you use the main pod name.

However, if you want to use `NVActivityIndicatorView` in an app extension, use `pod NVActivityIndicatorView/AppExtension` instead.

_**Note:** Related issue [#119](https://github.com/ninjaprox/NVActivityIndicatorView/issues/119)._

## Usage

Firstly, import `NVActivityIndicatorView`.

```swift
import NVActivityIndicatorView
```

### Initialization

Then, there are two ways you can create `NVActivityIndicatorView`:

- By storyboard, changing class of any `UIView` to `NVActivityIndicatorView`.

_**Note:** Set Module to `NVActivityIndicatorView`._

- By code, using initializer. All parameters other than `frame` are optional and `NVActivityIndicatorView.DEFAULT_*` are used as default values.

```swift
NVActivityIndicatorView(frame: frame, type: type, color: color, padding: padding)
```

### Control

Start animating.

```swift
activityIndicatorView.startAnimating()
```

Stop animating.

```swift
activityIndicatorView.stopAnimating()
```

Determine if it is animating.

```swift
animating = activityIndicatorView.isAnimating
```

### Change properties

In storyboard, you can change all properties in Attributes inspector tab of Utilities panel.

_**Note:** Use one of values (case-insensitive) in [Animation types](#animation-types) for `Type Name`._

All properties are public so you can change them after initializing.

_**Note:** All changes must be made before calling `startAnimating()`._

### UI blocker

By conforming `NVActivityIndicatorViewable` protocol, you can use `NVActivityIndicatorView` as UI blocker for `UIViewController`.

```swift
class ViewController: UIViewController, NVActivityIndicatorViewable { }
```

Start animating.

```swift
startAnimating(size, message) // plus other parameters as in initializer.
```

Stop animating.

```swift
stopAnimating()
```

Check if it is animating.

```swift
animating = isAnimating
```

Or you can use `NVActivityIndicatorPresenter` to display UI blocker anywhere.

Start animating.

```swift
let activityData = ActivityData()

NVActivityIndicatorPresenter.sharedInstance.startAnimating(activityData)
```

_**Note:** Check [documentation](https://nvactivityindicatorview.vinhis.me) for detail of `ActivityData`._

Stop animating.

```swift
NVActivityIndicatorPresenter.sharedInstance.stopAnimating()
```

Change message.

```swift
NVActivityIndicatorPresenter.sharedInstance.setMessage("Done")
```

Check if it is animating.

```swift
animating = NVActivityIndicatorPresenter.sharedInstance.isAnimating
```

#### Fade in/out animation

You have control over showing and hiding UI blocker animation.

```swift
startAnimating(fadeInAnimation: fadeInAnimation)
stopAnimating(fadeOutAnimation)
```

Check `DEFAULT_FADE_IN_ANIMATION` and `DEFAULT_FADE_OUT_ANIMATION` for examples of how to implement animation.

## Acknowledgment

Thanks [Connor Atherton](https://github.com/ConnorAtherton) for great loaders and [Danil Gontovnik](https://github.com/gontovnik) for kick-start.

## License

The MIT License (MIT)

Copyright (c) 2016 Vinh Nguyen [@ninjaprox](http://twitter.com/ninjaprox)
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//
// NVActivityIndicatorAnimationAudioEqualizer.swift
// NVActivityIndicatorView
//
// The MIT License (MIT)

// Copyright (c) 2016 Vinh Nguyen

// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//

import UIKit

class NVActivityIndicatorAnimationAudioEqualizer: NVActivityIndicatorAnimationDelegate {

func setUpAnimation(in layer: CALayer, size: CGSize, color: UIColor) {
let lineSize = size.width / 9
let x = (layer.bounds.size.width - lineSize * 7) / 2
let y = (layer.bounds.size.height - size.height) / 2
let duration: [CFTimeInterval] = [4.3, 2.5, 1.7, 3.1]
let values = [0, 0.7, 0.4, 0.05, 0.95, 0.3, 0.9, 0.4, 0.15, 0.18, 0.75, 0.01]

// Draw lines
for i in 0 ..< 4 {
let animation = CAKeyframeAnimation()

animation.keyPath = "path"
animation.isAdditive = true
animation.values = []

for j in 0 ..< values.count {
let heightFactor = values[j]
let height = size.height * CGFloat(heightFactor)
let point = CGPoint(x: 0, y: size.height - height)
let path = UIBezierPath(rect: CGRect(origin: point, size: CGSize(width: lineSize, height: height)))

animation.values?.append(path.cgPath)
}
animation.duration = duration[i]
animation.repeatCount = HUGE
animation.isRemovedOnCompletion = false

let line = NVActivityIndicatorShape.line.layerWith(size: CGSize(width: lineSize, height: size.height), color: color)
let frame = CGRect(x: x + lineSize * 2 * CGFloat(i),
y: y,
width: lineSize,
height: size.height)

line.frame = frame
line.add(animation, forKey: "animation")
layer.addSublayer(line)
}
}
}
Loading

0 comments on commit 1e949da

Please sign in to comment.