提交 cd580b3e 作者: 王苏进

feat: 初始化

上级
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
build/
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: "54e66469a933b60ddf175f858f82eaeb97e48c8d"
channel: "stable"
project_type: plugin
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
- platform: android
create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
- platform: ios
create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
## 0.0.1
* TODO: Describe initial release.
TODO: Add your license here.
# aivoice_plugin
A new Flutter plugin project.
## Getting Started
This project is a starting point for a Flutter
[plug-in package](https://flutter.dev/developing-packages/),
a specialized package that includes platform-specific implementation code for
Android and/or iOS.
For help getting started with Flutter development, view the
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.cxx
group 'com.example.aivoice_plugin'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
if (project.android.hasProperty("namespace")) {
namespace 'com.example.aivoice_plugin'
}
compileSdk 34
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
}
defaultConfig {
minSdkVersion 19
}
dependencies {
testImplementation 'org.jetbrains.kotlin:kotlin-test'
testImplementation 'org.mockito:mockito-core:5.0.0'
}
testOptions {
unitTests.all {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
outputs.upToDateWhen {false}
showStandardStreams = true
}
}
}
}
rootProject.name = 'aivoice_plugin'
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.aivoice_plugin">
</manifest>
package com.yourcompany.aivoiceplugin;
import androidx.annotation.NonNull;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
public class AivoicePlugin implements FlutterPlugin, MethodCallHandler {
private MethodChannel channel;
@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "aivoice_plugin");
channel.setMethodCallHandler(this);
}
@Override
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
if (call.method.equals("getPlatformVersion")) {
result.success("Android " + android.os.Build.VERSION.RELEASE);
} else if (call.method.equals("initEngine")) {
// 空实现
result.success(null);
} else {
result.notImplemented();
}
}
@Override
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
channel.setMethodCallHandler(null);
}
}
\ No newline at end of file
package com.example.aivoice_plugin
import androidx.annotation.NonNull
import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
import io.flutter.plugin.common.MethodChannel.Result
/** AivoicePlugin */
class AivoicePlugin: FlutterPlugin, MethodCallHandler {
/// The MethodChannel that will the communication between Flutter and native Android
///
/// This local reference serves to register the plugin with the Flutter Engine and unregister it
/// when the Flutter Engine is detached from the Activity
private lateinit var channel : MethodChannel
override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
channel = MethodChannel(flutterPluginBinding.binaryMessenger, "aivoice_plugin")
channel.setMethodCallHandler(this)
}
override fun onMethodCall(call: MethodCall, result: Result) {
if (call.method == "getPlatformVersion") {
result.success("Android ${android.os.Build.VERSION.RELEASE}")
} else {
result.notImplemented()
}
}
override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {
channel.setMethodCallHandler(null)
}
}
package com.example.aivoice_plugin
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
import kotlin.test.Test
import org.mockito.Mockito
/*
* This demonstrates a simple unit test of the Kotlin portion of this plugin's implementation.
*
* Once you have built the plugin's example app, you can run these tests from the command
* line by running `./gradlew testDebugUnitTest` in the `example/android/` directory, or
* you can run them directly from IDEs that support JUnit such as Android Studio.
*/
internal class AivoicePluginTest {
@Test
fun onMethodCall_getPlatformVersion_returnsExpectedValue() {
val plugin = AivoicePlugin()
val call = MethodCall("getPlatformVersion", null)
val mockResult: MethodChannel.Result = Mockito.mock(MethodChannel.Result::class.java)
plugin.onMethodCall(call, mockResult)
Mockito.verify(mockResult).success("Android " + android.os.Build.VERSION.RELEASE)
}
}
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: "54e66469a933b60ddf175f858f82eaeb97e48c8d"
channel: "stable"
project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
- platform: ios
create_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
base_revision: 54e66469a933b60ddf175f858f82eaeb97e48c8d
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
# aivoice_plugin_example
Demonstrates how to use the aivoice_plugin plugin.
## Getting Started
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
android {
namespace "com.example.aivoice_plugin_example"
compileSdk flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.aivoice_plugin_example"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {}
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="aivoice_plugin_example"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility?hl=en and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
</queries>
</manifest>
package com.example.aivoice_plugin_example
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity()
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
org.gradle.jvmargs=-Xmx4G
android.useAndroidX=true
android.enableJetifier=true
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}
settings.ext.flutterSdkPath = flutterSdkPath()
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
}
include ":app"
// This is a basic Flutter integration test.
//
// Since integration tests run in a full Flutter application, they can interact
// with the host side of a plugin implementation, unlike Dart unit tests.
//
// For more information about Flutter integration tests, please see
// https://docs.flutter.dev/cookbook/testing/integration/introduction
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:aivoice_plugin/aivoice_plugin.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
testWidgets('getPlatformVersion test', (WidgetTester tester) async {
final AivoicePlugin plugin = AivoicePlugin();
final String? version = await plugin.getPlatformVersion();
// The version string depends on the host platform running the test, so
// just assert that some non-empty string is returned.
expect(version?.isNotEmpty, true);
});
}
**/dgph
*.mode1v3
*.mode2v3
*.moved-aside
*.pbxuser
*.perspectivev3
**/*sync/
.sconsign.dblite
.tags*
**/.vagrant/
**/DerivedData/
Icon?
**/Pods/
**/.symlinks/
profile
xcuserdata
**/.generated/
Flutter/App.framework
Flutter/Flutter.framework
Flutter/Flutter.podspec
Flutter/Generated.xcconfig
Flutter/ephemeral/
Flutter/app.flx
Flutter/app.zip
Flutter/flutter_assets/
Flutter/flutter_export_environment.sh
ServiceDefinitions.json
Runner/GeneratedPluginRegistrant.*
# Exceptions to above rules.
!default.mode1v3
!default.mode2v3
!default.pbxuser
!default.perspectivev3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>12.0</string>
</dict>
</plist>
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
# Uncomment this line to define a global platform for your project
# platform :ios, '12.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/volcengine/volcengine-specs.git'
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks! :linkage => :static
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
PODS:
- aivoice_plugin (0.0.1):
- Flutter
- SpeechEngineToB
- Flutter (1.0.0)
- integration_test (0.0.1):
- Flutter
- SpeechEngineToB (0.0.4):
- TTNetworkManager (= 5.0.29.22)
- TTNetworkManager (5.0.29.22)
DEPENDENCIES:
- aivoice_plugin (from `.symlinks/plugins/aivoice_plugin/ios`)
- Flutter (from `Flutter`)
- integration_test (from `.symlinks/plugins/integration_test/ios`)
SPEC REPOS:
https://github.com/volcengine/volcengine-specs.git:
- SpeechEngineToB
- TTNetworkManager
EXTERNAL SOURCES:
aivoice_plugin:
:path: ".symlinks/plugins/aivoice_plugin/ios"
Flutter:
:path: Flutter
integration_test:
:path: ".symlinks/plugins/integration_test/ios"
SPEC CHECKSUMS:
aivoice_plugin: 994d33c97542be282047ff9ecc4766641f802c4a
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
integration_test: 13825b8a9334a850581300559b8839134b124670
SpeechEngineToB: a49185c07a099cdc052de97218bc10dc4ff60152
TTNetworkManager: 47d93100d944e2ae807e035d8636df92fd5cc390
PODFILE CHECKSUM: bde3e45995fad5550475b342803cb71575488751
COCOAPODS: 1.14.3
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "331C8080294A63A400263BE5"
BuildableName = "RunnerTests.xctest"
BlueprintName = "RunnerTests"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
# Launch Screen Assets
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="168" height="185"/>
</resources>
</document>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Flutter View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Example</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>example</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
#import "GeneratedPluginRegistrant.h"
import Flutter
import UIKit
import XCTest
class RunnerTests: XCTestCase {
func testExample() {
// If you add code to the Runner application, consider adding tests here.
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
}
}
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:aivoice_plugin/aivoice_plugin.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
final _aivoicePlugin = AivoicePlugin();
@override
void initState() {
super.initState();
initPlatformState();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
String platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
// We also handle the message potentially returning null.
try {
platformVersion =
await _aivoicePlugin.getPlatformVersion() ?? 'Unknown platform version';
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
setState(() {
_platformVersion = platformVersion;
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Text('Running on: $_platformVersion\n'),
),
),
);
}
}
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
aivoice_plugin:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "0.0.1"
async:
dependency: transitive
description:
name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.dev"
source: hosted
version: "2.11.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
characters:
dependency: transitive
description:
name: characters
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
clock:
dependency: transitive
description:
name: clock
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
url: "https://pub.dev"
source: hosted
version: "1.1.1"
collection:
dependency: transitive
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.18.0"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
url: "https://pub.dev"
source: hosted
version: "1.0.8"
fake_async:
dependency: transitive
description:
name: fake_async
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
url: "https://pub.dev"
source: hosted
version: "1.3.1"
file:
dependency: transitive
description:
name: file
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_driver:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
fuchsia_remote_debug_protocol:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
integration_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
url: "https://pub.dev"
source: hosted
version: "10.0.0"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
url: "https://pub.dev"
source: hosted
version: "2.0.1"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
url: "https://pub.dev"
source: hosted
version: "2.0.1"
lints:
dependency: transitive
description:
name: lints
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
url: "https://pub.dev"
source: hosted
version: "3.0.0"
matcher:
dependency: transitive
description:
name: matcher
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.dev"
source: hosted
version: "0.12.16+1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
url: "https://pub.dev"
source: hosted
version: "1.11.0"
path:
dependency: transitive
description:
name: path
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.9.0"
platform:
dependency: transitive
description:
name: platform
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
url: "https://pub.dev"
source: hosted
version: "3.1.4"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.dev"
source: hosted
version: "2.1.8"
process:
dependency: transitive
description:
name: process
sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32"
url: "https://pub.dev"
source: hosted
version: "5.0.2"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_span:
dependency: transitive
description:
name: source_span
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev"
source: hosted
version: "1.10.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.2"
string_scanner:
dependency: transitive
description:
name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
sync_http:
dependency: transitive
description:
name: sync_http
sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961"
url: "https://pub.dev"
source: hosted
version: "0.3.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
url: "https://pub.dev"
source: hosted
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev"
source: hosted
version: "0.6.1"
vector_math:
dependency: transitive
description:
name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.dev"
source: hosted
version: "2.1.4"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
url: "https://pub.dev"
source: hosted
version: "13.0.0"
webdriver:
dependency: transitive
description:
name: webdriver
sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
sdks:
dart: ">=3.3.4 <4.0.0"
flutter: ">=3.3.0"
name: aivoice_plugin_example
description: "Demonstrates how to use the aivoice_plugin plugin."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
environment:
sdk: '>=3.3.4 <4.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
aivoice_plugin:
# When depending on this package from a real application you should use:
# aivoice_plugin: ^x.y.z
# See https://dart.dev/tools/pub/dependencies#version-constraints
# The example app is bundled with the plugin so we use a path dependency on
# the parent directory to use the current plugin's version.
path: ../
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.6
dev_dependencies:
integration_test:
sdk: flutter
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^3.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:aivoice_plugin_example/main.dart';
void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) => widget is Text &&
widget.data!.startsWith('Running on:'),
),
findsOneWidget,
);
});
}
.idea/
.vagrant/
.sconsign.dblite
.svn/
.DS_Store
*.swp
profile
DerivedData/
build/
GeneratedPluginRegistrant.h
GeneratedPluginRegistrant.m
.generated/
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3
xcuserdata
*.moved-aside
*.pyc
*sync/
Icon?
.tags*
/Flutter/Generated.xcconfig
/Flutter/ephemeral/
/Flutter/flutter_export_environment.sh
\ No newline at end of file
#import <Flutter/Flutter.h>
@interface AivoicePlugin : NSObject<FlutterPlugin>
@end
#import "AivoicePlugin.h"
@interface AivoicePlugin ()
@end
@implementation AivoicePlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
FlutterMethodChannel* channel = [FlutterMethodChannel
methodChannelWithName:@"aivoice_plugin"
binaryMessenger:[registrar messenger]];
AivoicePlugin* instance = [[AivoicePlugin alloc] init];
[registrar addMethodCallDelegate:instance channel:channel];
}
- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
if ([@"getPlatformVersion" isEqualToString:call.method]) {
result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
} else if ([@"initEngine" isEqualToString:call.method]) {
// 空实现
result(nil);
} else {
result(FlutterMethodNotImplemented);
}
}
@end
//
// FileRecorder.h
// SpeechDemo
//
// Created by fangweiwei on 2021/8/31.
// Copyright © 2021 fangweiwei. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <SpeechEngineToB/SpeechEngine.h>
NS_ASSUME_NONNULL_BEGIN
@interface FileRecorder : NSObject
- (void)setSpeechEngine:(SpeechEngine *)engine;
- (BOOL)startWithPath:(NSString *)path filename:(NSString *)filename;
- (void)stop;
@end
NS_ASSUME_NONNULL_END
//
// FileRecorder.m
// SpeechDemo
//
// Created by fangweiwei on 2021/8/31.
// Copyright © 2021 fangweiwei. All rights reserved.
//
#import "FileRecorder.h"
#import "FileUtils.h"
@interface FileRecorder ()
@property (nonatomic, weak) SpeechEngine *curEngine;
@property (nonatomic, strong) NSThread *worker;
@property (nonatomic, copy) NSString *path;
@property (nonatomic, copy) NSString *filename;
@end
@implementation FileRecorder
- (instancetype)init
{
self = [super init];
if (self) {
_worker = nil;
}
return self;
}
- (void)setSpeechEngine:(SpeechEngine *)engine {
self.curEngine = engine;
}
- (BOOL)startWithPath:(NSString *)path filename:(NSString *)filename {
if (self.worker) {
if (self.worker.executing) {
NSLog(@"Already start!");
return TRUE;
}
[self.worker cancel];
self.worker = nil;
}
self.path = path;
self.filename = filename;
self.worker = [[NSThread alloc] initWithTarget:self selector:@selector(runner) object:nil];
[self.worker start];
return TRUE;
}
- (void)stop {
if (!self.worker) {
NSLog(@"Not start yet!");
return;
}
[self.worker cancel];
self.worker = nil;
}
- (void)runner {
NSUInteger dataLength = 8000 * 2 * 0.1;
NSFileHandle *file = [FileUtils openFileForReading:self.filename inPath:self.path];
NSUInteger total = 0;
while (!self.worker.cancelled) {
NSData *data;
if (![FileUtils readData:&data length:dataLength fromFileHandel:file]) {
break;
}
total += data.length;
if (data.length > 0) {
SEErrorCode ret = [self.curEngine feedAudio:(int16_t *)data.bytes length:(int32_t)(data.length / 2)];
if (ret) {
NSLog(@"Feed audio data failed: %d, lenght: %lu.", ret, (unsigned long)(data.length / 2));
break;
}
} else {
NSLog(@"Finished reading");
break;
}
}
NSLog(@"Read tatal: %lu", (unsigned long)total);
[FileUtils closeFile:file];
}
@end
//
// FileUtils.h
// SpeechDemo
//
// Created by fangweiwei on 2020/6/16.
// Copyright © 2020 fangweiwei. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface FileUtils : NSObject
+ (NSFileHandle *)openFileForReading:(NSString *)filename inPath:(NSString *)path;
+ (NSFileHandle *)openFileForWriting:(NSString *)filename inPath:(NSString *)path;
+ (BOOL)writeData:(NSData *)data toFileHandel:(NSFileHandle *)fileHandle;
+ (BOOL)readData:(NSData *_Nullable*_Nullable)data length:(NSUInteger)length fromFileHandel:(NSFileHandle *)fileHandle;
+ (void)closeFile:(NSFileHandle *)filehandle;
@end
NS_ASSUME_NONNULL_END
//
// FileUtils.m
// SpeechDemo
//
// Created by fangweiwei on 2020/6/16.
// Copyright © 2020 fangweiwei. All rights reserved.
//
#import "FileUtils.h"
@implementation FileUtils
+ (NSFileHandle *)openFileForReading:(NSString *)filename inPath:(NSString *)path {
NSString *filePath = [path stringByAppendingPathComponent:filename];
return [NSFileHandle fileHandleForReadingAtPath:filePath];
}
+ (NSFileHandle *)openFileForWriting:(NSString *)filename inPath:(NSString *)path {
NSString *filePath = [path stringByAppendingPathComponent:filename];
[[NSFileManager defaultManager] createFileAtPath:filePath contents:nil attributes:nil];
return [NSFileHandle fileHandleForUpdatingAtPath:filePath];
}
+ (BOOL)writeData:(NSData *)data toFileHandel:(NSFileHandle *)fileHandle {
if (fileHandle && data) {
@try {
[fileHandle writeData:data];
} @catch (NSException *exception) {
NSLog(@"FileUtils, write data failed: %@", exception.description);
return FALSE;
}
return TRUE;
}
return FALSE;
}
+ (BOOL)readData:(NSData **)data length:(NSUInteger)length fromFileHandel:(NSFileHandle *)fileHandle {
if (fileHandle && data) {
NSError *err;
if (@available(iOS 13.0, *)) {
*data = [fileHandle readDataUpToLength:length error:&err];
if (err) {
NSLog(@"FileUtils read data failed: %@.", err);
return FALSE;
}
}
return TRUE;
}
return FALSE;
}
+ (void)closeFile:(NSFileHandle *)filehandle {
if (filehandle) {
[filehandle closeFile];
}
}
@end
//
// SensitiveDefines.h
// SpeechDemo
//
// Created by bytedance on 2022/12/9.
// Copyright © 2022 tianlei.richard. All rights reserved.
//
#define SensitiveDefines_h
/**
* SensitiveDefines
* Defines in this class should be different for different business,
* please contact with @Bytedance AILab about what value should be set before use it.
*/
// User Info
extern NSString* SDEF_UID;
// Online & Resource Authentication
extern NSString* SDEF_APPID;
extern NSString* SDEF_TOKEN;
extern NSString* SDEF_APP_VERSION;
// Offline Authentication
extern NSString* SDEF_AUTHENTICATE_ADDRESS;
extern NSString* SDEF_AUTHENTICATE_URI;
extern NSString* SDEF_SECRET;
extern NSString* SDEF_BUSINESS_KEY;
extern NSString* SDEF_LICENSE_NAME;
extern NSString* SDEF_LICENSE_BUSI_ID;
// Address
extern NSString* SDEF_DEFAULT_ADDRESS;
extern NSString* SDEF_DEFAULT_HTTP_ADDRESS;
// ASR
extern NSString* SDEF_ASR_DEFAULT_CLUSTER;
extern NSString* SDEF_ASR_DEFAULT_URI;
// AU
extern NSString* SDEF_AU_DEFAULT_CLUSTER;
extern NSString* SDEF_AU_DEFAULT_URI;
// TTS
extern NSString* SDEF_TTS_DEFAULT_URI;
extern NSString* SDEF_TTS_DEFAULT_CLUSTER;
extern NSString* SDEF_TTS_DEFAULT_BACKEND_CLUSTER;
extern NSString* SDEF_TTS_DEFAULT_ONLINE_VOICE;
extern NSString* SDEF_TTS_DEFAULT_ONLINE_VOICE_TYPE;
extern NSString* SDEF_TTS_DEFAULT_OFFLINE_VOICE;
extern NSString* SDEF_TTS_DEFAULT_OFFLINE_VOICE_TYPE;
extern NSString* SDEF_TTS_DEFAULT_ONLINE_LANGUAGE;
extern NSString* SDEF_TTS_DEFAULT_OFFLINE_LANGUAGE;
const NSArray* SDEF_TTS_DEFAULT_DOWNLOAD_OFFLINE_VOICES();
// VoiceClone
extern NSString* SDEF_VOICECLONE_DEFAULT_UIDS;
extern int SDEF_VOICECLONE_DEFAULT_TASK_ID;
// VoiceConv
extern NSString* SDEF_VOICECONV_DEFAULT_URI;
extern NSString* SDEF_VOICECONV_DEFAULT_CLUSTER;
extern NSString* SDEF_VOICECONV_DEFAULT_VOICE;
extern NSString* SDEF_VOICECONV_DEFAULT_VOICE_TYPE;
// Fulllink
extern NSString* SDEF_FULLLINK_DEFAULT_URI;
// Dialog
extern NSString* SDEF_DIALOG_DEFAULT_URI;
extern NSString* SDEF_DIALOG_DEFAULT_APP_ID;
extern NSString* SDEF_DIALOG_DEFAULT_ID;
extern NSString* SDEF_DIALOG_DEFAULT_ROLE;
extern NSString* SDEF_DIALOG_DEFAULT_CLOTHES_TYPE;
extern NSString* SDEF_DIALOG_DEFAULT_TTA_VOICE_TYPE;
// CAPT
extern NSString* SDEF_CAPT_DEFAULT_MDD_URI;
extern NSString* SDEF_CAPT_DEFAULT_CLUSTER;
//
// SensitiveDefines.m
// SpeechDemo
//
// Created by bytedance on 2022/12/9.
// Copyright © 2022 tianlei.richard. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SensitiveDefines.h"
// User Info
const NSString* SDEF_UID = @"YOUR UID";
// Online & Resource Authentication
const NSString* SDEF_APPID = @"2301072440";
const NSString* SDEF_TOKEN = @"Bearer;75UvJCpxRjTCppqQUkQ-o-4UfjnCgVmp";//;
const NSString* SDEF_APP_VERSION = @"1.0.0";
// Offline Authentication
const NSString* SDEF_AUTHENTICATE_ADDRESS = @"AUTHENTICAT ADDRESS";
const NSString* SDEF_AUTHENTICATE_URI = @"AUTHENTICATE URI";
const NSString* SDEF_SECRET = @"YOUR SECRET";
const NSString* SDEF_BUSINESS_KEY = @"YOUR BUSINESS KEY";
const NSString* SDEF_LICENSE_NAME = @"YOUR LICENSE NAME";
const NSString* SDEF_LICENSE_BUSI_ID = @"YOUR LICENSE BUSI_ID";
// Address
const NSString* SDEF_DEFAULT_ADDRESS = @"wss://openspeech.bytedance.com";
const NSString* SDEF_DEFAULT_HTTP_ADDRESS = @"https://openspeech.bytedance.com";
// ASR
const NSString* SDEF_ASR_DEFAULT_CLUSTER = @"volcengine_streaming_common";
const NSString* SDEF_ASR_DEFAULT_URI = @"/api/v2/asr";
// AU
const NSString* SDEF_AU_DEFAULT_CLUSTER = @"YOUR AU CLUSTER";
const NSString* SDEF_AU_DEFAULT_URI = @"/api/v1/sauc";
// TTS
const NSString* SDEF_TTS_DEFAULT_URI = @"/api/v1/tts/ws_binary";
const NSString* SDEF_TTS_DEFAULT_CLUSTER = @"volcano_tts";
const NSString* SDEF_TTS_DEFAULT_BACKEND_CLUSTER = @"YOUR TTS BACKEND CLUSTER";
const NSString* SDEF_TTS_DEFAULT_ONLINE_VOICE = @"灿灿";
const NSString* SDEF_TTS_DEFAULT_ONLINE_VOICE_TYPE = @"BV213_w5H18f6VbKnhg3Ph";
//BV002_streaming BV021_PSj8BvWAZyepfUPB BV705_streaming BV115_H74MBi790rUFu993 BV213_w5H18f6VbKnhg3Ph
const NSString* SDEF_TTS_DEFAULT_OFFLINE_VOICE = @"YOUR TTS OFFLINE VOICE";
const NSString* SDEF_TTS_DEFAULT_OFFLINE_VOICE_TYPE = @"YOUR TTS OFFLINE VOICE TYPE";
const NSString* SDEF_TTS_DEFAULT_ONLINE_LANGUAGE = @"YOUT TTS ONLINE LANGUAGE";
const NSString* SDEF_TTS_DEFAULT_OFFLINE_LANGUAGE = @"YOUT TTS OFFLINE LANGUAGE";
const NSArray* SDEF_TTS_DEFAULT_DOWNLOAD_OFFLINE_VOICES() { return @[]; }
// VoiceClone
const NSString* SDEF_VOICECLONE_DEFAULT_UIDS = @"uid_1;uid_2";
int SDEF_VOICECLONE_DEFAULT_TASK_ID = -1;
// VoiceConv
const NSString* SDEF_VOICECONV_DEFAULT_URI = @"/api/v1/voice_conv/ws";
const NSString* SDEF_VOICECONV_DEFAULT_CLUSTER = @"YOUR VOICECONV CLUSTER";
const NSString* SDEF_VOICECONV_DEFAULT_VOICE = @"VOICECONV VOICE";
const NSString* SDEF_VOICECONV_DEFAULT_VOICE_TYPE = @"VOICECONV VOICE TYPE";
// Fulllink
const NSString* SDEF_FULLLINK_DEFAULT_URI = @"FULLLINK URI";
// Dialog
const NSString* SDEF_DIALOG_DEFAULT_URI = @"DIALOG URI";
const NSString* SDEF_DIALOG_DEFAULT_APP_ID = @"DIALOG APP ID";
const NSString* SDEF_DIALOG_DEFAULT_ID = @"DIALOG ID";
const NSString* SDEF_DIALOG_DEFAULT_ROLE = @"DIALOG ROLE";
const NSString* SDEF_DIALOG_DEFAULT_CLOTHES_TYPE = @"DIALOG CLOTHES TYPE";
const NSString* SDEF_DIALOG_DEFAULT_TTA_VOICE_TYPE = @"DIALOG TTA_VOICE_TYPE";
// CAPT
const NSString* SDEF_CAPT_DEFAULT_MDD_URI = @"CAPT MDD URI";
const NSString* SDEF_CAPT_DEFAULT_CLUSTER = @"YOUR CAPT CLUSTER";
//
// SettingViewDelegate.h
// SpeechDemo
//
// Created by bytedance on 2021/3/26.
// Copyright © 2021 chengzihao.ds. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "Settings.h"
#pragma mark - SettingItemCell
@interface SettingItemCell : UITableViewCell<UITextFieldDelegate>
@property (weak, nonatomic) Settings *settings;
@property (weak, nonatomic) UITableView* parent;
-(void)init:(Settings*)settings parent:(UITableView*)parent;
-(SettingItem*)getCorrespondItem;
- (BOOL)textFieldShouldReturn:(UITextField *)textField;
@end
#pragma mark - SettingBoolCell
@interface SettingBoolCell : SettingItemCell
@property (weak, nonatomic) IBOutlet UILabel *keyLabel;
@property (weak, nonatomic) IBOutlet UISwitch *valSwitch;
-(void)switchAction:(UISwitch*)sender;
@end
#pragma mark - SettingIntCell
@interface SettingIntCell : SettingItemCell
@property (weak, nonatomic) IBOutlet UILabel *keyLabel;
@property (weak, nonatomic) IBOutlet UITextField *valTextField;
-(void)textFieldDidChange :(UITextField *)textField;
@end
#pragma mark - SettingStringCell
@interface SettingStringCell : SettingItemCell
@property (weak, nonatomic) IBOutlet UILabel *keyLabel;
@property (weak, nonatomic) IBOutlet UITextField *valTextField;
-(void)textFieldDidChange :(UITextField *)textField;
@end
#pragma mark - SettingOptionsCell
@interface SettingOptionsCell : SettingItemCell<UIPickerViewDelegate, UIPickerViewDataSource>
@property (weak, nonatomic) IBOutlet UILabel *keyLabel;
@property (weak, nonatomic) IBOutlet UITextField *valTextField;
@property (strong, nonatomic) UIPickerView *pickerView;
@property (strong, nonatomic) UIToolbar *pickerToolbar;
-(void)pickerConfirm;
-(void)pickerCancel;
@end
#pragma mark - SettingViewDelegate
@interface SettingViewDelegate : NSObject<UITableViewDelegate, UITableViewDataSource>
@property (strong, nonatomic) Settings* settings;
+ (instancetype)build:(Settings*)settings;
@end
//
// Settings.h
// SpeechDemo
//
// Created by bytedance on 2021/3/26.
// Copyright © 2021 chengzihao.ds. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
#pragma mark - SettingType
typedef NS_ENUM(NSInteger, SettingType) {
kSettingGroup = 0,
kSettingBool = 1,
kSettingInt = 2,
kSettingString = 3,
kSettingOptions = 4,
};
#pragma mark - SettingOptions
@interface SettingOptions : NSObject
@property (strong, nonatomic) NSArray* optionsArray;
@property (assign, nonatomic) int chooseIdx;
+ (instancetype)build:(NSArray*)ops choose:(int)idx;
@end
#pragma mark - SettingItem
@interface SettingItem : NSObject
@property (assign, nonatomic) SettingType type;
@property (strong, nonatomic) NSString* key;
@property (strong, nonatomic) NSObject* value;
@property (strong, nonatomic) NSString* hint;
+ (instancetype)build:(SettingType)type key:(NSString*)key val:(NSObject*)val hint:(NSString*)hint;
+ (instancetype)buildGroup:(NSString*)key val:(NSString*)val hint:(NSString*)hint;
+ (instancetype)buildBool:(NSString*)key val:(BOOL)val hint:(NSString*)hint;
+ (instancetype)buildInt:(NSString*)key val:(int)val hint:(NSString*)hint;
+ (instancetype)buildString:(NSString*)key val:(NSString*)val hint:(NSString*)hint;
+ (instancetype)buildOptions:(NSString*)key val:(SettingOptions*)val hint:(NSString*)hint;
@end
#pragma mark - Settings
@interface Settings : NSObject
// kSettingGroup type, use SettingItem 1 dimension array.
@property (strong, nonatomic) NSMutableArray* groups;
// other type, use SettingItem 2 dimension array. 1st dimension for each group, 2nd dimension for detail SettingItem in group.
@property (strong, nonatomic) NSMutableArray* configs;
+ (instancetype)build;
- (void)registerItems:(NSArray*)cfgs;
- (void)setBool:(NSString*)key;
- (void)setBool:(NSString*)key val:(BOOL)val;
- (void)setInt:(NSString*)key;
- (void)setInt:(NSString*)key val:(int)val;
- (void)setString:(NSString*)key;
- (void)setString:(NSString*)key val:(NSString*)val;
- (void)setOptions:(NSString*)key;
- (void)setOptions:(NSString*)key val:(SettingOptions*)val;
- (BOOL)getBool:(NSString*)key;
- (BOOL)getBool:(NSString*)key def:(BOOL)def;
- (int)getInt:(NSString*)key;
- (int)getInt:(NSString*)key def:(int)def;
- (NSString*)getString:(NSString*)key;
- (NSString*)getString:(NSString*)key def:(NSString*)def;
- (SettingOptions*)getOptions:(NSString*)key;
- (SettingOptions*)getOptions:(NSString*)key def:(SettingOptions*)def;
- (NSString*)getOptionsValue:(NSString*)key;
@end
NS_ASSUME_NONNULL_END
//
// Settings.m
// SpeechDemo
//
// Created by bytedance on 2021/3/26.
// Copyright © 2021 chengzihao.ds. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Settings.h"
#pragma mark - SettingOptions
@implementation SettingOptions
+ (instancetype)build:(NSArray*)ops choose:(int)idx {
SettingOptions* instance = [[self alloc] init];
instance.optionsArray = ops;
instance.chooseIdx = idx;
return instance;
}
@end
#pragma mark - SettingItem
@implementation SettingItem
+ (instancetype)build:(SettingType)type key:(NSString*)key val:(NSObject*)val hint:(NSString*)hint {
SettingItem* instance = [[self alloc] init];
instance.key = key;
instance.type = type;
instance.value = val;
instance.hint = hint;
return instance;
}
+ (instancetype)buildGroup:(NSString*)key val:(NSString*)val hint:(NSString*)hint {
return [SettingItem build:kSettingGroup key:key val:val hint:hint];
}
+ (instancetype)buildBool:(NSString*)key val:(BOOL)val hint:(NSString*)hint {
return [SettingItem build:kSettingBool key:key val:val ? @1 : @0 hint:hint];
}
+ (instancetype)buildInt:(NSString*)key val:(int)val hint:(NSString*)hint {
return [SettingItem build:kSettingInt key:key val:@(val) hint:hint];
}
+ (instancetype)buildString:(NSString*)key val:(NSString*)val hint:(NSString*)hint {
return [SettingItem build:kSettingString key:key val:val hint:hint];
}
+ (instancetype)buildOptions:(NSString*)key val:(SettingOptions*)val hint:(NSString*)hint {
return [SettingItem build:kSettingOptions key:key val:val hint:hint];
}
@end
#pragma mark - Settings
@implementation Settings
+ (instancetype)build {
Settings* instance = [[self alloc] init];
instance.groups = [[NSMutableArray alloc]init];
instance.configs = [[NSMutableArray alloc]init];
// configs has at least one group
[instance.configs addObject:[[NSMutableArray alloc] init]];
return instance;
}
- (void)setItem:(SettingItem*)item {
if (item.type == kSettingGroup) {
// group type
for (int i = 0; i < _groups.count; ++i) {
SettingItem* groupItem = _groups[i];
if ([groupItem.key isEqualToString:item.key]) {
// same group exist, do nothing
return;
}
}
[_groups addObject:item];
NSMutableArray* group = _configs[0];
if (_configs.count == 1 && group.count == 0) {
// first group has no items yet, means this is first group
return;
}
// append new group
[_configs addObject:[[NSMutableArray alloc] init]];
return;
} else {
// other type
NSMutableArray* group = NULL;
for (int i = 0; i < _configs.count; ++i) {
group = _configs[i];
for (int j = 0; j < group.count; ++j) {
SettingItem* cur = group[j];
if ([cur.key isEqualToString:item.key]) {
_configs[i][j] = item;
return;
}
}
}
// default add to last group
[group addObject:item];
}
}
- (SettingItem*)getItem:(NSString*)key type:(SettingType)type {
if (type == kSettingGroup) {
// group type
for (int i = 0; i < _groups.count; ++i) {
SettingItem* cur = _groups[i];
if ([cur.key isEqualToString:key]) {
return cur;
}
}
return NULL;
} else {
// other type
for (int i = 0; i < _configs.count; ++i) {
NSMutableArray* group = _configs[i];
for (int j = 0; j < group.count; ++j) {
SettingItem* cur = group[j];
if ([cur.key isEqualToString:key]) {
if (cur.type == type) {
return cur;
}
return NULL;
}
}
}
return NULL;
}
return NULL;
}
- (void)registerItems:(NSArray*)cfgs {
for (int i = 0; i < cfgs.count; ++i) {
[self setItem:cfgs[i]];
}
}
- (void)setBool:(NSString*)key {
[self setBool:key val:false];
}
- (void)setBool:(NSString*)key val:(BOOL)val {
[self setItem:[SettingItem buildBool:key val:val hint:@""]];
}
- (void)setInt:(NSString*)key {
[self setInt:key val:0];
}
- (void)setInt:(NSString*)key val:(int)val {
[self setItem:[SettingItem buildInt:key val:val hint:@""]];
}
- (void)setString:(NSString*)key {
[self setString:key val:@""];
}
- (void)setString:(NSString*)key val:(NSString*)val {
[self setItem:[SettingItem buildString:key val:val hint:@""]];
}
- (void)setOptions:(NSString*)key {
[self setOptions:key val:[SettingOptions build:@[] choose:0]];
}
- (void)setOptions:(NSString*)key val:(SettingOptions*)val {
[self setItem:[SettingItem buildOptions:key val:val hint:@""]];
}
- (BOOL)getBool:(NSString*)key {
return [self getBool:key def:false];
}
- (BOOL)getBool:(NSString*)key def:(BOOL)def {
SettingItem* item = [self getItem:key type:kSettingBool];
if (item != NULL) {
NSNumber* val = (NSNumber*)item.value;
return [val intValue] == 1;
}
return def;
}
- (int)getInt:(NSString*)key {
return [self getInt:key def:0];
}
- (int)getInt:(NSString*)key def:(int)def {
SettingItem* item = [self getItem:key type:kSettingInt];
if (item != NULL) {
NSNumber* val = (NSNumber*)item.value;
return [val intValue];
}
return def;
}
- (NSString*)getString:(NSString*)key {
return [self getString:key def:@""];
}
- (NSString*)getString:(NSString*)key def:(NSString*)def {
SettingItem* item = [self getItem:key type:kSettingString];
if (item != NULL) {
return (NSString*)item.value;
}
return def;
}
- (SettingOptions*)getOptions:(NSString*)key {
return [self getOptions:key def:[SettingOptions build:@[] choose:0]];
}
- (SettingOptions*)getOptions:(NSString*)key def:(SettingOptions*)def {
SettingItem* item = [self getItem:key type:kSettingOptions];
if (item != NULL) {
return (SettingOptions*)item.value;
}
return def;
}
- (NSString*)getOptionsValue:(NSString*)key {
SettingItem* item = [self getItem:key type:kSettingOptions];
if (item != NULL) {
SettingOptions *options = (SettingOptions*)item.value;
return options.optionsArray[options.chooseIdx];
}
return @"";
}
@end
//
// SettingsHelper.h
// SpeechDemo
//
// Created by bytedance on 2020/9/9.
// Copyright © 2020 fengkai.0518. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Settings.h"
NS_ASSUME_NONNULL_BEGIN
#pragma mark - SETTING_KEY
// common
extern NSString *const SETTING_COMMON;
extern NSString *const SETTING_APPID;
extern NSString *const SETTING_TOKEN;
extern NSString *const SETTING_CLUSTER;
extern NSString *const SETTING_ADDRESS;
extern NSString *const SETTING_URI;
extern NSString *const SETTING_VOICE;
extern NSString *const SETTING_VOICE_TYPE;
extern NSString *const SETTING_ONLINE_VOICE;
extern NSString *const SETTING_ONLINE_VOICE_TYPE;
extern NSString *const SETTING_OFFLINE_VOICE;
extern NSString *const SETTING_OFFLINE_VOICE_TYPE;
extern NSString *const SETTING_GET_VOLUME;
extern NSString *const SETTING_RECORD_TYPE;
extern NSString *const SETTING_RECORD_SAVE;
extern NSString *const SETTING_RECORD_FILE_TYPE;
extern NSString *const SETTING_SAMPLE_RATE;
extern NSString *const SETTING_CHANNEL;
extern NSString *const SETTING_ENABLE_AEC;
extern NSString *const SETTING_RESTART_AUDIO_SESSION_ENABLE;
extern NSString *const SETTING_RESUME_OTHERS_INTERRUPTED_PLAYBACK_ENABLE;
extern NSString *const SETTING_AUTHENTICATION_TYPE;
extern NSString *const SETTING_BUSINESS_KEY;
extern NSString *const SETTING_AUTHENTICATE_SECRET;
extern NSString *const SETTING_AUDIO_FADEOUT_DURATION;
extern NSString *const SETTING_VAD_MAX_SPEECH_DURATION;
extern NSString *const SETTING_VAD_MAX_MUSIC_DURATION;
extern NSString *const SETTING_STREAM_PACKAGE_DURATION;
// asr
extern NSString *const SETTING_ASR;
extern NSString *const SETTING_ASR_WORK_MODE;
extern NSString *const SETTING_ASR_SCENARIO_TYPE;
extern NSString *const SETTING_ASR_RECORDER_SAVE;
extern NSString *const SETTING_ASR_ENABLE_DDC;
extern NSString *const SETTING_ASR_ENABLE_ITN;
extern NSString *const SETTING_ASR_ENABLE_NLU_PUNC;
extern NSString *const SETTING_ASR_DISABLE_END_PUNC;
extern NSString *const SETTING_ASR_KEEP_RECORDING;
extern NSString *const SETTING_ASR_HOTWORDS;
extern NSString *const SETTING_ASR_CORRECTWORDS;
extern NSString *const SETTING_ASR_VAD_START_SILENCE_TIME;
extern NSString *const SETTING_ASR_VAD_END_SILENCE_TIME;
extern NSString *const SETTING_ASR_VAD_MODE;
extern NSString *const SETTING_ASR_RESULT_TYPE;
extern NSString *const SETTING_ASR_MAX_RETRY_TIMES;
extern NSString *const SETTING_ASR_SHOW_LANGUAGE;
extern NSString *const SETTING_ASR_LANGUAGE;
extern NSString *const SETTING_ASR_AUTO_STOP;
// capt
extern NSString *const SETTING_CAPT;
extern NSString *const SETTING_CAPT_RECORDER_SAVE;
extern NSString *const SETTING_CAPT_STREAMING_MODE;
extern NSString *const SETTING_CAPT_CORE_TYPE;
extern NSString *const SETTING_CAPT_DIFFICULTY_LEVEL;
// fulllink
extern NSString *const SETTING_FULLLINK;
extern NSString *const SETTING_FULLLINK_ENGINE_TYPE;
extern NSString *const SETTING_FULLLINK_WAKEUP_WORDS;
extern NSString *const SETTING_FULLLINK_ENABLE_RECORDER_DUMP;
extern NSString *const SETTING_FULLLINK_ENABLE_KWS_DUMP;
extern NSString *const SETTING_FULLLINK_WAKEUP_MODE;
extern NSString *const SETTING_FULLLINK_ONLY_ASR;
extern NSString *const SETTING_FULLLINK_DISABLE_TTS;
extern NSString *const SETTING_FULLLINK_DISABLE_SIGNAL;
extern NSString *const SETTING_FULLLINK_DISABLE_DEVICE_TYPE;
extern NSString *const SETTING_FULLLINK_DISABLE_SIGTHREAD_PRI;
extern NSString *const SETTING_FULLLINK_DISABLE_FILE_OR_DIRECTORY_NAME;
// tts
extern NSString *const SETTING_TTS;
extern NSString *const SETTING_TTS_ONLINE_LANGUAGE;
extern NSString *const SETTING_TTS_OFFLINE_LANGUAGE;
extern NSString *const SETTING_TTS_ENABLE_PLAYER;
extern NSString *const SETTING_TTS_ENABLE_DUMP;
extern NSString *const SETTING_TTS_ENABLE_DATA_CALLBACK;
extern NSString *const SETTING_TTS_ENABLE_CACHE;
extern NSString *const SETTING_TTS_WITH_INTENT;
extern NSString *const SETTING_TTS_LIMIT_CPU_USAGE;
extern NSString *const SETTING_TTS_TEXT_TYPE;
extern NSString *const SETTING_TTS_WORK_MODE;
extern NSString *const SETTING_TTS_SPEAK_SPEED;
extern NSString *const SETTING_TTS_AUDIO_VOLUME;
extern NSString *const SETTING_TTS_AUDIO_PITCH;
extern NSString *const SETTING_TTS_SAMPLE_RATE;
extern NSString *const SETTING_TTS_EMOTION;
extern NSString *const SETTING_TTS_MODEL_NAME;
extern NSString *const SETTING_TTS_SILENCE_DURATION;
extern NSString *const SETTING_TTS_OFFLINE_RESOURCE_FORMAT;
extern NSString *const SETTING_TTS_LICENSE_NAME;
extern NSString *const SETTING_TTS_LICENSE_BUSI_ID;
extern NSString *const SETTING_TTS_BACKEND_CLUSTER;
extern NSString *const SETTING_TTS_SILENCE_DURATION;
extern NSString *const SETTING_TTS_USE_VOICECLONE_VOICE;
// voiceclone
extern NSString *const SETTING_VOICECLONE;
extern NSString *const SETTING_VOICECLONE_ADDRESS;
extern NSString *const SETTING_VOICECLONE_STREAM_ADDRESS;
extern NSString *const SETTING_VOICECLONE_UID;
extern NSString *const SETTING_VOICECLONE_QUERY_UIDS;
extern NSString *const SETTING_VOICECLONE_VOICE_TYPE;
extern NSString *const SETTING_VOICECLONE_GENDER;
extern NSString *const SETTING_VOICECLONE_TASKID;
// voiceconv
extern NSString *const SETTING_VOICECONV;
extern NSString *const SETTING_VOICECONV_RESULT_SAMPLE_RATE;
extern NSString *const SETTING_VOICECONV_ENABLE_RECORD_DUMP;
extern NSString *const SETTING_VOICECONV_ENABLE_RESULT_DUMP;
extern NSString *const SETTING_VOICECONV_REQUEST_INTERVAL;
// dialog
extern NSString *const SETTING_DIALOG;
extern NSString *const SETTING_DIALOG_ID;
extern NSString *const SETTING_DIALOG_ROLE;
extern NSString *const SETTING_DIALOG_CLOTHES_TYPE;
extern NSString *const SETTING_DIALOG_TTA_VOICE_TYPE;
// vad
extern NSString *const SETTING_VAD;
extern NSString *const SETTING_VAD_RECORDER_SAVE;
extern NSString *const SETTING_VAD_HEAD_SILENCE_THRESHOLD;
extern NSString *const SETTING_VAD_TAIL_SILENCE_THRESHOLD;
// au
extern NSString *const SETTING_AU;
extern NSString *const SETTING_AU_ABILITY;
extern NSString *const SETTING_AU_RECORDER_SAVE;
extern NSString *const SETTING_AU_PROCESS_TIMEOUT;
extern NSString *const SETTING_AU_AUDIO_PACKET_DURATION;
extern NSString *const SETTING_AU_EMPTY_PACKET_INTERVAL;
#pragma mark - SETTING_HELPER
@interface SettingsHelper : NSObject
+ (instancetype)shareInstance;
- (Settings*)getSettings:(NSString*)engine;
@end
NS_ASSUME_NONNULL_END
//
// SettingsViewController.h
// SpeechDemo
//
// Created by fangweiwei on 2020/2/28.
// Copyright © 2020 fangweiwei. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface SettingsViewController : UITableViewController
@property (strong, nonatomic) NSString *viewId;
@end
NS_ASSUME_NONNULL_END
//
// SettingsViewController.m
// SpeechDemo
//
// Created by fangweiwei on 2020/2/28.
// Copyright © 2020 fangweiwei. All rights reserved.
//
#import "SettingsViewController.h"
#import "SettingsHelper.h"
#import "SettingViewDelegate.h"
@interface SettingsViewController () <UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UITableView *settingTableView;
@property (strong, nonatomic) SettingViewDelegate *settingViewDelegate;
@end
@implementation SettingsViewController
- (void)viewDidLoad {
[super viewDidLoad];
SettingsHelper* settingsInstance = [SettingsHelper shareInstance];
self.settingViewDelegate = [SettingViewDelegate build:[settingsInstance getSettings:self.viewId]];
self.settingTableView.delegate = self.settingViewDelegate;
self.settingTableView.dataSource = self.settingViewDelegate;
}
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
[segue destinationViewController];
}
@end
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论