├── .gitignore ├── .idea ├── libraries │ └── Dart_SDK.xml ├── modules.xml ├── runConfigurations │ └── example_lib_main_dart.xml └── workspace.xml ├── .metadata ├── 1.png ├── 2.png ├── 3.png ├── CHANGELOG.md ├── LICENSE ├── README.md ├── acr_cloud_sdk.iml ├── analysis_options.yaml ├── android ├── .gitignore ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── libs │ ├── acrcloud-universal-sdk-1.2.20.jar │ ├── arm64-v8a │ │ └── libACRCloudUniversalEngine.so │ ├── armeabi-v7a │ │ └── libACRCloudUniversalEngine.so │ ├── armeabi │ │ └── libACRCloudUniversalEngine.so │ ├── mips │ │ └── libACRCloudUniversalEngine.so │ ├── mips64 │ │ └── libACRCloudUniversalEngine.so │ ├── x86 │ │ └── libACRCloudUniversalEngine.so │ └── x86_64 │ │ └── libACRCloudUniversalEngine.so ├── settings.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── kotlin │ └── com │ └── chizi │ └── acr_cloud_sdk │ ├── AcrCloudSdkPlugin.kt │ └── MethodCallHandlerImpl.kt ├── codemagic.yaml ├── example ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── chizi │ │ │ │ │ └── acr_cloud_sdk_example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── values-night │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── assets │ └── images │ │ ├── more.png │ │ └── music.png ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ ├── core │ │ ├── models │ │ │ └── deezer_song_model.dart │ │ ├── network_layer │ │ │ ├── api │ │ │ │ └── song.dart │ │ │ ├── base_network │ │ │ │ └── base_network.dart │ │ │ ├── base_repository.dart │ │ │ ├── exceptions │ │ │ │ └── exceptions.dart │ │ │ ├── failure │ │ │ │ └── failure.dart │ │ │ ├── helper │ │ │ │ └── api_helper.dart │ │ │ └── network │ │ │ │ └── network_info.dart │ │ ├── providers.dart │ │ └── viewmodel │ │ │ └── home_vm.dart │ ├── main.dart │ ├── utils │ │ ├── log.dart │ │ ├── margin.dart │ │ ├── navigator.dart │ │ ├── pretty_json.dart │ │ └── theme.dart │ └── views │ │ ├── home_page.dart │ │ └── song_detail.dart ├── macos │ ├── .gitignore │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ │ ├── Base.lproj │ │ └── MainMenu.xib │ │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ │ ├── DebugProfile.entitlements │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ └── Release.entitlements ├── pubspec.lock ├── pubspec.yaml └── test │ └── widget_test.dart ├── ios ├── .gitignore ├── Assets │ └── .gitkeep ├── Classes │ ├── ACRCloudConfig.h │ ├── ACRCloudRecognition.h │ ├── AcrCloudSdkPlugin.h │ ├── AcrCloudSdkPlugin.m │ └── SwiftAcrCloudSdkPlugin.swift ├── Libraries │ └── libACRCloud_IOS_SDK.a └── acr_cloud_sdk.podspec ├── lib ├── acr_cloud_sdk.dart └── src │ ├── acr_cloud.dart │ └── models │ └── song_model.dart ├── macos ├── Classes │ ├── ACRCloudConfig.h │ ├── ACRCloudRecognition.h │ ├── AcrCloudSdkPlugin.h │ ├── AcrCloudSdkPlugin.m │ └── SwiftAcrCloudSdkPlugin.swift ├── Libraries │ └── libACRCloud_IOS_SDK.a └── acr_cloud_sdk.podspec ├── pubspec.lock ├── pubspec.yaml └── test └── acr_cloud_sdk_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | -------------------------------------------------------------------------------- /.idea/libraries/Dart_SDK.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/runConfigurations/example_lib_main_dart.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: a0860f6e87ba4f9031bee4d6f56c08b970606bee 8 | channel: dev 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/1.png -------------------------------------------------------------------------------- /2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/2.png -------------------------------------------------------------------------------- /3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/3.png -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 2.0.2 2 | * Update sdk to >=2.19.2 <3.0.0 3 | 4 | ## 2.0.1 5 | * Update deps. 6 | 7 | ## 2.0.0 8 | * Migrated to null-saftey. 9 | 10 | ## 1.0.0 11 | * Initial release. 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Chiziaruhoma Ogbonda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ACR Cloud SDK 2 | `** This is an unofficial SDK for flutter` 3 | 4 | Automatic content recognition (ACR) is an identification technology to recognise content played on a media device or present in a media file. This enables users quickly obtain detailed information about the content they have just experienced without any text based input or search efforts. 5 | 6 | 7 | 8 | ## 🤔 How ACR works 9 | ACR can help users deal with multimedia more effective and make applications more intelligent. [More info](https://docs.acrcloud.com/tutorials/recognize-music). 10 | 11 | 12 | ## 📸 Screen Shots 13 | 14 |

15 | 16 | 17 | 18 |

