Skip to content

Commit

Permalink
Merge pull request #76 from tumblr/kanvas-rename
Browse files Browse the repository at this point in the history
Renames KanvasCamera to Kanvas
  • Loading branch information
bjtitus authored Feb 3, 2021
2 parents 364c1aa + 351b9b1 commit cac9321
Show file tree
Hide file tree
Showing 619 changed files with 3,810 additions and 3,346 deletions.
2 changes: 2 additions & 0 deletions .circleci/cache-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# To invalidate the cache, generate a new UUID using `uuidgen` on the command line then paste it here
92DD7AFB-12E6-46E9-B74E-0E9430A5C43F
14 changes: 7 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,28 @@ jobs:
- git/shallow-checkout
- ios/install-dependencies:
bundle-install: true
bundler-working-directory: KanvasCameraExample
bundler-working-directory: KanvasExample
pod-install: true
cocoapods-working-directory: KanvasCameraExample
cocoapods-working-directory: KanvasExample
- run:
name: Pod Install
when: always
working_directory: ./KanvasCameraExample
working_directory: ./KanvasExample
command: bundle exec pod install
- ios/test:
xcode-version: 11.2.1
workspace: KanvasCameraExample/KanvasCameraExample.xcworkspace
scheme: KanvasCameraExample
workspace: KanvasExample/KanvasExample.xcworkspace
scheme: KanvasExample
device: iPhone 8
ios-version: "14.0"
- run:
name: Zip failed diffs
when: always
working_directory: ./KanvasCameraExample/KanvasCameraExampleTests
working_directory: ./KanvasExample/KanvasExampleTests
command: zip -r diffoutput.zip FailureDiffs || true
- store_artifacts:
name: Save diffs
path: KanvasCameraExample/KanvasCameraExampleTests/diffoutput.zip
path: KanvasExample/KanvasExampleTests/diffoutput.zip
destination: testresults
- ios/save-xcodebuild-artifacts:
result-bundle-path: build/results
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ import Foundation
}
}

