Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-23925] iOS: Wrap platform-API's in precompile-macros #8456

Merged
merged 10 commits into from
Oct 4, 2016
31 changes: 31 additions & 0 deletions apidoc/Titanium/Media/Media.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,33 @@ methods:
platforms: [iphone, ipad, android]
since: "5.1.0"
osver: {ios: {min: "7.0"}}

- name: hasPhotoGalleryPermissions
summary: Returns `true` if the app has photo gallery permissions.
returns:
type: Boolean
platforms: [iphone, ipad]
since: "6.0.0"

- name: requestPhotoGalleryPermissions
summary: Requests for photo gallery permissions.
description: |
In iOS 6, Apple introduced the Info.plist key `NSPhotoLibraryUsageDescription` that is used to display an
own description while authorizing photo gallery permissions. In iOS 10, this key is mandatory when accessing the
photo gallery and the application will crash if your app does not include the key. Check the [Apple docs](https://developer.apple.com/library/prerelease/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html)
for more information. If the user has, the callback will return the earlier decision. To change the permission the
user needs to change it in the device settings.

This API is available in iOS 8 and later. Earlier versions of iOS, as well as apps that do not include this method,
will present the system-dialog while the dialog is opened with <Titanium.Media.openPhotoGallery>.
parameters:
- name: callback
summary: Function to call upon user decision to grant camera access.
type: Callback<RequestPhotoGalleryAccessResult>
platforms: [iphone, ipad]
since: "6.0.0"
osver: {ios: {min: "8.0"}}

- name: requestCameraAccess
deprecated:
since: "5.1.0"
Expand Down Expand Up @@ -1922,6 +1949,10 @@ name: RequestMusicLibraryAccessResult
summary: Argument passed to the callback when a request finishes successfully or erroneously.
extends: ErrorResponse
---
name: RequestPhotoGalleryAccessResult
summary: Argument passed to the callback when a request finishes successfully or erroneously.
extends: ErrorResponse
---
name: RouteDescription
summary: An Object describing the current audio route.
platforms: [iphone, ipad]
Expand Down
22 changes: 20 additions & 2 deletions iphone/Classes/MediaModule.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2015 by Appcelerator, Inc. All Rights Reserved.
* Copyright (c) 2009-2016 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
Expand All @@ -10,30 +10,44 @@
#import "KrollCallback.h"
#import "TiMediaAudioSession.h"
#import "MediaPlayer/MediaPlayer.h"
#ifdef USE_TI_MEDIAMUSICPLAYER
#import "TiMediaMusicPlayer.h"
#endif
#import "TiViewProxy.h"

@interface MediaModule : TiModule
<
UINavigationControllerDelegate,
#if defined(USE_TI_MEDIASHOWCAMERA) || defined(USE_TI_MEDIAOPENPHOTOGALLERY) || defined(USE_TI_MEDIASTARTVIDEOEDITING)
UIImagePickerControllerDelegate,
#endif
#ifdef USE_TI_MEDIAOPENMUSICLIBRARY
MPMediaPickerControllerDelegate,
#endif
UIPopoverControllerDelegate,
UIPopoverPresentationControllerDelegate,
#if defined(USE_TI_MEDIASHOWCAMERA) || defined(USE_TI_MEDIAOPENPHOTOGALLERY) || defined(USE_TI_MEDIASTARTVIDEOEDITING)
UIVideoEditorControllerDelegate
#endif
> {
@private
// Camera picker
#if defined(USE_TI_MEDIASHOWCAMERA) || defined(USE_TI_MEDIAOPENPHOTOGALLERY) || defined(USE_TI_MEDIASTARTVIDEOEDITING)
UIImagePickerController *picker;
#endif
BOOL autoHidePicker;
BOOL saveToRoll;

// Music picker
#ifdef USE_TI_MEDIAOPENMUSICLIBRARY
MPMediaPickerController* musicPicker;
#endif

// Music players
#ifdef USE_TI_MEDIAMUSICPLAYER
TiMediaMusicPlayer* systemMusicPlayer;
TiMediaMusicPlayer* appMusicPlayer;
#endif

// Shared picker bits; OK, since they're modal (and we can perform sanity checks for the necessary bits)
BOOL animatedPicker;
Expand All @@ -43,8 +57,10 @@

id popover;
TiViewProxy* cameraView;


#if defined(USE_TI_MEDIASHOWCAMERA) || defined(USE_TI_MEDIAOPENPHOTOGALLERY) || defined(USE_TI_MEDIASTARTVIDEOEDITING)
UIVideoEditorController *editor;
#endif
KrollCallback *editorSuccessCallback;
KrollCallback *editorErrorCallback;
KrollCallback *editorCancelCallback;
Expand All @@ -64,8 +80,10 @@
@property(nonatomic,readonly) NSNumber* cameraAuthorizationStatus;
@property(nonatomic, assign) NSNumber* audioSessionMode;
@property(nonatomic, assign) NSString* audioSessionCategory;
#ifdef USE_TI_MEDIAMUSICPLAYER
@property(nonatomic,readonly) TiMediaMusicPlayer* systemMusicPlayer;
@property(nonatomic,readonly) TiMediaMusicPlayer* appMusicPlayer;
#endif

@property(nonatomic,readonly) NSNumber* UNKNOWN_ERROR;
@property(nonatomic,readonly) NSNumber* DEVICE_BUSY;
Expand Down