19 | 20 | ### 🚀 Initialize SDK 21 | 22 | ```dart 23 | final AcrCloudSdk arc = AcrCloudSdk(); 24 | 25 | arc..init( 26 | host: '', // obtain from https://www.acrcloud.com/ 27 | accessKey: '', // obtain from https://www.acrcloud.com/ 28 | accessSecret: '', // obtain from https://www.acrcloud.com/ 29 | setLog: false, 30 | )..songModelStream.listen(searchSong); 31 | 32 | void searchSong(SongModel song) async { 33 | print(song); // Recognized song data 34 | } 35 | ``` 36 | 37 | Initialize sdk and listen for song recognition events. 38 | 39 | ### ️🎶 Start Recognition 40 | 41 | ```dart 42 | bool started = await arc.start(); 43 | ``` 44 | - This function will automatic start the recording and recognizing process. 45 | - When there’s a result, songModelStream & resultStream will return the data as events. 46 | - The whole recognition time is controlled by ACRCloud’s Server. 47 | - You can call the stop function to terminate this process. 48 | 49 | ### ⛔ Stop Recognition 50 | 51 | ```dart 52 | bool started = await arc.stop(); 53 | ``` 54 | - This function will cancel the recognition immediately. 55 | 56 | 57 | ## ✨ Contribution 58 | Lots of PR's would be needed to improve this plugin. So lots of suggestions and PRs are welcome. 59 | -------------------------------------------------------------------------------- /acr_cloud_sdk.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:lints/recommended.yaml 2 | 3 | 4 | analyzer: 5 | exclude: 6 | - flutter/* 7 | - example/** 8 | 9 | # Additional information about this file can be found at 10 | # https://dart.dev/guides/language/analysis-options 11 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'com.chizi.acr_cloud_sdk' 2 | version '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | ext.kotlin_version = '1.7.10' 6 | repositories { 7 | google() 8 | mavenCentral() 9 | } 10 | 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:7.2.0' 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | mavenCentral() 21 | } 22 | } 23 | 24 | apply plugin: 'com.android.library' 25 | apply plugin: 'kotlin-android' 26 | 27 | android { 28 | compileSdkVersion 31 29 | 30 | compileOptions { 31 | sourceCompatibility JavaVersion.VERSION_1_8 32 | targetCompatibility JavaVersion.VERSION_1_8 33 | } 34 | 35 | kotlinOptions { 36 | jvmTarget = '1.8' 37 | } 38 | 39 | sourceSets { 40 | main.java.srcDirs += 'src/main/kotlin' 41 | main.jniLibs.srcDirs = ['libs'] 42 | } 43 | 44 | defaultConfig { 45 | minSdkVersion 16 46 | } 47 | 48 | buildTypes { 49 | release { 50 | minifyEnabled false 51 | } 52 | } 53 | lintOptions { 54 | disable 'InvalidPackage' 55 | } 56 | } 57 | 58 | dependencies { 59 | implementation fileTree(include: ['*.jar'], dir: 'libs') 60 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 61 | } 62 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 6 | -------------------------------------------------------------------------------- /android/libs/acrcloud-universal-sdk-1.2.20.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/android/libs/acrcloud-universal-sdk-1.2.20.jar -------------------------------------------------------------------------------- /android/libs/arm64-v8a/libACRCloudUniversalEngine.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/android/libs/arm64-v8a/libACRCloudUniversalEngine.so -------------------------------------------------------------------------------- /android/libs/armeabi-v7a/libACRCloudUniversalEngine.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/android/libs/armeabi-v7a/libACRCloudUniversalEngine.so -------------------------------------------------------------------------------- /android/libs/armeabi/libACRCloudUniversalEngine.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/android/libs/armeabi/libACRCloudUniversalEngine.so -------------------------------------------------------------------------------- /android/libs/mips/libACRCloudUniversalEngine.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/android/libs/mips/libACRCloudUniversalEngine.so -------------------------------------------------------------------------------- /android/libs/mips64/libACRCloudUniversalEngine.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/android/libs/mips64/libACRCloudUniversalEngine.so -------------------------------------------------------------------------------- /android/libs/x86/libACRCloudUniversalEngine.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/android/libs/x86/libACRCloudUniversalEngine.so -------------------------------------------------------------------------------- /android/libs/x86_64/libACRCloudUniversalEngine.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/android/libs/x86_64/libACRCloudUniversalEngine.so -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'acr_cloud_sdk' 2 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /android/src/main/kotlin/com/chizi/acr_cloud_sdk/AcrCloudSdkPlugin.kt: -------------------------------------------------------------------------------- 1 | package com.chizi.acr_cloud_sdk 2 | 3 | import androidx.annotation.NonNull 4 | import io.flutter.embedding.engine.plugins.FlutterPlugin 5 | import io.flutter.embedding.engine.plugins.activity.ActivityAware 6 | import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding 7 | import io.flutter.plugin.common.EventChannel 8 | import io.flutter.plugin.common.MethodChannel 9 | 10 | 11 | /** AcrCloudSdkPlugin */ 12 | class AcrCloudSdkPlugin: FlutterPlugin, ActivityAware { 13 | 14 | private var channel: MethodChannel? = null 15 | private var resultChannel: EventChannel? = null 16 | private var timeChannel: EventChannel? = null 17 | private val channelID = "plugins.chizi.tech/acr_cloud_sdk" 18 | private val resultChannelID = "plugins.chizi.tech/acr_cloud_sdk.result" 19 | private val timeChannelID = "plugins.chizi.tech/acr_cloud_sdk.time" 20 | private var handler: MethodCallHandlerImpl? = null 21 | 22 | override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { 23 | setupChannel(flutterPluginBinding) 24 | } 25 | 26 | override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { 27 | teardownChannel() 28 | } 29 | 30 | private fun setupChannel(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { 31 | channel = MethodChannel(flutterPluginBinding.binaryMessenger, channelID) 32 | resultChannel = EventChannel(flutterPluginBinding.binaryMessenger, resultChannelID) 33 | timeChannel = EventChannel(flutterPluginBinding.binaryMessenger, timeChannelID) 34 | handler = MethodCallHandlerImpl(flutterPluginBinding.applicationContext, null, timeChannel,resultChannel, channel!!) 35 | channel?.setMethodCallHandler(handler) 36 | } 37 | 38 | 39 | 40 | override fun onAttachedToActivity(binding: ActivityPluginBinding) { 41 | handler?.setActivity(binding.activity) 42 | } 43 | 44 | override fun onDetachedFromActivityForConfigChanges() { 45 | handler?.setActivity(null) 46 | } 47 | 48 | override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) { 49 | onAttachedToActivity(binding) 50 | } 51 | 52 | override fun onDetachedFromActivity() { 53 | // onDetachedFromActivity() 54 | } 55 | 56 | private fun teardownChannel() { 57 | channel?.setMethodCallHandler(null) 58 | channel = null 59 | handler = null 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /android/src/main/kotlin/com/chizi/acr_cloud_sdk/MethodCallHandlerImpl.kt: -------------------------------------------------------------------------------- 1 | package com.chizi.acr_cloud_sdk 2 | 3 | 4 | import android.Manifest 5 | import android.app.Activity 6 | import android.content.Context 7 | import android.content.pm.PackageManager 8 | import android.media.MediaPlayer 9 | import android.os.Handler 10 | import android.os.Looper 11 | import android.widget.TextView 12 | import androidx.core.app.ActivityCompat 13 | import com.acrcloud.rec.* 14 | import com.acrcloud.rec.utils.ACRCloudLogger 15 | import io.flutter.plugin.common.EventChannel 16 | import io.flutter.plugin.common.MethodCall 17 | import io.flutter.plugin.common.MethodChannel 18 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler 19 | import java.util.* 20 | 21 | 22 | internal class MethodCallHandlerImpl(context: Context, activity: Activity?, timeChannel: EventChannel?, resultChannel: EventChannel?, methodChannel: MethodChannel) : MethodCallHandler, IACRCloudListener, IACRCloudRadioMetadataListener, EventChannel.StreamHandler { 23 | 24 | private var context: Context? 25 | private var activity: Activity? 26 | private var timeChannel: EventChannel? 27 | private var resultChannel: EventChannel? 28 | private var methodChannel: MethodChannel? 29 | 30 | private val TAG: String = "acr_cloud_sdk" 31 | 32 | 33 | private var mProcessing = false 34 | private var mAutoRecognizing = false 35 | private var initState = false 36 | 37 | private val mediaPlayer = MediaPlayer() 38 | 39 | private var timeEvents: EventChannel.EventSink? = null 40 | private var resultEvents: EventChannel.EventSink? = null 41 | 42 | private val path = "" 43 | 44 | private var startTime: Long = 0 45 | private val stopTime: Long = 0 46 | 47 | private val PRINT_MSG = 1001 48 | 49 | private var mConfig: ACRCloudConfig? = null 50 | private var mClient: ACRCloudClient? = null 51 | 52 | fun setActivity(act: Activity?) { 53 | this.activity = act 54 | } 55 | 56 | init { 57 | this.activity = activity 58 | this.context = context 59 | this.resultChannel = resultChannel 60 | this.timeChannel = timeChannel 61 | this.methodChannel = methodChannel 62 | timeChannel?.setStreamHandler(this) 63 | resultChannel?.setStreamHandler(this) 64 | 65 | } 66 | 67 | override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) { 68 | Handler(Looper.getMainLooper()).post { 69 | when (call.method) { 70 | "init" -> { 71 | init(call, result) 72 | } 73 | "start" -> { 74 | start(call,result) 75 | } 76 | "cancel" -> { 77 | cancel(result) 78 | } 79 | else -> { 80 | result.notImplemented() 81 | } 82 | } 83 | 84 | } 85 | } 86 | 87 | private fun init(call: MethodCall, result: MethodChannel.Result) { 88 | 89 | val host = call.argument("host") 90 | val accessKey = call.argument("accessKey") 91 | val accessSecret = call.argument("accessSecret") 92 | 93 | 94 | val hostAuto = call.argument("hostAuto") 95 | val accessKeyAuto = call.argument("accessKeyAuto") 96 | val accessSecretAuto = call.argument("accessSecretAuto") 97 | 98 | val recorderConfigRate = call.argument("recorderConfigRate") ?: 8000 99 | val recorderConfigChannels= call.argument("recorderConfigChannels") ?: 1 100 | val isVolumeCallback = call.argument("isVolumeCallback")?: false 101 | val setLog = call.argument("setLog") ?: false 102 | 103 | try { 104 | 105 | verifyPermissions() 106 | 107 | mConfig = ACRCloudConfig() 108 | 109 | mConfig!!.acrcloudListener = this 110 | mConfig!!.context = context 111 | 112 | 113 | 114 | mConfig!!.host = host 115 | mConfig!!.accessKey = accessKey 116 | mConfig!!.accessSecret = accessSecret 117 | 118 | // auto recognize access key 119 | 120 | mConfig!!.hostAuto = hostAuto 121 | mConfig!!.accessKeyAuto = accessKeyAuto 122 | mConfig!!.accessSecretAuto = accessSecretAuto 123 | 124 | 125 | mConfig!!.recorderConfig.rate = recorderConfigRate 126 | mConfig!!.recorderConfig.channels = recorderConfigChannels 127 | 128 | // If you do not need volume callback, you set it false. 129 | 130 | mConfig!!.recorderConfig.isVolumeCallback = isVolumeCallback 131 | 132 | mClient = ACRCloudClient() 133 | ACRCloudLogger.setLog(setLog) 134 | 135 | initState = mClient!!.initWithConfig(mConfig) 136 | 137 | } catch (e: Exception){ 138 | result.error(TAG, null, e.toString()) 139 | } 140 | 141 | } 142 | 143 | 144 | 145 | 146 | private fun start(call: MethodCall, result: MethodChannel.Result) { 147 | val autoRecognize = call.argument("autoRecognize")?: false 148 | val requestRadioMeta = call.argument("requestRadioMetadata")?: false 149 | 150 | if(requestRadioMeta) requestRadioMetadata() 151 | 152 | if (autoRecognize) { 153 | openAutoRecognize(result) 154 | } else { 155 | closeAutoRecognize(result) 156 | } 157 | 158 | if (!initState) { 159 | result.error(TAG, "init error", "please initialize plugin with .init()") 160 | return 161 | } 162 | if (!mProcessing) { 163 | mProcessing = true 164 | if (mClient == null || !mClient!!.startRecognize()) { 165 | mProcessing = false 166 | 167 | result.error(TAG, "start error!", "Could not start the service") 168 | } 169 | startTime = System.currentTimeMillis() 170 | } 171 | } 172 | 173 | private fun cancel(result: MethodChannel.Result) { 174 | if (mProcessing && mClient != null) { 175 | mClient!!.cancel() 176 | } 177 | reset() 178 | result.success(true) 179 | } 180 | 181 | private fun openAutoRecognize(result: MethodChannel.Result) { 182 | if (!mAutoRecognizing) { 183 | mAutoRecognizing = true 184 | if (mClient == null || !mClient!!.runAutoRecognize()) { 185 | mAutoRecognizing = true 186 | result.error(TAG, "openAutoRecognize error!", "Could not openAutoRecognize") 187 | 188 | } 189 | } 190 | } 191 | 192 | private fun closeAutoRecognize(result: MethodChannel.Result) { 193 | if (mAutoRecognizing) { 194 | mAutoRecognizing = false 195 | mClient!!.cancelAutoRecognize() 196 | result.error(TAG, "closeAutoRecognize error!", "Could not closeAutoRecognize") 197 | 198 | } 199 | } 200 | 201 | // callback IACRCloudRadioMetadataListener 202 | private fun requestRadioMetadata() { 203 | val lat = "39.98" 204 | val lng = "116.29" 205 | val freq: MutableList = ArrayList() 206 | freq.add("88.7") 207 | if (!mClient!!.requestRadioMetadataAsyn(lat, lng, freq, 208 | ACRCloudConfig.RadioType.FM, this)) { 209 | println("requestRadioMetadata error") 210 | } 211 | } 212 | 213 | private fun reset() { 214 | mProcessing = false 215 | } 216 | 217 | private val REQUEST_EXTERNAL_STORAGE = 1 218 | private val PERMISSIONS = arrayOf( 219 | Manifest.permission.ACCESS_NETWORK_STATE, 220 | Manifest.permission.ACCESS_WIFI_STATE, 221 | Manifest.permission.INTERNET, 222 | Manifest.permission.RECORD_AUDIO 223 | ) 224 | 225 | private fun verifyPermissions() { 226 | for (i in PERMISSIONS.indices) { 227 | val permission = activity?.let { ActivityCompat.checkSelfPermission(it, PERMISSIONS[i]) } 228 | if (permission != PackageManager.PERMISSION_GRANTED) { 229 | activity?.let { 230 | ActivityCompat.requestPermissions(it, PERMISSIONS, 231 | REQUEST_EXTERNAL_STORAGE) 232 | } 233 | break 234 | } 235 | } 236 | } 237 | 238 | 239 | 240 | override fun onResult(results: ACRCloudResult?) { 241 | this.reset() 242 | 243 | // If you want to save the record audio data, you can refer to the following codes. 244 | /* 245 | byte[] recordPcm = results.getRecordDataPCM(); 246 | if (recordPcm != null) { 247 | byte[] recordWav = ACRCloudUtils.pcm2Wav(recordPcm, this.mConfig.recorderConfig.rate, this.mConfig.recorderConfig.channels); 248 | ACRCloudUtils.createFileWithByte(recordWav, path + "/" + "record.wav"); 249 | } 250 | */ 251 | val result: String = results!!.result 252 | resultEvents?.success(result) 253 | } 254 | 255 | override fun onVolumeChanged(p0: Double) { 256 | val time = (System.currentTimeMillis() - startTime) / 1000 257 | timeEvents?.success(time.toDouble()) 258 | 259 | } 260 | 261 | 262 | override fun onRadioMetadataResult(result: String?) { 263 | resultEvents?.success(result) 264 | } 265 | 266 | override fun onListen(arguments: Any?, events: EventChannel.EventSink?) { 267 | when (arguments) { 268 | 0 -> { 269 | this.timeEvents = events 270 | } 271 | 1 -> { 272 | this.resultEvents = events 273 | } 274 | else -> { 275 | } 276 | } 277 | } 278 | 279 | override fun onCancel(arguments: Any?) { 280 | if (mProcessing && mClient != null) { 281 | mClient!!.release() 282 | mClient!!.cancel() 283 | } 284 | reset() 285 | } 286 | } 287 | -------------------------------------------------------------------------------- /codemagic.yaml: -------------------------------------------------------------------------------- 1 | # Check out https://docs.codemagic.io/getting-started/yaml/ for more information 2 | 3 | workflows: 4 | flutter-package: 5 | name: Flutter or Dart Package 6 | environment: 7 | flutter: dev 8 | scripts: 9 | - flutter packages pub get 10 | - flutter test -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: a0860f6e87ba4f9031bee4d6f56c08b970606bee 8 | channel: dev 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.1 2 | 3 | * TODO: Describe initial release. 4 | -------------------------------------------------------------------------------- /example/LICENSE: -------------------------------------------------------------------------------- 1 | TODO: Add your license here. 2 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # acr_cloud_sdk_example 2 | 3 | Demonstrates how to use the acr_cloud_sdk plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 29 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.chizi.acr_cloud_sdk_example" 42 | minSdkVersion 16 43 | targetSdkVersion 29 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | } 47 | 48 | buildTypes { 49 | release { 50 | // TODO: Add your own signing config for the release build. 51 | // Signing with the debug keys for now, so `flutter run --release` works. 52 | signingConfig signingConfigs.debug 53 | } 54 | } 55 | } 56 | 57 | flutter { 58 | source '../..' 59 | } 60 | 61 | dependencies { 62 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 63 | } 64 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 13 | 17 | 21 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/chizi/acr_cloud_sdk_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.chizi.acr_cloud_sdk_example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /example/assets/images/more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/assets/images/more.png -------------------------------------------------------------------------------- /example/assets/images/music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/assets/images/music.png -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - acr_cloud_sdk (0.0.1): 3 | - Flutter 4 | - Flutter (1.0.0) 5 | - path_provider (0.0.1): 6 | - Flutter 7 | - "permission_handler (5.0.1+1)": 8 | - Flutter 9 | 10 | DEPENDENCIES: 11 | - acr_cloud_sdk (from `.symlinks/plugins/acr_cloud_sdk/ios`) 12 | - Flutter (from `Flutter`) 13 | - path_provider (from `.symlinks/plugins/path_provider/ios`) 14 | - permission_handler (from `.symlinks/plugins/permission_handler/ios`) 15 | 16 | EXTERNAL SOURCES: 17 | acr_cloud_sdk: 18 | :path: ".symlinks/plugins/acr_cloud_sdk/ios" 19 | Flutter: 20 | :path: Flutter 21 | path_provider: 22 | :path: ".symlinks/plugins/path_provider/ios" 23 | permission_handler: 24 | :path: ".symlinks/plugins/permission_handler/ios" 25 | 26 | SPEC CHECKSUMS: 27 | acr_cloud_sdk: be534d6a9db53b00a541c7ce31bbb414e2485305 28 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec 29 | path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c 30 | permission_handler: eac8e15b4a1a3fba55b761d19f3f4e6b005d15b6 31 | 32 | PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c 33 | 34 | COCOAPODS: 1.10.0 35 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | 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. -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | acr_cloud_sdk_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UILaunchStoryboardName 30 | LaunchScreen 31 | UIMainStoryboardFile 32 | Main 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | UIViewControllerBasedStatusBarAppearance 47 | 48 | NSMicrophoneUsageDescription 49 | Need your microphone 50 | 51 | 52 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/lib/core/models/deezer_song_model.dart: -------------------------------------------------------------------------------- 1 | class DeezerSongModel { 2 | int? id; 3 | bool? readable; 4 | String? title; 5 | String? titleShort; 6 | String? titleVersion; 7 | String? isrc; 8 | String? link; 9 | String? share; 10 | num? duration; 11 | num? trackPosition; 12 | num? diskNumber; 13 | num? rank; 14 | String? releaseDate; 15 | bool? explicitLyrics; 16 | int? explicitContentLyrics; 17 | int? explicitContentCover; 18 | String? preview; 19 | num? bpm; 20 | num? gain; 21 | List? availableCountries; 22 | List? contributors; 23 | String? md5Image; 24 | Artist? artist; 25 | Album? album; 26 | String? type; 27 | 28 | DeezerSongModel({ 29 | this.id, 30 | this.readable, 31 | this.title, 32 | this.titleShort, 33 | this.titleVersion, 34 | this.isrc, 35 | this.link, 36 | this.share, 37 | this.duration, 38 | this.trackPosition, 39 | this.diskNumber, 40 | this.rank, 41 | this.releaseDate, 42 | this.explicitLyrics, 43 | this.explicitContentLyrics, 44 | this.explicitContentCover, 45 | this.preview, 46 | this.bpm, 47 | this.gain, 48 | this.availableCountries, 49 | this.contributors, 50 | this.md5Image, 51 | this.artist, 52 | this.album, 53 | this.type, 54 | }); 55 | 56 | DeezerSongModel.fromJson(Map json) { 57 | id = json['id']; 58 | readable = json['readable']; 59 | title = json['title']; 60 | titleShort = json['title_short']; 61 | titleVersion = json['title_version']; 62 | isrc = json['isrc']; 63 | link = json['link']; 64 | share = json['share']; 65 | duration = json['duration']; 66 | trackPosition = json['track_position']; 67 | diskNumber = json['disk_number']; 68 | rank = json['rank']; 69 | releaseDate = json['release_date']; 70 | explicitLyrics = json['explicit_lyrics']; 71 | explicitContentLyrics = json['explicit_content_lyrics']; 72 | explicitContentCover = json['explicit_content_cover']; 73 | preview = json['preview']; 74 | bpm = json['bpm']; 75 | gain = json['gain']; 76 | availableCountries = json['available_countries'].cast(); 77 | if (json['contributors'] != null) { 78 | contributors = []; 79 | json['contributors'].forEach((v) { 80 | contributors?.add(new Contributors.fromJson(v)); 81 | }); 82 | } 83 | md5Image = json['md5_image']; 84 | artist = 85 | json['artist'] != null ? new Artist.fromJson(json['artist']) : null; 86 | album = json['album'] != null ? new Album.fromJson(json['album']) : null; 87 | type = json['type']; 88 | } 89 | 90 | Map toJson() { 91 | final Map data = new Map(); 92 | data['id'] = this.id; 93 | data['readable'] = this.readable; 94 | data['title'] = this.title; 95 | data['title_short'] = this.titleShort; 96 | data['title_version'] = this.titleVersion; 97 | data['isrc'] = this.isrc; 98 | data['link'] = this.link; 99 | data['share'] = this.share; 100 | data['duration'] = this.duration; 101 | data['track_position'] = this.trackPosition; 102 | data['disk_number'] = this.diskNumber; 103 | data['rank'] = this.rank; 104 | data['release_date'] = this.releaseDate; 105 | data['explicit_lyrics'] = this.explicitLyrics; 106 | data['explicit_content_lyrics'] = this.explicitContentLyrics; 107 | data['explicit_content_cover'] = this.explicitContentCover; 108 | data['preview'] = this.preview; 109 | data['bpm'] = this.bpm; 110 | data['gain'] = this.gain; 111 | data['available_countries'] = this.availableCountries; 112 | if (this.contributors != null) { 113 | data['contributors'] = this.contributors?.map((v) => v.toJson()).toList(); 114 | } 115 | data['md5_image'] = this.md5Image; 116 | if (this.artist != null) { 117 | data['artist'] = this.artist?.toJson(); 118 | } 119 | if (this.album != null) { 120 | data['album'] = this.album?.toJson(); 121 | } 122 | data['type'] = this.type; 123 | return data; 124 | } 125 | } 126 | 127 | class Contributors { 128 | int? id; 129 | String? name; 130 | String? link; 131 | String? share; 132 | String? picture; 133 | String? pictureSmall; 134 | String? pictureMedium; 135 | String? pictureBig; 136 | String? pictureXl; 137 | bool? radio; 138 | String? tracklist; 139 | String? type; 140 | String? role; 141 | 142 | Contributors( 143 | {this.id, 144 | this.name, 145 | this.link, 146 | this.share, 147 | this.picture, 148 | this.pictureSmall, 149 | this.pictureMedium, 150 | this.pictureBig, 151 | this.pictureXl, 152 | this.radio, 153 | this.tracklist, 154 | this.type, 155 | this.role}); 156 | 157 | Contributors.fromJson(Map json) { 158 | id = json['id']; 159 | name = json['name']; 160 | link = json['link']; 161 | share = json['share']; 162 | picture = json['picture']; 163 | pictureSmall = json['picture_small']; 164 | pictureMedium = json['picture_medium']; 165 | pictureBig = json['picture_big']; 166 | pictureXl = json['picture_xl']; 167 | radio = json['radio']; 168 | tracklist = json['tracklist']; 169 | type = json['type']; 170 | role = json['role']; 171 | } 172 | 173 | Map toJson() { 174 | final Map data = new Map(); 175 | data['id'] = this.id; 176 | data['name'] = this.name; 177 | data['link'] = this.link; 178 | data['share'] = this.share; 179 | data['picture'] = this.picture; 180 | data['picture_small'] = this.pictureSmall; 181 | data['picture_medium'] = this.pictureMedium; 182 | data['picture_big'] = this.pictureBig; 183 | data['picture_xl'] = this.pictureXl; 184 | data['radio'] = this.radio; 185 | data['tracklist'] = this.tracklist; 186 | data['type'] = this.type; 187 | data['role'] = this.role; 188 | return data; 189 | } 190 | } 191 | 192 | class Artist { 193 | int? id; 194 | String? name; 195 | String? link; 196 | String? share; 197 | String? picture; 198 | String? pictureSmall; 199 | String? pictureMedium; 200 | String? pictureBig; 201 | String? pictureXl; 202 | bool? radio; 203 | String? tracklist; 204 | String? type; 205 | 206 | Artist( 207 | {this.id, 208 | this.name, 209 | this.link, 210 | this.share, 211 | this.picture, 212 | this.pictureSmall, 213 | this.pictureMedium, 214 | this.pictureBig, 215 | this.pictureXl, 216 | this.radio, 217 | this.tracklist, 218 | this.type}); 219 | 220 | Artist.fromJson(Map json) { 221 | id = json['id']; 222 | name = json['name']; 223 | link = json['link']; 224 | share = json['share']; 225 | picture = json['picture']; 226 | pictureSmall = json['picture_small']; 227 | pictureMedium = json['picture_medium']; 228 | pictureBig = json['picture_big']; 229 | pictureXl = json['picture_xl']; 230 | radio = json['radio']; 231 | tracklist = json['tracklist']; 232 | type = json['type']; 233 | } 234 | 235 | Map toJson() { 236 | final Map data = new Map(); 237 | data['id'] = this.id; 238 | data['name'] = this.name; 239 | data['link'] = this.link; 240 | data['share'] = this.share; 241 | data['picture'] = this.picture; 242 | data['picture_small'] = this.pictureSmall; 243 | data['picture_medium'] = this.pictureMedium; 244 | data['picture_big'] = this.pictureBig; 245 | data['picture_xl'] = this.pictureXl; 246 | data['radio'] = this.radio; 247 | data['tracklist'] = this.tracklist; 248 | data['type'] = this.type; 249 | return data; 250 | } 251 | } 252 | 253 | class Album { 254 | int? id; 255 | String? title; 256 | String? link; 257 | String? cover; 258 | String? coverSmall; 259 | String? coverMedium; 260 | String? coverBig; 261 | String? coverXl; 262 | String? md5Image; 263 | String? releaseDate; 264 | String? tracklist; 265 | String? type; 266 | 267 | Album( 268 | {this.id, 269 | this.title, 270 | this.link, 271 | this.cover, 272 | this.coverSmall, 273 | this.coverMedium, 274 | this.coverBig, 275 | this.coverXl, 276 | this.md5Image, 277 | this.releaseDate, 278 | this.tracklist, 279 | this.type}); 280 | 281 | Album.fromJson(Map json) { 282 | id = json['id']; 283 | title = json['title']; 284 | link = json['link']; 285 | cover = json['cover']; 286 | coverSmall = json['cover_small']; 287 | coverMedium = json['cover_medium']; 288 | coverBig = json['cover_big']; 289 | coverXl = json['cover_xl']; 290 | md5Image = json['md5_image']; 291 | releaseDate = json['release_date']; 292 | tracklist = json['tracklist']; 293 | type = json['type']; 294 | } 295 | 296 | Map toJson() { 297 | final Map data = new Map(); 298 | data['id'] = this.id; 299 | data['title'] = this.title; 300 | data['link'] = this.link; 301 | data['cover'] = this.cover; 302 | data['cover_small'] = this.coverSmall; 303 | data['cover_medium'] = this.coverMedium; 304 | data['cover_big'] = this.coverBig; 305 | data['cover_xl'] = this.coverXl; 306 | data['md5_image'] = this.md5Image; 307 | data['release_date'] = this.releaseDate; 308 | data['tracklist'] = this.tracklist; 309 | data['type'] = this.type; 310 | return data; 311 | } 312 | } 313 | -------------------------------------------------------------------------------- /example/lib/core/network_layer/api/song.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:acr_cloud_sdk_example/core/models/deezer_song_model.dart'; 4 | import 'package:acr_cloud_sdk_example/core/network_layer/failure/failure.dart'; 5 | import 'package:acr_cloud_sdk_example/core/network_layer/helper/api_helper.dart'; 6 | import 'package:dartz/dartz.dart' show Either, Right, Left; 7 | 8 | import '../base_repository.dart'; 9 | 10 | class SongAPI extends BaseRepository { 11 | final apiHelper = ApiHelper(); 12 | 13 | Future> dataFromDeezer(String? id) async { 14 | return _dataFromDeezer(id); 15 | } 16 | 17 | Future> _dataFromDeezer(String? id) async { 18 | try { 19 | var headers = { 20 | 'Content-type': 'application/json;charset=UTF-8', 21 | 'Accept': 'application/json;charset=UTF-8', 22 | }; 23 | final response = await apiHelper.get( 24 | url: 'https://api.deezer.com/track/$id', 25 | headers: headers, 26 | ); 27 | 28 | if (response.contains('title')) 29 | return Right(DeezerSongModel.fromJson(json.decode(response))); 30 | else 31 | return Left(ServerFailure(message: response)); 32 | } catch (e) { 33 | return Left(ServerFailure(message: e.toString())); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /example/lib/core/network_layer/base_network/base_network.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:dio/dio.dart'; 4 | 5 | mixin BaseNetwork { 6 | final Dio client = Dio( 7 | BaseOptions( 8 | responseType: ResponseType.plain, 9 | ), 10 | ); 11 | 12 | Future> get defaultHeaders async => { 13 | 'Content-type': 'application/json;charset=UTF-8', 14 | 'Accept': 'application/json;charset=UTF-8', 15 | }; 16 | 17 | final String defaultBody = '{}'; 18 | //* Helper functions 19 | 20 | Future getData({ 21 | required String url, 22 | Map? headers, 23 | }) async { 24 | return await client.get( 25 | url, 26 | options: Options( 27 | headers: headers ?? await defaultHeaders, 28 | ), 29 | ); 30 | } 31 | 32 | Future postData({ 33 | required String url, 34 | Map? headers, 35 | Map? body, 36 | }) async { 37 | return await client.post( 38 | url, 39 | data: json.encode(body ?? defaultBody), 40 | options: Options( 41 | headers: headers ?? await defaultHeaders, 42 | ), 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /example/lib/core/network_layer/base_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | 3 | import 'failure/failure.dart'; 4 | 5 | class BaseRepository { 6 | Future> informDeviceIsOffline() async { 7 | return Left(DeviceOfflineFailure()); 8 | } 9 | 10 | Either informServerFailure({ 11 | int code = -1, 12 | String message = '', 13 | }) { 14 | return Left( 15 | ServerFailure(code: code, message: message), 16 | ); 17 | } 18 | 19 | Either informLocalCacheFailure() { 20 | return Left(LocalCacheFailure()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /example/lib/core/network_layer/exceptions/exceptions.dart: -------------------------------------------------------------------------------- 1 | class ServerException implements Exception { 2 | final String message; 3 | final int code; 4 | 5 | ServerException({this.message = "", this.code = -1}); 6 | 7 | @override 8 | String toString() { 9 | return '${this.runtimeType}(message:$message, code:$code)'; 10 | } 11 | } 12 | 13 | class CacheException implements Exception {} 14 | 15 | class FetchDataException extends ServerException { 16 | FetchDataException([String? message]) 17 | : super(message: "Error During Communication: "); 18 | } 19 | 20 | class BadRequestException extends ServerException { 21 | BadRequestException([message]) : super(message: "Invalid Request: "); 22 | } 23 | 24 | class UnauthorisedException extends ServerException { 25 | UnauthorisedException([message]) : super(message: "Unauthorised: "); 26 | } 27 | 28 | class InvalidInputException extends ServerException { 29 | InvalidInputException([String? message]) : super(message: "Invalid Input: "); 30 | } 31 | -------------------------------------------------------------------------------- /example/lib/core/network_layer/failure/failure.dart: -------------------------------------------------------------------------------- 1 | abstract class Failure {} 2 | 3 | // General failures 4 | class ServerFailure extends Failure { 5 | final String message; 6 | final int code; 7 | 8 | ServerFailure({this.message = "", this.code = -1}); 9 | @override 10 | String toString() { 11 | return '${this.runtimeType}(message:$message, code:$code)'; 12 | } 13 | } 14 | 15 | class LocalCacheFailure extends Failure {} 16 | 17 | class DeviceOfflineFailure extends ServerFailure { 18 | @override 19 | String toString() { 20 | return 'Your Device might be offline'; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /example/lib/core/network_layer/helper/api_helper.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:acr_cloud_sdk_example/core/network_layer/base_network/base_network.dart'; 4 | import 'package:acr_cloud_sdk_example/core/network_layer/exceptions/exceptions.dart'; 5 | import 'package:acr_cloud_sdk_example/utils/log.dart'; 6 | import 'package:dio/dio.dart'; 7 | 8 | class ApiHelper with BaseNetwork { 9 | Future get({ 10 | required String url, 11 | Map? headers, 12 | }) async { 13 | var responseJson; 14 | try { 15 | final response = await getData( 16 | url: url, 17 | headers: headers, 18 | ); 19 | 20 | Log().debug(url, response.data); 21 | responseJson = _returnResponse(response); 22 | } on SocketException { 23 | throw FetchDataException('No Internet connection'); 24 | } catch (e) { 25 | if (e is UnauthorisedException) Log().error(e.toString()); 26 | throw e; 27 | } 28 | return responseJson; 29 | } 30 | 31 | Future getRaw({ 32 | required String url, 33 | Map? headers, 34 | }) async { 35 | Response responseJson; 36 | try { 37 | final response = await getData( 38 | url: url, 39 | headers: headers, 40 | ); 41 | 42 | Log().debug(url, response.data); 43 | responseJson = response; 44 | } on SocketException { 45 | throw FetchDataException('No Internet connection'); 46 | } catch (e) { 47 | if (e is UnauthorisedException) Log().error(e.toString()); 48 | throw e; 49 | } 50 | return responseJson; 51 | } 52 | 53 | Future post({ 54 | required String url, 55 | List? passRange, 56 | bool throwError = false, 57 | Map? headers, 58 | required Map body, 59 | }) async { 60 | var responseJson; 61 | try { 62 | Log().debug('body', body); 63 | final response = await postData( 64 | url: url, 65 | headers: headers, 66 | body: body, 67 | ); 68 | print(response.data); 69 | if (!throwError) { 70 | if (passRange != null) { 71 | for (int item in passRange) { 72 | item == response.statusCode 73 | ? responseJson = response.data 74 | : throw response.data; 75 | } 76 | } else { 77 | responseJson = _returnResponse(response); 78 | } 79 | } else { 80 | return response.data; 81 | } 82 | } on SocketException { 83 | throw FetchDataException('No Internet connection'); 84 | } catch (e) { 85 | print(e.toString()); 86 | if (e is UnauthorisedException) Log().error(e.toString()); 87 | if (e.toString().toLowerCase().contains('time')) 88 | throw 'Sever Took too long to Respond'; 89 | else 90 | throw e; 91 | } 92 | return responseJson; 93 | } 94 | 95 | String _returnResponse(Response response) { 96 | switch (response.statusCode) { 97 | case 200: 98 | return response.data; 99 | case 400: 100 | return (response.data.toString()); 101 | case 422: 102 | return (response.data.toString()); 103 | case 404: 104 | throw BadRequestException(response.data.toString()); 105 | case 401: 106 | case 403: 107 | throw UnauthorisedException(response.data.toString()); 108 | case 500: 109 | default: 110 | throw FetchDataException( 111 | 'Error occured while Communication with Server with StatusCode : ${response.statusCode}'); 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /example/lib/core/network_layer/network/network_info.dart: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /example/lib/core/providers.dart: -------------------------------------------------------------------------------- 1 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 2 | 3 | import 'viewmodel/home_vm.dart'; 4 | 5 | final homeVM = ChangeNotifierProvider((_) => HomeViewModel()); 6 | -------------------------------------------------------------------------------- /example/lib/core/viewmodel/home_vm.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:acr_cloud_sdk/acr_cloud_sdk.dart'; 4 | import 'package:acr_cloud_sdk_example/core/network_layer/api/song.dart'; 5 | import 'package:acr_cloud_sdk_example/views/song_detail.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; 8 | 9 | class HomeViewModel extends ChangeNotifier { 10 | late AnimationController controller; 11 | final AcrCloudSdk arc = AcrCloudSdk(); 12 | final SongAPI api = SongAPI(); 13 | 14 | BuildContext? _context; 15 | 16 | SongModel? _songModel; 17 | SongModel? get songModel => _songModel; 18 | set songModel(SongModel? val) { 19 | _songModel = val; 20 | notifyListeners(); 21 | } 22 | 23 | bool _loading = false; 24 | bool get loading => _loading; 25 | set loading(bool val) { 26 | _loading = val; 27 | notifyListeners(); 28 | } 29 | 30 | Future init(BuildContext context) async { 31 | try { 32 | _context = context; 33 | 34 | arc 35 | ..init( 36 | host: 37 | 'identify-eu-west-1.acrcloud.com', // obtain from https://www.acrcloud.com/ 38 | accessKey: 39 | '92e5456a723332fd090e3ab70ece161e', // obtain from https://www.acrcloud.com/ 40 | accessSecret: 41 | 'orZqaXs6DkJglYXeypJC0YCh0a4LEjOoMdl8gNTJ', // obtain from https://www.acrcloud.com/ 42 | setLog: false, 43 | ) 44 | ..songModelStream.listen(searchSong); 45 | } catch (e) { 46 | print(e.toString()); 47 | } 48 | } 49 | 50 | void start() async { 51 | try { 52 | controller.repeat(); 53 | loading = true; 54 | await arc.start(); 55 | } catch (e) { 56 | print(e.toString()); 57 | } 58 | } 59 | 60 | void stop() async { 61 | try { 62 | controller.stop(); 63 | loading = false; 64 | await arc.stop(); 65 | } catch (e) { 66 | print(e.toString()); 67 | } 68 | } 69 | 70 | void searchSong(SongModel song) async { 71 | var data = song.metadata; 72 | 73 | if (data != null && data.music!.length > 0) { 74 | var req = await api 75 | .dataFromDeezer(data.music?[0].externalMetadata?.deezer?.track?.id); 76 | req.fold( 77 | (l) => print(l.toString()), 78 | (songModel) { 79 | showCupertinoModalBottomSheet( 80 | context: _context!, 81 | builder: (_) { 82 | return SongDetailPage(songModel); 83 | }); 84 | }, 85 | ); 86 | } 87 | controller.stop(); 88 | loading = false; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:acr_cloud_sdk_example/utils/log.dart'; 2 | import 'package:flutter/foundation.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 6 | 7 | import 'utils/theme.dart'; 8 | import 'views/home_page.dart'; 9 | 10 | void main() { 11 | Log.init(kReleaseMode); 12 | runApp(ProviderScope(child: MyApp())); 13 | } 14 | 15 | class MyApp extends StatelessWidget { 16 | @override 17 | Widget build(BuildContext context) { 18 | overrideDeviceColors(); 19 | return MaterialApp( 20 | title: 'SoundCheck', 21 | debugShowCheckedModeBanner: false, 22 | theme: themeData(context), 23 | home: HomePage(), 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /example/lib/utils/log.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import './pretty_json.dart'; 4 | import 'package:meta/meta.dart'; 5 | 6 | class Log { 7 | factory Log() => _instance; 8 | 9 | Log._(this.production); 10 | 11 | static void init([bool production = false]) => _instance = Log._(production); 12 | 13 | static late Log _instance; 14 | 15 | final bool production; 16 | 17 | String debug(String tag, [dynamic payload]) { 18 | var output; 19 | if (production) return ''; 20 | try { 21 | output = generator('=', tag, jsonPretty(json.decode(payload))); 22 | } catch (e) { 23 | output = generator('=', tag, payload); 24 | } 25 | print(output); 26 | return output; 27 | } 28 | 29 | String error(String tag, [dynamic payload]) { 30 | if (production) return ''; 31 | final output = generator('*', tag, payload); 32 | print(output); 33 | return output; 34 | } 35 | 36 | @visibleForTesting 37 | String generator(String delim, String tag, [dynamic payload]) { 38 | if (production) return ''; 39 | var _ = ''; 40 | 41 | final _d = delim.padRight(20, delim); 42 | _ += '\n$delim> $tag $_d>\n'; 43 | if (payload != null) { 44 | _ += '$payload \n$_d\n'; 45 | } 46 | 47 | return _; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /example/lib/utils/margin.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class XMargin extends StatelessWidget { 4 | final double x; 5 | const XMargin(this.x); 6 | @override 7 | Widget build(BuildContext context) { 8 | return SizedBox(width: x); 9 | } 10 | } 11 | 12 | class YMargin extends StatelessWidget { 13 | final double y; 14 | const YMargin(this.y); 15 | @override 16 | Widget build(BuildContext context) { 17 | return SizedBox(height: y); 18 | } 19 | } 20 | 21 | extension CustomContext on BuildContext { 22 | double screenHeight([double percent = 1]) => 23 | MediaQuery.of(this).size.height * percent; 24 | 25 | double screenWidth([double percent = 1]) => 26 | MediaQuery.of(this).size.width * percent; 27 | } 28 | -------------------------------------------------------------------------------- /example/lib/utils/navigator.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class MyNavigators {} 4 | 5 | extension MyNavigator on BuildContext { 6 | navigateReplace(Widget route, {isDialog = false}) => 7 | Navigator.pushReplacement( 8 | this, 9 | MaterialPageRoute( 10 | fullscreenDialog: isDialog, 11 | builder: (context) => route, 12 | ), 13 | ); 14 | 15 | navigate(Widget route, {isDialog = false}) => Navigator.push( 16 | this, 17 | MaterialPageRoute( 18 | fullscreenDialog: isDialog, 19 | builder: (context) => route, 20 | ), 21 | ); 22 | 23 | popToFirst() => Navigator.of(this).popUntil((route) => route.isFirst); 24 | 25 | popView() => Navigator.pop(this); 26 | 27 | navigateTransparentRoute(Widget route) { 28 | return Navigator.push( 29 | this, 30 | TransparentRoute( 31 | builder: (context) => route, 32 | ), 33 | ); 34 | } 35 | } 36 | 37 | class TransparentRoute extends PageRoute { 38 | TransparentRoute({ 39 | required this.builder, 40 | RouteSettings? settings, 41 | }) : super(settings: settings, fullscreenDialog: false); 42 | 43 | final WidgetBuilder builder; 44 | 45 | @override 46 | bool get opaque => false; 47 | 48 | @override 49 | Color? get barrierColor => null; 50 | 51 | @override 52 | String? get barrierLabel => null; 53 | 54 | @override 55 | bool get maintainState => true; 56 | 57 | @override 58 | Duration get transitionDuration => Duration(milliseconds: 350); 59 | 60 | @override 61 | Widget buildPage(BuildContext context, Animation animation, 62 | Animation secondaryAnimation) { 63 | final result = builder(context); 64 | return FadeTransition( 65 | opacity: Tween(begin: 0, end: 1).animate(animation), 66 | child: Semantics( 67 | scopesRoute: true, 68 | explicitChildNodes: true, 69 | child: SlideTransition( 70 | transformHitTests: false, 71 | position: Tween( 72 | begin: const Offset(0.0, 1.0), 73 | end: Offset.zero, 74 | ).animate(animation), 75 | child: new SlideTransition( 76 | position: new Tween( 77 | begin: Offset.zero, 78 | end: const Offset(0.0, -1.0), 79 | ).animate(secondaryAnimation), 80 | child: result, 81 | ), 82 | ), 83 | ), 84 | ); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /example/lib/utils/pretty_json.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | jsonPretty(Object obj) { 4 | JsonEncoder encoder = JsonEncoder.withIndent(' '); 5 | String prettyprint = encoder.convert(obj); 6 | return prettyprint; 7 | } 8 | -------------------------------------------------------------------------------- /example/lib/utils/theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | import 'package:google_fonts/google_fonts.dart'; 4 | 5 | const Color white = Colors.white; 6 | 7 | const Color black = Colors.black; 8 | 9 | const Color kPrimaryColor = Color(0xffEE2261); 10 | 11 | const Color bgColor = Color(0xff2F2F2F); 12 | 13 | themeData(context) => ThemeData( 14 | textTheme: GoogleFonts.montserratTextTheme(Theme.of(context).textTheme), 15 | primaryColor: kPrimaryColor, 16 | brightness: Brightness.dark, 17 | visualDensity: VisualDensity.adaptivePlatformDensity, 18 | ); 19 | 20 | overrideDeviceColors() { 21 | SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( 22 | /* set Status bar color in Android devices. */ 23 | statusBarColor: Colors.transparent, 24 | /* set Status bar icons color in Android devices.*/ 25 | statusBarIconBrightness: Brightness.light, 26 | /* set Status bar icon color in iOS. */ 27 | statusBarBrightness: Brightness.dark, 28 | systemNavigationBarColor: bgColor, 29 | )); 30 | SystemChrome.setPreferredOrientations([ 31 | DeviceOrientation.portraitUp, 32 | DeviceOrientation.portraitDown, 33 | ]); 34 | } 35 | -------------------------------------------------------------------------------- /example/lib/views/home_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:acr_cloud_sdk_example/core/providers.dart'; 2 | import 'package:acr_cloud_sdk_example/utils/margin.dart'; 3 | import 'package:acr_cloud_sdk_example/utils/theme.dart'; 4 | import 'package:flutter/cupertino.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter_hooks/flutter_hooks.dart'; 7 | import 'package:google_fonts/google_fonts.dart'; 8 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 9 | import 'dart:math' as math show sin, pi, sqrt; 10 | 11 | import 'package:flutter/animation.dart'; 12 | 13 | class HomePage extends StatefulHookWidget { 14 | @override 15 | _HomePageState createState() => _HomePageState(); 16 | } 17 | 18 | class _HomePageState extends State with TickerProviderStateMixin { 19 | @override 20 | void initState() { 21 | super.initState(); 22 | 23 | context.read(homeVM).init(context); 24 | 25 | context.read(homeVM).controller = AnimationController( 26 | vsync: this, 27 | duration: const Duration(milliseconds: 2000), 28 | ); 29 | } 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | final loading = useProvider(homeVM.select((v) => v.loading)); 34 | return Scaffold( 35 | backgroundColor: bgColor, 36 | body: Center( 37 | child: Column( 38 | mainAxisAlignment: MainAxisAlignment.center, 39 | crossAxisAlignment: CrossAxisAlignment.center, 40 | children: [ 41 | Spacer(), 42 | Ripples( 43 | size: loading ? 160 : 40, 44 | child: Container( 45 | width: 40, 46 | height: 40, 47 | margin: const EdgeInsets.all(20), 48 | child: Image.asset( 49 | "assets/images/music.png", 50 | height: 40, 51 | ), 52 | ), 53 | ), 54 | Spacer(), 55 | Container( 56 | height: 55, 57 | width: 200, 58 | child: CupertinoButton( 59 | onPressed: () { 60 | if (!loading) { 61 | context.read(homeVM).start(); 62 | } else { 63 | context.read(homeVM).stop(); 64 | } 65 | }, 66 | child: Text( 67 | 'Tap to ${loading ? 'Cancel' : 'Identify'}', 68 | style: GoogleFonts.montserrat( 69 | color: Colors.white, 70 | fontSize: 17, 71 | fontWeight: FontWeight.w500, 72 | ), 73 | ), 74 | ), 75 | ), 76 | const YMargin(100) 77 | ], 78 | ), 79 | ), 80 | ); 81 | } 82 | } 83 | 84 | class Ripples extends HookWidget { 85 | const Ripples({ 86 | Key? key, 87 | this.size = 80.0, 88 | this.color = kPrimaryColor, 89 | this.onPressed, 90 | required this.child, 91 | }) : super(key: key); 92 | 93 | final double size; 94 | final Color color; 95 | final Widget child; 96 | final VoidCallback? onPressed; 97 | 98 | Widget _button() { 99 | final _controller = useProvider(homeVM.select((v) => v.controller)); 100 | 101 | return Center( 102 | child: ClipRRect( 103 | borderRadius: BorderRadius.circular(size), 104 | child: DecoratedBox( 105 | decoration: BoxDecoration( 106 | gradient: RadialGradient( 107 | colors: [color, Color.lerp(color, Colors.black, .05)!], 108 | ), 109 | ), 110 | child: ScaleTransition( 111 | scale: Tween(begin: 0.95, end: 1.0).animate( 112 | CurvedAnimation( 113 | parent: _controller, 114 | curve: const _PulsateCurve(), 115 | ), 116 | ), 117 | child: child, 118 | ), 119 | ), 120 | ), 121 | ); 122 | } 123 | 124 | @override 125 | Widget build(BuildContext context) { 126 | final _controller = useProvider(homeVM.select((v) => v.controller)); 127 | 128 | return CustomPaint( 129 | painter: _CirclePainter( 130 | _controller, 131 | color: color, 132 | ), 133 | child: SizedBox( 134 | width: size * 2.125, 135 | height: size * 2.125, 136 | child: _button(), 137 | ), 138 | ); 139 | } 140 | } 141 | 142 | class _CirclePainter extends CustomPainter { 143 | _CirclePainter( 144 | this._animation, { 145 | required this.color, 146 | }) : super(repaint: _animation); 147 | 148 | final Color? color; 149 | final Animation _animation; 150 | 151 | void circle(Canvas canvas, Rect rect, double value) { 152 | final double opacity = (1.0 - (value / 4.0)).clamp(0.0, 1.0); 153 | final Color _color = color!.withOpacity(opacity); 154 | 155 | final double size = rect.width / 2; 156 | final double area = size * size; 157 | final double radius = math.sqrt(area * value / 4); 158 | 159 | final Paint paint = Paint()..color = _color; 160 | canvas.drawCircle(rect.center, radius, paint); 161 | } 162 | 163 | @override 164 | void paint(Canvas canvas, Size size) { 165 | final Rect rect = Rect.fromLTRB(0.0, 0.0, size.width, size.height); 166 | 167 | for (int wave = 3; wave >= 0; wave--) { 168 | circle(canvas, rect, wave + _animation.value); 169 | } 170 | } 171 | 172 | @override 173 | bool shouldRepaint(_CirclePainter oldDelegate) => true; 174 | } 175 | 176 | class _PulsateCurve extends Curve { 177 | const _PulsateCurve(); 178 | 179 | @override 180 | double transform(double t) { 181 | if (t == 0 || t == 1) { 182 | return 0.01; 183 | } 184 | return math.sin(t * math.pi); 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /example/lib/views/song_detail.dart: -------------------------------------------------------------------------------- 1 | import 'package:acr_cloud_sdk_example/core/models/deezer_song_model.dart'; 2 | import 'package:acr_cloud_sdk_example/utils/margin.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:google_fonts/google_fonts.dart'; 5 | 6 | class SongDetailPage extends StatelessWidget { 7 | final DeezerSongModel? songModel; 8 | const SongDetailPage([this.songModel]); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return Container( 13 | height: 150, 14 | child: Material( 15 | color: Colors.white, 16 | child: Column( 17 | mainAxisAlignment: MainAxisAlignment.center, 18 | children: [ 19 | Row( 20 | children: [ 21 | Container( 22 | height: 100, 23 | width: 100, 24 | margin: const EdgeInsets.all(20), 25 | decoration: BoxDecoration( 26 | color: Color(0xffEDEDED), 27 | borderRadius: BorderRadius.circular(10), 28 | image: songModel != null 29 | ? DecorationImage( 30 | fit: BoxFit.cover, 31 | image: NetworkImage( 32 | songModel?.album?.coverMedium ?? '', 33 | ), 34 | ) 35 | : null), 36 | ), 37 | const XMargin(10), 38 | Column( 39 | crossAxisAlignment: CrossAxisAlignment.start, 40 | children: [ 41 | Container( 42 | width: context.screenWidth(0.42), 43 | child: Text( 44 | songModel?.title ?? '', 45 | overflow: TextOverflow.ellipsis, 46 | style: GoogleFonts.montserrat( 47 | color: Colors.black, 48 | fontSize: 18, 49 | fontWeight: FontWeight.w500, 50 | ), 51 | ), 52 | ), 53 | const YMargin(10), 54 | Text( 55 | songModel?.artist?.name ?? '', 56 | style: GoogleFonts.montserrat( 57 | color: Color(0xff727272), 58 | fontSize: 15, 59 | fontWeight: FontWeight.w300, 60 | ), 61 | ), 62 | const YMargin(5), 63 | Row( 64 | children: [ 65 | Container( 66 | child: Text( 67 | '${songModel?.album?.title ?? ''}', 68 | overflow: TextOverflow.ellipsis, 69 | style: GoogleFonts.montserrat( 70 | color: Color(0xffA3A3A3), 71 | fontSize: 11, 72 | fontWeight: FontWeight.w300, 73 | ), 74 | ), 75 | ), 76 | Container( 77 | child: Text( 78 | ' • ${DateTime.parse(songModel?.releaseDate ?? DateTime.now().toIso8601String()).year}', 79 | overflow: TextOverflow.ellipsis, 80 | style: GoogleFonts.montserrat( 81 | color: Color(0xffA3A3A3), 82 | fontSize: 11, 83 | fontWeight: FontWeight.w300, 84 | ), 85 | ), 86 | ), 87 | ], 88 | ), 89 | ], 90 | ), 91 | Spacer(), 92 | Image.asset( 93 | "assets/images/more.png", 94 | height: 20, 95 | ), 96 | const XMargin(30), 97 | ], 98 | ) 99 | ], 100 | ), 101 | ), 102 | ); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import acr_cloud_sdk 9 | import path_provider_macos 10 | 11 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 12 | AcrCloudSdkPlugin.register(with: registry.registrar(forPlugin: "AcrCloudSdkPlugin")) 13 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 14 | } 15 | -------------------------------------------------------------------------------- /example/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.11' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /example/macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - acr_cloud_sdk (0.0.1): 3 | - FlutterMacOS 4 | - FlutterMacOS (1.0.0) 5 | - path_provider_macos (0.0.1): 6 | - FlutterMacOS 7 | 8 | DEPENDENCIES: 9 | - acr_cloud_sdk (from `Flutter/ephemeral/.symlinks/plugins/acr_cloud_sdk/macos`) 10 | - FlutterMacOS (from `Flutter/ephemeral`) 11 | - path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`) 12 | 13 | EXTERNAL SOURCES: 14 | acr_cloud_sdk: 15 | :path: Flutter/ephemeral/.symlinks/plugins/acr_cloud_sdk/macos 16 | FlutterMacOS: 17 | :path: Flutter/ephemeral 18 | path_provider_macos: 19 | :path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos 20 | 21 | SPEC CHECKSUMS: 22 | acr_cloud_sdk: 0c90543397b39f479cb3f2c544a94d36ff2eafa2 23 | FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424 24 | path_provider_macos: a0a3fd666cb7cd0448e936fb4abad4052961002b 25 | 26 | PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c 27 | 28 | COCOAPODS: 1.11.2 29 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = acr_cloud_sdk_example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.chizi.acrCloudSdkExample 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2021 com.chizi. All rights reserved. 15 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | acr_cloud_sdk: 5 | dependency: "direct main" 6 | description: 7 | path: ".." 8 | relative: true 9 | source: path 10 | version: "2.0.2" 11 | async: 12 | dependency: transitive 13 | description: 14 | name: async 15 | sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 16 | url: "https://pub.dev" 17 | source: hosted 18 | version: "2.10.0" 19 | boolean_selector: 20 | dependency: transitive 21 | description: 22 | name: boolean_selector 23 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" 24 | url: "https://pub.dev" 25 | source: hosted 26 | version: "2.1.1" 27 | characters: 28 | dependency: transitive 29 | description: 30 | name: characters 31 | sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c 32 | url: "https://pub.dev" 33 | source: hosted 34 | version: "1.2.1" 35 | charcode: 36 | dependency: transitive 37 | description: 38 | name: charcode 39 | sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 40 | url: "https://pub.dev" 41 | source: hosted 42 | version: "1.3.1" 43 | clock: 44 | dependency: transitive 45 | description: 46 | name: clock 47 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf 48 | url: "https://pub.dev" 49 | source: hosted 50 | version: "1.1.1" 51 | collection: 52 | dependency: transitive 53 | description: 54 | name: collection 55 | sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 56 | url: "https://pub.dev" 57 | source: hosted 58 | version: "1.17.0" 59 | crypto: 60 | dependency: transitive 61 | description: 62 | name: crypto 63 | sha256: "8be10341257b613566fdc9fd073c46f7c032ed329b1c732bda17aca29f2366c8" 64 | url: "https://pub.dev" 65 | source: hosted 66 | version: "3.0.0" 67 | cupertino_icons: 68 | dependency: "direct main" 69 | description: 70 | name: cupertino_icons 71 | sha256: caac504f942f41dfadcf45229ce8c47065b93919a12739f20d6173a883c5ec73 72 | url: "https://pub.dev" 73 | source: hosted 74 | version: "1.0.2" 75 | dartz: 76 | dependency: "direct main" 77 | description: 78 | name: dartz 79 | sha256: "133f435d3d28d08bcd7d0ed98fff126817a757cb268b288826f02429f4bc4b6e" 80 | url: "https://pub.dev" 81 | source: hosted 82 | version: "0.10.0-nullsafety.1" 83 | dio: 84 | dependency: "direct main" 85 | description: 86 | name: dio 87 | sha256: "14c118b5af669fb7b277d88bdf1c49f44d71f19e5b2c4a52491ad57b479d8eb5" 88 | url: "https://pub.dev" 89 | source: hosted 90 | version: "4.0.0-beta7" 91 | equatable: 92 | dependency: "direct main" 93 | description: 94 | name: equatable 95 | sha256: "8867afc0f09dd9aff976817fbd94e9a35a3a2e58bef3b39a5376918321ec97a4" 96 | url: "https://pub.dev" 97 | source: hosted 98 | version: "2.0.0" 99 | fake_async: 100 | dependency: transitive 101 | description: 102 | name: fake_async 103 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" 104 | url: "https://pub.dev" 105 | source: hosted 106 | version: "1.3.1" 107 | ffi: 108 | dependency: transitive 109 | description: 110 | name: ffi 111 | sha256: d97fffd9d86f3dccc7a9059128b468a99320c69007cc9d41a3a1bda07d4e86dc 112 | url: "https://pub.dev" 113 | source: hosted 114 | version: "1.0.0" 115 | file: 116 | dependency: transitive 117 | description: 118 | name: file 119 | sha256: "9fd2163d866769f60f4df8ac1dc59f52498d810c356fe78022e383dd3c57c0e1" 120 | url: "https://pub.dev" 121 | source: hosted 122 | version: "6.1.0" 123 | flutter: 124 | dependency: "direct main" 125 | description: flutter 126 | source: sdk 127 | version: "0.0.0" 128 | flutter_hooks: 129 | dependency: "direct main" 130 | description: 131 | name: flutter_hooks 132 | sha256: "2b969bb449330a547150827dfe0376f1c2374035ed7c6eb879b385def4d5e614" 133 | url: "https://pub.dev" 134 | source: hosted 135 | version: "0.16.0" 136 | flutter_riverpod: 137 | dependency: transitive 138 | description: 139 | name: flutter_riverpod 140 | sha256: "1d5894ac1d2df32821e6bc022b66f91820fe638307ea439c364bd73d5a5afc8c" 141 | url: "https://pub.dev" 142 | source: hosted 143 | version: "0.13.1" 144 | flutter_test: 145 | dependency: "direct dev" 146 | description: flutter 147 | source: sdk 148 | version: "0.0.0" 149 | freezed_annotation: 150 | dependency: transitive 151 | description: 152 | name: freezed_annotation 153 | sha256: "07568a2bb30ec39b2ec2bbd308c8f1552375787f4c8f443c07e50e66d9c97d0d" 154 | url: "https://pub.dev" 155 | source: hosted 156 | version: "0.14.1" 157 | google_fonts: 158 | dependency: "direct main" 159 | description: 160 | name: google_fonts 161 | sha256: a9df6f353ca45d6328c5015e5f7f92a79ba9b781719b631bbf2189a20c12bc49 162 | url: "https://pub.dev" 163 | source: hosted 164 | version: "2.0.0" 165 | hooks_riverpod: 166 | dependency: "direct main" 167 | description: 168 | name: hooks_riverpod 169 | sha256: "51faa3fb075a37f9c58121ce821edf94baf0ac38abebf2b561df0e7e8396cd8d" 170 | url: "https://pub.dev" 171 | source: hosted 172 | version: "0.13.1" 173 | http: 174 | dependency: transitive 175 | description: 176 | name: http 177 | sha256: "0a48a4e44ec1b6a52eb93b12d129f5b74ee6dbb27703439c965f1bd86f7be59f" 178 | url: "https://pub.dev" 179 | source: hosted 180 | version: "0.13.0" 181 | http_parser: 182 | dependency: transitive 183 | description: 184 | name: http_parser 185 | sha256: e362d639ba3bc07d5a71faebb98cde68c05bfbcfbbb444b60b6f60bb67719185 186 | url: "https://pub.dev" 187 | source: hosted 188 | version: "4.0.0" 189 | js: 190 | dependency: transitive 191 | description: 192 | name: js 193 | sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" 194 | url: "https://pub.dev" 195 | source: hosted 196 | version: "0.6.5" 197 | json_annotation: 198 | dependency: transitive 199 | description: 200 | name: json_annotation 201 | sha256: "0aab0aad3dde662cdc02d3a6fa6c9f20687a91089900bd25c64f3badcc90bf21" 202 | url: "https://pub.dev" 203 | source: hosted 204 | version: "4.0.0" 205 | matcher: 206 | dependency: transitive 207 | description: 208 | name: matcher 209 | sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" 210 | url: "https://pub.dev" 211 | source: hosted 212 | version: "0.12.13" 213 | material_color_utilities: 214 | dependency: transitive 215 | description: 216 | name: material_color_utilities 217 | sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 218 | url: "https://pub.dev" 219 | source: hosted 220 | version: "0.2.0" 221 | meta: 222 | dependency: transitive 223 | description: 224 | name: meta 225 | sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" 226 | url: "https://pub.dev" 227 | source: hosted 228 | version: "1.8.0" 229 | modal_bottom_sheet: 230 | dependency: "direct main" 231 | description: 232 | name: modal_bottom_sheet 233 | sha256: "24072fb73bf3c9a5558e9989d3cee45bb10bd6fac5f8b45a1b20394b9a06713e" 234 | url: "https://pub.dev" 235 | source: hosted 236 | version: "2.0.0" 237 | path: 238 | dependency: transitive 239 | description: 240 | name: path 241 | sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b 242 | url: "https://pub.dev" 243 | source: hosted 244 | version: "1.8.2" 245 | path_provider: 246 | dependency: transitive 247 | description: 248 | name: path_provider 249 | sha256: aa1b3572707c240d72569ce01756728cf0c8dca0cc381253d8ca2858c13edfe4 250 | url: "https://pub.dev" 251 | source: hosted 252 | version: "2.0.1" 253 | path_provider_linux: 254 | dependency: transitive 255 | description: 256 | name: path_provider_linux 257 | sha256: "938d2b6591587bcb009d2109a6ea464fd8fb2a75dc6423171b0d0afb1d27c708" 258 | url: "https://pub.dev" 259 | source: hosted 260 | version: "2.0.0" 261 | path_provider_macos: 262 | dependency: transitive 263 | description: 264 | name: path_provider_macos 265 | sha256: eb58b896ea3a504f0b0fa7870646bda6935a6f752b2a54df33f97070dacca8d4 266 | url: "https://pub.dev" 267 | source: hosted 268 | version: "2.0.0" 269 | path_provider_platform_interface: 270 | dependency: transitive 271 | description: 272 | name: path_provider_platform_interface 273 | sha256: "2e14fc474b8acfc4111ac8eb0e37c2fe70234f9f8cd796f1560d03aa1689fa51" 274 | url: "https://pub.dev" 275 | source: hosted 276 | version: "2.0.0" 277 | path_provider_windows: 278 | dependency: transitive 279 | description: 280 | name: path_provider_windows 281 | sha256: ecd4d04c225596bcf0fbb86408a1f40084a02dfa412e60172ad52a7f12a781ef 282 | url: "https://pub.dev" 283 | source: hosted 284 | version: "2.0.0" 285 | pedantic: 286 | dependency: transitive 287 | description: 288 | name: pedantic 289 | sha256: "8f6460c77a98ad2807cd3b98c67096db4286f56166852d0ce5951bb600a63594" 290 | url: "https://pub.dev" 291 | source: hosted 292 | version: "1.11.0" 293 | permission_handler: 294 | dependency: transitive 295 | description: 296 | name: permission_handler 297 | sha256: "33c6a1253d1f95fd06fa74b65b7ba907ae9811f9d5c1d3150e51417d04b8d6a8" 298 | url: "https://pub.dev" 299 | source: hosted 300 | version: "10.2.0" 301 | permission_handler_android: 302 | dependency: transitive 303 | description: 304 | name: permission_handler_android 305 | sha256: "8028362b40c4a45298f1cbfccd227c8dd6caf0e27088a69f2ba2ab15464159e2" 306 | url: "https://pub.dev" 307 | source: hosted 308 | version: "10.2.0" 309 | permission_handler_apple: 310 | dependency: transitive 311 | description: 312 | name: permission_handler_apple 313 | sha256: "9c370ef6a18b1c4b2f7f35944d644a56aa23576f23abee654cf73968de93f163" 314 | url: "https://pub.dev" 315 | source: hosted 316 | version: "9.0.7" 317 | permission_handler_platform_interface: 318 | dependency: transitive 319 | description: 320 | name: permission_handler_platform_interface 321 | sha256: "68abbc472002b5e6dfce47fe9898c6b7d8328d58b5d2524f75e277c07a97eb84" 322 | url: "https://pub.dev" 323 | source: hosted 324 | version: "3.9.0" 325 | permission_handler_windows: 326 | dependency: transitive 327 | description: 328 | name: permission_handler_windows 329 | sha256: f67cab14b4328574938ecea2db3475dad7af7ead6afab6338772c5f88963e38b 330 | url: "https://pub.dev" 331 | source: hosted 332 | version: "0.1.2" 333 | platform: 334 | dependency: transitive 335 | description: 336 | name: platform 337 | sha256: ebc79f16b5f6b609aad4a5e63447d4795d16f7adee46e93ed03200848c006735 338 | url: "https://pub.dev" 339 | source: hosted 340 | version: "3.0.0" 341 | plugin_platform_interface: 342 | dependency: transitive 343 | description: 344 | name: plugin_platform_interface 345 | sha256: c2c49e16d42fd6983eb55e44b7f197fdf16b4da7aab7f8e1d21da307cad3fb02 346 | url: "https://pub.dev" 347 | source: hosted 348 | version: "2.0.0" 349 | process: 350 | dependency: transitive 351 | description: 352 | name: process 353 | sha256: c7b9f7d8a6ee4407ab4f8a7d4a951f8f5659c40df14c0924e2e97c32372e9b14 354 | url: "https://pub.dev" 355 | source: hosted 356 | version: "4.1.0" 357 | riverpod: 358 | dependency: transitive 359 | description: 360 | name: riverpod 361 | sha256: ca4ef57a23c113420ee9998063effab9c8b1d7142279bd16422a0f08203c79c6 362 | url: "https://pub.dev" 363 | source: hosted 364 | version: "0.13.1" 365 | sky_engine: 366 | dependency: transitive 367 | description: flutter 368 | source: sdk 369 | version: "0.0.99" 370 | source_span: 371 | dependency: transitive 372 | description: 373 | name: source_span 374 | sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 375 | url: "https://pub.dev" 376 | source: hosted 377 | version: "1.9.1" 378 | stack_trace: 379 | dependency: transitive 380 | description: 381 | name: stack_trace 382 | sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 383 | url: "https://pub.dev" 384 | source: hosted 385 | version: "1.11.0" 386 | state_notifier: 387 | dependency: transitive 388 | description: 389 | name: state_notifier 390 | sha256: "629c10533982f40660197f5d2d0884b3ab58a1f6a7e72b16a8aefea6c1e9054a" 391 | url: "https://pub.dev" 392 | source: hosted 393 | version: "0.7.0" 394 | stream_channel: 395 | dependency: transitive 396 | description: 397 | name: stream_channel 398 | sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" 399 | url: "https://pub.dev" 400 | source: hosted 401 | version: "2.1.1" 402 | string_scanner: 403 | dependency: transitive 404 | description: 405 | name: string_scanner 406 | sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" 407 | url: "https://pub.dev" 408 | source: hosted 409 | version: "1.2.0" 410 | term_glyph: 411 | dependency: transitive 412 | description: 413 | name: term_glyph 414 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 415 | url: "https://pub.dev" 416 | source: hosted 417 | version: "1.2.1" 418 | test_api: 419 | dependency: transitive 420 | description: 421 | name: test_api 422 | sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 423 | url: "https://pub.dev" 424 | source: hosted 425 | version: "0.4.16" 426 | typed_data: 427 | dependency: transitive 428 | description: 429 | name: typed_data 430 | sha256: "53bdf7e979cfbf3e28987552fd72f637e63f3c8724c9e56d9246942dc2fa36ee" 431 | url: "https://pub.dev" 432 | source: hosted 433 | version: "1.3.0" 434 | vector_math: 435 | dependency: transitive 436 | description: 437 | name: vector_math 438 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 439 | url: "https://pub.dev" 440 | source: hosted 441 | version: "2.1.4" 442 | win32: 443 | dependency: transitive 444 | description: 445 | name: win32 446 | sha256: "11661cfdf2de1d46dc6e988fd98c0ffbd70e1eb0172efd726cb64648b11b3815" 447 | url: "https://pub.dev" 448 | source: hosted 449 | version: "2.0.4" 450 | xdg_directories: 451 | dependency: transitive 452 | description: 453 | name: xdg_directories 454 | sha256: "0186b3f2d66be9a12b0295bddcf8b6f8c0b0cc2f85c6287344e2a6366bc28457" 455 | url: "https://pub.dev" 456 | source: hosted 457 | version: "0.2.0" 458 | sdks: 459 | dart: ">=2.19.2 <3.0.0" 460 | flutter: ">=2.8.0" 461 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: acr_cloud_sdk_example 2 | description: Demonstrates how to use the acr_cloud_sdk plugin. 3 | version: 0.0.1 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | environment: 9 | sdk: ">=2.12.0 <3.0.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | 15 | acr_cloud_sdk: 16 | # When depending on this package from a real application you should use: 17 | # acr_cloud_sdk: ^x.y.z 18 | # See https://dart.dev/tools/pub/dependencies#version-constraints 19 | # The example app is bundled with the plugin so we use a path dependency on 20 | # the parent directory to use the current plugin's version. 21 | path: ../ 22 | 23 | # The following adds the Cupertino Icons font to your application. 24 | # Use with the CupertinoIcons class for iOS style icons. 25 | cupertino_icons: ^1.0.2 26 | dio: ^4.0.0-beta7 27 | 28 | # State Management 29 | hooks_riverpod: ^0.13.1 30 | flutter_hooks: ^0.16.0 31 | dartz: ^0.10.0-nullsafety.1 32 | 33 | # Equality 34 | equatable: ^2.0.0 35 | modal_bottom_sheet: ^2.0.00 36 | 37 | #UI 38 | google_fonts: ^2.0.0 39 | 40 | dev_dependencies: 41 | flutter_test: 42 | sdk: flutter 43 | 44 | # For information on the generic Dart part of this file, see the 45 | # following page: https://dart.dev/tools/pub/pubspec 46 | 47 | # The following section is specific to Flutter. 48 | flutter: 49 | 50 | # The following line ensures that the Material Icons font is 51 | # included with your application, so that you can use the icons in 52 | # the material Icons class. 53 | uses-material-design: true 54 | 55 | # To add assets to your application, add an assets section, like this: 56 | assets: 57 | - assets/images/ -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:acr_cloud_sdk_example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Verify Platform version', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that platform version is retrieved. 19 | expect( 20 | find.byWidgetPredicate( 21 | (Widget widget) => 22 | widget is Text && widget.data!.startsWith('Running on:'), 23 | ), 24 | findsOneWidget, 25 | ); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | /Flutter/flutter_export_environment.sh -------------------------------------------------------------------------------- /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /ios/Classes/ACRCloudConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // ACRCloud_Config.h 3 | // ACRCloud_IOS_SDK 4 | // 5 | // Created by olym on 15/3/25. 6 | // Copyright (c) 2015年 ACRCloud. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum { 12 | rec_mode_remote = 0, //query remote db 13 | rec_mode_local = 1, //query local db 14 | rec_mode_both = 2, // query both remote db and local db 15 | rec_mode_advance_remote = 3 //query remote db and saving recording fingerprint when offline. 16 | }ACRCloudRecMode; 17 | 18 | typedef enum { 19 | rec_data_audio = 0, //rec audio data 20 | rec_data_humming = 1, //rec humming data 21 | rec_data_both = 2 //rec both 22 | }ACRCloudRecData; 23 | 24 | typedef enum { 25 | result_type_error = -1, 26 | result_type_none = 0, 27 | result_type_audio = 1, 28 | result_type_live = 2, 29 | result_type_audio_live = 3, 30 | }ACRCloudResultType; 31 | 32 | typedef enum { 33 | http_resume_type_error = -1, 34 | http_resume_type_resume = 0, 35 | http_resume_type_restart = 1, 36 | http_resume_type_success = 2, 37 | } HTTPResumeType; 38 | 39 | #define ACRCLOUD_VERSION @"1.0" 40 | 41 | 42 | typedef void(^ACRCloudResultBlock)(NSString *result, ACRCloudResultType resMode); 43 | typedef void(^ACRCloudResultWithFpBlock)(NSString *result, NSData *fingerprint); 44 | typedef void(^ACRCloudResultWithDataBlock)(NSString *result, NSData *data); 45 | 46 | typedef void(^ACRCloudStateBlock)(NSString *state); 47 | 48 | typedef void(^ACRCloudVolumeBlock)(float volume); 49 | 50 | @interface ACRCloudConfig : NSObject 51 | { 52 | NSString *_accessKey; 53 | NSString *_accessSecret; 54 | NSString *_host; 55 | NSString *_audioType; 56 | NSString *_homedir; 57 | NSString *_uuid; 58 | NSString *_protocal; 59 | NSDictionary *_params; 60 | ACRCloudRecMode _recMode; 61 | ACRCloudRecData _recDataType; 62 | NSInteger _requestTimeout; 63 | NSInteger _prerecorderTime; 64 | NSInteger _keepPlaying; 65 | NSUInteger _audioSessionCategory; //default 1, support blooth and airplay 66 | ACRCloudResultBlock _resultBlock; 67 | ACRCloudStateBlock _stateBlock; 68 | ACRCloudVolumeBlock _volumeBlock; 69 | ACRCloudResultWithFpBlock _resultFpBlock; 70 | ACRCloudResultWithDataBlock _resultDataBlock; 71 | } 72 | 73 | @property(nonatomic, retain) NSString *accessKey; 74 | @property(nonatomic, retain) NSString *accessSecret; 75 | @property(nonatomic, retain) NSString *host; 76 | @property(nonatomic, retain) NSString *audioType; 77 | @property(nonatomic, retain) NSString *homedir; 78 | @property(nonatomic, retain) NSString *uuid; 79 | @property(nonatomic, retain) NSString *protocol; 80 | @property(nonatomic, retain) NSDictionary *params; 81 | @property(nonatomic, assign) ACRCloudRecMode recMode; 82 | @property(nonatomic, assign) ACRCloudRecData recDataType; 83 | @property(nonatomic, assign) NSInteger requestTimeout; 84 | @property(nonatomic, assign) NSInteger prerecorderTime; 85 | @property(nonatomic, assign) NSInteger keepPlaying; 86 | @property(nonatomic, assign) NSUInteger audioSessionCategory; 87 | @property(nonatomic, copy) ACRCloudResultBlock resultBlock; 88 | @property(nonatomic, copy) ACRCloudStateBlock stateBlock; 89 | @property(nonatomic, copy) ACRCloudVolumeBlock volumeBlock; 90 | @property(nonatomic, copy) ACRCloudResultWithFpBlock resultFpBlock; 91 | @property(nonatomic, copy) ACRCloudResultWithDataBlock resultDataBlock; 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /ios/Classes/ACRCloudRecognition.h: -------------------------------------------------------------------------------- 1 | // 2 | // ACRCloud_IOS_SDK.h 3 | // ACRCloud_IOS_SDK 4 | // 5 | // Created by olym on 15/3/24. 6 | // Copyright (c) 2015年 ACRCloud. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ACRCloudConfig.h" 11 | 12 | @interface ACRCloudRecognition : NSObject 13 | 14 | -(id)initWithConfig:(ACRCloudConfig*)config; 15 | 16 | -(void)startPreRecord:(NSInteger)recordTime; 17 | -(void)stopPreRecord; 18 | 19 | -(void)startRecordRec; 20 | 21 | -(void)stopRecordRec; 22 | 23 | -(void)stopRecordAndRec; 24 | 25 | //only support RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz 26 | -(NSString*)recognize:(char*)buffer len:(int)len; 27 | 28 | //only support RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz 29 | -(NSString*)recognize:(NSData*)pcm_data; 30 | 31 | -(void)recognize_fp:(NSData*)fingerprint 32 | resultBlock:(ACRCloudResultBlock)resultBlock; 33 | 34 | -(NSString*)recognize_fp:(NSData*)fingerprint; 35 | -(NSString*)recognize_hum_fp:(NSData*)fingerprint; 36 | 37 | //only support RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz 38 | +(NSData*)get_fingerprint:(char*)pcm len:(int)len; 39 | +(NSData*)get_fingerprint:(NSData*)pcm; 40 | +(NSData*)get_hum_fingerprint:(NSData*)pcm; 41 | 42 | +(NSData*) get_fingerprint:(char*)pcm 43 | len:(unsigned)len 44 | sampleRate:(unsigned)sampleRate 45 | nChannel:(short)nChannel; 46 | +(NSData*)get_fingerprint:(NSData*)pcm 47 | sampleRate:(unsigned)sampleRate 48 | nChannel:(short)nChannel; 49 | 50 | //convert pcm/wav to mono 8000HZ 51 | +(NSData*) resample:(NSData*)pcm 52 | sampleRate:(unsigned)sampleRate 53 | nChannel:(short)nChannel; 54 | 55 | +(NSData*) resample:(char*)pcm 56 | len:(unsigned)len 57 | sampleRate:(unsigned)sampleRate 58 | nChannel:(short)nChannel; 59 | 60 | +(NSData*) resample_bit32:(char*)pcm 61 | len:(unsigned)bytes 62 | sampleRate:(unsigned)sampleRate 63 | nChannel:(short)nChannel 64 | isFloat:(bool)isFloat; 65 | 66 | +(NSString*) version; 67 | @end 68 | -------------------------------------------------------------------------------- /ios/Classes/AcrCloudSdkPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface AcrCloudSdkPlugin : NSObject 4 | @end 5 | -------------------------------------------------------------------------------- /ios/Classes/AcrCloudSdkPlugin.m: -------------------------------------------------------------------------------- 1 | #import "AcrCloudSdkPlugin.h" 2 | #if __has_include() 3 | #import 4 | #else 5 | // Support project import fallback if the generated compatibility header 6 | // is not copied when this plugin is created as a library. 7 | // https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 8 | #import "acr_cloud_sdk-Swift.h" 9 | #endif 10 | 11 | @implementation AcrCloudSdkPlugin 12 | + (void)registerWithRegistrar:(NSObject*)registrar { 13 | [SwiftAcrCloudSdkPlugin registerWithRegistrar:registrar]; 14 | } 15 | @end 16 | -------------------------------------------------------------------------------- /ios/Classes/SwiftAcrCloudSdkPlugin.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | public class SwiftAcrCloudSdkPlugin: NSObject, FlutterPlugin, FlutterStreamHandler { 4 | var _start = false 5 | var _client: ACRCloudRecognition? 6 | var timeEvents:FlutterEventSink? 7 | var resultEvents:FlutterEventSink? 8 | final var TAG = "acr_cloud_sdk" 9 | 10 | public static func register(with registrar: FlutterPluginRegistrar) { 11 | let channel = FlutterMethodChannel(name: "plugins.chizi.tech/acr_cloud_sdk", binaryMessenger: registrar.messenger()) 12 | let instance = SwiftAcrCloudSdkPlugin() 13 | let timeChannel = FlutterEventChannel.init( name: "plugins.chizi.tech/acr_cloud_sdk.time",binaryMessenger: registrar.messenger()) 14 | 15 | let resultChannel = FlutterEventChannel.init(name: "plugins.chizi.tech/acr_cloud_sdk.result",binaryMessenger: registrar.messenger()); 16 | 17 | timeChannel.setStreamHandler(instance) 18 | resultChannel.setStreamHandler(instance) 19 | 20 | 21 | registrar.addMethodCallDelegate(instance, channel: channel) 22 | } 23 | 24 | public func onListen(withArguments arguments: Any?, 25 | eventSink: @escaping FlutterEventSink) -> FlutterError? { 26 | 27 | if arguments as? Int == 0 { 28 | timeEvents = eventSink 29 | } 30 | 31 | if arguments as? Int == 1 { 32 | resultEvents = eventSink 33 | } 34 | 35 | return nil 36 | } 37 | 38 | public func onCancel(withArguments arguments: Any?) -> FlutterError? { 39 | timeEvents = nil 40 | resultEvents = nil 41 | return nil 42 | } 43 | 44 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 45 | 46 | DispatchQueue.main.async { [self] in 47 | switch call.method { 48 | case "init": 49 | self.initialize(call:call, result: result) 50 | 51 | case "start": 52 | if(_client != nil){ 53 | self.startRecognition(result: result) 54 | }else{ 55 | result(FlutterError.init(code: TAG, message: "init error", details: "please initialize plugin with .init()")) 56 | } 57 | 58 | case "cancel": 59 | if(_client != nil){ 60 | self.stopRecognition(result: result) 61 | }else{ 62 | result(FlutterError.init(code: TAG, message: "init error", details: "please initialize plugin with .init()")) 63 | } 64 | default: 65 | result(FlutterMethodNotImplemented) 66 | return 67 | } 68 | } 69 | } 70 | 71 | public func initialize(call: FlutterMethodCall, result: @escaping FlutterResult) { 72 | 73 | do{ 74 | if let args = call.arguments as? Dictionary, 75 | let host = args["host"] as? String, 76 | let accessKey = args["accessKey"] as? String, 77 | let accessSecret = args["accessSecret"] as? String, 78 | let requestTimeout = args["recorderConfigChannels"] as? Int, 79 | let recMode = args["recMode"] as? Int{ 80 | let config = ACRCloudConfig(); 81 | 82 | config.accessKey = accessKey 83 | config.accessSecret = accessSecret 84 | config.host = host 85 | 86 | config.requestTimeout = requestTimeout 87 | //if you want to identify your offline db, set the recMode to "rec_mode_local" 88 | 89 | switch recMode { 90 | case 0: 91 | config.recMode = rec_mode_remote; 92 | 93 | case 1: 94 | config.recMode = rec_mode_local; 95 | 96 | case 2: 97 | config.recMode = rec_mode_both; 98 | 99 | case 3: 100 | config.recMode = rec_mode_advance_remote; 101 | 102 | default: 103 | config.recMode = rec_mode_remote; 104 | } 105 | 106 | config.requestTimeout = 10; 107 | config.protocol = "https"; 108 | 109 | /* used for local model */ 110 | if (config.recMode == rec_mode_local || config.recMode == rec_mode_both) { 111 | config.homedir = Bundle.main.resourcePath!.appending("/acrcloud_local_db"); 112 | } 113 | 114 | config.stateBlock = {[weak self] state in 115 | self?.handleState(state!); 116 | } 117 | config.volumeBlock = {[weak self] volume in 118 | //do some animations with volume 119 | self?.handleVolume(volume); 120 | }; 121 | config.resultBlock = {[weak self] result, resType in 122 | self?.handleResult(result!, resType:resType); 123 | } 124 | self._client = ACRCloudRecognition(config: config); 125 | result(true) 126 | } else { 127 | result(FlutterError.init(code: TAG, message: nil, details: "init failed")) 128 | } 129 | 130 | } 131 | 132 | } 133 | 134 | public func detachFromEngine(for registrar: FlutterPluginRegistrar) { 135 | _client = nil 136 | } 137 | 138 | public func startRecognition(result: @escaping FlutterResult) { 139 | if (_start) { 140 | result(false) 141 | return; 142 | } 143 | self._client?.startRecordRec(); 144 | self._start = true; 145 | result(true) 146 | } 147 | 148 | func stopRecognition(result: @escaping FlutterResult) { 149 | self._client?.stopRecordRec() 150 | self._start = false; 151 | } 152 | 153 | func handleResult(_ result: String, resType: ACRCloudResultType) -> Void 154 | { 155 | 156 | DispatchQueue.main.async { 157 | if(self.resultEvents != nil){ 158 | self.resultEvents!(result); 159 | } 160 | self._client?.stopRecordRec(); 161 | self._start = false; 162 | } 163 | } 164 | 165 | func handleVolume(_ volume: Float) -> Void { 166 | DispatchQueue.main.async { 167 | if(self.timeEvents != nil){ 168 | self.timeEvents!(Double(volume)); 169 | } 170 | // self.volumeLabel.text = String(format: "Volume: %f", volume) 171 | } 172 | } 173 | 174 | func handleState(_ state: String) -> Void 175 | { 176 | DispatchQueue.main.async { 177 | 178 | debugPrint(state) 179 | } 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /ios/Libraries/libACRCloud_IOS_SDK.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/ios/Libraries/libACRCloud_IOS_SDK.a -------------------------------------------------------------------------------- /ios/acr_cloud_sdk.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint acr_cloud_sdk.podspec' to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'acr_cloud_sdk' 7 | s.version = '0.0.1' 8 | s.summary = 'A new flutter plugin project.' 9 | s.description = <<-DESC 10 | A new flutter plugin project. 11 | DESC 12 | s.homepage = 'http://example.com' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Your Company' => 'email@example.com' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'Classes/**/*' 17 | s.public_header_files = 'Classes/*.h' 18 | s.dependency 'Flutter' 19 | s.platform = :ios, '8.0' 20 | 21 | s.requires_arc = true 22 | s.frameworks = 'AVFoundation', 'AudioToolbox', 'Security' 23 | s.libraries = 'resolv', 'c++' 24 | s.vendored_libraries = 'Libraries/libACRCloud_IOS_SDK.a' 25 | 26 | # Flutter.framework does not contain a i386 slice. 27 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } 28 | s.swift_version = '5.0' 29 | end 30 | -------------------------------------------------------------------------------- /lib/acr_cloud_sdk.dart: -------------------------------------------------------------------------------- 1 | library acr_cloud_sdk; 2 | 3 | export 'src/models/song_model.dart'; 4 | export 'src/acr_cloud.dart'; 5 | -------------------------------------------------------------------------------- /lib/src/acr_cloud.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: constant_identifier_names 2 | 3 | import 'dart:async'; 4 | import 'dart:io'; 5 | import 'package:flutter/services.dart'; 6 | import 'package:permission_handler/permission_handler.dart'; 7 | 8 | import 'models/song_model.dart'; 9 | 10 | /// Recognition mode 11 | /// 12 | /// https://docs.acrcloud.com/docs/acrcloud/audio-fingerprinting-sdks/android-sdk/ 13 | 14 | enum ACRCloudRecMode { 15 | /// query remote db 16 | remote, 17 | 18 | /// query local db 19 | local, 20 | 21 | /// query both remote db and local db 22 | both, 23 | 24 | ///query remote db and saving recording fingerprint when offline. 25 | advance_remote, 26 | 27 | /// default mode 28 | default_mode 29 | } 30 | 31 | /// ACRCloudClient is the main class of this SDK. It provides functions of configuration management, 32 | /// automatic audio recording and recognition, manual audio file recognition and so on. 33 | /// 34 | class AcrCloudSdk { 35 | static const MethodChannel _channel = 36 | MethodChannel('plugins.chizi.tech/acr_cloud_sdk'); 37 | 38 | static const EventChannel _resultChannel = 39 | EventChannel('plugins.chizi.tech/acr_cloud_sdk.result'); 40 | 41 | static const EventChannel _timeChannel = 42 | EventChannel('plugins.chizi.tech/acr_cloud_sdk.time'); 43 | 44 | /// Fires whenever a song's time is recognized 45 | /// returns data as ```double``` 46 | /// 47 | Stream get timeStream => 48 | _timeChannel.receiveBroadcastStream(0).cast(); 49 | 50 | /// Fires whenever a song is recognized 51 | /// returns data as ```String``` 52 | /// 53 | Stream get resultStream => 54 | _resultChannel.receiveBroadcastStream(1).cast(); 55 | 56 | /// Fires whenever a song is recognized 57 | /// returns data as ```SongModel``` object 58 | /// 59 | Stream get songModelStream => 60 | resultStream.map((e) => SongModel.fromJson(e)); 61 | 62 | /// You should initilize the AcrCloudSdk instance with this function. 63 | /// 64 | /// The `host` argument's meaning depends on recMode, if recMode is `ACRCloudRecMode.local` 65 | /// it means local fingerprinting database directory else it means the host of server 66 | /// 67 | /// `LocationData`. The `interval` and `distanceFilter` are controlling how 68 | /// 69 | /// `accessKey` is the Access key of your ACRCloud project 70 | /// 71 | /// `accessSecret` is the Access secret of your ACRCloud project 72 | /// 73 | /// Http request timeout, default is [5000ms] and can be set using `requestTimeout`. 74 | /// 75 | /// This `setLog` argument is to toggle display of log in terminal 76 | /// 77 | /// `recMode` argument is the Recognition mode 78 | Future init({ 79 | required String host, 80 | required String accessKey, 81 | required String accessSecret, 82 | String? hostAuto, 83 | String? accessKeyAuto, 84 | String? accessSecretAuto, 85 | int recorderConfigRate = 8000, 86 | Duration? requestTimeout, 87 | int recorderConfigChannels = 1, 88 | bool isVolumeCallback = true, 89 | bool setLog = true, 90 | ACRCloudRecMode recMode = ACRCloudRecMode.default_mode, 91 | }) async { 92 | try { 93 | var status = await Permission.microphone.status; 94 | if ((status.isDenied || status.isPermanentlyDenied) && 95 | Platform.isAndroid) { 96 | // We didn't ask for permission yet. 97 | await [ 98 | Permission.microphone, 99 | Permission.location, 100 | Permission.locationAlways, 101 | Permission.locationWhenInUse, 102 | Permission.phone, 103 | Permission.storage, 104 | ].request(); 105 | return await init( 106 | host: host, 107 | accessKey: accessKey, 108 | accessSecret: accessSecret, 109 | hostAuto: hostAuto, 110 | accessKeyAuto: accessKeyAuto, 111 | accessSecretAuto: accessSecretAuto, 112 | recorderConfigRate: recorderConfigRate, 113 | recorderConfigChannels: recorderConfigChannels, 114 | requestTimeout: requestTimeout, 115 | isVolumeCallback: isVolumeCallback, 116 | setLog: setLog, 117 | recMode: recMode); 118 | } else { 119 | return await _channel.invokeMethod( 120 | 'init', 121 | { 122 | "host": host, 123 | "accessKey": accessKey, 124 | "accessSecret": accessSecret, 125 | "hostAuto": hostAuto ?? host, 126 | "accessKeyAuto": accessKeyAuto ?? accessKey, 127 | "accessSecretAuto": accessSecretAuto ?? accessSecret, 128 | "recorderConfigRate": recorderConfigRate, 129 | "recorderConfigChannels": recorderConfigChannels, 130 | "isVolumeCallback": isVolumeCallback, 131 | "setLog": setLog, 132 | "requestTimeout": requestTimeout?.inMilliseconds, 133 | "recMode": recMode.index, 134 | }, 135 | ); 136 | } 137 | } catch (e) { 138 | return false; 139 | } 140 | } 141 | 142 | /// This function will automatic start the recording and recognizing process. 143 | /// 144 | /// `autoRecognize` & `requestRadioMetadata` are false by default 145 | /// 146 | Future start({ 147 | bool autoRecognize = false, 148 | bool requestRadioMetadata = false, 149 | }) async { 150 | final bool data = await _channel.invokeMethod( 151 | 'start', 152 | { 153 | "autoRecognize": autoRecognize, 154 | "requestRadioMetadata": requestRadioMetadata, 155 | }, 156 | ); 157 | return data; 158 | } 159 | 160 | /// This function will cancel the recognition immediately. 161 | /// 162 | Future stop() async { 163 | final bool data = await _channel.invokeMethod('cancel'); 164 | return data; 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /lib/src/models/song_model.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | /// ACRCloud Music Metadata 4 | /// 5 | /// https://docs.acrcloud.com/docs/acrcloud/metadata/music/ 6 | /// 7 | class SongModel { 8 | /// Response Status 9 | Status? status; 10 | 11 | /// Response metadata 12 | Metadata? metadata; 13 | 14 | /// Response resultType 15 | int? resultType; 16 | 17 | double? costTime; 18 | 19 | SongModel({this.status, this.metadata, this.resultType, this.costTime}); 20 | 21 | SongModel.fromJson(String data) { 22 | Map json = jsonDecode(data); 23 | status = json['status'] != null ? Status.fromJson(json['status']) : null; 24 | metadata = 25 | json['metadata'] != null ? Metadata.fromJson(json['metadata']) : null; 26 | resultType = json['result_type']; 27 | costTime = json['cost_time']; 28 | } 29 | 30 | Map toJson() { 31 | final data = {}; 32 | if (status != null) { 33 | data['status'] = status?.toJson(); 34 | } 35 | if (metadata != null) { 36 | data['metadata'] = metadata?.toJson(); 37 | } 38 | data['result_type'] = resultType; 39 | data['cost_time'] = costTime; 40 | return data; 41 | } 42 | } 43 | 44 | class Status { 45 | String? msg; 46 | String? version; 47 | int? code; 48 | 49 | Status({this.msg, this.version, this.code}); 50 | 51 | Status.fromJson(Map json) { 52 | msg = json['msg']; 53 | version = json['version']; 54 | code = json['code']; 55 | } 56 | 57 | Map toJson() { 58 | final Map data = {}; 59 | data['msg'] = msg; 60 | data['version'] = version; 61 | data['code'] = code; 62 | return data; 63 | } 64 | } 65 | 66 | class Metadata { 67 | List? music; 68 | String? timestampUtc; 69 | 70 | Metadata({this.music, this.timestampUtc}); 71 | 72 | Metadata.fromJson(Map json) { 73 | if (json['music'] != null) { 74 | music = []; 75 | json['music'].forEach((v) { 76 | music?.add(Music.fromJson(v)); 77 | }); 78 | } 79 | timestampUtc = json['timestamp_utc']; 80 | } 81 | 82 | Map toJson() { 83 | final Map data = {}; 84 | if (music != null) { 85 | data['music'] = music?.map((v) => v.toJson()).toList(); 86 | } 87 | data['timestamp_utc'] = timestampUtc; 88 | return data; 89 | } 90 | } 91 | 92 | class Music { 93 | /// Music label information 94 | String? label; 95 | 96 | /// External 3rd party IDs and metadata 97 | ExternalMetadata? externalMetadata; 98 | 99 | /// ACRCloud unique identifier 100 | String? acrid; 101 | 102 | /// Album fields 103 | Album? album; 104 | 105 | int? resultFrom; 106 | 107 | /// Artists fields 108 | List? artists; 109 | 110 | /// Track title 111 | String? title; 112 | 113 | /// Duration of the track in millisecond 114 | int? durationMs; 115 | 116 | /// Release data of the track, format:YYYY-MM-DD 117 | String? releaseDate; 118 | 119 | /// Match confidence score. 120 | /// Range: 70 - 100 121 | int? score; 122 | 123 | /// The time position of the audio/song being played (millisecond) 124 | int? playOffsetMs; 125 | 126 | Music( 127 | {this.label, 128 | this.externalMetadata, 129 | this.acrid, 130 | this.album, 131 | this.resultFrom, 132 | this.artists, 133 | this.title, 134 | this.durationMs, 135 | this.releaseDate, 136 | this.score, 137 | this.playOffsetMs}); 138 | 139 | Music.fromJson(Map json) { 140 | label = json['label']; 141 | externalMetadata = json['external_metadata'] != null 142 | ? ExternalMetadata.fromJson(json['external_metadata']) 143 | : null; 144 | acrid = json['acrid']; 145 | album = json['album'] != null ? Album.fromJson(json['album']) : null; 146 | resultFrom = json['result_from']; 147 | if (json['artists'] != null) { 148 | artists = []; 149 | json['artists'].forEach((v) { 150 | artists?.add(Artists.fromJson(v)); 151 | }); 152 | } 153 | title = json['title']; 154 | durationMs = json['duration_ms']; 155 | releaseDate = json['release_date']; 156 | score = json['score']; 157 | playOffsetMs = json['play_offset_ms']; 158 | } 159 | 160 | Map toJson() { 161 | final Map data = {}; 162 | data['label'] = label; 163 | if (externalMetadata != null) { 164 | data['external_metadata'] = externalMetadata?.toJson(); 165 | } 166 | data['acrid'] = acrid; 167 | if (album != null) { 168 | data['album'] = album?.toJson(); 169 | } 170 | data['result_from'] = resultFrom; 171 | if (artists != null) { 172 | data['artists'] = artists?.map((v) => v.toJson()).toList(); 173 | } 174 | data['title'] = title; 175 | data['duration_ms'] = durationMs; 176 | data['release_date'] = releaseDate; 177 | data['score'] = score; 178 | data['play_offset_ms'] = playOffsetMs; 179 | 180 | return data; 181 | } 182 | } 183 | 184 | class ExternalMetadata { 185 | /// Spotify fields 186 | Spotify? spotify; 187 | 188 | /// Deezer fields 189 | Deezer? deezer; 190 | 191 | ExternalMetadata({this.spotify, this.deezer}); 192 | 193 | ExternalMetadata.fromJson(Map json) { 194 | spotify = 195 | json['spotify'] != null ? Spotify.fromJson(json['spotify']) : null; 196 | deezer = json['deezer'] != null ? Deezer.fromJson(json['deezer']) : null; 197 | } 198 | 199 | Map toJson() { 200 | final Map data = {}; 201 | if (spotify != null) { 202 | data['spotify'] = spotify?.toJson(); 203 | } 204 | if (deezer != null) { 205 | data['deezer'] = deezer?.toJson(); 206 | } 207 | return data; 208 | } 209 | } 210 | 211 | class Album { 212 | String? name; 213 | 214 | Album({this.name}); 215 | 216 | Album.fromJson(Map json) { 217 | name = json['name']; 218 | } 219 | 220 | Map toJson() { 221 | final Map data = {}; 222 | data['name'] = name; 223 | return data; 224 | } 225 | } 226 | 227 | class Artists { 228 | String? name; 229 | 230 | Artists({this.name}); 231 | 232 | Artists.fromJson(Map json) { 233 | name = json['name']; 234 | } 235 | 236 | Map toJson() { 237 | final Map data = {}; 238 | data['name'] = name; 239 | return data; 240 | } 241 | } 242 | 243 | class Spotify { 244 | SpotifyAlbum? album; 245 | List? artists; 246 | Track? track; 247 | 248 | Spotify({this.album, this.artists, this.track}); 249 | 250 | Spotify.fromJson(Map json) { 251 | album = json['album'] != null ? SpotifyAlbum.fromJson(json['album']) : null; 252 | if (json['artists'] != null) { 253 | artists = []; 254 | json['artists'].forEach((v) { 255 | artists?.add(SpotifyArtists.fromJson(v)); 256 | }); 257 | } 258 | track = json['track'] != null ? Track.fromJson(json['track']) : null; 259 | } 260 | 261 | Map toJson() { 262 | final Map data = {}; 263 | if (album != null) { 264 | data['album'] = album?.toJson(); 265 | } 266 | if (artists != null) { 267 | data['artists'] = artists?.map((v) => v.toJson()).toList(); 268 | } 269 | if (track != null) { 270 | data['track'] = track?.toJson(); 271 | } 272 | return data; 273 | } 274 | } 275 | 276 | class SpotifyAlbum { 277 | /// Name of the album 278 | dynamic name; 279 | 280 | // ID of the album 281 | dynamic id; 282 | 283 | SpotifyAlbum({this.name, this.id}); 284 | 285 | SpotifyAlbum.fromJson(Map json) { 286 | name = json['name']; 287 | id = json['id']; 288 | } 289 | 290 | Map toJson() { 291 | final Map data = {}; 292 | data['name'] = name; 293 | data['id'] = id; 294 | return data; 295 | } 296 | } 297 | 298 | class SpotifyArtists { 299 | /// Name of the artists 300 | dynamic name; 301 | 302 | // ID of the artists 303 | dynamic id; 304 | 305 | SpotifyArtists({this.name, this.id}); 306 | 307 | SpotifyArtists.fromJson(Map json) { 308 | name = json['name']; 309 | id = json['id']; 310 | } 311 | 312 | Map toJson() { 313 | final Map data = {}; 314 | data['name'] = name; 315 | data['id'] = id; 316 | return data; 317 | } 318 | } 319 | 320 | class Deezer { 321 | DeezerAlbum? deezerAlbum; 322 | List? deezerArtists; 323 | Track? track; 324 | 325 | Deezer({this.deezerAlbum, this.deezerArtists, this.track}); 326 | 327 | Deezer.fromJson(Map json) { 328 | deezerAlbum = json['deezer_album'] != null 329 | ? DeezerAlbum.fromJson(json['deezer_album']) 330 | : null; 331 | if (json['artists'] != null) { 332 | deezerArtists = []; 333 | json['artists'].forEach((v) { 334 | deezerArtists?.add(DeezerArtists.fromJson(v)); 335 | }); 336 | } 337 | track = json['track'] != null ? Track.fromJson(json['track']) : null; 338 | } 339 | 340 | Map toJson() { 341 | final Map data = {}; 342 | if (deezerAlbum != null) { 343 | data['album'] = deezerAlbum?.toJson(); 344 | } 345 | if (deezerArtists != null) { 346 | data['artists'] = deezerArtists?.map((v) => v.toJson()).toList(); 347 | } 348 | if (track != null) { 349 | data['track'] = track?.toJson(); 350 | } 351 | return data; 352 | } 353 | } 354 | 355 | class DeezerAlbum { 356 | int? id; 357 | 358 | DeezerAlbum({this.id}); 359 | 360 | DeezerAlbum.fromJson(Map json) { 361 | id = json['id']; 362 | } 363 | 364 | Map toJson() { 365 | final Map data = {}; 366 | data['id'] = id; 367 | return data; 368 | } 369 | } 370 | 371 | class DeezerArtists { 372 | /// Name of the artists 373 | dynamic name; 374 | 375 | // ID of the artists 376 | dynamic id; 377 | 378 | DeezerArtists({this.name, this.id}); 379 | 380 | DeezerArtists.fromJson(Map json) { 381 | name = json['name']; 382 | id = json['id']; 383 | } 384 | 385 | Map toJson() { 386 | final Map data = {}; 387 | data['name'] = name; 388 | data['id'] = id; 389 | return data; 390 | } 391 | } 392 | 393 | class Track { 394 | /// Name of the track 395 | String? name; 396 | 397 | // ID of the track 398 | String? id; 399 | 400 | Track({this.name, this.id}); 401 | 402 | Track.fromJson(Map json) { 403 | name = json['name']; 404 | id = json['id']; 405 | } 406 | 407 | Map toJson() { 408 | final Map data = {}; 409 | data['name'] = name; 410 | data['id'] = id; 411 | return data; 412 | } 413 | } 414 | -------------------------------------------------------------------------------- /macos/Classes/ACRCloudConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // ACRCloud_Config.h 3 | // ACRCloud_IOS_SDK 4 | // 5 | // Created by olym on 15/3/25. 6 | // Copyright (c) 2015年 ACRCloud. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum { 12 | rec_mode_remote = 0, //query remote db 13 | rec_mode_local = 1, //query local db 14 | rec_mode_both = 2, // query both remote db and local db 15 | rec_mode_advance_remote = 3 //query remote db and saving recording fingerprint when offline. 16 | }ACRCloudRecMode; 17 | 18 | typedef enum { 19 | rec_data_audio = 0, //rec audio data 20 | rec_data_humming = 1, //rec humming data 21 | rec_data_both = 2 //rec both 22 | }ACRCloudRecData; 23 | 24 | typedef enum { 25 | result_type_error = -1, 26 | result_type_none = 0, 27 | result_type_audio = 1, 28 | result_type_live = 2, 29 | result_type_audio_live = 3, 30 | }ACRCloudResultType; 31 | 32 | typedef enum { 33 | http_resume_type_error = -1, 34 | http_resume_type_resume = 0, 35 | http_resume_type_restart = 1, 36 | http_resume_type_success = 2, 37 | } HTTPResumeType; 38 | 39 | #define ACRCLOUD_VERSION @"1.0" 40 | 41 | 42 | typedef void(^ACRCloudResultBlock)(NSString *result, ACRCloudResultType resMode); 43 | typedef void(^ACRCloudResultWithFpBlock)(NSString *result, NSData *fingerprint); 44 | typedef void(^ACRCloudResultWithDataBlock)(NSString *result, NSData *data); 45 | 46 | typedef void(^ACRCloudStateBlock)(NSString *state); 47 | 48 | typedef void(^ACRCloudVolumeBlock)(float volume); 49 | 50 | @interface ACRCloudConfig : NSObject 51 | { 52 | NSString *_accessKey; 53 | NSString *_accessSecret; 54 | NSString *_host; 55 | NSString *_audioType; 56 | NSString *_homedir; 57 | NSString *_uuid; 58 | NSString *_protocal; 59 | NSDictionary *_params; 60 | ACRCloudRecMode _recMode; 61 | ACRCloudRecData _recDataType; 62 | NSInteger _requestTimeout; 63 | NSInteger _prerecorderTime; 64 | NSInteger _keepPlaying; 65 | NSUInteger _audioSessionCategory; //default 1, support blooth and airplay 66 | ACRCloudResultBlock _resultBlock; 67 | ACRCloudStateBlock _stateBlock; 68 | ACRCloudVolumeBlock _volumeBlock; 69 | ACRCloudResultWithFpBlock _resultFpBlock; 70 | ACRCloudResultWithDataBlock _resultDataBlock; 71 | } 72 | 73 | @property(nonatomic, retain) NSString *accessKey; 74 | @property(nonatomic, retain) NSString *accessSecret; 75 | @property(nonatomic, retain) NSString *host; 76 | @property(nonatomic, retain) NSString *audioType; 77 | @property(nonatomic, retain) NSString *homedir; 78 | @property(nonatomic, retain) NSString *uuid; 79 | @property(nonatomic, retain) NSString *protocol; 80 | @property(nonatomic, retain) NSDictionary *params; 81 | @property(nonatomic, assign) ACRCloudRecMode recMode; 82 | @property(nonatomic, assign) ACRCloudRecData recDataType; 83 | @property(nonatomic, assign) NSInteger requestTimeout; 84 | @property(nonatomic, assign) NSInteger prerecorderTime; 85 | @property(nonatomic, assign) NSInteger keepPlaying; 86 | @property(nonatomic, assign) NSUInteger audioSessionCategory; 87 | @property(nonatomic, copy) ACRCloudResultBlock resultBlock; 88 | @property(nonatomic, copy) ACRCloudStateBlock stateBlock; 89 | @property(nonatomic, copy) ACRCloudVolumeBlock volumeBlock; 90 | @property(nonatomic, copy) ACRCloudResultWithFpBlock resultFpBlock; 91 | @property(nonatomic, copy) ACRCloudResultWithDataBlock resultDataBlock; 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /macos/Classes/ACRCloudRecognition.h: -------------------------------------------------------------------------------- 1 | // 2 | // ACRCloud_IOS_SDK.h 3 | // ACRCloud_IOS_SDK 4 | // 5 | // Created by olym on 15/3/24. 6 | // Copyright (c) 2015年 ACRCloud. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ACRCloudConfig.h" 11 | 12 | @interface ACRCloudRecognition : NSObject 13 | 14 | -(id)initWithConfig:(ACRCloudConfig*)config; 15 | 16 | -(void)startPreRecord:(NSInteger)recordTime; 17 | -(void)stopPreRecord; 18 | 19 | -(void)startRecordRec; 20 | 21 | -(void)stopRecordRec; 22 | 23 | -(void)stopRecordAndRec; 24 | 25 | //only support RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz 26 | -(NSString*)recognize:(char*)buffer len:(int)len; 27 | 28 | //only support RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz 29 | -(NSString*)recognize:(NSData*)pcm_data; 30 | 31 | -(void)recognize_fp:(NSData*)fingerprint 32 | resultBlock:(ACRCloudResultBlock)resultBlock; 33 | 34 | -(NSString*)recognize_fp:(NSData*)fingerprint; 35 | -(NSString*)recognize_hum_fp:(NSData*)fingerprint; 36 | 37 | //only support RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz 38 | +(NSData*)get_fingerprint:(char*)pcm len:(int)len; 39 | +(NSData*)get_fingerprint:(NSData*)pcm; 40 | +(NSData*)get_hum_fingerprint:(NSData*)pcm; 41 | 42 | +(NSData*) get_fingerprint:(char*)pcm 43 | len:(unsigned)len 44 | sampleRate:(unsigned)sampleRate 45 | nChannel:(short)nChannel; 46 | +(NSData*)get_fingerprint:(NSData*)pcm 47 | sampleRate:(unsigned)sampleRate 48 | nChannel:(short)nChannel; 49 | 50 | //convert pcm/wav to mono 8000HZ 51 | +(NSData*) resample:(NSData*)pcm 52 | sampleRate:(unsigned)sampleRate 53 | nChannel:(short)nChannel; 54 | 55 | +(NSData*) resample:(char*)pcm 56 | len:(unsigned)len 57 | sampleRate:(unsigned)sampleRate 58 | nChannel:(short)nChannel; 59 | 60 | +(NSData*) resample_bit32:(char*)pcm 61 | len:(unsigned)bytes 62 | sampleRate:(unsigned)sampleRate 63 | nChannel:(short)nChannel 64 | isFloat:(bool)isFloat; 65 | 66 | +(NSString*) version; 67 | @end 68 | -------------------------------------------------------------------------------- /macos/Classes/AcrCloudSdkPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface AcrCloudSdkPlugin : NSObject 4 | @end 5 | -------------------------------------------------------------------------------- /macos/Classes/AcrCloudSdkPlugin.m: -------------------------------------------------------------------------------- 1 | #import "AcrCloudSdkPlugin.h" 2 | #if __has_include() 3 | #import 4 | #else 5 | // Support project import fallback if the generated compatibility header 6 | // is not copied when this plugin is created as a library. 7 | // https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 8 | #import "acr_cloud_sdk-Swift.h" 9 | #endif 10 | 11 | @implementation AcrCloudSdkPlugin 12 | + (void)registerWithRegistrar:(NSObject*)registrar { 13 | [SwiftAcrCloudSdkPlugin registerWithRegistrar:registrar]; 14 | } 15 | @end 16 | -------------------------------------------------------------------------------- /macos/Classes/SwiftAcrCloudSdkPlugin.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | public class AcrCloudSdkPlugin: NSObject, FlutterPlugin { 5 | public static func register(with registrar: FlutterPluginRegistrar) { 6 | let channel = FlutterMethodChannel(name: "acr_cloud_sdk", binaryMessenger: registrar.messenger) 7 | let instance = AcrCloudSdkPlugin() 8 | registrar.addMethodCallDelegate(instance, channel: channel) 9 | } 10 | 11 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 12 | switch call.method { 13 | case "getPlatformVersion": 14 | result("macOS " + ProcessInfo.processInfo.operatingSystemVersionString) 15 | default: 16 | result(FlutterMethodNotImplemented) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /macos/Libraries/libACRCloud_IOS_SDK.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zfinix/acr_cloud_sdk/f75c17fc94b70afbe06d046b419afb84ded09859/macos/Libraries/libACRCloud_IOS_SDK.a -------------------------------------------------------------------------------- /macos/acr_cloud_sdk.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint acr_cloud_sdk.podspec` to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'acr_cloud_sdk' 7 | s.version = '0.0.1' 8 | s.summary = 'A new flutter plugin project.' 9 | s.description = <<-DESC 10 | A new flutter plugin project. 11 | DESC 12 | s.homepage = 'http://example.com' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Your Company' => 'email@example.com' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'Classes/**/*' 17 | s.dependency 'FlutterMacOS' 18 | 19 | s.platform = :osx, '10.11' 20 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } 21 | s.swift_version = '5.0' 22 | 23 | s.requires_arc = true 24 | s.frameworks = 'AVFoundation', 'AudioToolbox', 'Security' 25 | s.libraries = 'resolv', 'c++' 26 | s.vendored_libraries = 'Libraries/libACRCloud_IOS_SDK.a' 27 | 28 | # Flutter.framework does not contain a i386 slice. 29 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES'} 30 | s.swift_version = '5.0' 31 | end 32 | 33 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.10.0" 12 | boolean_selector: 13 | dependency: transitive 14 | description: 15 | name: boolean_selector 16 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.1.1" 20 | characters: 21 | dependency: transitive 22 | description: 23 | name: characters 24 | sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "1.2.1" 28 | clock: 29 | dependency: transitive 30 | description: 31 | name: clock 32 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "1.1.1" 36 | collection: 37 | dependency: transitive 38 | description: 39 | name: collection 40 | sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.17.0" 44 | fake_async: 45 | dependency: transitive 46 | description: 47 | name: fake_async 48 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "1.3.1" 52 | flutter: 53 | dependency: "direct main" 54 | description: flutter 55 | source: sdk 56 | version: "0.0.0" 57 | flutter_test: 58 | dependency: "direct dev" 59 | description: flutter 60 | source: sdk 61 | version: "0.0.0" 62 | js: 63 | dependency: transitive 64 | description: 65 | name: js 66 | sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" 67 | url: "https://pub.dev" 68 | source: hosted 69 | version: "0.6.5" 70 | lints: 71 | dependency: "direct dev" 72 | description: 73 | name: lints 74 | sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c 75 | url: "https://pub.dev" 76 | source: hosted 77 | version: "1.0.1" 78 | matcher: 79 | dependency: transitive 80 | description: 81 | name: matcher 82 | sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" 83 | url: "https://pub.dev" 84 | source: hosted 85 | version: "0.12.13" 86 | material_color_utilities: 87 | dependency: transitive 88 | description: 89 | name: material_color_utilities 90 | sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 91 | url: "https://pub.dev" 92 | source: hosted 93 | version: "0.2.0" 94 | meta: 95 | dependency: transitive 96 | description: 97 | name: meta 98 | sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" 99 | url: "https://pub.dev" 100 | source: hosted 101 | version: "1.8.0" 102 | path: 103 | dependency: transitive 104 | description: 105 | name: path 106 | sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b 107 | url: "https://pub.dev" 108 | source: hosted 109 | version: "1.8.2" 110 | permission_handler: 111 | dependency: "direct main" 112 | description: 113 | name: permission_handler 114 | sha256: "33c6a1253d1f95fd06fa74b65b7ba907ae9811f9d5c1d3150e51417d04b8d6a8" 115 | url: "https://pub.dev" 116 | source: hosted 117 | version: "10.2.0" 118 | permission_handler_android: 119 | dependency: transitive 120 | description: 121 | name: permission_handler_android 122 | sha256: "8028362b40c4a45298f1cbfccd227c8dd6caf0e27088a69f2ba2ab15464159e2" 123 | url: "https://pub.dev" 124 | source: hosted 125 | version: "10.2.0" 126 | permission_handler_apple: 127 | dependency: transitive 128 | description: 129 | name: permission_handler_apple 130 | sha256: "9c370ef6a18b1c4b2f7f35944d644a56aa23576f23abee654cf73968de93f163" 131 | url: "https://pub.dev" 132 | source: hosted 133 | version: "9.0.7" 134 | permission_handler_platform_interface: 135 | dependency: transitive 136 | description: 137 | name: permission_handler_platform_interface 138 | sha256: "68abbc472002b5e6dfce47fe9898c6b7d8328d58b5d2524f75e277c07a97eb84" 139 | url: "https://pub.dev" 140 | source: hosted 141 | version: "3.9.0" 142 | permission_handler_windows: 143 | dependency: transitive 144 | description: 145 | name: permission_handler_windows 146 | sha256: f67cab14b4328574938ecea2db3475dad7af7ead6afab6338772c5f88963e38b 147 | url: "https://pub.dev" 148 | source: hosted 149 | version: "0.1.2" 150 | plugin_platform_interface: 151 | dependency: transitive 152 | description: 153 | name: plugin_platform_interface 154 | sha256: c2c49e16d42fd6983eb55e44b7f197fdf16b4da7aab7f8e1d21da307cad3fb02 155 | url: "https://pub.dev" 156 | source: hosted 157 | version: "2.0.0" 158 | sky_engine: 159 | dependency: transitive 160 | description: flutter 161 | source: sdk 162 | version: "0.0.99" 163 | source_span: 164 | dependency: transitive 165 | description: 166 | name: source_span 167 | sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 168 | url: "https://pub.dev" 169 | source: hosted 170 | version: "1.9.1" 171 | stack_trace: 172 | dependency: transitive 173 | description: 174 | name: stack_trace 175 | sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 176 | url: "https://pub.dev" 177 | source: hosted 178 | version: "1.11.0" 179 | stream_channel: 180 | dependency: transitive 181 | description: 182 | name: stream_channel 183 | sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" 184 | url: "https://pub.dev" 185 | source: hosted 186 | version: "2.1.1" 187 | string_scanner: 188 | dependency: transitive 189 | description: 190 | name: string_scanner 191 | sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" 192 | url: "https://pub.dev" 193 | source: hosted 194 | version: "1.2.0" 195 | term_glyph: 196 | dependency: transitive 197 | description: 198 | name: term_glyph 199 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 200 | url: "https://pub.dev" 201 | source: hosted 202 | version: "1.2.1" 203 | test_api: 204 | dependency: transitive 205 | description: 206 | name: test_api 207 | sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 208 | url: "https://pub.dev" 209 | source: hosted 210 | version: "0.4.16" 211 | vector_math: 212 | dependency: transitive 213 | description: 214 | name: vector_math 215 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 216 | url: "https://pub.dev" 217 | source: hosted 218 | version: "2.1.4" 219 | sdks: 220 | dart: ">=2.19.2 <3.0.0" 221 | flutter: ">=2.8.0" 222 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: acr_cloud_sdk 2 | description: This is an unofficial ACR Cloud SDK to recognize sound and music influtter 3 | version: 2.0.2 4 | homepage: https://github.com/Zfinix/acr_cloud_sdk 5 | 6 | environment: 7 | sdk: ">=2.19.2 <3.0.0" 8 | flutter: ">=1.20.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | permission_handler: ^10.2.0 14 | 15 | dev_dependencies: 16 | flutter_test: 17 | sdk: flutter 18 | lints: any 19 | 20 | # For information on the generic Dart part of this file, see the 21 | # following page: https://dart.dev/tools/pub/pubspec 22 | 23 | # The following section is specific to Flutter. 24 | flutter: 25 | # This section identifies this Flutter project as a plugin project. 26 | # The 'pluginClass' and Android 'package' identifiers should not ordinarily 27 | # be modified. They are used by the tooling to maintain consistency when 28 | # adding or updating assets for this project. 29 | plugin: 30 | platforms: 31 | android: 32 | package: com.chizi.acr_cloud_sdk 33 | pluginClass: AcrCloudSdkPlugin 34 | ios: 35 | pluginClass: AcrCloudSdkPlugin 36 | macos: 37 | pluginClass: AcrCloudSdkPlugin 38 | -------------------------------------------------------------------------------- /test/acr_cloud_sdk_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | void main() { 5 | const MethodChannel channel = MethodChannel('acr_cloud_sdk'); 6 | 7 | TestWidgetsFlutterBinding.ensureInitialized(); 8 | 9 | setUp(() { 10 | channel.setMockMethodCallHandler((MethodCall methodCall) async { 11 | return '42'; 12 | }); 13 | }); 14 | 15 | tearDown(() { 16 | channel.setMockMethodCallHandler(null); 17 | }); 18 | 19 | test('getPlatformVersion', () async { 20 | // expect(await AcrCloudSdk.platformVersion, '42'); 21 | }); 22 | } 23 | --------------------------------------------------------------------------------