Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable-5.2.1] NMC/2261 - Audio Upload #166

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
}
}
4 changes: 2 additions & 2 deletions iOSClient/AudioRecorder/NCAudioRecorderViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class NCAudioRecorderViewController: UIViewController, NCAudioRecorderDelegate {

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

Task {
self.fileName = await NCNetworking.shared.createFileName(fileNameBase: NSLocalizedString("_untitled_", comment: "") + ".m4a", account: self.appDelegate.account, serverUrl: self.appDelegate.activeServerUrl)
Expand Down Expand Up @@ -135,7 +135,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>
112 changes: 112 additions & 0 deletions iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="EOV-Xa-OrB">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Create Form Upload Voice Note-->
<scene sceneID="H4p-Ap-xKz">
<objects>
<viewController storyboardIdentifier="NCCreateFormUploadRichdocuments.storyboard" id="EH3-Kr-Ge2" customClass="NCCreateFormUploadVoiceNote" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="0VF-hE-m57">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" scrollEnabled="NO" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="P5m-5b-4fH">
<rect key="frame" x="0.0" y="156" width="375" height="511"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="dataSource" destination="EH3-Kr-Ge2" id="63Y-M1-J0v"/>
<outlet property="delegate" destination="EH3-Kr-Ge2" id="uwo-SP-voa"/>
</connections>
</tableView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2kV-MD-Mr1">
<rect key="frame" x="163.5" y="74" width="48" height="48"/>
<constraints>
<constraint firstAttribute="height" constant="48" id="lvH-R5-WG0"/>
<constraint firstAttribute="width" constant="48" id="ycN-Nf-l3I"/>
</constraints>
<state key="normal" image="audioPlay"/>
<connections>
<action selector="playStop:" destination="EH3-Kr-Ge2" eventType="touchUpInside" id="gn1-ck-mrp"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00:00:00" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yM4-zd-vae">
<rect key="frame" x="20" y="125.5" width="70" height="17"/>
<constraints>
<constraint firstAttribute="width" constant="70" id="E19-mm-2zM"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00:00:00" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4rT-eR-bIP" userLabel="Label Duration">
<rect key="frame" x="285" y="125.5" width="70" height="17"/>
<constraints>
<constraint firstAttribute="width" constant="70" id="yts-al-4er"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progress="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="mh4-C7-Jvy">
<rect key="frame" x="100" y="132" width="175" height="4"/>
</progressView>
</subviews>
<viewLayoutGuide key="safeArea" id="QZD-6c-JyV"/>
<constraints>
<constraint firstItem="QZD-6c-JyV" firstAttribute="trailing" secondItem="4rT-eR-bIP" secondAttribute="trailing" constant="20" id="0KS-tQ-xp9"/>
<constraint firstItem="P5m-5b-4fH" firstAttribute="top" secondItem="mh4-C7-Jvy" secondAttribute="bottom" constant="20" id="7wo-IQ-YOi"/>
<constraint firstItem="yM4-zd-vae" firstAttribute="leading" secondItem="QZD-6c-JyV" secondAttribute="leading" constant="20" id="A3g-8h-po1"/>
<constraint firstItem="2kV-MD-Mr1" firstAttribute="centerX" secondItem="QZD-6c-JyV" secondAttribute="centerX" id="A8I-kN-gAG"/>
<constraint firstItem="4rT-eR-bIP" firstAttribute="leading" secondItem="mh4-C7-Jvy" secondAttribute="trailing" constant="10" id="HT0-rd-njh"/>
<constraint firstItem="mh4-C7-Jvy" firstAttribute="top" secondItem="2kV-MD-Mr1" secondAttribute="bottom" constant="10" id="KcO-xO-GE3"/>
<constraint firstItem="mh4-C7-Jvy" firstAttribute="leading" secondItem="yM4-zd-vae" secondAttribute="trailing" constant="10" id="Mer-P7-VTb"/>
<constraint firstItem="P5m-5b-4fH" firstAttribute="leading" secondItem="QZD-6c-JyV" secondAttribute="leading" id="PhA-gB-PSz"/>
<constraint firstItem="2kV-MD-Mr1" firstAttribute="top" secondItem="QZD-6c-JyV" secondAttribute="top" constant="10" id="U7R-it-8t5"/>
<constraint firstItem="4rT-eR-bIP" firstAttribute="centerY" secondItem="mh4-C7-Jvy" secondAttribute="centerY" id="gr8-3p-pV4"/>
<constraint firstItem="QZD-6c-JyV" firstAttribute="trailing" secondItem="P5m-5b-4fH" secondAttribute="trailing" id="hZV-08-h9R"/>
<constraint firstItem="QZD-6c-JyV" firstAttribute="bottom" secondItem="P5m-5b-4fH" secondAttribute="bottom" id="lMT-0w-jzT"/>
<constraint firstItem="mh4-C7-Jvy" firstAttribute="centerY" secondItem="yM4-zd-vae" secondAttribute="centerY" id="uXj-AK-H2x"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="ebY-Ch-8JZ"/>
<connections>
<outlet property="buttonPlayStop" destination="2kV-MD-Mr1" id="Ttq-De-1rD"/>
<outlet property="labelDuration" destination="4rT-eR-bIP" id="aIb-vS-vKy"/>
<outlet property="labelTimer" destination="yM4-zd-vae" id="lwu-f8-s7o"/>
<outlet property="progressView" destination="mh4-C7-Jvy" id="mUp-51-AxU"/>
<outlet property="tableView" destination="P5m-5b-4fH" id="CP7-wi-o8w"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="cls-iU-aea" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1196" y="228.93553223388307"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="jyZ-UH-jdM">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="EOV-Xa-OrB" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="YIP-Ix-pK6">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="EH3-Kr-Ge2" kind="relationship" relationship="rootViewController" id="ICk-k0-y6j"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="AXd-Eb-IUk" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="256.80000000000001" y="228.93553223388307"/>
</scene>
</scenes>
<resources>
<image name="audioPlay" width="300" height="300"/>
</resources>
</document>
Loading