All Projects → lemberg → ios-permissions-service

lemberg / ios-permissions-service

Licence: other
An easy way to do permissions requests & handling automatically.

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to ios-permissions-service

Sppermissions
Ask permissions with ready-use interface. You can check status permission and if it has been requested before. Support SwiftUI.
Stars: ✭ 4,701 (+18704%)
Mutual labels:  camera, calendar, permissions
ImageAttachment
Example App to show how to pick an image from Camera/Gallery
Stars: ✭ 23 (-8%)
Mutual labels:  gallery, camera
Album
android 图片视频加载库,单选,多选,预览,自定义UI,相机,裁剪...等等 已适配android10,11
Stars: ✭ 53 (+112%)
Mutual labels:  gallery, camera
Rxpaparazzo
RxJava extension for Android to take images using camera and gallery and pick files up
Stars: ✭ 467 (+1768%)
Mutual labels:  gallery, camera
Instacam
Instant canvas video
Stars: ✭ 106 (+324%)
Mutual labels:  camera, microphone
Privacy Indicator App
🔔 Get the famous "Recording Indicators" feature of iOS14 to android. Get notified every time a third-party app or a service uses camera or microphone.
Stars: ✭ 124 (+396%)
Mutual labels:  camera, microphone
Pickimage
Shows a DialogFragment with camera and gallery options. User can choose wich provider wants to pick images from. 📸 🖼️
Stars: ✭ 386 (+1444%)
Mutual labels:  gallery, camera
Privacy services manager
A single management utility to administer Location Services, Contacts requests, Accessibility, and iCloud access in Apple's OS X.
Stars: ✭ 115 (+360%)
Mutual labels:  calendar, contacts
Android Image Picker
Image Picker for Android 🤖
Stars: ✭ 847 (+3288%)
Mutual labels:  gallery, camera
Croperino
📷 A simple image cropping tool that provides gallery or camera help for Native Android (Java)
Stars: ✭ 176 (+604%)
Mutual labels:  gallery, camera
Album
🍉 Album and Gallery for Android platform.
Stars: ✭ 2,430 (+9620%)
Mutual labels:  gallery, camera
App Media
Elements for accessing data from media input devices and visualizing that data for users
Stars: ✭ 60 (+140%)
Mutual labels:  camera, microphone
Cordova Plugin Ios Camera Permissions
Cordova / PhoneGap Plugin Permission Settings for NSCameraUsageDescription and NSPhotoLibraryUsageDescription in iOS 11 by adding a declaration to the Info.plist file, see:
Stars: ✭ 34 (+36%)
Mutual labels:  camera, permissions
Vigilante
🛡️ Android security (camera/microphone dots indicators) app using Hilt, Animations, Coroutines, Material, StateFlow, Jetpack (Room, ViewModel, Paging, Security, Biometrics, Start-up) based on MVVM architecture.
Stars: ✭ 234 (+836%)
Mutual labels:  camera, microphone
ProPicker
ProPicker is a file picker (image, video, file) library for Android. It helps you to pick any file and return the result in a convenient way
Stars: ✭ 25 (+0%)
Mutual labels:  gallery, camera
Ypimagepicker
📸 Instagram-like image picker & filters for iOS
Stars: ✭ 3,661 (+14544%)
Mutual labels:  gallery, camera
Outlookcaldavsynchronizer
Sync Outlook with Google, SOGo, Nextcloud or any other CalDAV/CardDAV server
Stars: ✭ 560 (+2140%)
Mutual labels:  calendar, contacts
Vdirsyncer
📇 Synchronize calendars and contacts.
Stars: ✭ 872 (+3388%)
Mutual labels:  calendar, contacts
Paparazzo
Custom iOS camera and photo picker with editing capabilities
Stars: ✭ 714 (+2756%)
Mutual labels:  gallery, camera
TakePhoto
🔥Kongzue的APP拍照&相册选择工具
Stars: ✭ 41 (+64%)
Mutual labels:  gallery, camera

License Version Carthage compatible Swift Version iOS Platform By

An easy way to do permissions requests & handling automatically.

  1. Why do you need it?
  2. Features
  3. Supported Permission Types
  4. Installation
    1. CocoaPods
    2. Carthage
  5. How To Use
  6. Configurations
    1. Custom alert messages
    2. Location permission
  7. Requirements
  8. Author
  9. License

Why do you need it?

This library is an easy way to handle notDetermined, authorised, restricted and denied cases without doing it by yourself. No more need to do error handling for restricted and denied cases, create and present to user specific alerts. Of cause, it is not a silver bullet, but a good tool for your project!

Features

  • Customise or localise alerts messages via Configuration
  • Automatic alert creating and presenting
  • Opportunity for users to easily change permissions in Settings
  • CoreLocation permission returns you completion block with user's decision
  • Example project for easy understanding of framework