/// A protocol for injecting analytics into the KanvasCamera module
@objc public protocol KanvasCameraAnalyticsProvider {
/// A protocol for injecting analytics into the Kanvas module
@objc public protocol KanvasAnalyticsProvider {

/// Logs an event when the camera is opened
///
Expand Down
22 changes: 11 additions & 11 deletions Classes/Camera/CameraController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation
import UIKit

// Media wrapper for media generated from the CameraController
public enum KanvasCameraMedia {
public enum KanvasMedia {
case image(URL, MediaInfo, CGSize)
case video(URL, MediaInfo, CGSize)
case frames(URL, MediaInfo, CGSize)
Expand Down Expand Up @@ -43,10 +43,10 @@ enum CameraControllerError: Swift.Error {
public protocol CameraControllerDelegate: class {
/**
A function that is called when an image is exported. Can be nil if the export fails
- parameter media: KanvasCameraMedia - this is the media created in the controller (can be image, video, etc)
- seealso: enum KanvasCameraMedia
- parameter media: KanvasMedia - this is the media created in the controller (can be image, video, etc)
- seealso: enum KanvasMedia
*/
func didCreateMedia(_ cameraController: CameraController, media: KanvasCameraMedia?, exportAction: KanvasExportAction, error: Error?)
func didCreateMedia(_ cameraController: CameraController, media: KanvasMedia?, exportAction: KanvasExportAction, error: Error?)

/**
A function that is called when the main camera dismiss button is pressed
Expand Down Expand Up @@ -172,7 +172,7 @@ public class CameraController: UIViewController, MediaClipsEditorDelegate, Camer
}()

private let settings: CameraSettings
private let analyticsProvider: KanvasCameraAnalyticsProvider?
private let analyticsProvider: KanvasAnalyticsProvider?
private var currentMode: CameraMode
private var isRecording: Bool
private var disposables: [NSKeyValueObservation] = []
Expand All @@ -196,8 +196,8 @@ public class CameraController: UIViewController, MediaClipsEditorDelegate, Camer
/// interact with the user, which options should the controller give the user
/// and which should be the result of the interaction.
/// - stickerProvider: Class that will provide the stickers in the editor.
/// - analyticsProvider: An class conforming to KanvasCameraAnalyticsProvider
convenience public init(settings: CameraSettings, stickerProvider: StickerProvider?, analyticsProvider: KanvasCameraAnalyticsProvider?, quickBlogSelectorCoordinator: KanvasQuickBlogSelectorCoordinating?, tagCollection: UIView?) {
/// - analyticsProvider: An class conforming to KanvasAnalyticsProvider
convenience public init(settings: CameraSettings, stickerProvider: StickerProvider?, analyticsProvider: KanvasAnalyticsProvider?, quickBlogSelectorCoordinator: KanvasQuickBlogSelectorCoordinating?, tagCollection: UIView?) {
self.init(settings: settings, recorderClass: CameraRecorder.self, segmentsHandlerClass: CameraSegmentHandler.self, captureDeviceAuthorizer: CaptureDeviceAuthorizer(), stickerProvider: stickerProvider, analyticsProvider: analyticsProvider, quickBlogSelectorCoordinator: quickBlogSelectorCoordinator, tagCollection: tagCollection)
}

Expand All @@ -213,13 +213,13 @@ public class CameraController: UIViewController, MediaClipsEditorDelegate, Camer
/// motion segments and constructing final input.
/// - captureDeviceAuthorizer: Class responsible for authorizing access to capture devices.
/// - stickerProvider: Class that will provide the stickers in the editor.
/// - analyticsProvider: A class conforming to KanvasCameraAnalyticsProvider
/// - analyticsProvider: A class conforming to KanvasAnalyticsProvider
init(settings: CameraSettings,
recorderClass: CameraRecordingProtocol.Type,
segmentsHandlerClass: SegmentsHandlerType.Type,
captureDeviceAuthorizer: CaptureDeviceAuthorizing,
stickerProvider: StickerProvider?,
analyticsProvider: KanvasCameraAnalyticsProvider?,
analyticsProvider: KanvasAnalyticsProvider?,
quickBlogSelectorCoordinator: KanvasQuickBlogSelectorCoordinating?,
tagCollection: UIView?) {
self.settings = settings
Expand Down Expand Up @@ -657,7 +657,7 @@ public class CameraController: UIViewController, MediaClipsEditorDelegate, Camer
func didTapForMode(_ mode: CameraMode) {
switch mode.group {
case .gif:
takeGif(numberOfFrames: KanvasCameraTimes.gifTapNumberOfFrames, framesPerSecond: KanvasCameraTimes.gifPreferredFramesPerSecond)
takeGif(numberOfFrames: KanvasTimes.gifTapNumberOfFrames, framesPerSecond: KanvasTimes.gifPreferredFramesPerSecond)
case .photo, .video:
takePhoto()
}
Expand All @@ -666,7 +666,7 @@ public class CameraController: UIViewController, MediaClipsEditorDelegate, Camer
func didStartPressingForMode(_ mode: CameraMode) {
switch mode.group {
case .gif:
takeGif(numberOfFrames: KanvasCameraTimes.gifHoldNumberOfFrames, framesPerSecond: KanvasCameraTimes.gifPreferredFramesPerSecond)
takeGif(numberOfFrames: KanvasTimes.gifHoldNumberOfFrames, framesPerSecond: KanvasTimes.gifPreferredFramesPerSecond)
case .video:
prepareHapticFeedback()
let _ = cameraInputController.startRecording(on: mode)
Expand Down
8 changes: 4 additions & 4 deletions Classes/Camera/CameraPermissionsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ class CameraPermissionsView: UIView, CameraPermissionsViewable, MediaPickerButto

private struct Constants {
static let borderWidth: CGFloat = 2
static let titleFont: UIFont = KanvasCameraFonts.shared.permissions.titleFont
static let titleFont: UIFont = KanvasFonts.shared.permissions.titleFont
static let textColor: UIColor = .white
static let descriptionFont: UIFont = KanvasCameraFonts.shared.permissions.descriptionFont
static let descriptionFont: UIFont = KanvasFonts.shared.permissions.descriptionFont
static let descriptionOpacity: CGFloat = 0.65
static let buttonFont: UIFont = KanvasCameraFonts.shared.permissions.buttonFont
static let buttonFont: UIFont = KanvasFonts.shared.permissions.buttonFont
static let buttonColor: UIColor = .init(red: 0, green: 184.0/255.0, blue: 1.0, alpha: 1.0)
static let buttonAcceptedBackgroundColor: UIColor = .init(hex: 0x00cf35)
static let buttonAcceptedColor: UIColor = .black
Expand Down Expand Up @@ -126,7 +126,7 @@ class CameraPermissionsView: UIView, CameraPermissionsViewable, MediaPickerButto
}()

private static var checkImage: UIImage? = {
return KanvasCameraImages.permissionCheckmark?.withRenderingMode(.alwaysTemplate)
return KanvasImages.permissionCheckmark?.withRenderingMode(.alwaysTemplate)
}()

weak var delegate: CameraPermissionsViewDelegate?
Expand Down
20 changes: 10 additions & 10 deletions Classes/Camera/CameraView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ protocol CameraViewDelegate: class {
}

struct CameraConstants {
static let optionVerticalMargin: CGFloat = KanvasCameraDesign.shared.cameraViewOptionVerticalMargin
static let optionHorizontalMargin: CGFloat = KanvasCameraDesign.shared.cameraViewOptionHorizontalMargin
static let optionButtonSize: CGFloat = KanvasCameraDesign.shared.cameraViewOptionButtonSize
static let optionSpacing: CGFloat = KanvasCameraDesign.shared.cameraViewOptionSpacing
static let optionVerticalMargin: CGFloat = KanvasDesign.shared.cameraViewOptionVerticalMargin
static let optionHorizontalMargin: CGFloat = KanvasDesign.shared.cameraViewOptionHorizontalMargin
static let optionButtonSize: CGFloat = KanvasDesign.shared.cameraViewOptionButtonSize
static let optionSpacing: CGFloat = KanvasDesign.shared.cameraViewOptionSpacing
private static let hidingAnimationDuration: CGFloat = 0.2
fileprivate static let defaultOptionRows: CGFloat = 2

static let buttonBackgroundColor: UIColor = KanvasCameraDesign.shared.cameraViewButtonBackgroundColor
static let buttonInvertedBackgroundColor: UIColor = KanvasCameraDesign.shared.cameraViewButtonInvertedBackgroundColor
static let buttonBackgroundColor: UIColor = KanvasDesign.shared.cameraViewButtonBackgroundColor
static let buttonInvertedBackgroundColor: UIColor = KanvasDesign.shared.cameraViewButtonInvertedBackgroundColor
}

/// View with containers for all camera subviews (input, mode selector, etc)
Expand Down Expand Up @@ -152,7 +152,7 @@ final class CameraView: UIView {
private func setupModeLayoutGuide() {
addLayoutGuide(modeLayoutGuide)

let bottomMargin: CGFloat = KanvasCameraDesign.shared.isBottomPicker ? MediaClipsEditorView.height - (ModeSelectorAndShootView.modeSelectorHeight + ModeSelectorAndShootView.modeSelectorTopMargin) : MediaClipsEditorView.height
let bottomMargin: CGFloat = KanvasDesign.shared.isBottomPicker ? MediaClipsEditorView.height - (ModeSelectorAndShootView.modeSelectorHeight + ModeSelectorAndShootView.modeSelectorTopMargin) : MediaClipsEditorView.height

modeLayoutGuide.leadingAnchor.constraint(equalTo: safeLayoutGuide.leadingAnchor).isActive = true
modeLayoutGuide.trailingAnchor.constraint(equalTo: safeLayoutGuide.trailingAnchor).isActive = true
Expand Down Expand Up @@ -225,7 +225,7 @@ final class CameraView: UIView {
closeButton.translatesAutoresizingMaskIntoConstraints = false


if KanvasCameraDesign.shared.isBottomPicker {
if KanvasDesign.shared.isBottomPicker {
closeButton.backgroundColor = CameraConstants.buttonBackgroundColor
closeButton.layer.cornerRadius = CameraConstants.optionButtonSize / 2
closeButton.layer.masksToBounds = true
Expand All @@ -236,7 +236,7 @@ final class CameraView: UIView {
}

if settings.topButtonsSwapped {
closeButton.setImage(KanvasCameraDesign.shared.cameraViewNextImage, for: .normal)
closeButton.setImage(KanvasDesign.shared.cameraViewNextImage, for: .normal)
NSLayoutConstraint.activate([
closeButton.trailingAnchor.constraint(equalTo: safeLayoutGuide.trailingAnchor, constant: -CameraConstants.optionHorizontalMargin),
closeButton.topAnchor.constraint(equalTo: safeLayoutGuide.topAnchor, constant: CameraConstants.optionVerticalMargin),
Expand All @@ -245,7 +245,7 @@ final class CameraView: UIView {
])
}
else {
closeButton.setImage(KanvasCameraDesign.shared.cameraViewCloseImage, for: .normal)
closeButton.setImage(KanvasDesign.shared.cameraViewCloseImage, for: .normal)

NSLayoutConstraint.activate([
closeButton.leadingAnchor.constraint(equalTo: safeLayoutGuide.leadingAnchor, constant: CameraConstants.optionHorizontalMargin),
Expand Down
4 changes: 2 additions & 2 deletions Classes/Camera/CameraZoomHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ final class CameraZoomHandler {
private var currentDevice: AVCaptureDevice? {
return delegate?.currentDeviceForZooming
}
private let analyticsProvider: KanvasCameraAnalyticsProvider?
private let analyticsProvider: KanvasAnalyticsProvider?

/// The designated initializer
///
/// - Parameter analyticsProvider: Optionally provide an analytics class
init(analyticsProvider: KanvasCameraAnalyticsProvider? = nil) {
init(analyticsProvider: KanvasAnalyticsProvider? = nil) {
self.analyticsProvider = analyticsProvider
}

Expand Down
4 changes: 2 additions & 2 deletions Classes/Camera/Filters/CameraFilterCollectionCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import Foundation
import UIKit

private struct CameraFilterCollectionCellDimensions: FilterCollectionCellDimensions {
let circleDiameter: CGFloat = KanvasCameraDesign.shared.cameraFilterCollectionCellCircleDiameter
let circleMaxDiameter: CGFloat = KanvasCameraDesign.shared.cameraFilterCollectionCellCircleMaxDiameter
let circleDiameter: CGFloat = KanvasDesign.shared.cameraFilterCollectionCellCircleDiameter
let circleMaxDiameter: CGFloat = KanvasDesign.shared.cameraFilterCollectionCellCircleMaxDiameter
let padding: CGFloat = 0
var minimumHeight: CGFloat { return circleMaxDiameter }
var width: CGFloat { return circleMaxDiameter }
Expand Down
18 changes: 9 additions & 9 deletions Classes/Camera/Filters/FilterSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import UIKit

private struct FilterSettingsViewConstants {
static let animationDuration: TimeInterval = 0.25
static let iconSize: CGFloat = KanvasCameraDesign.shared.filterSettingsViewIconSize
static let padding: CGFloat = KanvasCameraDesign.shared.filterSettingsViewPadding
static let iconSize: CGFloat = KanvasDesign.shared.filterSettingsViewIconSize
static let padding: CGFloat = KanvasDesign.shared.filterSettingsViewPadding
static let collectionViewHeight = CameraFilterCollectionCell.minimumHeight + 10
static let height: CGFloat = collectionViewHeight + padding + iconSize
}
Expand All @@ -37,7 +37,7 @@ final class FilterSettingsView: IgnoreTouchesView {
collectionContainer.accessibilityIdentifier = "Filter Collection Container"
collectionContainer.clipsToBounds = false

let defaultImage = KanvasCameraDesign.shared.filterSettingsViewFiltersOffImage
let defaultImage = KanvasDesign.shared.filterSettingsViewFiltersOffImage
visibilityButton = UIButton()
visibilityButton.accessibilityIdentifier = "Filter Visibility Button"
visibilityButton.setImage(defaultImage, for: .normal)
Expand Down Expand Up @@ -70,12 +70,12 @@ final class FilterSettingsView: IgnoreTouchesView {
let backgroundColor: UIColor

if shown {
image = KanvasCameraDesign.shared.filterSettingsViewFiltersOnImage
backgroundColor = KanvasCameraDesign.shared.filterSettingsViewButtonBackgroundInvertedColor
image = KanvasDesign.shared.filterSettingsViewFiltersOnImage
backgroundColor = KanvasDesign.shared.filterSettingsViewButtonBackgroundInvertedColor
}
else {
image = KanvasCameraDesign.shared.filterSettingsViewFiltersOffImage
backgroundColor = KanvasCameraDesign.shared.filterSettingsViewButtonBackgroundColor
image = KanvasDesign.shared.filterSettingsViewFiltersOffImage
backgroundColor = KanvasDesign.shared.filterSettingsViewButtonBackgroundColor
}

self.visibilityButton.backgroundColor = backgroundColor
Expand Down Expand Up @@ -116,8 +116,8 @@ private extension FilterSettingsView {
addSubview(visibilityButton)
visibilityButton.translatesAutoresizingMaskIntoConstraints = false

if KanvasCameraDesign.shared.isBottomPicker {
visibilityButton.backgroundColor = KanvasCameraDesign.shared.filterSettingsViewButtonBackgroundColor
if KanvasDesign.shared.isBottomPicker {
visibilityButton.backgroundColor = KanvasDesign.shared.filterSettingsViewButtonBackgroundColor
visibilityButton.layer.cornerRadius = FilterSettingsViewConstants.iconSize / 2
visibilityButton.layer.masksToBounds = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ private let backgroundColorCollection = [brightBlue,


// The colors used throughout the module
public struct KanvasCameraColors {
public struct KanvasColors {

public static var shared: KanvasCameraColors = {
return KanvasCameraColors(
public static var shared: KanvasColors = {
return KanvasColors(
drawingDefaultColor: brightBlue,
colorPickerColors: pickerColors,
selectedPickerColor: selectedColor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
//

public struct KanvasCameraDesign {
public struct KanvasDesign {

// MARK: - General
public let isBottomPicker: Bool
Expand Down Expand Up @@ -208,13 +208,13 @@ public struct KanvasCameraDesign {
self.mediaClipsCollectionCellLabelHorizontalPadding = mediaClipsCollectionCellLabelHorizontalPadding
}

public static var shared: KanvasCameraDesign = {
public static var shared: KanvasDesign = {
return .original
}()


public static var original: KanvasCameraDesign = {
return KanvasCameraDesign(
public static var original: KanvasDesign = {
return KanvasDesign(
isBottomPicker: false,
cameraViewButtonBackgroundColor: .clear,
cameraViewButtonInvertedBackgroundColor: .clear,
Expand Down Expand Up @@ -257,7 +257,7 @@ public struct KanvasCameraDesign {
mediaClipsCollectionControllerLeftInset: 11,
mediaClipsCollectionControllerRightInset: 11,
mediaClipsCollectionViewFadeOutGradientLocations: [0, 0.05, 0.9, 1.0],
mediaClipsEditorViewBackgroundColor: KanvasCameraColors.shared.translucentBlack,
mediaClipsEditorViewBackgroundColor: KanvasColors.shared.translucentBlack,
mediaClipsEditorViewButtonLeadingMargin: 16,
mediaClipsEditorViewButtonTrailingMargin: 16,
mediaClipsEditorViewTopPadding: 6,
Expand All @@ -270,15 +270,15 @@ public struct KanvasCameraDesign {
mediaClipsCollectionCellSelectedBorderWidth: 2.0,
mediaClipsCollectionCellCornerRadius: 8,
mediaClipsCollectionCellClipAlpha: 0.5,
mediaClipsCollectionCellFont: KanvasCameraFonts.shared.mediaClipsFont,
mediaClipsCollectionCellFont: KanvasFonts.shared.mediaClipsFont,
mediaClipsCollectionCellLabelVerticalPadding: 3.5,
mediaClipsCollectionCellLabelHorizontalPadding: 5.5
)
}()


public static var bottomPicker: KanvasCameraDesign = {
return KanvasCameraDesign(
public static var bottomPicker: KanvasDesign = {
return KanvasDesign(
isBottomPicker: true,
cameraViewButtonBackgroundColor: UIColor.black.withAlphaComponent(0.4),
cameraViewButtonInvertedBackgroundColor: UIColor.white,
Expand Down Expand Up @@ -334,7 +334,7 @@ public struct KanvasCameraDesign {
mediaClipsCollectionCellSelectedBorderWidth: 3,
mediaClipsCollectionCellCornerRadius: 4,
mediaClipsCollectionCellClipAlpha: 0.87,
mediaClipsCollectionCellFont: KanvasCameraFonts.shared.mediaClipsSmallFont,
mediaClipsCollectionCellFont: KanvasFonts.shared.mediaClipsSmallFont,
mediaClipsCollectionCellLabelVerticalPadding: 4.5,
mediaClipsCollectionCellLabelHorizontalPadding: 3.5
)
Expand Down
Loading

0 comments on commit cac9321

Please sign in to comment.