Skip to content

Commit 58d5c23

Browse files
authored
Merge pull request #687 from cph-cachet/audiostreamer-dev
[Audio Streamer] Release of 2.2.0+1 (fixed example app iOS permission)
2 parents bb85032 + 0182225 commit 58d5c23

11 files changed

Lines changed: 69 additions & 36 deletions

File tree

packages/audio_streamer/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.2.0+1
2+
- updated example app podfile to correctly include permission for iOS
3+
- updated README to include podfile permission
4+
15
## 2.2.0
26
- upgrade of `permission_handler: ^10.0.0`
37
- Upgraded to Dart 2.17 and Flutter 3.0

packages/audio_streamer/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,23 @@ When editing the `Info.plist` file manually, the entries needed are:
2525
</array>
2626
```
2727

28+
* Edit the `Podfile` to include the permission for the microphone:
29+
30+
```ruby
31+
post_install do |installer|
32+
installer.pods_project.targets.each do |target|
33+
flutter_additional_ios_build_settings(target)
34+
35+
target.build_configurations.each do |config|
36+
# for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h
37+
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
38+
'$(inherited)',
39+
'PERMISSION_MICROPHONE=1',]
40+
end
41+
end
42+
end
43+
```
44+
2845
## Example
2946
See the file `example/lib/main.dart` for a fully fledged example app using the plugin.
3047

packages/audio_streamer/example/.flutter-plugins-dependencies

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/audio_streamer/example/ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>8.0</string>
24+
<string>11.0</string>
2525
</dict>
2626
</plist>

packages/audio_streamer/example/ios/Flutter/flutter_export_environment.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/audio_streamer/example/ios/Podfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Uncomment this line to define a global platform for your project
2-
# platform :ios, '9.0'
2+
# platform :ios, '11.0'
33

44
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
55
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
@@ -37,5 +37,14 @@ end
3737
post_install do |installer|
3838
installer.pods_project.targets.each do |target|
3939
flutter_additional_ios_build_settings(target)
40+
41+
target.build_configurations.each do |config|
42+
# You can remove unused permissions here
43+
# for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h
44+
# e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
45+
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
46+
'$(inherited)',
47+
'PERMISSION_MICROPHONE=1',]
48+
end
4049
end
4150
end

packages/audio_streamer/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 46;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -163,12 +163,11 @@
163163
97C146E61CF9000F007C117D /* Project object */ = {
164164
isa = PBXProject;
165165
attributes = {
166-
LastUpgradeCheck = 1020;
166+
LastUpgradeCheck = 1300;
167167
ORGANIZATIONNAME = "The Chromium Authors";
168168
TargetAttributes = {
169169
97C146ED1CF9000F007C117D = {
170170
CreatedOnToolsVersion = 7.3.1;
171-
DevelopmentTeam = N6R2LB9629;
172171
LastSwiftMigration = 1100;
173172
};
174173
};
@@ -208,6 +207,7 @@
208207
/* Begin PBXShellScriptBuildPhase section */
209208
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
210209
isa = PBXShellScriptBuildPhase;
210+
alwaysOutOfDate = 1;
211211
buildActionMask = 2147483647;
212212
files = (
213213
);
@@ -244,6 +244,7 @@
244244
};
245245
9740EEB61CF901F6004384FC /* Run Script */ = {
246246
isa = PBXShellScriptBuildPhase;
247+
alwaysOutOfDate = 1;
247248
buildActionMask = 2147483647;
248249
files = (
249250
);
@@ -349,7 +350,7 @@
349350
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
350351
GCC_WARN_UNUSED_FUNCTION = YES;
351352
GCC_WARN_UNUSED_VARIABLE = YES;
352-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
353+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
353354
MTL_ENABLE_DEBUG_INFO = NO;
354355
SDKROOT = iphoneos;
355356
SUPPORTED_PLATFORMS = iphoneos;
@@ -365,15 +366,18 @@
365366
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
366367
CLANG_ENABLE_MODULES = YES;
367368
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
368-
DEVELOPMENT_TEAM = N6R2LB9629;
369+
DEVELOPMENT_TEAM = 59TCTNUBMQ;
369370
ENABLE_BITCODE = NO;
370371
FRAMEWORK_SEARCH_PATHS = (
371372
"$(inherited)",
372373
"$(PROJECT_DIR)/Flutter",
373374
);
374375
INFOPLIST_FILE = Runner/Info.plist;
375-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
376-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
376+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
377+
LD_RUNPATH_SEARCH_PATHS = (
378+
"$(inherited)",
379+
"@executable_path/Frameworks",
380+
);
377381
LIBRARY_SEARCH_PATHS = (
378382
"$(inherited)",
379383
"$(PROJECT_DIR)/Flutter",
@@ -433,7 +437,7 @@
433437
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
434438
GCC_WARN_UNUSED_FUNCTION = YES;
435439
GCC_WARN_UNUSED_VARIABLE = YES;
436-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
440+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
437441
MTL_ENABLE_DEBUG_INFO = YES;
438442
ONLY_ACTIVE_ARCH = YES;
439443
SDKROOT = iphoneos;
@@ -482,7 +486,7 @@
482486
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
483487
GCC_WARN_UNUSED_FUNCTION = YES;
484488
GCC_WARN_UNUSED_VARIABLE = YES;
485-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
489+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
486490
MTL_ENABLE_DEBUG_INFO = NO;
487491
SDKROOT = iphoneos;
488492
SUPPORTED_PLATFORMS = iphoneos;
@@ -499,15 +503,18 @@
499503
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
500504
CLANG_ENABLE_MODULES = YES;
501505
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
502-
DEVELOPMENT_TEAM = N6R2LB9629;
506+
DEVELOPMENT_TEAM = 59TCTNUBMQ;
503507
ENABLE_BITCODE = NO;
504508
FRAMEWORK_SEARCH_PATHS = (
505509
"$(inherited)",
506510
"$(PROJECT_DIR)/Flutter",
507511
);
508512
INFOPLIST_FILE = Runner/Info.plist;
509-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
510-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
513+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
514+
LD_RUNPATH_SEARCH_PATHS = (
515+
"$(inherited)",
516+
"@executable_path/Frameworks",
517+
);
511518
LIBRARY_SEARCH_PATHS = (
512519
"$(inherited)",
513520
"$(PROJECT_DIR)/Flutter",
@@ -528,15 +535,18 @@
528535
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
529536
CLANG_ENABLE_MODULES = YES;
530537
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
531-
DEVELOPMENT_TEAM = N6R2LB9629;
538+
DEVELOPMENT_TEAM = 59TCTNUBMQ;
532539
ENABLE_BITCODE = NO;
533540
FRAMEWORK_SEARCH_PATHS = (
534541
"$(inherited)",
535542
"$(PROJECT_DIR)/Flutter",
536543
);
537544
INFOPLIST_FILE = Runner/Info.plist;
538-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
539-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
545+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
546+
LD_RUNPATH_SEARCH_PATHS = (
547+
"$(inherited)",
548+
"@executable_path/Frameworks",
549+
);
540550
LIBRARY_SEARCH_PATHS = (
541551
"$(inherited)",
542552
"$(PROJECT_DIR)/Flutter",

packages/audio_streamer/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1020"
3+
LastUpgradeVersion = "1300"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

packages/audio_streamer/example/ios/Runner/Info.plist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,9 @@
4747
</array>
4848
<key>UIViewControllerBasedStatusBarAppearance</key>
4949
<false/>
50+
<key>CADisableMinimumFrameDurationOnPhone</key>
51+
<true/>
52+
<key>UIApplicationSupportsIndirectInputEvents</key>
53+
<true/>
5054
</dict>
5155
</plist>

packages/audio_streamer/lib/audio_streamer.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class AudioStreamer {
2020
Stream<List<double>>? _stream;
2121
StreamSubscription<List<dynamic>>? _subscription;
2222

23+
/// Use EventChannel to receive audio stream from native
2324
Stream<List<double>> _makeAudioStream(Function handleErrorFunction) {
2425
if (_stream == null) {
2526
_stream = _noiseEventChannel
@@ -35,14 +36,15 @@ class AudioStreamer {
3536
return _stream!;
3637
}
3738

38-
/// Verify that it was granted
39+
/// Verify that microphone permission was granted
3940
static Future<bool> checkPermission() async =>
40-
Permission.microphone.request().isGranted;
41+
await Permission.microphone.request().isGranted;
4142

4243
/// Request the microphone permission
4344
static Future<void> requestPermission() async =>
44-
Permission.microphone.request();
45+
await Permission.microphone.request();
4546

47+
/// Start recording if microphone permission was granted
4648
Future<bool> start(Function onData, Function handleError) async {
4749
if (_isRecording) {
4850
print('AudioStreamer: Already recording!');
@@ -70,6 +72,7 @@ class AudioStreamer {
7072
return _isRecording;
7173
}
7274

75+
/// Stop the recording
7376
Future<bool> stop() async {
7477
try {
7578
if (_subscription != null) {

0 commit comments

Comments
 (0)