Skip to content

Commit

Permalink
Merge pull request #35 from AppDevGuy/v0.3.3_develop
Browse files Browse the repository at this point in the history
v0.3.3 Release
  • Loading branch information
AppDevGuy authored Feb 25, 2023
2 parents c1ead5e + 1cad9fe commit bcb7ae6
Show file tree
Hide file tree
Showing 52 changed files with 536 additions and 269 deletions.
37 changes: 23 additions & 14 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,31 @@ name: Swift

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

#list of jobs to perform
jobs:
test:
name: Test
runs-on: macOS-latest

#the only job in the list, named `build`
build_and_test:
#specify OS to run the jobs on
runs-on: macos-latest
#sequential steps to run for the `build` job
steps:
- uses: actions/checkout@v2
- name: Build and Test
# step 1, use Marketplace action called Checkout@v2, to checkout the code
- uses: actions/checkout@v2 #'uses' keyword launches the Marketplace action
# step 2, verbosely build the package using the `swift` CLI
- name: Build
run: swift build -v #'run' keyword executes the command, as if it's run in terminal
# step 3, run tests
# Note that you must use "=" and not ":" despite error logs for -destiation using ":"
# Also using "Any iOS Simulator" doesn't seem to work despite being an option.
# The using CODE_SIGN... and beyond are for Codecov purposes when generating results.
- name: Run tests
run: |
cd Example
pod install
xcodebuild clean test -workspace OSSSpeechKit.xcworkspace -scheme OSSSpeechKit-Example -destination "platform=iOS Simulator,OS=13.7,name=iPhone 11 Pro Max" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO
bash <(curl https://codecov.io/bash | sed 's/"$beta_xcode_partials"//g')
env:
destination: "platform=iOS Simulator,OS=13.7,name=iPhone 11 Pro Max"
cd Example
pod install
xcodebuild clean test -scheme OSSSpeechKit-Example -workspace OSSSpeechKit.xcworkspace -destination 'platform=iOS Simulator,OS=16.2,name=iPhone 14' CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO
bash <(curl https://codecov.io/bash | sed 's/"$beta_xcode_partials"//g')
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Check Travis CI version info:
# https://docs.travis-ci.com/user/reference/osx/
language: objective-c
osx_image: xcode11.3
osx_image: xcode14.2
xcode_workspace: OSSSpeechKit.xcworkspace
xcode_scheme: OSSSpeechKit-Example
xcode_destination: platform=iOS Simulator,OS=13.3,name=iPhone 11
xcode_destination: platform=iOS Simulator,OS=16.2,name=iPhone 14
before_install:
- cd Example
- pod install
- cd Example
- pod install
after_success:
# - bash <(curl -s https://codecov.io/bash)
# Fixing code cov issue with solution from https://community.codecov.io/t/llvm-cov-failed-to-produce-results-for/1652/9
# - bash <(curl -s https://codecov.io/bash)
# Fixing code cov issue with solution from https://community.codecov.io/t/llvm-cov-failed-to-produce-results-for/1652/9
- bash <(curl https://codecov.io/bash | sed 's/"$beta_xcode_partials"//g')
- gem install jazzy
- make documentation
Expand Down
49 changes: 33 additions & 16 deletions Example/OSSSpeechKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -186,7 +186,7 @@
607FACCD1AFB9204008FA782 /* Frameworks */,
607FACCE1AFB9204008FA782 /* Resources */,
5004C6A87EB6F934EFA310F2 /* [CP] Embed Pods Frameworks */,
B042F2D2245FCDD900958719 /* ShellScript */,
B042F2D2245FCDD900958719 /* Run Script */,
);
buildRules = (
);
Expand Down Expand Up @@ -223,7 +223,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1140;
LastUpgradeCheck = 1130;
LastUpgradeCheck = 1420;
ORGANIZATIONNAME = CocoaPods;
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
Expand Down Expand Up @@ -287,34 +287,34 @@
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-OSSSpeechKit_Example/Pods-OSSSpeechKit_Example-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/OSSSpeechKit/OSSSpeechKit.framework",
"${BUILT_PRODUCTS_DIR}/PureLayout/PureLayout.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OSSSpeechKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PureLayout.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-OSSSpeechKit_Example/Pods-OSSSpeechKit_Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
B042F2D2245FCDD900958719 /* ShellScript */ = {
B042F2D2245FCDD900958719 /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Run Script";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
shellScript = "export PATH=\"$PATH:/opt/homebrew/bin\"\nif which swiftlint > /dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
EBB80964F428049277FF60C0 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
Expand Down Expand Up @@ -428,6 +428,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -453,7 +454,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -484,6 +485,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -503,10 +505,9 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
VALIDATE_PRODUCT = YES;
};
Expand All @@ -522,8 +523,11 @@
DEVELOPMENT_TEAM = "";
GCC_OPTIMIZATION_LEVEL = 0;
INFOPLIST_FILE = OSSSpeechKit/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -543,8 +547,11 @@
DEVELOPMENT_TEAM = "";
GCC_OPTIMIZATION_LEVEL = 0;
INFOPLIST_FILE = OSSSpeechKit/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -571,7 +578,12 @@
"$(inherited)",
);
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -594,7 +606,12 @@
);
GCC_OPTIMIZATION_LEVEL = 0;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
LastUpgradeVersion = "1420"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
36 changes: 21 additions & 15 deletions Example/OSSSpeechKit/CountryLanguageListTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,12 @@ class CountryLanguageListTableViewController: UITableViewController {
// MARK: - Variables

private let speechKit = OSSSpeech.shared

private lazy var microphoneButton: UIBarButtonItem = {
var micImage: UIImage?
if #available(iOS 13.0, *) {
micImage = UIImage(systemName: "mic.fill")?.withRenderingMode(.alwaysTemplate)
} else {
micImage = UIImage(named: "oss-microphone-icon")?.withRenderingMode(.alwaysTemplate)
}
micImage = UIImage(systemName: "mic.fill")?.withRenderingMode(.alwaysTemplate)
let button = UIBarButtonItem(image: micImage, style: .plain, target: self, action: #selector(recordVoice))
button.tintColor = .black
button.tintColor = .label
button.accessibilityIdentifier = "OSSSpeechKitMicButton"
return button
}()
Expand All @@ -58,13 +54,24 @@ class CountryLanguageListTableViewController: UITableViewController {
// MARK: - Voice Recording

@objc func recordVoice() {
if microphoneButton.tintColor == .red {
shoudlStartRecordingVoice(microphoneButton.tintColor != .red)
}

private func shoudlStartRecordingVoice(_ shouldRecord: Bool) {
updateMicButtonColor(forState: shouldRecord)
if !shouldRecord {
speechKit.endVoiceRecording()
return
}
microphoneButton.tintColor = .red
speechKit.recordVoice()
}

func updateMicButtonColor(forState isRecording: Bool) {
DispatchQueue.main.async { [weak self] in
guard let self else { return }
self.microphoneButton.tintColor = isRecording ? .red : .label
}
}
}

extension CountryLanguageListTableViewController {
Expand Down Expand Up @@ -111,7 +118,7 @@ extension CountryLanguageListTableViewController: OSSSpeechDelegate {
}

func didFailToProcessRequest(withError error: Error?) {
recordVoice()
shoudlStartRecordingVoice(false)
guard let err = error else {
print("Error with the request but the error returned is nil")
return
Expand All @@ -125,14 +132,13 @@ extension CountryLanguageListTableViewController: OSSSpeechDelegate {

func didFailToCommenceSpeechRecording() {
print("Failed to record speech.")
recordVoice()
shoudlStartRecordingVoice(false)
}

func didFinishListening(withText text: String) {
weak var weakSelf = self
OperationQueue.main.addOperation {
weakSelf?.microphoneButton.tintColor = .black
weakSelf?.speechKit.speakText(text)
OperationQueue.main.addOperation { [weak self] in
self?.updateMicButtonColor(forState: false)
self?.speechKit.speakText(text)
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use_frameworks!
platform :ios, '12.0'
platform :ios, '13.0'

target 'OSSSpeechKit_Example' do
pod 'OSSSpeechKit', :path => '../'
pod 'PureLayout', :inhibit_warnings => true


target 'OSSSpeechKit_Tests' do
inherit! :search_paths

Expand Down
16 changes: 16 additions & 0 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
PODS:
- OSSSpeechKit (0.3.3)

DEPENDENCIES:
- OSSSpeechKit (from `../`)

EXTERNAL SOURCES:
OSSSpeechKit:
:path: "../"

SPEC CHECKSUMS:
OSSSpeechKit: ea0fd8151e7e338bc6ddc6bb749455fc3b33cfde

PODFILE CHECKSUM: 619c7767d93bbf8bc7a5c2d0a1d118e435561c49

COCOAPODS: 1.11.3
Loading

0 comments on commit bcb7ae6

Please sign in to comment.