Supported Permission Types

  • Camera
  • Contacts
  • Events
  • Gallery
  • Location
  • MediaLibrary
  • Microphone
  • Reminder
  • Siri
  • SpeechRecognition

Installation with CocoaPods

ios-permissions-service is available through CocoaPods and Carthage

CocoaPods

To install it, simply add one or several lines to your Podfile like this:

  pod "PermissionsService/Location"
  pod "PermissionsService/Camera"

Full list of available permissions you can found here.

If you'll need, there is still a versions written on Swift 3/4 which you can find in separate branches

Now you need to run pod update command from you project folder and that's it!

Carthage

  1. Add the following line to your Cartfile:
  github "lemberg/ios-permissions-service"

If you want to use a specific branch with another Swift version you can add branch name:

github "lemberg/ios-permissions-service" "swift4"
  1. Run carthage update --platform iOS command from you project folder.

  2. Find the Carthage/Build folder, which is in your project folder. Drag and drop PermissionsService.framework file, to the Linked Frameworks and Libraries section in General settings tab of your project.

  3. Do to Build Phases settings tab. Click the “+” icon and choose New Run Script Phase if not exist. Add the following line to your script

  /usr/local/bin/carthage copy-frameworks
  1. Add the framework's paths under Input Files:
  $(SRCROOT)/Carthage/Build/iOS/PermissionsService.framework
  1. Add the framework's paths to the Output Files:
  $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/PermissionsService.framework

More info about using and configuring Carthage you can find here.

Note!

There is an important note about installing, because of Apple's policy. Due to this policy regarding permission access, binaries may be rejected due to a perceived attempt to access privacy-sensitive data without a usage key, and then further rejected for not actually requesting permissions. This error will be when you'll try uploading to itunesconnect.

But there is a solutuion. You need to provide custom build flags before building the dynamic framework to only compile with permissions you request.

  1. Go to your project root directory and add xcconfig file named PermissionConfiguration.xcconfig. Example of such file you can find here.

  2. Comment lines which you don't want to use like this:

    
    PERMISSION_CAMERA            = PERMISSION_CAMERA
    PERMISSION_CONTACTS          = // PERMISSION_CONTACTS
    

Here you can see an example of using only Camera permission. Contacts permission will be unavailable.

  1. Now you can run carthage update --platform iOS to compile framework.

If you'll need to change available permissions, go to PermissionConfiguration.xcconfig file and modify it. Then update the framework again.

How To Use

  1. Configure your project in all ways needed for chosen permission type. For example, in a case of a gallery, add a specific key to your .plist file.

  2. Implement Permissible protocol in your class. If it's not a UIVIewController class you should implement showAlert(_:) method, but if it is - there is a default implementation and you can leave it empty.

  3. Add Permission<T: PermissionService> object with a type you needed and use prepare(_:) method for request permission and presenting alert to the user.

  Permission<Gallery>.prepare(for: self, callback: { (granted) in
      if granted {
          //present library
      } else {
          //perform specific functions 
      }
    })

This case if show a simple variant of use with default permission settings.

Be aware that Calendar permission service named Events.

  1. Enjoy!

Configurations

This library gives you an opportunity to do some customising or configurations if you need it.

Configurate messages

You can add custom alerts messages for denied and restricted cases by creating new struct which conform to ServiceMessages protocol.

struct CameraMessages: ServiceMessages {
    
    let deniedTitle = "Access denied"
    let deniedMessage = "You can enable access to camera in Privacy Settings"
    let restrictedTitle = "Access restricted"
    let restrictedMessage = "Access to camera is restricted"
    
}

To use your custom messages you need to use DefaultConfiguration class. Let's init it!

   let config = DefaultConfiguration(with: CameraMessages())

And now put it in prepare(_:) method, like this:

  Permission<Camera>.prepare(for: self, with: config) { (granted) in
     if granted {
         print("Granted")
     } else {
         print("Error")
     }

 }

Location permission types

As you can know, you can request two types of user location permission: WhenInUse and Always. For choosing it you need to use configurations too. Class LocationConfiguration is a subclass of DefaultConfiguration and have the same way to use.

You can init it only with type

      let config = LocationConfiguration(.always)

Or you can use it with your messages

     let config = LocationConfiguration(.always, with: CustomLocationMessages())

And then simply put it in your prepare(_:) method as you already did with DefaultConfiguration.

  Permission<Location>.prepare(for: self, with: config) { (granted) in
     if granted {
         print("Granted")
     } else {
         print("Error")
     }

 }

If you still have some questions or issues (maybe even improvements!) feel free to open new issue or PR.

Requirements

  • Swift Version
  • iOS Platform
  • Xcode Version

Author

Lemberg Solutions

iOS Platform

License

ios-permissions-service is available under the BSD license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].