Skip to content

Commit

Permalink
Reconfigure Cirrus to use clang 7 (flutter#905)
Browse files Browse the repository at this point in the history
clang-format 5.0 formats ObjC files differently than newer versions, which results in the CI failing the format check for PRs formatted locally with a recent clang version.

The latest clang version available on the Ubuntu repositories for the Cirrus machines is 7, upgrading to that seems to be consistent with what I locally get with clang-format 8.0.

This PR also reformats all files with the new clang style.
  • Loading branch information
amirh committed Nov 20, 2018
1 parent d35a3df commit e9d7a6c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ios/Classes/CameraPlugin.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import <Flutter/Flutter.h>

@interface CameraPlugin : NSObject<FlutterPlugin>
@interface CameraPlugin : NSObject <FlutterPlugin>
@end
33 changes: 18 additions & 15 deletions ios/Classes/CameraPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ - (FlutterError *)flutterError {
}
@end

@interface FLTSavePhotoDelegate : NSObject<AVCapturePhotoCaptureDelegate>
@interface FLTSavePhotoDelegate : NSObject <AVCapturePhotoCaptureDelegate>
@property(readonly, nonatomic) NSString *path;
@property(readonly, nonatomic) FlutterResult result;

Expand Down Expand Up @@ -59,8 +59,10 @@ - (void)captureOutput:(AVCapturePhotoOutput *)output
}
@end

@interface FLTCam : NSObject<FlutterTexture, AVCaptureVideoDataOutputSampleBufferDelegate,
AVCaptureAudioDataOutputSampleBufferDelegate, FlutterStreamHandler>
@interface FLTCam : NSObject <FlutterTexture,
AVCaptureVideoDataOutputSampleBufferDelegate,
AVCaptureAudioDataOutputSampleBufferDelegate,
FlutterStreamHandler>
@property(readonly, nonatomic) int64_t textureId;
@property(nonatomic, copy) void (^onFrameAvailable)();
@property(nonatomic) FlutterEventChannel *eventChannel;
Expand Down Expand Up @@ -111,8 +113,8 @@ - (instancetype)initWithCameraName:(NSString *)cameraName
_captureSession.sessionPreset = preset;
_captureDevice = [AVCaptureDevice deviceWithUniqueID:cameraName];
NSError *localError = nil;
_captureVideoInput =
[AVCaptureDeviceInput deviceInputWithDevice:_captureDevice error:&localError];
_captureVideoInput = [AVCaptureDeviceInput deviceInputWithDevice:_captureDevice
error:&localError];
if (localError) {
*error = localError;
return nil;
Expand All @@ -123,7 +125,7 @@ - (instancetype)initWithCameraName:(NSString *)cameraName

_captureVideoOutput = [AVCaptureVideoDataOutput new];
_captureVideoOutput.videoSettings =
@{(NSString *)kCVPixelBufferPixelFormatTypeKey : @(kCVPixelFormatType_32BGRA) };
@{(NSString *)kCVPixelBufferPixelFormatTypeKey : @(kCVPixelFormatType_32BGRA)};
[_captureVideoOutput setAlwaysDiscardsLateVideoFrames:YES];
[_captureVideoOutput setSampleBufferDelegate:self queue:dispatch_get_main_queue()];

Expand Down Expand Up @@ -154,9 +156,9 @@ - (void)stop {
- (void)captureToFile:(NSString *)path result:(FlutterResult)result {
AVCapturePhotoSettings *settings = [AVCapturePhotoSettings photoSettings];
[settings setHighResolutionPhotoEnabled:YES];
[_capturePhotoOutput
capturePhotoWithSettings:settings
delegate:[[FLTSavePhotoDelegate alloc] initWithPath:path result:result]];
[_capturePhotoOutput capturePhotoWithSettings:settings
delegate:[[FLTSavePhotoDelegate alloc] initWithPath:path
result:result]];
}

- (void)captureOutput:(AVCaptureOutput *)output
Expand Down Expand Up @@ -330,8 +332,9 @@ - (BOOL)setupWriterForPath:(NSString *)path {
if (!_isAudioSetup) {
[self setUpCaptureSessionForAudio];
}
_videoWriter =
[[AVAssetWriter alloc] initWithURL:outputURL fileType:AVFileTypeQuickTimeMovie error:&error];
_videoWriter = [[AVAssetWriter alloc] initWithURL:outputURL
fileType:AVFileTypeQuickTimeMovie
error:&error];
NSParameterAssert(_videoWriter);
if (error) {
_eventSink(@{@"event" : @"error", @"errorDescription" : error.description});
Expand Down Expand Up @@ -375,8 +378,8 @@ - (void)setUpCaptureSessionForAudio {
// Create a device input with the device and add it to the session.
// Setup the audio input.
AVCaptureDevice *audioDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
AVCaptureDeviceInput *audioInput =
[AVCaptureDeviceInput deviceInputWithDevice:audioDevice error:&error];
AVCaptureDeviceInput *audioInput = [AVCaptureDeviceInput deviceInputWithDevice:audioDevice
error:&error];
if (error) {
_eventSink(@{@"event" : @"error", @"errorDescription" : error.description});
}
Expand Down Expand Up @@ -411,8 +414,8 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
FlutterMethodChannel *channel =
[FlutterMethodChannel methodChannelWithName:@"plugins.flutter.io/camera"
binaryMessenger:[registrar messenger]];
CameraPlugin *instance =
[[CameraPlugin alloc] initWithRegistry:[registrar textures] messenger:[registrar messenger]];
CameraPlugin *instance = [[CameraPlugin alloc] initWithRegistry:[registrar textures]
messenger:[registrar messenger]];
[registrar addMethodCallDelegate:instance channel:channel];
}

Expand Down

0 comments on commit e9d7a6c

Please sign in to comment.