Skip to content

Commit

Permalink
NMC 2261 - Audio record and upload customisation
Browse files Browse the repository at this point in the history
  • Loading branch information
TSI-amrutwaghmare committed Dec 5, 2023
1 parent 9b5e1ea commit bb25a43
Show file tree
Hide file tree
Showing 8 changed files with 426 additions and 79 deletions.
52 changes: 52 additions & 0 deletions Tests/NextcloudUnitTests/AudioUploadTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//
// AudioUploadTests.swift
// NextcloudTests
//
// Created by A200020526 on 13/06/23.
// Copyright © 2023 Marino Faggiana. All rights reserved.
//

import XCTest
@testable import Nextcloud

final class AudioUploadTests: XCTestCase {
var viewController:NCAudioRecorderViewController?

override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
// Step 1. Create an instance of UIStoryboard
let viewController = UIStoryboard(name: "NCAudioRecorderViewController", bundle: nil).instantiateInitialViewController() as? NCAudioRecorderViewController
// Step 3. Make the viewDidLoad() execute.
viewController?.loadViewIfNeeded()
}

override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
viewController = nil
}

func testExample() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
// Any test you write for XCTest can be annotated as throws and async.
// Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.
// Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.
}

func testPerformanceExample() throws {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}

func testAudioMeterUpdateAfterDb(){
viewController?.audioMeterDidUpdate(0.5)
XCTAssertNotNil(!(viewController?.durationLabel.text?.isEmpty ?? false))
}

func testStartRecorder(){
viewController?.startStop()
XCTAssertEqual(viewController?.recording.state, nil, "Test start audio recorder")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class NCAudioRecorderViewController: UIViewController, NCAudioRecorderDelegate {

view.backgroundColor = .clear
contentContainerView.backgroundColor = UIColor.lightGray
voiceRecordHUD.fillColor = UIColor.green
voiceRecordHUD.fillColor = NCBrandColor.shared.progressColorGreen60
}

override func viewWillAppear(_ animated: Bool) {
Expand Down Expand Up @@ -142,7 +142,7 @@ class NCAudioRecorderViewController: UIViewController, NCAudioRecorderDelegate {
}

voiceRecordHUD.update(CGFloat(rate))
voiceRecordHUD.fillColor = UIColor.green
voiceRecordHUD.fillColor = NCBrandColor.shared.progressColorGreen60

let formatter = DateComponentsFormatter()
formatter.allowedUnits = [.second]
Expand Down
33 changes: 33 additions & 0 deletions iOSClient/Main/Create cloud/FolderPathCustomCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// FolderPathCustomCell.swift
// Nextcloud
//
// Created by Sumit on 28/04/21.
// Copyright © 2021 Marino Faggiana. All rights reserved.
//

import Foundation

class FolderPathCustomCell: XLFormButtonCell{

@IBOutlet weak var photoLabel: UILabel!
@IBOutlet weak var folderImage: UIImageView!
@IBOutlet weak var bottomLineView: UIView!

override func awakeFromNib() {
super.awakeFromNib()
}

override func configure() {
super.configure()
}

override func update() {
super.update()
if (rowDescriptor.tag == "PhotoButtonDestinationFolder"){
bottomLineView.isHidden = true
}else{
bottomLineView.isHidden = false
}
}
}
74 changes: 74 additions & 0 deletions iOSClient/Main/Create cloud/FolderPathCustomCell.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" shouldIndentWhileEditing="NO" reuseIdentifier="folderCustomCell" id="gCq-ql-kOy" customClass="FolderPathCustomCell" customModule="Nextcloud" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="gCq-ql-kOy" id="ZCa-fn-Xv4">
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GB7-Lu-frs">
<rect key="frame" x="20" y="11.666666666666664" width="42" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="l63-AG-MTN">
<rect key="frame" x="373" y="9.6666666666666643" width="25" height="25"/>
<constraints>
<constraint firstAttribute="width" constant="25" id="a67-iQ-0bc"/>
<constraint firstAttribute="height" constant="25" id="dIj-dS-LsQ"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hsG-y9-Vyh" userLabel="bottomline">
<rect key="frame" x="0.0" y="43" width="414" height="1"/>
<color key="backgroundColor" systemColor="separatorColor"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="okE-Xs-OPB"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="cs4-ud-88f" userLabel="topline">
<rect key="frame" x="0.0" y="0.0" width="414" height="1"/>
<color key="backgroundColor" systemColor="separatorColor"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="ZW0-np-clD"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="GB7-Lu-frs" firstAttribute="leading" secondItem="ZCa-fn-Xv4" secondAttribute="leading" constant="20" id="1CX-lB-x8B"/>
<constraint firstItem="l63-AG-MTN" firstAttribute="centerY" secondItem="ZCa-fn-Xv4" secondAttribute="centerY" id="5Fe-g5-NmK"/>
<constraint firstItem="hsG-y9-Vyh" firstAttribute="leading" secondItem="ZCa-fn-Xv4" secondAttribute="leading" id="CsC-Wc-ghc"/>
<constraint firstItem="cs4-ud-88f" firstAttribute="top" secondItem="ZCa-fn-Xv4" secondAttribute="top" id="TOq-Jy-guz"/>
<constraint firstItem="GB7-Lu-frs" firstAttribute="centerY" secondItem="ZCa-fn-Xv4" secondAttribute="centerY" id="Yg4-B7-Ylv"/>
<constraint firstAttribute="trailing" secondItem="hsG-y9-Vyh" secondAttribute="trailing" id="abc-ys-XbX"/>
<constraint firstAttribute="trailing" secondItem="l63-AG-MTN" secondAttribute="trailing" constant="16" id="kod-W1-FAt"/>
<constraint firstAttribute="bottom" secondItem="hsG-y9-Vyh" secondAttribute="bottom" id="n3N-38-KYt"/>
<constraint firstItem="cs4-ud-88f" firstAttribute="leading" secondItem="ZCa-fn-Xv4" secondAttribute="leading" id="xBD-wU-ksp"/>
<constraint firstAttribute="trailing" secondItem="cs4-ud-88f" secondAttribute="trailing" id="yaU-4w-s5Y"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="bottomLineView" destination="hsG-y9-Vyh" id="ei7-ki-fst"/>
<outlet property="folderImage" destination="l63-AG-MTN" id="viQ-ea-JwI"/>
<outlet property="photoLabel" destination="GB7-Lu-frs" id="GjI-eQ-w8z"/>
</connections>
<point key="canvasLocation" x="71.014492753623188" y="107.8125"/>
</tableViewCell>
</objects>
<resources>
<systemColor name="separatorColor">
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.28999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
Loading

0 comments on commit bb25a43

Please sign in to comment.