├── .swift-version
├── code
├── Assets
│ ├── .gitkeep
│ ├── arek.png
│ └── arek_contacts.png
└── Classes
│ ├── .gitkeep
│ ├── Core
│ ├── Utilities
│ │ ├── ArekPermissionStatus.swift
│ │ ├── ArekPermissionFrequency.swift
│ │ ├── ArekPopupData.swift
│ │ ├── ArekLocalizationManager.swift
│ │ └── ArekConfiguration.swift
│ └── Arek.swift
│ └── Permissions
│ ├── Location
│ ├── ArekLocationAlways.swift
│ ├── ArekLocationWhenInUse.swift
│ ├── ArekBaseLocationDelegate.swift
│ └── ArekBaseLocation.swift
│ ├── ArekCamera.swift
│ ├── ArekMicrophone.swift
│ ├── ArekPhoto.swift
│ ├── ArekReminders.swift
│ ├── ArekContacts.swift
│ ├── Bluetooth
│ ├── ArekBluetoothDelegate.swift
│ └── ArekBluetooth.swift
│ ├── ArekEvents.swift
│ ├── ArekMediaLibrary.swift
│ ├── ArekSpeechRecognizer.swift
│ ├── ArekHealth.swift
│ ├── ArekNotifications.swift
│ ├── ArekCloudKit.swift
│ └── ArekMotion.swift
├── Cartfile
├── Cartfile.resolved
├── Package.swift
├── Example
├── Podfile
├── arek_example
│ ├── Assets.xcassets
│ │ ├── Contents.json
│ │ ├── arek.imageset
│ │ │ ├── arek.png
│ │ │ └── Contents.json
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── Localizable.strings
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── ArekCellVM.swift
│ ├── AppDelegate.swift
│ ├── Info.plist
│ ├── ArekCell.swift
│ ├── ArekCellVMServiceLocalizable.swift
│ ├── ViewController.swift
│ └── ArekCellVMServiceProgrammatically.swift
├── arek_example.xcodeproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── project.pbxproj
├── arek_example.xcworkspace
│ └── contents.xcworkspacedata
├── arek_exampleTests
│ ├── Info.plist
│ └── arek_exampleTests.swift
├── arek_exampleUITests
│ ├── Info.plist
│ └── arek_exampleUITests.swift
├── README.md
└── Podfile.lock
├── arek.xcodeproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
├── xcshareddata
│ └── xcschemes
│ │ └── arek.xcscheme
└── project.pbxproj
├── .swiftlint.yml
├── arek
├── Info.plist
└── arek.h
├── .gitignore
├── LICENSE
├── arek.podspec
└── README.md
/.swift-version:
--------------------------------------------------------------------------------
1 | 3.0
2 |
--------------------------------------------------------------------------------
/code/Assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/code/Classes/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Cartfile:
--------------------------------------------------------------------------------
1 | github "Codeido/PMAlertController"
2 |
--------------------------------------------------------------------------------
/Cartfile.resolved:
--------------------------------------------------------------------------------
1 | github "Codeido/PMAlertController" "2.1.2"
2 |
--------------------------------------------------------------------------------
/code/Assets/arek.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/polydice/arek/master/code/Assets/arek.png
--------------------------------------------------------------------------------
/Package.swift:
--------------------------------------------------------------------------------
1 | import PackageDescription
2 |
3 | let package = Package(
4 | name: "arek"
5 | )
6 |
--------------------------------------------------------------------------------
/Example/Podfile:
--------------------------------------------------------------------------------
1 | use_frameworks!
2 | target 'arek_example' do
3 | pod 'arek', :path => '../'
4 | end
5 |
--------------------------------------------------------------------------------
/code/Assets/arek_contacts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/polydice/arek/master/code/Assets/arek_contacts.png
--------------------------------------------------------------------------------
/Example/arek_example/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Example/arek_example/Assets.xcassets/arek.imageset/arek.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/polydice/arek/master/Example/arek_example/Assets.xcassets/arek.imageset/arek.png
--------------------------------------------------------------------------------
/arek.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Example/arek_example.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Example/arek_example.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Example/arek_example/Assets.xcassets/arek.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "arek.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/.swiftlint.yml:
--------------------------------------------------------------------------------
1 | disabled_rules: # rule identifiers to exclude from running
2 | - line_length
3 | - trailing_whitespace
4 | - sorted_imports
5 | - variable_name
6 |
7 | opt_in_rules: # some rules are only opt-in
8 | - sorted_imports
9 | - switch_case_on_newline
10 |
11 | excluded:
12 | - Carthage
13 | - Example
14 | - Pods
15 |
16 | variable_name:
17 | min_length: 2
18 |
19 | type_body_length:
20 | - 400
21 |
22 | function_parameter_count:
23 | - 6
24 |
--------------------------------------------------------------------------------
/Example/arek_exampleTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Example/arek_exampleUITests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/arek/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | $(CURRENT_PROJECT_VERSION)
21 | NSPrincipalClass
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4 |
5 | ## Build generated
6 | build/
7 | DerivedData/
8 |
9 | ## Various settings
10 | *.pbxuser
11 | !default.pbxuser
12 | *.mode1v3
13 | !default.mode1v3
14 | *.mode2v3
15 | !default.mode2v3
16 | *.perspectivev3
17 | !default.perspectivev3
18 | xcuserdata/
19 |
20 | ## Other
21 | *.moved-aside
22 | *.xcuserstate
23 |
24 | ## Obj-C/Swift specific
25 | *.hmap
26 | *.ipa
27 | *.dSYM.zip
28 | *.dSYM
29 |
30 | ## Playgrounds
31 | timeline.xctimeline
32 | playground.xcworkspace
33 |
34 | # Swift Package Manager
35 | Packages/
36 | .build/
37 |
38 | # CocoaPods
39 | Pods/
40 |
41 | # Carthage
42 | #
43 | Carthage/Checkouts
44 | Carthage/Build
45 |
46 | # fastlane
47 | fastlane/report.xml
48 | fastlane/Preview.html
49 | fastlane/screenshots
50 | fastlane/test_output
51 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2016 Ennio Masi
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/Example/arek_example/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ios-marketing",
45 | "size" : "1024x1024",
46 | "scale" : "1x"
47 | }
48 | ],
49 | "info" : {
50 | "version" : 1,
51 | "author" : "xcode"
52 | }
53 | }
--------------------------------------------------------------------------------
/Example/arek_example/Base.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 | /*
2 | Localizable.strings
3 | arek_example
4 |
5 | Created by Ennio Masi on 05/07/2017.
6 | Copyright © 2017 ennioma. All rights reserved.
7 | */
8 |
9 | "ArekContacts_initial_title"="Access request";
10 | "ArekContacts_initial_message"="I would like to access your Contacts!";
11 | "ArekContacts_reenable_title"="🙏🏼🙏🏼🙏🏼";
12 | "ArekContacts_reenable_message"="Please re-enable 🙏🏼";
13 | "ArekContacts_allow_button_title"="Allow 👍🏼";
14 | "ArekContacts_deny_button_title"="Deny 👎🏼";
15 | /*==*/
16 | "ArekPhoto_initial_title"="Access request";
17 | "ArekPhoto_initial_message"="I would like to access your Photos!";
18 | "ArekPhoto_reenable_title"="🙏🏼🙏🏼🙏🏼";
19 | "ArekPhoto_reenable_message"="Please re-enable 🙏🏼";
20 | "ArekPhoto_allow_button_title"="Allow 👍🏼";
21 | "ArekPhoto_deny_button_title"="Deny 👎🏼";
22 | /*==*/
23 | "ArekReminders_initial_title"="Access request";
24 | "ArekReminders_initial_message"="I would like to access your Reminders!";
25 | "ArekReminders_reenable_title"="🙏🏼🙏🏼🙏🏼";
26 | "ArekReminders_reenable_message"="Please re-enable 🙏🏼";
27 | "ArekReminders_allow_button_title"="Allow 👍🏼";
28 | "ArekReminders_deny_button_title"="Deny 👎🏼";
29 |
--------------------------------------------------------------------------------
/Example/arek_exampleUITests/arek_exampleUITests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // arek_exampleUITests.swift
3 | // arek_exampleUITests
4 | //
5 | // Created by Ennio Masi on 11/03/2017.
6 | // Copyright © 2017 ennioma. All rights reserved.
7 | //
8 |
9 | import XCTest
10 |
11 | class arek_exampleUITests: XCTestCase {
12 |
13 | override func setUp() {
14 | super.setUp()
15 |
16 | // Put setup code here. This method is called before the invocation of each test method in the class.
17 |
18 | // In UI tests it is usually best to stop immediately when a failure occurs.
19 | continueAfterFailure = false
20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
21 | XCUIApplication().launch()
22 |
23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
24 | }
25 |
26 | override func tearDown() {
27 | // Put teardown code here. This method is called after the invocation of each test method in the class.
28 | super.tearDown()
29 | }
30 |
31 | func testExample() {
32 | // Use recording to get started writing UI tests.
33 | // Use XCTAssert and related functions to verify your tests produce the correct results.
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/code/Classes/Core/Utilities/ArekPermissionStatus.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekPermissionStatus.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 |
28 | public enum ArekPermissionStatus: String {
29 | case authorized
30 | case denied
31 | case notDetermined
32 | case notAvailable
33 | }
34 |
--------------------------------------------------------------------------------
/code/Classes/Core/Utilities/ArekPermissionFrequency.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekPermissionFrequency.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 |
28 | /*
29 | * Frequency to ask the user to present the request again
30 | */
31 | public enum ArekPermissionFrequency {
32 | case Always
33 | case EveryHour
34 | case OnceADay
35 | case OnceAWeek
36 | case JustOnce
37 | }
38 |
--------------------------------------------------------------------------------
/Example/arek_example/ArekCellVM.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekCellVM.swift
3 | // arek_example
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import arek
28 |
29 | class ArekCellVM {
30 | private(set) var permission: ArekPermissionProtocol
31 | private(set) var title: String
32 |
33 | init(permission: ArekPermissionProtocol, title: String) {
34 | self.permission = permission
35 | self.title = title
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/arek/arek.h:
--------------------------------------------------------------------------------
1 | //
2 | // arek.h
3 | // arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | #import
27 |
28 | //! Project version number for arek.
29 | FOUNDATION_EXPORT double arekVersionNumber;
30 |
31 | //! Project version string for arek.
32 | FOUNDATION_EXPORT const unsigned char arekVersionString[];
33 |
34 | // In this header, you should import all the public headers of your framework using statements like #import
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Example/arek_example/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // arek_example
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import UIKit
27 |
28 | @UIApplicationMain
29 | class AppDelegate: UIResponder, UIApplicationDelegate {
30 |
31 | var window: UIWindow?
32 |
33 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
34 | return true
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/Example/arek_example/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 |
--------------------------------------------------------------------------------
/code/Classes/Core/Utilities/ArekPopupData.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekPopupData.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 |
28 | public enum ArekPopupType {
29 | case codeido
30 | case native
31 | }
32 |
33 | public struct ArekPopupData {
34 | var title: String!
35 | var message: String!
36 | var image: String!
37 | var allowButtonTitle: String!
38 | var denyButtonTitle: String!
39 | var type: ArekPopupType!
40 |
41 | public init(title: String = "", message: String = "", image: String = "", allowButtonTitle: String = "", denyButtonTitle: String = "", type: ArekPopupType = .codeido) {
42 | self.title = title
43 | self.message = message
44 | self.image = image
45 | self.allowButtonTitle = allowButtonTitle
46 | self.denyButtonTitle = denyButtonTitle
47 | self.type = type
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Example/arek_example/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | NSAppleMusicUsageDescription
24 | Oh oh get me your Media!
25 | NSCameraUsageDescription
26 | I want to access your Camera!
27 | NSContactsUsageDescription
28 | Let me read your contacts!
29 | NSLocationAlwaysUsageDescription
30 | Get me the Location Dude!
31 | NSPhotoLibraryUsageDescription
32 | Want to access your photos!
33 | NSRemindersUsageDescription
34 | Let's go to your reminders!
35 | NSMotionUsageDescription
36 | Want your motion dataaaa
37 | NSLocationAlwaysAndWhenInUseUsageDescription
38 | Get me the Location Dude!
39 | NSLocationWhenInUseUsageDescription
40 | Get me the Location Dude!
41 | UILaunchStoryboardName
42 | LaunchScreen
43 | UIMainStoryboardFile
44 | Main
45 | UIRequiredDeviceCapabilities
46 |
47 | armv7
48 |
49 | UISupportedInterfaceOrientations
50 |
51 | UIInterfaceOrientationPortrait
52 | UIInterfaceOrientationPortraitUpsideDown
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/code/Classes/Permissions/Location/ArekLocationAlways.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekLocationAlways.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import CoreLocation
28 |
29 | final public class ArekLocationAlways: ArekBaseLocation {
30 |
31 | override public init() {
32 | let identifier = "ArekLocationAlways"
33 | super.init(identifier: identifier)
34 |
35 | self.identifier = identifier
36 | }
37 |
38 | public override init(configuration: ArekConfiguration? = nil, initialPopupData: ArekPopupData? = nil, reEnablePopupData: ArekPopupData? = nil) {
39 | super.init(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
40 |
41 | self.identifier = "ArekLocationAlways"
42 | }
43 |
44 | override public func askForPermission(completion: @escaping ArekPermissionResponse) {
45 | self.completion = completion
46 | self.requestAlwaysAuthorization()
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/code/Classes/Permissions/Location/ArekLocationWhenInUse.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekLocationWhenInUse.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import CoreLocation
28 |
29 | final public class ArekLocationWhenInUse: ArekBaseLocation {
30 | override public init() {
31 | let identifier = "ArekLocationWhenInUse"
32 | super.init(identifier: identifier)
33 |
34 | self.identifier = identifier
35 | }
36 |
37 | public override init(configuration: ArekConfiguration? = nil, initialPopupData: ArekPopupData? = nil, reEnablePopupData: ArekPopupData? = nil) {
38 | super.init(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
39 |
40 | self.identifier = "ArekLocationWhenInUse"
41 | }
42 |
43 | override public func askForPermission(completion: @escaping ArekPermissionResponse) {
44 | self.completion = completion
45 | self.requestWhenInUseAuthorization()
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Example/arek_exampleTests/arek_exampleTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // arek_exampleTests.swift
3 | // arek_exampleTests
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import XCTest
27 | @testable import arek_example
28 |
29 | class arek_exampleTests: XCTestCase {
30 |
31 | override func setUp() {
32 | super.setUp()
33 | // Put setup code here. This method is called before the invocation of each test method in the class.
34 | }
35 |
36 | override func tearDown() {
37 | // Put teardown code here. This method is called after the invocation of each test method in the class.
38 | super.tearDown()
39 | }
40 |
41 | func testExample() {
42 | // This is an example of a functional test case.
43 | // Use XCTAssert and related functions to verify your tests produce the correct results.
44 | }
45 |
46 | func testPerformanceExample() {
47 | // This is an example of a performance test case.
48 | self.measure {
49 | // Put the code you want to measure the time of here.
50 | }
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/Example/README.md:
--------------------------------------------------------------------------------
1 | This example shows how to create and manage permissions in two different ways:
2 |
3 | Looking at the file `ArekCellVM` you can see that some permissions (i.e. [`ArekMediaLibrary`](https://github.com/ennioma/arek/blob/master/code/Classes/Permissions/ArekMediaLibrary.swift)) are instantiated as:
4 |
5 | `ArekMediaLibrary(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)`
6 |
7 | Where:
8 | - configuration
9 | - initialPopupData
10 | - reEnablePopupData
11 |
12 | are three structs that can be populated programmatically.
13 |
14 | But if you take a look at
15 |
16 | ```swift
17 | static private func giveMeContacts() -> ArekPermissionProtocol {
18 | return ArekContacts()
19 | }
20 | ```
21 |
22 | You can notice that [`ArekContacts`](https://github.com/ennioma/arek/blob/master/code/Classes/Permissions/ArekContacts.swift) has been instantiated without any parameter.
23 |
24 | In this case the parameters are read from any `Localizable.string` provided from your app, following this convention:
25 |
26 | ```swift
27 | struct ArekLocalizationManager {
28 | var initialTitle: String = ""
29 | var initialMessage: String = ""
30 | var image: String = ""
31 | var reEnableTitle: String = ""
32 | var reEnableMessage: String = ""
33 | var allowButtonTitle: String = ""
34 | var denyButtonTitle: String = ""
35 |
36 | init(permission: String) {
37 | self.initialTitle = NSLocalizedString("\(permission)_initial_title", comment: "")
38 | self.initialMessage = NSLocalizedString("\(permission)_initial_message", comment: "")
39 |
40 | self.image = "\(permission)_image"
41 |
42 | self.reEnableTitle = NSLocalizedString("\(permission)_reenable_title", comment: "")
43 | self.reEnableMessage = NSLocalizedString("\(permission)_reenable_message", comment: "")
44 |
45 | self.allowButtonTitle = NSLocalizedString("\(permission)_allow_button_title", comment: "")
46 | self.denyButtonTitle = NSLocalizedString("\(permission)_deny_button_title", comment: "")
47 | }
48 | }
49 | ```
50 |
51 | The complete list of the identifiers that can be configured in the Localizable files is [here](https://github.com/ennioma/arek#localized-strings).
--------------------------------------------------------------------------------
/code/Classes/Permissions/Location/ArekBaseLocationDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekBaseLocationDelegate.swift
3 | // arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import CoreLocation
28 |
29 | public class ArekBaseLocationDelegate: NSObject, CLLocationManagerDelegate {
30 | var locationManager: CLLocationManager = CLLocationManager()
31 |
32 | weak var permission: ArekPermissionProtocol?
33 | var completion: ArekPermissionResponse?
34 |
35 | public init(permission: ArekPermissionProtocol, completion: @escaping ArekPermissionResponse) {
36 | super.init()
37 | self.completion = completion
38 | self.permission = permission
39 | self.locationManager.delegate = self
40 | }
41 |
42 | public func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
43 | if let permission = self.permission {
44 | permission.status(completion: { (status) in
45 | if let completion = self.completion { completion(status) }
46 | })
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Example/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - arek (1.6.0):
3 | - arek/Bluetooth (= 1.6.0)
4 | - arek/Camera (= 1.6.0)
5 | - arek/CloudKit (= 1.6.0)
6 | - arek/Contacts (= 1.6.0)
7 | - arek/Core (= 1.6.0)
8 | - arek/Events (= 1.6.0)
9 | - arek/Health (= 1.6.0)
10 | - arek/Location (= 1.6.0)
11 | - arek/MediaLibrary (= 1.6.0)
12 | - arek/Microphone (= 1.6.0)
13 | - arek/Motion (= 1.6.0)
14 | - arek/Notifications (= 1.6.0)
15 | - arek/Photos (= 1.6.0)
16 | - arek/Reminders (= 1.6.0)
17 | - arek/SpeechRecognizer (= 1.6.0)
18 | - PMAlertController (= 2.1.2)
19 | - arek/Bluetooth (1.6.0):
20 | - arek/Core
21 | - PMAlertController (= 2.1.2)
22 | - arek/Camera (1.6.0):
23 | - arek/Core
24 | - PMAlertController (= 2.1.2)
25 | - arek/CloudKit (1.6.0):
26 | - arek/Core
27 | - PMAlertController (= 2.1.2)
28 | - arek/Contacts (1.6.0):
29 | - arek/Core
30 | - PMAlertController (= 2.1.2)
31 | - arek/Core (1.6.0):
32 | - PMAlertController (= 2.1.2)
33 | - arek/Events (1.6.0):
34 | - arek/Core
35 | - PMAlertController (= 2.1.2)
36 | - arek/Health (1.6.0):
37 | - arek/Core
38 | - PMAlertController (= 2.1.2)
39 | - arek/Location (1.6.0):
40 | - arek/Core
41 | - PMAlertController (= 2.1.2)
42 | - arek/MediaLibrary (1.6.0):
43 | - arek/Core
44 | - PMAlertController (= 2.1.2)
45 | - arek/Microphone (1.6.0):
46 | - arek/Core
47 | - PMAlertController (= 2.1.2)
48 | - arek/Motion (1.6.0):
49 | - arek/Core
50 | - PMAlertController (= 2.1.2)
51 | - arek/Notifications (1.6.0):
52 | - arek/Core
53 | - PMAlertController (= 2.1.2)
54 | - arek/Photos (1.6.0):
55 | - arek/Core
56 | - PMAlertController (= 2.1.2)
57 | - arek/Reminders (1.6.0):
58 | - arek/Core
59 | - PMAlertController (= 2.1.2)
60 | - arek/SpeechRecognizer (1.6.0):
61 | - arek/Core
62 | - PMAlertController (= 2.1.2)
63 | - PMAlertController (2.1.2)
64 |
65 | DEPENDENCIES:
66 | - arek (from `../`)
67 |
68 | EXTERNAL SOURCES:
69 | arek:
70 | :path: ../
71 |
72 | SPEC CHECKSUMS:
73 | arek: 24c5e1ece5f7c9c93a08f10243e717c78b26548c
74 | PMAlertController: 0fbcc3d1cee86ee0bd85f693ca85f6388e504ec8
75 |
76 | PODFILE CHECKSUM: 51391b981566b427912c687e0f5ba15813bf3aa4
77 |
78 | COCOAPODS: 1.3.1
79 |
--------------------------------------------------------------------------------
/code/Classes/Core/Utilities/ArekLocalizationManager.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekLocalizationManager.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 |
28 | struct ArekLocalizationManager {
29 | var initialTitle: String = ""
30 | var initialMessage: String = ""
31 | var image: String = ""
32 | var reEnableTitle: String = ""
33 | var reEnableMessage: String = ""
34 | var allowButtonTitle: String = ""
35 | var denyButtonTitle: String = ""
36 |
37 | init(permission: String) {
38 | self.initialTitle = NSLocalizedString("\(permission)_initial_title", comment: "")
39 | self.initialMessage = NSLocalizedString("\(permission)_initial_message", comment: "")
40 |
41 | self.image = "\(permission)_image"
42 |
43 | self.reEnableTitle = NSLocalizedString("\(permission)_reenable_title", comment: "")
44 | self.reEnableMessage = NSLocalizedString("\(permission)_reenable_message", comment: "")
45 |
46 | self.allowButtonTitle = NSLocalizedString("\(permission)_allow_button_title", comment: "")
47 | self.denyButtonTitle = NSLocalizedString("\(permission)_deny_button_title", comment: "")
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/code/Classes/Permissions/ArekCamera.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekCamera.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import AVFoundation
28 |
29 | open class ArekCamera: ArekBasePermission, ArekPermissionProtocol {
30 | open var identifier: String = "ArekCamera"
31 |
32 | public init() {
33 | super.init(identifier: self.identifier)
34 | }
35 |
36 | public override init(configuration: ArekConfiguration? = nil, initialPopupData: ArekPopupData? = nil, reEnablePopupData: ArekPopupData? = nil) {
37 | super.init(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
38 | }
39 |
40 | open func status(completion: @escaping ArekPermissionResponse) {
41 | switch AVCaptureDevice.authorizationStatus(forMediaType: AVMediaTypeVideo) {
42 | case .notDetermined:
43 | return completion(.notDetermined)
44 | case .restricted, .denied:
45 | return completion(.denied)
46 | case .authorized:
47 | return completion(.authorized)
48 | }
49 | }
50 |
51 | open func askForPermission(completion: @escaping ArekPermissionResponse) {
52 | AVCaptureDevice.requestAccess(forMediaType: AVMediaTypeVideo) { (authorized) in
53 | if authorized {
54 | print("[🚨 Arek 🚨] 📷 permission authorized by user ✅")
55 | return completion(.authorized)
56 | }
57 | print("[🚨 Arek 🚨] 📷 permission denied by user ⛔️")
58 | return completion(.denied)
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/Example/arek_example/ArekCell.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekCell.swift
3 | // arek_example
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import UIKit
28 |
29 | import arek
30 |
31 | class ArekCell: UITableViewCell {
32 |
33 | @IBOutlet weak var titleLbl: UILabel!
34 | @IBOutlet weak var statusLbl: UILabel!
35 |
36 | var viewModel: ArekCellVM? {
37 | didSet {
38 | self.titleLbl.text = viewModel?.title
39 |
40 | self.viewModel?.permission.status(completion: { (status) in
41 |
42 | self.updateUI(status)
43 |
44 | })
45 | }
46 | }
47 |
48 | var clicked: Bool = false {
49 | didSet {
50 | if clicked, (viewModel?.permission != nil) {
51 |
52 | self.managePermission()
53 | }
54 | }
55 | }
56 |
57 | private func managePermission() {
58 | viewModel?.permission.manage(completion: { (status) in
59 |
60 | self.updateUI(status)
61 | })
62 | }
63 |
64 | private func updateUI(_ status: ArekPermissionStatus) {
65 | DispatchQueue.main.async {
66 | switch status {
67 | case .authorized:
68 | self.statusLbl.text = "✅"
69 | case .denied:
70 | self.statusLbl.text = "⛔️"
71 | case .notAvailable:
72 | self.statusLbl.text = "📵"
73 | case .notDetermined:
74 | self.statusLbl.text = "⁉️"
75 | }
76 |
77 | self.setSelected(false, animated: false)
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/code/Classes/Permissions/ArekMicrophone.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekMicrophone.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import AVFoundation
28 |
29 | open class ArekMicrophone: ArekBasePermission, ArekPermissionProtocol {
30 | public var identifier: String = "ArekMicrophone"
31 |
32 | public init() {
33 | super.init(identifier: self.identifier)
34 | }
35 |
36 | public override init(configuration: ArekConfiguration? = nil, initialPopupData: ArekPopupData? = nil, reEnablePopupData: ArekPopupData? = nil) {
37 | super.init(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
38 | }
39 |
40 | open func status(completion: @escaping ArekPermissionResponse) {
41 | switch AVAudioSession.sharedInstance().recordPermission() {
42 | case AVAudioSessionRecordPermission.denied:
43 | return completion(.denied)
44 | case AVAudioSessionRecordPermission.undetermined:
45 | return completion(.notDetermined)
46 | case AVAudioSessionRecordPermission.granted:
47 | return completion(.authorized)
48 | default:
49 | return completion(.notDetermined)
50 | }
51 | }
52 |
53 | open func askForPermission(completion: @escaping ArekPermissionResponse) {
54 | AVAudioSession.sharedInstance().requestRecordPermission { (granted) in
55 | if granted {
56 | print("[🚨 Arek 🚨] 🎤 permission authorized by user ✅")
57 | return completion(.authorized)
58 | }
59 | print("[🚨 Arek 🚨] 🎤 permission denied by user ⛔️")
60 | return completion(.denied)
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/code/Classes/Permissions/ArekPhoto.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekPhoto.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import Photos
28 |
29 | open class ArekPhoto: ArekBasePermission, ArekPermissionProtocol {
30 | open var identifier: String = "ArekPhoto"
31 |
32 | public init() {
33 | super.init(identifier: self.identifier)
34 | }
35 |
36 | public override init(configuration: ArekConfiguration? = nil, initialPopupData: ArekPopupData? = nil, reEnablePopupData: ArekPopupData? = nil) {
37 | super.init(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
38 | }
39 |
40 | open func status(completion: @escaping ArekPermissionResponse) {
41 | switch PHPhotoLibrary.authorizationStatus() {
42 | case .notDetermined:
43 | return completion(.notDetermined)
44 | case .restricted, .denied:
45 | return completion(.denied)
46 | case.authorized:
47 | return completion(.authorized)
48 | }
49 | }
50 |
51 | open func askForPermission(completion: @escaping ArekPermissionResponse) {
52 | PHPhotoLibrary.requestAuthorization { (status) in
53 | switch status {
54 | case .notDetermined:
55 | print("[🚨 Arek 🚨] 🌅 permission not determined 🤔")
56 | return completion(.notDetermined)
57 | case .restricted, .denied:
58 | print("[🚨 Arek 🚨] 🌅 permission denied by user ⛔️")
59 | return completion(.denied)
60 | case.authorized:
61 | print("[🚨 Arek 🚨] 🌅 permission authorized by user ✅")
62 | return completion(.authorized)
63 | }
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/code/Classes/Permissions/ArekReminders.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekReminders.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import EventKit
28 |
29 | open class ArekReminders: ArekBasePermission, ArekPermissionProtocol {
30 | open var identifier: String = "ArekReminders"
31 |
32 | public init() {
33 | super.init(identifier: self.identifier)
34 | }
35 |
36 | public override init(configuration: ArekConfiguration? = nil, initialPopupData: ArekPopupData? = nil, reEnablePopupData: ArekPopupData? = nil) {
37 | super.init(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
38 | }
39 |
40 | open func status(completion: @escaping ArekPermissionResponse) {
41 | let status = EKEventStore.authorizationStatus(for: .reminder)
42 | switch status {
43 | case .authorized:
44 | return completion(.authorized)
45 | case .restricted, .denied:
46 | return completion(.denied)
47 | case .notDetermined:
48 | return completion(.notDetermined)
49 | }
50 | }
51 |
52 | open func askForPermission(completion: @escaping ArekPermissionResponse) {
53 | EKEventStore().requestAccess(to: .reminder) { granted, error in
54 | if let error = error {
55 | print("[🚨 Arek 🚨] 🎗 permission error: \(error)")
56 | return completion(.notDetermined)
57 | }
58 | if granted {
59 | print("[🚨 Arek 🚨] 🎗 permission authorized by user ✅")
60 | return completion(.authorized)
61 | }
62 | print("[🚨 Arek 🚨] 🎗 permission denied by user ⛔️")
63 | return completion(.denied)
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Example/arek_example/ArekCellVMServiceLocalizable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekCellVMServiceLocalizable.swift
3 | // arek_example
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import arek
28 |
29 | struct LocalizableData {
30 | var permission: ArekPermissionProtocol
31 | var title: String
32 | }
33 |
34 | class ArekCellVMServiceLocalizable {
35 | static private var permissions = [
36 | LocalizableData(permission: ArekContacts(), title: "Access Contacts - PMAlertController"),
37 | LocalizableData(permission: ArekPhoto(), title: "Access Photo - PMAlertController"),
38 | LocalizableData(permission: ArekReminders(), title: "Access Reminders - PMAlertController")
39 | ]
40 |
41 | static func numberOfVMs() -> Int {
42 | return self.permissions.count
43 | }
44 |
45 | static func buildVM(index: Int) -> ArekCellVM {
46 | let permission = permissions[index]
47 |
48 | return ArekCellVM(permission: permission.permission, title: permission.title)
49 | }
50 |
51 | static private func getPermissionType(index: Int, configuration: ArekConfiguration, initialPopupData: ArekPopupData, reEnablePopupData: ArekPopupData) -> ArekPermissionProtocol? {
52 |
53 | switch index {
54 | case 0:
55 | return ArekMediaLibrary(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
56 | case 1:
57 | return ArekCamera(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
58 | case 2:
59 | return ArekLocationAlways(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
60 | default:
61 | return nil
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/code/Classes/Permissions/ArekContacts.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekContacts.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import Contacts
28 |
29 | open class ArekContacts: ArekBasePermission, ArekPermissionProtocol {
30 | open var identifier: String = "ArekContacts"
31 |
32 | public init() {
33 | super.init(identifier: self.identifier)
34 | }
35 |
36 | public override init(configuration: ArekConfiguration? = nil, initialPopupData: ArekPopupData? = nil, reEnablePopupData: ArekPopupData? = nil) {
37 | super.init(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
38 | }
39 |
40 | open func status(completion: @escaping ArekPermissionResponse) {
41 | switch Contacts.CNContactStore.authorizationStatus(for: CNEntityType.contacts) {
42 | case .authorized:
43 | return completion(.authorized)
44 | case .denied, .restricted:
45 | return completion(.denied)
46 | case .notDetermined:
47 | return completion(.notDetermined)
48 | }
49 | }
50 |
51 | open func askForPermission(completion: @escaping ArekPermissionResponse) {
52 | Contacts.CNContactStore().requestAccess(for: CNEntityType.contacts, completionHandler: { granted, error in
53 | if let error = error {
54 | print("[🚨 Arek 🚨] 🎫 not determined 🤔 error: \(error)")
55 | return completion(.notDetermined)
56 | }
57 |
58 | if granted {
59 | print("[🚨 Arek 🚨] 🎫 permission authorized by user ✅")
60 | return completion(.authorized)
61 | }
62 |
63 | print("[🚨 Arek 🚨] 🎫 denied by user ⛔️")
64 | return completion(.denied)
65 | })
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/code/Classes/Permissions/Bluetooth/ArekBluetoothDelegate.swift:
--------------------------------------------------------------------------------
1 | // Arek
2 | //
3 | // Copyright (c) 2016 Ennio Masi
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
13 | // all 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
21 | // THE SOFTWARE.
22 | //
23 |
24 | import Foundation
25 | import CoreBluetooth
26 |
27 | open class ArekBluetoothDelegate: NSObject, CBPeripheralManagerDelegate {
28 |
29 | open var identifier: String = "ArekBluetooth"
30 |
31 | internal var bluetoothManager: CBPeripheralManager!
32 | internal var completion: ArekPermissionResponse?
33 |
34 | public override init() {
35 | super.init()
36 | self.bluetoothManager = CBPeripheralManager(
37 | delegate: self,
38 | queue: nil,
39 | options: [CBPeripheralManagerOptionShowPowerAlertKey: false]
40 | )
41 | }
42 |
43 | public func peripheralManagerDidUpdateState(_ peripheral: CBPeripheralManager) {
44 | switch peripheral.state {
45 | case .unauthorized:
46 | print("[🚨 Arek 🚨] bluetooth permission denied by user ⛔️")
47 | if let completion = self.completion {
48 | return completion(.denied)
49 | }
50 | break
51 | case .poweredOn:
52 | print("[🚨 Arek 🚨] bluetooth permission authorized by user ✅")
53 | if let completion = self.completion {
54 | return completion(.authorized)
55 | }
56 | break
57 | case .unsupported, .poweredOff, .resetting:
58 | print("[🚨 Arek 🚨] bluetooth not available 🚫")
59 | if let completion = self.completion {
60 | return completion(.notAvailable)
61 | }
62 | break
63 | case .unknown:
64 | print("[🚨 Arek 🚨] bluetooth could not be determined 🤔")
65 | if let completion = self.completion {
66 | return completion(.notDetermined)
67 | }
68 | break
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/code/Classes/Permissions/ArekEvents.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekEvents.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import EventKit
28 |
29 | open class ArekEvents: ArekBasePermission, ArekPermissionProtocol {
30 | open var identifier: String = "ArekEvents"
31 |
32 | public init() {
33 | super.init(identifier: self.identifier)
34 | }
35 |
36 | public override init(configuration: ArekConfiguration? = nil, initialPopupData: ArekPopupData? = nil, reEnablePopupData: ArekPopupData? = nil) {
37 | super.init(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
38 | }
39 |
40 | open func status(completion: @escaping ArekPermissionResponse) {
41 | let status = EKEventStore.authorizationStatus(for: .event)
42 | switch status {
43 | case .authorized:
44 | return completion(.authorized)
45 | case .restricted, .denied:
46 | return completion(.denied)
47 | case .notDetermined:
48 | return completion(.notDetermined)
49 | }
50 | }
51 |
52 | open func askForPermission(completion: @escaping ArekPermissionResponse) {
53 | EKEventStore().requestAccess(to: .event) { granted, error in
54 | if let error = error {
55 | print("[🚨 Arek 🚨] 📆 permission not determined 🤔, error \(error)")
56 | return completion(.notDetermined)
57 | }
58 |
59 | if granted {
60 | print("[🚨 Arek 🚨] 📆 permission authorized by user ✅")
61 | return completion(.authorized)
62 | }
63 | print("[🚨 Arek 🚨] 📆 permission denied by user ⛔️")
64 | return completion(.denied)
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/arek.xcodeproj/xcshareddata/xcschemes/arek.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
45 |
46 |
52 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
70 |
71 |
72 |
73 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/Example/arek_example/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // arek_example
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import UIKit
27 |
28 | import arek
29 |
30 | struct ExamplePermission {
31 | var permission: ArekBasePermission
32 | var title: String
33 | }
34 |
35 | class ViewController: UIViewController {
36 |
37 | }
38 |
39 | extension ViewController: UITableViewDataSource {
40 | func numberOfSections(in tableView: UITableView) -> Int {
41 | return 2
42 | }
43 |
44 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
45 | if section == 0 {
46 | return ArekCellVMServiceProgrammatically.numberOfVMs()
47 | } else if section == 1 {
48 | return ArekCellVMServiceLocalizable.numberOfVMs()
49 | }
50 |
51 | return 0
52 | }
53 |
54 | public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
55 | guard let cell = tableView.dequeueReusableCell(withIdentifier: "ArekCell", for: indexPath) as? ArekCell else { fatalError() }
56 |
57 | if indexPath.section == 0 {
58 | cell.viewModel = ArekCellVMServiceProgrammatically.buildVM(index: indexPath.row)
59 | } else if indexPath.section == 1 {
60 | cell.viewModel = ArekCellVMServiceLocalizable.buildVM(index: indexPath.row)
61 | }
62 |
63 | return cell
64 | }
65 | }
66 |
67 | extension ViewController: UITableViewDelegate {
68 | func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
69 | if section == 0 {
70 | return "Permissions configured programmatically"
71 | } else if section == 1 {
72 | return "Permissions configured with Localizable"
73 | }
74 |
75 | return ""
76 | }
77 |
78 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
79 | guard let cell = tableView.cellForRow(at: indexPath) as? ArekCell else { fatalError() }
80 |
81 | cell.clicked = true
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/code/Classes/Permissions/Location/ArekBaseLocation.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekBaseLocation.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import CoreLocation
28 |
29 | public class ArekBaseLocation: ArekBasePermission, ArekPermissionProtocol {
30 | public var identifier: String = "ArekBaseLocation"
31 | var completion: ArekPermissionResponse? {
32 | willSet {
33 | locationDelegate = ArekBaseLocationDelegate(permission: self, completion: newValue!)
34 | }
35 | }
36 | private var locationDelegate: ArekBaseLocationDelegate?
37 |
38 | public init() {
39 | super.init(identifier: self.identifier)
40 | }
41 |
42 | public override init(identifier: String) {
43 | super.init(identifier: identifier)
44 | }
45 |
46 | public override init(configuration: ArekConfiguration? = nil, initialPopupData: ArekPopupData? = nil, reEnablePopupData: ArekPopupData? = nil) {
47 | super.init(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
48 | }
49 |
50 | public func status(completion: @escaping ArekPermissionResponse) {
51 | guard CLLocationManager.locationServicesEnabled() else { return completion(.notDetermined) }
52 |
53 | switch CLLocationManager.authorizationStatus() {
54 | case .notDetermined:
55 | return completion(.notDetermined)
56 | case .restricted, .denied:
57 | return completion(.denied)
58 | case .authorizedAlways, .authorizedWhenInUse:
59 | return completion(.authorized)
60 | }
61 | }
62 |
63 | public func askForPermission(completion: @escaping ArekPermissionResponse) {
64 | fatalError("askForPermission(configuration) has not been implemented")
65 | }
66 |
67 | func requestAlwaysAuthorization() {
68 | if let delegate = self.locationDelegate {
69 | delegate.locationManager.requestAlwaysAuthorization()
70 | }
71 | }
72 |
73 | func requestWhenInUseAuthorization() {
74 | if let delegate = self.locationDelegate {
75 | delegate.locationManager.requestWhenInUseAuthorization()
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/code/Classes/Permissions/ArekMediaLibrary.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekMediaLibrary.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import MediaPlayer
28 |
29 | open class ArekMediaLibrary: ArekBasePermission, ArekPermissionProtocol {
30 | open var identifier: String = "ArekMediaLibrary"
31 |
32 | public init() {
33 | super.init(identifier: self.identifier)
34 | }
35 |
36 | public override init(configuration: ArekConfiguration? = nil, initialPopupData: ArekPopupData? = nil, reEnablePopupData: ArekPopupData? = nil) {
37 | super.init(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
38 | }
39 |
40 | open func status(completion: @escaping ArekPermissionResponse) {
41 | if #available(iOS 9.3, *) {
42 | let status = MPMediaLibrary.authorizationStatus()
43 | switch status {
44 | case .authorized:
45 | return completion(.authorized)
46 | case .restricted, .denied:
47 | return completion(.denied)
48 | case .notDetermined:
49 | return completion(.notDetermined)
50 | }
51 | } else {
52 | return completion(.notAvailable)
53 | }
54 | }
55 |
56 | open func askForPermission(completion: @escaping ArekPermissionResponse) {
57 | if #available(iOS 9.3, *) {
58 | MPMediaLibrary.requestAuthorization { status in
59 | switch status {
60 | case .authorized:
61 | print("[🚨 Arek 🚨] 💽 permission authorized by user ✅")
62 | return completion(.authorized)
63 | case .restricted, .denied:
64 | print("[🚨 Arek 🚨] 💽 permission denied by user ⛔️")
65 | return completion(.denied)
66 | case .notDetermined:
67 | print("[🚨 Arek 🚨] 💽 permission not determined 🤔")
68 | return completion(.notDetermined)
69 | }
70 | }
71 | } else {
72 | print("[🚨 Arek 🚨] 💽 permission denied by iOS ⛔️")
73 | return completion(.notAvailable)
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/code/Classes/Permissions/ArekSpeechRecognizer.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekSpeechRecognizer.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import Speech
28 |
29 | open class ArekSpeechRecognizer: ArekBasePermission, ArekPermissionProtocol {
30 | open var identifier: String = "ArekSpeechRecognizer"
31 |
32 | public init() {
33 | super.init(identifier: self.identifier)
34 | }
35 |
36 | public override init(configuration: ArekConfiguration? = nil, initialPopupData: ArekPopupData? = nil, reEnablePopupData: ArekPopupData? = nil) {
37 | super.init(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
38 | }
39 |
40 | open func status(completion: @escaping ArekPermissionResponse) {
41 | if #available(iOS 10.0, *) {
42 | let status = SFSpeechRecognizer.authorizationStatus()
43 | switch status {
44 | case .authorized:
45 | return completion(.authorized)
46 | case .restricted, .denied:
47 | return completion(.denied)
48 | case .notDetermined:
49 | return completion(.notDetermined)
50 | }
51 | } else {
52 | return completion(.notAvailable)
53 | }
54 | }
55 |
56 | open func askForPermission(completion: @escaping ArekPermissionResponse) {
57 | if #available(iOS 10.0, *) {
58 | SFSpeechRecognizer.requestAuthorization { status in
59 | switch status {
60 | case .authorized:
61 | print("[🚨 Arek 🚨] 🗣 permission authorized by user ✅")
62 | return completion(.authorized)
63 | case .restricted, .denied:
64 | print("[🚨 Arek 🚨] 🗣 permission denied by user ⛔️")
65 | return completion(.denied)
66 | case .notDetermined:
67 | print("[🚨 Arek 🚨] 🗣 permission not determined 🤔")
68 | return completion(.notDetermined)
69 | }
70 | }
71 | } else {
72 | print("[🚨 Arek 🚨] 🗣 permission only available from iOS 10 ⛔️")
73 | return completion(.notAvailable)
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/code/Classes/Permissions/ArekHealth.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekHealth.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import HealthKit
28 |
29 | open class ArekHealth: ArekBasePermission, ArekPermissionProtocol {
30 |
31 | public var identifier: String = "ArekHealth"
32 |
33 | var hkObjectType: HKObjectType?
34 | var hkSampleTypesToShare: Set?
35 | var hkSampleTypesToRead: Set?
36 |
37 | public init() {
38 | super.init(identifier: self.identifier)
39 | }
40 |
41 | public override init(configuration: ArekConfiguration? = nil, initialPopupData: ArekPopupData? = nil, reEnablePopupData: ArekPopupData? = nil) {
42 | super.init(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
43 | }
44 |
45 | open func status(completion: @escaping ArekPermissionResponse) {
46 | guard let objectType = self.hkObjectType else {
47 | return completion(.notDetermined)
48 | }
49 |
50 | switch HKHealthStore().authorizationStatus(for: objectType) {
51 | case .notDetermined:
52 | return completion(.notDetermined)
53 | case .sharingDenied:
54 | return completion(.denied)
55 | case .sharingAuthorized:
56 | return completion(.authorized)
57 | }
58 | }
59 |
60 | open func askForPermission(completion: @escaping ArekPermissionResponse) {
61 | if self.hkSampleTypesToRead == nil && self.hkSampleTypesToShare == nil {
62 | print("[🚨 Arek 🚨] 📈 no permissions specified 🤔")
63 | return completion(.notDetermined)
64 | }
65 | HKHealthStore().requestAuthorization(toShare: self.hkSampleTypesToShare, read: self.hkSampleTypesToRead) { (granted, error) in
66 | if let error = error {
67 | print("[🚨 Arek 🚨] 📈 permission not determined 🤔 error: \(error)")
68 | return completion(.notDetermined)
69 | }
70 |
71 | if granted {
72 | print("[🚨 Arek 🚨] 📈 permission authorized by user ✅")
73 | return completion(.authorized)
74 | }
75 | print("[🚨 Arek 🚨] 📈 permission denied by user ⛔️")
76 | return completion(.denied)
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/code/Classes/Permissions/Bluetooth/ArekBluetooth.swift:
--------------------------------------------------------------------------------
1 | // Arek
2 | //
3 | // Copyright (c) 2016 Ennio Masi
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
13 | // all 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
21 | // THE SOFTWARE.
22 | //
23 |
24 | import Foundation
25 | import CoreBluetooth
26 |
27 | open class ArekBluetooth: ArekBasePermission, ArekPermissionProtocol {
28 | open var identifier: String = "ArekBluetooth"
29 |
30 | let bluetooth = ArekBluetoothDelegate()
31 |
32 | public init() {
33 | super.init(identifier: self.identifier)
34 | }
35 |
36 | public override init(configuration: ArekConfiguration? = nil, initialPopupData: ArekPopupData? = nil, reEnablePopupData: ArekPopupData? = nil) {
37 | super.init(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
38 | }
39 |
40 | open func status(completion: @escaping ArekPermissionResponse) {
41 | bluetooth.completion = completion
42 |
43 | switch CBPeripheralManager.authorizationStatus() {
44 | case .restricted, .denied:
45 | return completion(.denied)
46 | case .notDetermined, .authorized:
47 | switch bluetooth.bluetoothManager.state {
48 | case .unauthorized:
49 | return completion(.denied)
50 | case .poweredOn:
51 | return completion(.authorized)
52 | case .unsupported, .poweredOff, .resetting:
53 | return completion(.notAvailable)
54 | case .unknown:
55 | return completion(.notDetermined)
56 | }
57 | }
58 | }
59 |
60 | open func askForPermission(completion: @escaping ArekPermissionResponse) {
61 | bluetooth.completion = completion
62 |
63 | switch bluetooth.bluetoothManager.state {
64 | case .unsupported, .poweredOff, .resetting:
65 | print("[🚨 Arek 🚨] bluetooth not available 🚫")
66 | return completion(.notAvailable)
67 | case .unauthorized:
68 | print("[🚨 Arek 🚨] bluetooth not authorized by the user ⛔️")
69 | return completion(.denied)
70 | case .unknown:
71 | print("[🚨 Arek 🚨] bluetooth could not be determined 🤔")
72 | return completion(.notDetermined)
73 | case .poweredOn:
74 | bluetooth.bluetoothManager?.startAdvertising(nil)
75 | bluetooth.bluetoothManager?.stopAdvertising()
76 | break
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/arek.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'arek'
3 | s.version = '1.6.0'
4 | s.summary = 'AREK is a clean and easy to use wrapper over any kind of iOS permission.'
5 | s.homepage = 'https://github.com/ennioma/arek'
6 | s.license = { :type => 'MIT', :file => 'LICENSE'}
7 | s.author = { 'Ennio Masi' => 'ennio.masi@gmail.com' }
8 | s.source = { :git => 'https://github.com/ennioma/arek.git', :tag => s.version.to_s }
9 | s.social_media_url = 'https://twitter.com/ennioma'
10 | s.ios.deployment_target = '9.0'
11 | s.source_files = 'code/Classes/**/*', 'code/Classes/Core/**/*', 'code/Classes/Permissions/**/*'
12 | s.exclude_files = 'Example/*'
13 | s.dependency 'PMAlertController', '2.1.2'
14 |
15 | s.subspec 'Core' do |ss|
16 | ss.source_files = 'code/Classes/Core/**/*.swift'
17 | end
18 |
19 | s.subspec 'Bluetooth' do |ss|
20 | ss.dependency 'arek/Core'
21 | ss.source_files = 'code/Classes/Permissions/Bluetooth/*.swift'
22 | ss.frameworks = 'CoreBluetooth'
23 | end
24 |
25 | s.subspec 'Camera' do |ss|
26 | ss.dependency 'arek/Core'
27 | ss.source_files = 'code/Classes/Permissions/ArekCamera.swift'
28 | ss.frameworks = 'AVFoundation'
29 | end
30 |
31 | s.subspec 'CloudKit' do |ss|
32 | ss.dependency 'arek/Core'
33 | ss.source_files = 'code/Classes/Permissions/ArekCloudKit.swift'
34 | ss.frameworks = 'CloudKit'
35 | end
36 |
37 | s.subspec 'Contacts' do |ss|
38 | ss.dependency 'arek/Core'
39 | ss.source_files = 'code/Classes/Permissions/ArekContacts.swift'
40 | ss.frameworks = 'AddressBook'
41 | end
42 |
43 | s.subspec 'Events' do |ss|
44 | ss.dependency 'arek/Core'
45 | ss.source_files = 'code/Classes/Permissions/ArekEvents.swift'
46 | ss.frameworks = 'EventKit'
47 | end
48 |
49 | s.subspec 'Health' do |ss|
50 | ss.dependency 'arek/Core'
51 | ss.source_files = 'code/Classes/Permissions/ArekHealth.swift'
52 | ss.frameworks = 'HealthKit'
53 | end
54 |
55 | s.subspec 'Location' do |ss|
56 | ss.dependency 'arek/Core'
57 | ss.source_files = 'code/Classes/Permissions/Location/*.swift'
58 | ss.frameworks = 'CoreLocation'
59 | end
60 |
61 | s.subspec 'MediaLibrary' do |ss|
62 | ss.dependency 'arek/Core'
63 | ss.source_files = 'code/Classes/Permissions/ArekMediaLibrary.swift'
64 | ss.frameworks = 'MediaPlayer'
65 | end
66 |
67 | s.subspec 'Microphone' do |ss|
68 | ss.dependency 'arek/Core'
69 | ss.source_files = 'code/Classes/Permissions/ArekMicrophone.swift'
70 | ss.frameworks = 'AVFoundation'
71 | end
72 |
73 | s.subspec 'Motion' do |ss|
74 | ss.dependency 'arek/Core'
75 | ss.source_files = 'code/Classes/Permissions/ArekMotion.swift'
76 | ss.frameworks = 'CoreMotion'
77 | end
78 |
79 | s.subspec 'Notifications' do |ss|
80 | ss.dependency 'arek/Core'
81 | ss.source_files = 'code/Classes/Permissions/ArekNotifications.swift'
82 | end
83 |
84 | s.subspec 'Photos' do |ss|
85 | ss.dependency 'arek/Core'
86 | ss.source_files = 'code/Classes/Permissions/ArekPhoto.swift'
87 | ss.frameworks = 'AssetsLibrary'
88 | end
89 |
90 | s.subspec 'Reminders' do |ss|
91 | ss.dependency 'arek/Core'
92 | ss.source_files = 'code/Classes/Permissions/ArekReminders.swift'
93 | ss.frameworks = 'EventKit'
94 | end
95 |
96 | s.subspec 'SpeechRecognizer' do |ss|
97 | ss.dependency 'arek/Core'
98 | ss.source_files = 'code/Classes/Permissions/ArekSpeechRecognizer.swift'
99 | ss.frameworks = 'Speech'
100 | ss.ios.deployment_target = '9.0'
101 | end
102 |
103 | end
104 |
--------------------------------------------------------------------------------
/code/Classes/Core/Utilities/ArekConfiguration.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekConfiguration.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 |
28 | public struct ArekConfiguration {
29 | var frequency: ArekPermissionFrequency = .OnceADay
30 | var presentInitialPopup: Bool = true
31 | var presentReEnablePopup: Bool = true
32 |
33 | private let week = 60.0*60.0*24.0*7.0
34 | private let hour = 60.0*60.0
35 |
36 | public init(frequency: ArekPermissionFrequency, presentInitialPopup: Bool, presentReEnablePopup: Bool) {
37 | self.frequency = frequency
38 | self.presentInitialPopup = presentInitialPopup
39 | self.presentReEnablePopup = presentReEnablePopup
40 | }
41 |
42 | func reEnablePopupPresented(permission: ArekPermissionProtocol) {
43 | UserDefaults.standard.set(Date(), forKey: permission.identifier)
44 | UserDefaults.standard.synchronize()
45 | }
46 |
47 | func canPresentReEnablePopup(permission: ArekPermissionProtocol) -> Bool {
48 | if !self.presentReEnablePopup {
49 | return false
50 | }
51 |
52 | switch self.frequency {
53 | case .OnceADay:
54 | guard let lastDate = self.lastDateForPermission(identifier: permission.identifier) else {
55 | return false
56 | }
57 |
58 | return !Calendar.current.isDateInToday(lastDate)
59 | case .EveryHour:
60 | guard let lastDate = self.lastDateForPermission(identifier: permission.identifier) else {
61 | return false
62 | }
63 |
64 | return Calendar.current.compare(lastDate, to: Date(), toGranularity: .hour) == ComparisonResult.orderedDescending
65 | case .JustOnce:
66 | return self.lastDateForPermission(identifier: permission.identifier) == nil
67 | case .OnceAWeek:
68 | guard let lastDate = self.lastDateForPermission(identifier: permission.identifier) else {
69 | return false
70 | }
71 |
72 | let ti = TimeInterval(week)
73 | let lastDateInAWeek = lastDate.addingTimeInterval(ti)
74 |
75 | return Calendar.current.compare(lastDateInAWeek, to: Date(), toGranularity: .day) == ComparisonResult.orderedDescending
76 | case .Always:
77 | return true
78 | }
79 | }
80 |
81 | private func lastDateForPermission(identifier: String) -> Date? {
82 | return UserDefaults.standard.object(forKey: identifier) as? Date
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/code/Classes/Permissions/ArekNotifications.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekNotifications.swift
3 | // arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 |
28 | import UIKit
29 | import UserNotifications
30 |
31 | open class ArekNotifications: ArekBasePermission, ArekPermissionProtocol {
32 | open var identifier: String = "ArekNotifications"
33 |
34 | public init() {
35 | super.init(identifier: self.identifier)
36 | }
37 |
38 | public override init(configuration: ArekConfiguration? = nil, initialPopupData: ArekPopupData? = nil, reEnablePopupData: ArekPopupData? = nil) {
39 | super.init(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
40 | }
41 |
42 | open func status(completion: @escaping ArekPermissionResponse) {
43 | if #available(iOS 10.0, *) {
44 | UNUserNotificationCenter.current().getNotificationSettings { (settings) in
45 | switch settings.authorizationStatus {
46 | case .notDetermined:
47 | return completion(.notDetermined)
48 | case .denied:
49 | return completion(.denied)
50 | case .authorized:
51 | return completion(.authorized)
52 | }
53 | }
54 | } else if #available(iOS 9.0, *) {
55 | if let types = UIApplication.shared.currentUserNotificationSettings?.types {
56 | if types.isEmpty {
57 | return completion(.notDetermined)
58 | }
59 | }
60 |
61 | return completion(.authorized)
62 | }
63 | }
64 |
65 | open func askForPermission(completion: @escaping ArekPermissionResponse) {
66 | if #available(iOS 10.0, *) {
67 | UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge]) { (granted, error) in
68 | if let error = error {
69 | print("[🚨 Arek 🚨] Push notifications permission not determined 🤔, error: \(error)")
70 | return completion(.notDetermined)
71 | }
72 | if granted {
73 | self.registerForRemoteNotifications()
74 |
75 | print("[🚨 Arek 🚨] Push notifications permission authorized by user ✅")
76 | return completion(.authorized)
77 | }
78 | print("[🚨 Arek 🚨] Push notifications permission denied by user ⛔️")
79 | return completion(.denied)
80 | }
81 | } else if #available(iOS 9.0, *) {
82 | UIApplication.shared.registerUserNotificationSettings(UIUserNotificationSettings(types: [.badge, .sound, .alert], categories: nil))
83 | self.registerForRemoteNotifications()
84 | }
85 | }
86 |
87 | fileprivate func registerForRemoteNotifications() {
88 | DispatchQueue.main.async {
89 | UIApplication.shared.registerForRemoteNotifications()
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/code/Classes/Permissions/ArekCloudKit.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekCloudKit.swift
3 | // ExampleSourceCode
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import UIKit
27 | import CloudKit
28 |
29 | open class ArekCloudKit: ArekBasePermission, ArekPermissionProtocol {
30 | open var identifier = "ArekCloudKit"
31 |
32 | public init() {
33 | super.init(identifier: self.identifier)
34 | }
35 |
36 | public override init(configuration: ArekConfiguration? = nil, initialPopupData: ArekPopupData? = nil, reEnablePopupData: ArekPopupData? = nil) {
37 | super.init(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
38 | }
39 |
40 | open func status(completion: @escaping ArekPermissionResponse) {
41 | CKContainer.default().status(forApplicationPermission: CKApplicationPermissions.userDiscoverability, completionHandler: { applicationPermissionStatus, error in
42 |
43 | if error != nil {
44 | return completion(.notDetermined)
45 | }
46 |
47 | switch applicationPermissionStatus {
48 | case .granted:
49 | return completion(.authorized)
50 | case .denied:
51 | return completion(.denied)
52 | case .couldNotComplete:
53 | return completion(.notDetermined)
54 | case .initialState:
55 | return completion(.notDetermined)
56 | }
57 | })
58 |
59 | }
60 |
61 | open func askForPermission(completion: @escaping ArekPermissionResponse) {
62 | CKContainer.default().accountStatus { (accountStatus, error) in
63 | if let error = error {
64 | print("[🚨 Arek 🚨] ☁️ accountStatus not determined 🤔 error: \(error)")
65 | return completion(.notDetermined)
66 | }
67 |
68 | switch accountStatus {
69 | case .available, .restricted:
70 | CKContainer.default().requestApplicationPermission(CKApplicationPermissions.userDiscoverability, completionHandler: { applicationPermissionStatus, error in
71 | if let error = error {
72 | print("[🚨 Arek 🚨] ☁️ discoverability not determined 🤔 error: \(error)")
73 | return completion(.notDetermined)
74 | }
75 |
76 | switch applicationPermissionStatus {
77 | case .denied:
78 | print("[🚨 Arek 🚨] ☁️ discoverability denied by user ⛔️")
79 | return completion(.denied)
80 | case .granted:
81 | print("[🚨 Arek 🚨] ☁️ discoverability permission authorized by user ✅")
82 | return completion(.authorized)
83 | case .couldNotComplete, .initialState:
84 | return completion(.notDetermined)
85 | }
86 | })
87 | case .noAccount:
88 | print("[🚨 Arek 🚨] ☁️ account not configured ⛔️")
89 | return completion(.denied)
90 | case .couldNotDetermine:
91 | print("[🚨 Arek 🚨] ☁️ account not determined 🤔")
92 | return completion(.notDetermined)
93 | }
94 | }
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/Example/arek_example/ArekCellVMServiceProgrammatically.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekCellVMServiceProgrammatically.swift
3 | // arek_example
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import arek
28 |
29 | class ArekCellVMServiceProgrammatically {
30 | static private var permissions = [
31 | ["popupDataTitle": "Media Library Access - native", "allowButtonTitle": "Allow 👍🏼", "denyButtonTitle": "No! 👎🏼", "enableTitle": "Please!", "reEnableTitle": "Re-enable please!"],
32 | ["popupDataTitle": "Camera Access - PMAlertController", "allowButtonTitle": "Allow 👍🏼", "denyButtonTitle": "No! 👎🏼", "enableTitle": "Please!", "reEnableTitle": "Re-enable please!"],
33 | ["popupDataTitle": "Location Always Access - native", "allowButtonTitle": "Allow 👍🏼", "denyButtonTitle": "No! 👎🏼", "enableTitle": "Please!", "reEnableTitle": "Re-enable please!"],
34 | ["popupDataTitle": "Motion - PMAlertController", "allowButtonTitle": "Allow 👍🏼", "denyButtonTitle": "No! 👎🏼", "enableTitle": "Please!", "reEnableTitle": "Re-enable please!"]
35 | ]
36 |
37 | static func numberOfVMs() -> Int {
38 | return self.permissions.count
39 | }
40 |
41 | static func buildVM(index: Int) -> ArekCellVM {
42 | let data = permissions[index]
43 |
44 | let configuration = ArekConfiguration(frequency: .Always, presentInitialPopup: true, presentReEnablePopup: true)
45 | let initialPopupData = ArekPopupData(title: data["popupDataTitle"]!, message: data["enableTitle"]!, image: "", allowButtonTitle: data["allowButtonTitle"]!, denyButtonTitle: data["denyButtonTitle"]!, type: getPopupType(index: index))
46 | let reenablePopupData = ArekPopupData(title: data["popupDataTitle"]!, message: data["reEnableTitle"]!, image: "", allowButtonTitle: data["allowButtonTitle"]!, denyButtonTitle: data["denyButtonTitle"]!, type: getPopupType(index: index))
47 |
48 | let permission = getPermissionType(index: index, configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reenablePopupData)
49 | return ArekCellVM(permission: permission!, title: data["popupDataTitle"]!)
50 | }
51 |
52 | static private func getPopupType(index: Int) -> ArekPopupType {
53 | switch index {
54 | case 0:
55 | return .native
56 | case 1:
57 | return .codeido
58 | case 2:
59 | return .native
60 | case 3:
61 | return .codeido
62 | default:
63 | return .native
64 | }
65 | }
66 |
67 | static private func getPermissionType(index: Int, configuration: ArekConfiguration, initialPopupData: ArekPopupData, reEnablePopupData: ArekPopupData) -> ArekPermissionProtocol? {
68 |
69 | switch index {
70 | case 0:
71 | return ArekMediaLibrary(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
72 | case 1:
73 | return ArekCamera(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
74 | case 2:
75 | return ArekLocationAlways(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
76 | case 3:
77 | return ArekMotion(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
78 | default:
79 | return nil
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/code/Classes/Permissions/ArekMotion.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ArekMotion.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import CoreMotion
28 |
29 | open class ArekMotion: ArekBasePermission, ArekPermissionProtocol {
30 | open var identifier: String = "ArekMotion"
31 |
32 | private let userKey = "ennioma.arek.motion.requested"
33 | private let motionManager = CMMotionActivityManager()
34 |
35 | private var motionRequested: ArekPermissionStatus {
36 | get {
37 | if let data = UserDefaults.standard.value(forKey: userKey) as? Data,
38 | let value = NSKeyedUnarchiver.unarchiveObject(with: data) as? String,
39 | let permission = ArekPermissionStatus(rawValue: value) {
40 |
41 | return permission
42 | }
43 |
44 | return .notDetermined
45 | }
46 | set {
47 | UserDefaults.standard.set(NSKeyedArchiver.archivedData(withRootObject: newValue.rawValue), forKey: userKey)
48 | UserDefaults.standard.synchronize()
49 | }
50 | }
51 |
52 | public init() {
53 | super.init(identifier: self.identifier)
54 | }
55 |
56 | public override init(configuration: ArekConfiguration? = nil, initialPopupData: ArekPopupData? = nil, reEnablePopupData: ArekPopupData? = nil) {
57 | super.init(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
58 | }
59 |
60 | open func status(completion: @escaping ArekPermissionResponse) {
61 | if CMMotionActivityManager.isActivityAvailable() == false { return completion(.notAvailable) }
62 |
63 | switch self.motionRequested {
64 | case .notDetermined:
65 | return completion(.notDetermined)
66 | //case .denied:
67 | //return completion(.denied)
68 | default:
69 | self.requestMotion(completion: completion)
70 | }
71 | }
72 |
73 | open func askForPermission(completion: @escaping ArekPermissionResponse) {
74 | if CMMotionActivityManager.isActivityAvailable() == false { return completion(.notAvailable) }
75 |
76 | motionManager.queryActivityStarting(from: Date(), to: Date(), to: .main) { _, error in
77 | if let error = error as NSError? {
78 | if error.code == Int(CMErrorMotionActivityNotAuthorized.rawValue) ||
79 | error.code == Int(CMErrorNotAuthorized.rawValue) {
80 | print("[🚨 Arek 🚨] 🏃🏻 permission denied by user ⛔️")
81 |
82 | self.motionRequested = .denied
83 | DispatchQueue.main.async { return completion(.denied) }
84 | } else {
85 | print("[🚨 Arek 🚨] 🏃🏻 permission not determined 🤔")
86 |
87 | self.motionRequested = .notDetermined
88 | DispatchQueue.main.async { return completion(.notDetermined) }
89 | }
90 | } else {
91 | print("[🚨 Arek 🚨] 🏃🏻 permission authorized by user ✅")
92 |
93 | self.motionRequested = .authorized
94 | DispatchQueue.main.async { return completion(.authorized) }
95 | }
96 | self.motionManager.stopActivityUpdates()
97 | }
98 | }
99 |
100 | private func requestMotion(completion: @escaping ArekPermissionResponse) {
101 | self.motionManager.queryActivityStarting(from: Date(), to: Date(), to: .main) { _, error in
102 | self.motionManager.stopActivityUpdates()
103 |
104 | if let error = error as NSError? {
105 | if error.code == Int(CMErrorMotionActivityNotAuthorized.rawValue) ||
106 | error.code == Int(CMErrorNotAuthorized.rawValue) {
107 |
108 | DispatchQueue.main.async { return completion(.denied) }
109 | } else {
110 | DispatchQueue.main.async { return completion(.notDetermined) }
111 | }
112 | } else {
113 | return completion(.authorized)
114 | }
115 | }
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/Example/arek_example/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 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
63 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 
7 | 
8 | [](https://github.com/Carthage/Carthage)
9 | 
10 | []()
11 |
12 | AREK is a clean and easy to use wrapper over any kind of iOS permission written in Swift.
13 |
14 | Why AREK could help you building a better app is well described by Apple here:
15 |
16 | ```
17 | Request personal data only when your app clearly needs it.
18 | ...
19 | Explain why your app needs the information if it’s not obvious.
20 | ...
21 | Request permission at launch only when necessary for your app to function.
22 | ...
23 | ```
24 |
25 | Every goal could be easily reached using **AREK**.
26 |
27 | * show a native popup used to avoid burning the possibility to ask to iOS the *real* permission
28 | * show a popup to invite the user to re-enable the permission if it has been denied
29 | * manage through an easy configuration how many times to ask the user to re-enable the permission (Only once, every hour, once a day, weekly, always😷)
30 |
31 | 🚨 AREK is a **Swift 3** and **XCode 8** compatible project 🚨
32 |
33 | ## Build Status
34 |
35 | | Branch | Status |
36 | | ------------- | ------------- |
37 | | Master | [](https://dashboard.buddybuild.com/apps/59a16154a7ae7b000183f1cf/build/latest?branch=master) |
38 | | Develop | [](https://dashboard.buddybuild.com/apps/59a16154a7ae7b000183f1cf/build/latest?branch=develop) |
39 |
40 | # Table of Contents
41 | 1. [Implemented permissions](#implementedPermissions)
42 | 2. [How to use AREK](#howTo)
43 | 3. [Permissions Configuration](#permissionsConfiguration)
44 | 4. [How to install AREK](#howToInstall)
45 | 5. [How to contribute](#contribute)
46 | 6. [TODO](#todo)
47 | 7. [License and Credits](#licenseCredits)
48 |
49 |
50 | # Implemented permissions
51 | - [x] Camera
52 | - [x] Bluetooth
53 | - [x] CloudKit
54 | - [x] Contacts
55 | - [x] Events (Calendar)
56 | - [x] Health
57 | - [x] Location (Always)
58 | - [x] Location (When in use)
59 | - [x] Media Library
60 | - [x] Microphone
61 | - [x] Motion
62 | - [x] Notifications
63 | - [x] Photo
64 | - [x] Reminders
65 | - [x] Speech Recognizer
66 |
67 |
68 | # How to use AREK
69 | ## Check permission status
70 | ```swift
71 | let permission = ArekPhoto()
72 |
73 | permission.status { (status) in
74 | switch status {
75 | case .authorized:
76 | print("! ✅ !")
77 | case .denied:
78 | print("! ⛔️ !" )
79 | case .notDetermined:
80 | print("! 🤔 !" )
81 | case .notAvailable:
82 | print("! 🚫 !" )
83 | }
84 | }
85 | ```
86 | ## Request a permission
87 | ```swift
88 | let permission = ArekEvent()
89 |
90 | permission.manage { (status) in
91 | switch status {
92 | case .authorized:
93 | symbol = "✅"
94 | case .denied:
95 | symbol = "⛔️"
96 | case .notDetermined:
97 | symbol = "🤔"
98 | case .notAvailable:
99 | return "🚫"
100 | }
101 | }
102 | ```
103 |
104 |
105 | # Permissions Configuration
106 | ## General configuration
107 | Each permission type included in `AREK` is configurable through the `ArekConfiguration` struct. Each permission has a default configuration, so if you are happy with the basic configuration you don't have to care about how it works behind the scenes.
108 |
109 | An `ArekConfiguration` is made up by:
110 |
111 | > **frequency**: ArekPermissionFrequency (.Always, .EveryHour, .OnceADay, .OnceAWeek, .JustOnce)
112 | This frequency value is related to how often you want to the user to re-enable a permission if that one has been disallowed.
113 |
114 | > Set by default to **.OnceADay**
115 |
116 | ----------
117 |
118 | > **presentInitialPopup**: Bool
119 | This is an initial popup used to ask **kindly** to the user to allow a permission. This is useful to avoid burning the possibility to show the system popup.
120 |
121 | >Set by default to **true**
122 |
123 | ----------
124 |
125 | > **presentReEnablePopup**: Bool
126 | This is the popup used to **kindly** to the user to re-enable that permission. The *frequency* value is related to this popup.
127 |
128 | > Set by defaul to **true**
129 |
130 | ## Configure the initial and the re-enable popup: `ArekPopupData`
131 | `ArekPopupData` is the struct used to configure both the pre-permission popup and the re-enable popup. These popups could be instances of the amazing [PMAlertController](https://github.com/Codeido/PMAlertController) by [Codeido](http://www.codeido.com/) or native iOS alerts.
132 |
133 | The configuration is the following:
134 | ```ruby
135 | public struct ArekPopupData {
136 | var title: String!
137 | var message: String!
138 | var image: String!
139 | var type: ArekPopupType!
140 |
141 | public init(title: String = "", message: String = "", image: String = "", type: ArekPopupType = .codeido) {
142 | self.title = title
143 | self.message = message
144 | self.image = image
145 | self.type = type
146 | }
147 | }
148 | ```
149 |
150 | This is an example of the `ArekContacts` pre-enable popup using `PMAlertController`:
151 |
152 |
153 |
154 | If you want to present a native `UIAlertController` set the type to `.native` otherwise if you want to setup a `PMAlertController` set the type to `.codeido`.
155 |
156 | ## Localized Strings
157 | **AREK** by convention expects to find localized strings in your Localizable files in order to configure the UI.
158 |
159 | In the following table there are the configurations for:
160 | - Pre-permission popup title
161 | - Pre-permission popup message
162 | - Re-enable popup title
163 | - Re-enable popup message
164 | - Popup image for that permission
165 | - Allow button title
166 | - Deny button title
167 |
168 | Messages related to the iOS native permission popup should be configured following the conventions described here.
169 |
170 | | Permission | Pre-permission Title | Pre-permission Message | Re-Enable Title | Re-Enable Message | Image | Allow Button Title | Deny Button Title |
171 | | :-------------: | :-------------: | :-------------: | :-------------: | :---------------: | :---: | :----------------: | :---------------: |
172 | | Camera | ArekCamera_initial_title | ArekCamera_initial_message | ArekCamera_reenable_title | ArekCamera_reenable_message | ArekCamera_image | ArekCamera_allow_button_title | ArekCamera_deny_button_title |
173 | | CloudKit | ArekCloudKit_initial_title | ArekCloudKit_initial_message | ArekCloudKit_reenable_title | ArekCloudKit_reenable_message | ArekCloudKit_image | ArekCloudKit_allow_button_title | ArekCloudKit_deny_button_title
174 | | Contacts | ArekContacts_initial_title | ArekContacts_initial_message | ArekContacts_reenable_title | ArekContacts_reenable_message | ArekContacts_image | ArekContacts_allow_button_title | ArekContacts_deny_button_title
175 | | Events | ArekEvents_initial_title | ArekEvents_initial_message | ArekEvents_reenable_title | ArekEvents_reenable_message | ArekEvents_image | ArekEvents_allow_button_title | ArekEvents_deny_button_title |
176 | | HealthKit | ArekHealth_initial_title | ArekHealth_initial_message | ArekHealth_reenable_title | ArekHealth_reenable_message | ArekHealth_image | ArekHealth_allow_button_title | ArekHealth_deny_button_title |
177 | | Media Library | ArekMediaLibrary_initial_title | ArekMediaLibrary_initial_message | ArekMediaLibrary_reenable_title | ArekMediaLibrary_reenable_message | ArekMediaLibrary_image | ArekMediaLibrary_allow_button_title | ArekMediaLibrary_deny_button_title |
178 | | Microphone | ArekMicrophone_initial_title | ArekMicrophone_initial_message | ArekMicrophone_reenable_title | ArekMicrophone_reenable_message | ArekMicrophone_image | ArekMicrophone_allow_button_title | ArekMicrophone_deny_button_title |
179 | | Motion | ArekMotion_initial_title | ArekMotion_initial_message | ArekMotion_reenable_title | ArekMotion_reenable_message | ArekMotion_image | ArekMotion_allow_button_title | ArekMotion_deny_button_title |
180 | | Notifications | ArekNotifications_initial_title | ArekNotifications_initial_message | ArekNotifications_reenable_title | ArekNotifications_reenable_message | ArekNotifications_image | ArekNotifications_allow_button_title | ArekNotifications_deny_button_title |
181 | | Photo Library | ArekPhoto_initial_title | ArekPhoto_initial_message | ArekPhoto_reenable_title | ArekPhoto_reenable_message | ArekPhoto_image | ArekPhoto_allow_button_title | ArekPhoto_deny_button_title |
182 | | Reminders | ArekReminders_initial_title | ArekReminders_initial_message | ArekReminders_reenable_title | ArekReminders_reenable_message | ArekReminders_image | ArekReminders_allow_button_title | ArekReminders_ deny_button_title|
183 | | Speech Recognizer | ArekSpeechRecognizer_initial_title | ArekSpeechRecognizer_initial_message | ArekSpeechRecognizer_reenable_title | ArekSpeechRecognizer_reenable_message | ArekSpeechRecognizer_image | ArekSpeechRecognizer_allow_button_title | ArekSpeechRecognizer_deny_button_title |
184 | | Bluetooth | ArekBluetooth_initial_title | ArekBluetooth_initial_message | ArekBluetooth_reenable_title | ArekBluetooth_reenable_message | ArekBluetooth_image | ArekBluetooth_allow_button_title | ArekBluetooth_deny_button_title |
185 | | Location | ArekBaseLocation_initial_title | ArekBaseLocation_initial_message | ArekBaseLocation_reenable_title | ArekBaseLocation_reenable_message | ArekBaseLocation_image | ArekBaseLocation_allow_button_title | ArekBaseLocation_deny_button_title |
186 |
187 |
188 | # How to install AREK
189 | ## CocoaPods
190 | Add AREK to your Podfile
191 |
192 | ```ruby
193 | use_frameworks!
194 | target 'MyTarget' do
195 | pod 'arek', '~> 1.6.0'
196 | end
197 | ```
198 |
199 | If you want to install just a specific permission, let's say `Bluetooth`, you have to specify:
200 | ```ruby
201 | use_frameworks!
202 | target 'MyTarget' do
203 | pod 'arek/Bluetooth', '~> 1.6.0'
204 | end
205 | ```
206 |
207 | ```bash
208 | $ pod install
209 | ```
210 |
211 | ## Carthage
212 | ```ruby
213 | github "ennioma/arek" ~> "1.6.0"
214 | ```
215 |
216 | Then on your application target *Build Phases* settings tab, add a "New Run Script Phase". Create a Run Script with the following content:
217 |
218 | ```ruby
219 | /usr/local/bin/carthage copy-frameworks
220 | ```
221 |
222 | and add the following paths under "Input Files":
223 |
224 | ```ruby
225 | $(SRCROOT)/Carthage/Build/iOS/arek.framework
226 | $(SRCROOT)/Carthage/Build/iOS/PMAlertController.framework
227 | ```
228 |
229 | ## Swift Package Manager
230 | ```ruby
231 | import PackageDescription
232 |
233 | let package = Package(
234 | name: "YourApp",
235 | dependencies: [
236 | .Package(url: "https://github.com/ennioma/arek.git", versionMajor: 3, minor: 0)
237 | ]
238 | )
239 | ```
240 |
241 | ## Add AREK source code to your project
242 | Add [https://github.com/ennioma/arek/tree/master/arek/arek/Arek](https://github.com/ennioma/arek/tree/master/arek/Classes) folder to your project.
243 |
244 | 🙏 Take care about adding the ArekHealth class to your project. It includes HealthKit in your project, so if you do this without using HealthKit, your app will be rejected during the AppStore review.
245 |
246 |
247 | # How to contribute
248 | Contributions are welcome 🙌 If you'd like to improve this projects I've shared with the community, just open an issue or raise a PR from the current develop branch.
249 |
250 | For any information or request feel free to contact me on twitter (@ennioma).
251 |
252 |
253 | # TODO
254 | - [] Provide a way to inject a custom PMAlertController in a permission
255 | - [] Provide a way to inject the popup type when the `init()` is called on a permission
256 | - [] Update the Swift Package Manager installation
257 |
258 |
259 | # License and Credits
260 | ## License:
261 | AREK is available under the MIT license. See the LICENSE file for more info.
262 |
263 | ## Arek on the Web:
264 | 1. [This week in Swift - Natasha The Robot](https://swiftnews.curated.co/issues/113#libraries)
265 | 2. [iOS Dev Weekly - Dave Verwer](https://iosdevweekly.com/issues/281#code)
266 |
267 | ## Credits:
268 | Icones provided by `Freepik` and `Vectors Market` from `Flaticon`
269 |
--------------------------------------------------------------------------------
/code/Classes/Core/Arek.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Arek.swift
3 | // Arek
4 | //
5 | // Copyright (c) 2016 Ennio Masi
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 | import UIKit
28 |
29 | import PMAlertController
30 |
31 | public typealias ArekPermissionResponse = (ArekPermissionStatus) -> Void
32 |
33 | public protocol ArekPermissionProtocol: class {
34 | var identifier: String { get }
35 | /**
36 | This is the key method to know if a permission has been authorized or denied.
37 |
38 | Parameter completion: this closure is invoked with the current permission status (ArekPermissionStatus)
39 | */
40 | func status(completion: @escaping ArekPermissionResponse)
41 |
42 | /**
43 | This is the key method to manage the request for a permission.
44 |
45 | The behaviour is based on the ArekConfiguration set in the permission during the initialization phase.
46 |
47 |
48 | Parameter completion: this closure is invoked with the current permission status (ArekPermissionStatus)
49 | */
50 | func manage(completion: @escaping ArekPermissionResponse)
51 | func askForPermission(completion: @escaping ArekPermissionResponse)
52 | }
53 |
54 | /**
55 | ArekBasePermission is a root class and each permission inherit from it.
56 |
57 | Don't instantiate ArekBasePermission directly.
58 | */
59 | open class ArekBasePermission {
60 | var configuration: ArekConfiguration = ArekConfiguration(frequency: .Always, presentInitialPopup:
61 | true, presentReEnablePopup: true)
62 | var initialPopupData: ArekPopupData = ArekPopupData()
63 | var reEnablePopupData: ArekPopupData = ArekPopupData()
64 |
65 | public init(identifier: String) {
66 | let data = ArekLocalizationManager(permission: identifier)
67 |
68 | self.initialPopupData = ArekPopupData(title: data.initialTitle,
69 | message: data.initialMessage,
70 | image: data.image,
71 | allowButtonTitle: data.allowButtonTitle,
72 | denyButtonTitle: data.denyButtonTitle)
73 | self.reEnablePopupData = ArekPopupData(title: data.reEnableTitle,
74 | message: data.reEnableMessage,
75 | image: data.image,
76 | allowButtonTitle: data.allowButtonTitle,
77 | denyButtonTitle: data.denyButtonTitle)
78 | }
79 |
80 | /**
81 | Base init shared among each permission provided by Arek
82 |
83 | - Parameters:
84 | - configuration: ArekConfiguration object used to define the behaviour of the pre-iOS popup and the re-enable permission popup
85 | - initialPopupData: title and message related to pre-iOS popup
86 | - reEnablePopupData: title and message related to re-enable permission popup
87 | */
88 | public init(configuration: ArekConfiguration? = nil, initialPopupData: ArekPopupData? = nil, reEnablePopupData: ArekPopupData? = nil) {
89 | self.configuration = configuration ?? self.configuration
90 | self.initialPopupData = initialPopupData ?? self.initialPopupData
91 | self.reEnablePopupData = reEnablePopupData ?? self.reEnablePopupData
92 | }
93 |
94 | private func manageInitialPopup(completion: @escaping ArekPermissionResponse) {
95 | if self.configuration.presentInitialPopup {
96 | self.presentInitialPopup(title: self.initialPopupData.title, message: self.initialPopupData.message, image: self.initialPopupData.image, allowButtonTitle: self.initialPopupData.allowButtonTitle, denyButtonTitle: self.initialPopupData.denyButtonTitle, completion: completion)
97 | } else {
98 | (self as? ArekPermissionProtocol)?.askForPermission(completion: completion)
99 | }
100 | }
101 |
102 | private func presentInitialPopup(title: String, message: String, image: String? = nil, allowButtonTitle: String, denyButtonTitle: String, completion: @escaping ArekPermissionResponse) {
103 | switch self.initialPopupData.type as ArekPopupType {
104 | case .codeido:
105 | self.presentInitialCodeidoPopup(title: title, message: message, image: image!, allowButtonTitle: allowButtonTitle, denyButtonTitle: denyButtonTitle, completion: completion)
106 | break
107 | case .native:
108 | self.presentInitialNativePopup(title: title, message: message, allowButtonTitle: allowButtonTitle, denyButtonTitle: denyButtonTitle, completion: completion)
109 | break
110 | }
111 | }
112 |
113 | private func presentInitialCodeidoPopup(title: String, message: String, image: String, allowButtonTitle: String, denyButtonTitle: String, completion: @escaping ArekPermissionResponse) {
114 | let alertVC = PMAlertController(title: title, description: message, image: UIImage(named: image), style: .walkthrough)
115 |
116 | alertVC.addAction(PMAlertAction(title: denyButtonTitle, style: .cancel, action: { _ in
117 | completion(.denied)
118 | alertVC.dismiss(animated: true, completion: nil)
119 | }))
120 |
121 | alertVC.addAction(PMAlertAction(title: allowButtonTitle, style: .default, action: { _ in
122 | (self as? ArekPermissionProtocol)?.askForPermission(completion: completion)
123 | alertVC.dismiss(animated: true, completion: nil)
124 | }))
125 |
126 | if var topController = UIApplication.shared.keyWindow?.rootViewController {
127 | while let presentedViewController = topController.presentedViewController {
128 | topController = presentedViewController
129 | }
130 |
131 | topController.present(alertVC, animated: true, completion: nil)
132 | }
133 | }
134 |
135 | private func presentInitialNativePopup(title: String, message: String, allowButtonTitle: String, denyButtonTitle: String, completion: @escaping ArekPermissionResponse) {
136 | let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
137 |
138 | let allow = UIAlertAction(title: allowButtonTitle, style: .default) { _ in
139 | (self as? ArekPermissionProtocol)?.askForPermission(completion: completion)
140 | alert.dismiss(animated: true, completion: nil)
141 | }
142 |
143 | let deny = UIAlertAction(title: denyButtonTitle, style: .cancel) { _ in
144 | completion(.denied)
145 | alert.dismiss(animated: true, completion: nil)
146 | }
147 |
148 | alert.addAction(deny)
149 | alert.addAction(allow)
150 |
151 | if var topController = UIApplication.shared.keyWindow?.rootViewController {
152 | while let presentedViewController = topController.presentedViewController {
153 | topController = presentedViewController
154 | }
155 |
156 | topController.present(alert, animated: true, completion: nil)
157 | }
158 | }
159 |
160 | private func presentReEnablePopup() {
161 | guard let permission = self as? ArekPermissionProtocol else { return }
162 |
163 | if self.configuration.canPresentReEnablePopup(permission: permission) {
164 | self.presentReEnablePopup(title: self.reEnablePopupData.title, message: self.reEnablePopupData.message, image: self.reEnablePopupData.image, allowButtonTitle: self.reEnablePopupData.allowButtonTitle, denyButtonTitle: self.reEnablePopupData.denyButtonTitle)
165 | } else {
166 | print("[🚨 Arek 🚨] for \(self) present re-enable not allowed")
167 | }
168 | }
169 |
170 | private func presentReEnablePopup(title: String, message: String, image: String?, allowButtonTitle: String, denyButtonTitle: String) {
171 | switch self.reEnablePopupData.type as ArekPopupType {
172 | case .codeido:
173 | self.presentReEnableCodeidoPopup(title: title, message: message, image: image!, allowButtonTitle: allowButtonTitle, denyButtonTitle: denyButtonTitle)
174 | break
175 | case .native:
176 | self.presentReEnableNativePopup(title: title, message: message, allowButtonTitle: allowButtonTitle, denyButtonTitle: denyButtonTitle)
177 | break
178 | }
179 | }
180 |
181 | private func presentReEnableNativePopup(title: String, message: String, allowButtonTitle: String, denyButtonTitle: String) {
182 | let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
183 |
184 | let allow = UIAlertAction(title: allowButtonTitle, style: .default) { _ in
185 | alert.dismiss(animated: true, completion: nil)
186 |
187 | guard let url = URL(string: UIApplicationOpenSettingsURLString) else { return }
188 |
189 | if #available(iOS 10.0, *) {
190 | UIApplication.shared.open(url, options: [:], completionHandler: nil)
191 | } else if #available(iOS 9.0, *) {
192 | UIApplication.shared.openURL(url)
193 | }
194 | }
195 |
196 | let deny = UIAlertAction(title: denyButtonTitle, style: .cancel) { _ in
197 | alert.dismiss(animated: true, completion: nil)
198 | }
199 |
200 | alert.addAction(deny)
201 | alert.addAction(allow)
202 |
203 | if var topController = UIApplication.shared.keyWindow?.rootViewController {
204 | while let presentedViewController = topController.presentedViewController {
205 | topController = presentedViewController
206 | }
207 |
208 | topController.present(alert, animated: true, completion: nil)
209 | }
210 |
211 | }
212 |
213 | private func presentReEnableCodeidoPopup(title: String, message: String, image: String, allowButtonTitle: String, denyButtonTitle: String) {
214 | let alertVC = PMAlertController(title: title, description: message, image: UIImage(named: image), style: .walkthrough)
215 |
216 | alertVC.addAction(PMAlertAction(title: denyButtonTitle, style: .cancel, action: { _ in
217 | alertVC.dismiss(animated: true, completion: nil)
218 | }))
219 |
220 | alertVC.addAction(PMAlertAction(title: allowButtonTitle, style: .default, action: { _ in
221 | alertVC.dismiss(animated: true, completion: nil)
222 | guard let url = URL(string: UIApplicationOpenSettingsURLString) else { return }
223 |
224 | if #available(iOS 10.0, *) {
225 | UIApplication.shared.open(url, options: [:], completionHandler: nil)
226 | } else if #available(iOS 9.0, *) {
227 | UIApplication.shared.openURL(url)
228 | }
229 | }))
230 |
231 | if var topController = UIApplication.shared.keyWindow?.rootViewController {
232 | while let presentedViewController = topController.presentedViewController {
233 | topController = presentedViewController
234 | }
235 |
236 | topController.present(alertVC, animated: true, completion: nil)
237 | }
238 | }
239 |
240 | open func manage(completion: @escaping ArekPermissionResponse) {
241 | (self as? ArekPermissionProtocol)?.status { status in
242 | self.managePermission(status: status, completion: completion)
243 | }
244 | }
245 |
246 | internal func managePermission(status: ArekPermissionStatus, completion: @escaping ArekPermissionResponse) {
247 | switch status {
248 | case .notDetermined:
249 | self.manageInitialPopup(completion: completion)
250 | break
251 | case .denied:
252 | self.presentReEnablePopup()
253 | return completion(.denied)
254 | case .authorized:
255 | return completion(.authorized)
256 | case .notAvailable:
257 | break
258 | }
259 | }
260 | }
261 |
--------------------------------------------------------------------------------
/arek.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 6BB101BA1E7044BA000CA36F /* arek.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BB101B81E7044BA000CA36F /* arek.h */; settings = {ATTRIBUTES = (Public, ); }; };
11 | 6BB101E31E70450B000CA36F /* .gitkeep in Resources */ = {isa = PBXBuildFile; fileRef = 6BB101C11E70450B000CA36F /* .gitkeep */; };
12 | 6BB101E41E70450B000CA36F /* arek.png in Resources */ = {isa = PBXBuildFile; fileRef = 6BB101C21E70450B000CA36F /* arek.png */; };
13 | 6BB101E51E70450B000CA36F /* arek_contacts.png in Resources */ = {isa = PBXBuildFile; fileRef = 6BB101C31E70450B000CA36F /* arek_contacts.png */; };
14 | 6BB101E61E70450B000CA36F /* .gitkeep in Resources */ = {isa = PBXBuildFile; fileRef = 6BB101C51E70450B000CA36F /* .gitkeep */; };
15 | 6BB101E71E70450B000CA36F /* Arek.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101C71E70450B000CA36F /* Arek.swift */; };
16 | 6BB101E81E70450B000CA36F /* ArekConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101C91E70450B000CA36F /* ArekConfiguration.swift */; };
17 | 6BB101E91E70450B000CA36F /* ArekLocalizationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101CA1E70450B000CA36F /* ArekLocalizationManager.swift */; };
18 | 6BB101EA1E70450B000CA36F /* ArekPermissionFrequency.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101CB1E70450B000CA36F /* ArekPermissionFrequency.swift */; };
19 | 6BB101EB1E70450B000CA36F /* ArekPermissionStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101CC1E70450B000CA36F /* ArekPermissionStatus.swift */; };
20 | 6BB101EC1E70450B000CA36F /* ArekPopupData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101CD1E70450B000CA36F /* ArekPopupData.swift */; };
21 | 6BB101ED1E70450B000CA36F /* ArekCamera.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101CF1E70450B000CA36F /* ArekCamera.swift */; };
22 | 6BB101EE1E70450B000CA36F /* ArekCloudKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101D01E70450B000CA36F /* ArekCloudKit.swift */; };
23 | 6BB101EF1E70450B000CA36F /* ArekContacts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101D11E70450B000CA36F /* ArekContacts.swift */; };
24 | 6BB101F01E70450B000CA36F /* ArekEvents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101D21E70450B000CA36F /* ArekEvents.swift */; };
25 | 6BB101F11E70450B000CA36F /* ArekHealth.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101D31E70450B000CA36F /* ArekHealth.swift */; };
26 | 6BB101F21E70450B000CA36F /* ArekMediaLibrary.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101D41E70450B000CA36F /* ArekMediaLibrary.swift */; };
27 | 6BB101F31E70450B000CA36F /* ArekMicrophone.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101D51E70450B000CA36F /* ArekMicrophone.swift */; };
28 | 6BB101F41E70450B000CA36F /* ArekMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101D61E70450B000CA36F /* ArekMotion.swift */; };
29 | 6BB101F51E70450B000CA36F /* ArekNotifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101D71E70450B000CA36F /* ArekNotifications.swift */; };
30 | 6BB101F61E70450B000CA36F /* ArekPhoto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101D81E70450B000CA36F /* ArekPhoto.swift */; };
31 | 6BB101F71E70450B000CA36F /* ArekReminders.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101D91E70450B000CA36F /* ArekReminders.swift */; };
32 | 6BB101F81E70450B000CA36F /* ArekSpeechRecognizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101DA1E70450B000CA36F /* ArekSpeechRecognizer.swift */; };
33 | 6BB101F91E70450B000CA36F /* ArekBluetooth.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101DC1E70450B000CA36F /* ArekBluetooth.swift */; };
34 | 6BB101FA1E70450B000CA36F /* ArekBluetoothDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101DD1E70450B000CA36F /* ArekBluetoothDelegate.swift */; };
35 | 6BB101FB1E70450B000CA36F /* ArekBaseLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101DF1E70450B000CA36F /* ArekBaseLocation.swift */; };
36 | 6BB101FC1E70450B000CA36F /* ArekBaseLocationDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101E01E70450B000CA36F /* ArekBaseLocationDelegate.swift */; };
37 | 6BB101FD1E70450B000CA36F /* ArekLocationAlways.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101E11E70450B000CA36F /* ArekLocationAlways.swift */; };
38 | 6BB101FE1E70450B000CA36F /* ArekLocationWhenInUse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB101E21E70450B000CA36F /* ArekLocationWhenInUse.swift */; };
39 | /* End PBXBuildFile section */
40 |
41 | /* Begin PBXFileReference section */
42 | 6BB101B51E7044BA000CA36F /* arek.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = arek.framework; sourceTree = BUILT_PRODUCTS_DIR; };
43 | 6BB101B81E7044BA000CA36F /* arek.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = arek.h; sourceTree = ""; };
44 | 6BB101B91E7044BA000CA36F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
45 | 6BB101C11E70450B000CA36F /* .gitkeep */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; };
46 | 6BB101C21E70450B000CA36F /* arek.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = arek.png; sourceTree = ""; };
47 | 6BB101C31E70450B000CA36F /* arek_contacts.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = arek_contacts.png; sourceTree = ""; };
48 | 6BB101C51E70450B000CA36F /* .gitkeep */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; };
49 | 6BB101C71E70450B000CA36F /* Arek.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Arek.swift; sourceTree = ""; };
50 | 6BB101C91E70450B000CA36F /* ArekConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekConfiguration.swift; sourceTree = ""; };
51 | 6BB101CA1E70450B000CA36F /* ArekLocalizationManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekLocalizationManager.swift; sourceTree = ""; };
52 | 6BB101CB1E70450B000CA36F /* ArekPermissionFrequency.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekPermissionFrequency.swift; sourceTree = ""; };
53 | 6BB101CC1E70450B000CA36F /* ArekPermissionStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekPermissionStatus.swift; sourceTree = ""; };
54 | 6BB101CD1E70450B000CA36F /* ArekPopupData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekPopupData.swift; sourceTree = ""; };
55 | 6BB101CF1E70450B000CA36F /* ArekCamera.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekCamera.swift; sourceTree = ""; };
56 | 6BB101D01E70450B000CA36F /* ArekCloudKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekCloudKit.swift; sourceTree = ""; };
57 | 6BB101D11E70450B000CA36F /* ArekContacts.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekContacts.swift; sourceTree = ""; };
58 | 6BB101D21E70450B000CA36F /* ArekEvents.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekEvents.swift; sourceTree = ""; };
59 | 6BB101D31E70450B000CA36F /* ArekHealth.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekHealth.swift; sourceTree = ""; };
60 | 6BB101D41E70450B000CA36F /* ArekMediaLibrary.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekMediaLibrary.swift; sourceTree = ""; };
61 | 6BB101D51E70450B000CA36F /* ArekMicrophone.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekMicrophone.swift; sourceTree = ""; };
62 | 6BB101D61E70450B000CA36F /* ArekMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekMotion.swift; sourceTree = ""; };
63 | 6BB101D71E70450B000CA36F /* ArekNotifications.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekNotifications.swift; sourceTree = ""; };
64 | 6BB101D81E70450B000CA36F /* ArekPhoto.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekPhoto.swift; sourceTree = ""; };
65 | 6BB101D91E70450B000CA36F /* ArekReminders.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekReminders.swift; sourceTree = ""; };
66 | 6BB101DA1E70450B000CA36F /* ArekSpeechRecognizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekSpeechRecognizer.swift; sourceTree = ""; };
67 | 6BB101DC1E70450B000CA36F /* ArekBluetooth.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekBluetooth.swift; sourceTree = ""; };
68 | 6BB101DD1E70450B000CA36F /* ArekBluetoothDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekBluetoothDelegate.swift; sourceTree = ""; };
69 | 6BB101DF1E70450B000CA36F /* ArekBaseLocation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekBaseLocation.swift; sourceTree = ""; };
70 | 6BB101E01E70450B000CA36F /* ArekBaseLocationDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekBaseLocationDelegate.swift; sourceTree = ""; };
71 | 6BB101E11E70450B000CA36F /* ArekLocationAlways.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekLocationAlways.swift; sourceTree = ""; };
72 | 6BB101E21E70450B000CA36F /* ArekLocationWhenInUse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekLocationWhenInUse.swift; sourceTree = ""; };
73 | /* End PBXFileReference section */
74 |
75 | /* Begin PBXFrameworksBuildPhase section */
76 | 6BB101B11E7044BA000CA36F /* Frameworks */ = {
77 | isa = PBXFrameworksBuildPhase;
78 | buildActionMask = 2147483647;
79 | files = (
80 | );
81 | runOnlyForDeploymentPostprocessing = 0;
82 | };
83 | /* End PBXFrameworksBuildPhase section */
84 |
85 | /* Begin PBXGroup section */
86 | 6BB101AB1E7044BA000CA36F = {
87 | isa = PBXGroup;
88 | children = (
89 | 6BB101B71E7044BA000CA36F /* arek */,
90 | 6BB101B61E7044BA000CA36F /* Products */,
91 | );
92 | sourceTree = "";
93 | };
94 | 6BB101B61E7044BA000CA36F /* Products */ = {
95 | isa = PBXGroup;
96 | children = (
97 | 6BB101B51E7044BA000CA36F /* arek.framework */,
98 | );
99 | name = Products;
100 | sourceTree = "";
101 | };
102 | 6BB101B71E7044BA000CA36F /* arek */ = {
103 | isa = PBXGroup;
104 | children = (
105 | 6BB101C01E70450B000CA36F /* Assets */,
106 | 6BB101C41E70450B000CA36F /* Classes */,
107 | 6BB101B81E7044BA000CA36F /* arek.h */,
108 | 6BB101B91E7044BA000CA36F /* Info.plist */,
109 | );
110 | path = arek;
111 | sourceTree = "";
112 | };
113 | 6BB101C01E70450B000CA36F /* Assets */ = {
114 | isa = PBXGroup;
115 | children = (
116 | 6BB101C11E70450B000CA36F /* .gitkeep */,
117 | 6BB101C21E70450B000CA36F /* arek.png */,
118 | 6BB101C31E70450B000CA36F /* arek_contacts.png */,
119 | );
120 | name = Assets;
121 | path = code/Assets;
122 | sourceTree = SOURCE_ROOT;
123 | };
124 | 6BB101C41E70450B000CA36F /* Classes */ = {
125 | isa = PBXGroup;
126 | children = (
127 | 6BB101C51E70450B000CA36F /* .gitkeep */,
128 | 6BB101C61E70450B000CA36F /* Core */,
129 | 6BB101CE1E70450B000CA36F /* Permissions */,
130 | );
131 | name = Classes;
132 | path = code/Classes;
133 | sourceTree = SOURCE_ROOT;
134 | };
135 | 6BB101C61E70450B000CA36F /* Core */ = {
136 | isa = PBXGroup;
137 | children = (
138 | 6BB101C71E70450B000CA36F /* Arek.swift */,
139 | 6BB101C81E70450B000CA36F /* Utilities */,
140 | );
141 | path = Core;
142 | sourceTree = "";
143 | };
144 | 6BB101C81E70450B000CA36F /* Utilities */ = {
145 | isa = PBXGroup;
146 | children = (
147 | 6BB101C91E70450B000CA36F /* ArekConfiguration.swift */,
148 | 6BB101CA1E70450B000CA36F /* ArekLocalizationManager.swift */,
149 | 6BB101CB1E70450B000CA36F /* ArekPermissionFrequency.swift */,
150 | 6BB101CC1E70450B000CA36F /* ArekPermissionStatus.swift */,
151 | 6BB101CD1E70450B000CA36F /* ArekPopupData.swift */,
152 | );
153 | path = Utilities;
154 | sourceTree = "";
155 | };
156 | 6BB101CE1E70450B000CA36F /* Permissions */ = {
157 | isa = PBXGroup;
158 | children = (
159 | 6BB101CF1E70450B000CA36F /* ArekCamera.swift */,
160 | 6BB101D01E70450B000CA36F /* ArekCloudKit.swift */,
161 | 6BB101D11E70450B000CA36F /* ArekContacts.swift */,
162 | 6BB101D21E70450B000CA36F /* ArekEvents.swift */,
163 | 6BB101D31E70450B000CA36F /* ArekHealth.swift */,
164 | 6BB101D41E70450B000CA36F /* ArekMediaLibrary.swift */,
165 | 6BB101D51E70450B000CA36F /* ArekMicrophone.swift */,
166 | 6BB101D61E70450B000CA36F /* ArekMotion.swift */,
167 | 6BB101D71E70450B000CA36F /* ArekNotifications.swift */,
168 | 6BB101D81E70450B000CA36F /* ArekPhoto.swift */,
169 | 6BB101D91E70450B000CA36F /* ArekReminders.swift */,
170 | 6BB101DA1E70450B000CA36F /* ArekSpeechRecognizer.swift */,
171 | 6BB101DB1E70450B000CA36F /* Bluetooth */,
172 | 6BB101DE1E70450B000CA36F /* Location */,
173 | );
174 | path = Permissions;
175 | sourceTree = "";
176 | };
177 | 6BB101DB1E70450B000CA36F /* Bluetooth */ = {
178 | isa = PBXGroup;
179 | children = (
180 | 6BB101DC1E70450B000CA36F /* ArekBluetooth.swift */,
181 | 6BB101DD1E70450B000CA36F /* ArekBluetoothDelegate.swift */,
182 | );
183 | path = Bluetooth;
184 | sourceTree = "";
185 | };
186 | 6BB101DE1E70450B000CA36F /* Location */ = {
187 | isa = PBXGroup;
188 | children = (
189 | 6BB101DF1E70450B000CA36F /* ArekBaseLocation.swift */,
190 | 6BB101E01E70450B000CA36F /* ArekBaseLocationDelegate.swift */,
191 | 6BB101E11E70450B000CA36F /* ArekLocationAlways.swift */,
192 | 6BB101E21E70450B000CA36F /* ArekLocationWhenInUse.swift */,
193 | );
194 | path = Location;
195 | sourceTree = "";
196 | };
197 | /* End PBXGroup section */
198 |
199 | /* Begin PBXHeadersBuildPhase section */
200 | 6BB101B21E7044BA000CA36F /* Headers */ = {
201 | isa = PBXHeadersBuildPhase;
202 | buildActionMask = 2147483647;
203 | files = (
204 | 6BB101BA1E7044BA000CA36F /* arek.h in Headers */,
205 | );
206 | runOnlyForDeploymentPostprocessing = 0;
207 | };
208 | /* End PBXHeadersBuildPhase section */
209 |
210 | /* Begin PBXNativeTarget section */
211 | 6BB101B41E7044BA000CA36F /* arek */ = {
212 | isa = PBXNativeTarget;
213 | buildConfigurationList = 6BB101BD1E7044BA000CA36F /* Build configuration list for PBXNativeTarget "arek" */;
214 | buildPhases = (
215 | 6BB101B01E7044BA000CA36F /* Sources */,
216 | 6BB101B11E7044BA000CA36F /* Frameworks */,
217 | 6BB101B21E7044BA000CA36F /* Headers */,
218 | 6BB101B31E7044BA000CA36F /* Resources */,
219 | );
220 | buildRules = (
221 | );
222 | dependencies = (
223 | );
224 | name = arek;
225 | productName = arek;
226 | productReference = 6BB101B51E7044BA000CA36F /* arek.framework */;
227 | productType = "com.apple.product-type.framework";
228 | };
229 | /* End PBXNativeTarget section */
230 |
231 | /* Begin PBXProject section */
232 | 6BB101AC1E7044BA000CA36F /* Project object */ = {
233 | isa = PBXProject;
234 | attributes = {
235 | LastUpgradeCheck = 0820;
236 | ORGANIZATIONNAME = "Ennio Masi";
237 | TargetAttributes = {
238 | 6BB101B41E7044BA000CA36F = {
239 | CreatedOnToolsVersion = 8.2.1;
240 | ProvisioningStyle = Automatic;
241 | };
242 | };
243 | };
244 | buildConfigurationList = 6BB101AF1E7044BA000CA36F /* Build configuration list for PBXProject "arek" */;
245 | compatibilityVersion = "Xcode 3.2";
246 | developmentRegion = English;
247 | hasScannedForEncodings = 0;
248 | knownRegions = (
249 | en,
250 | );
251 | mainGroup = 6BB101AB1E7044BA000CA36F;
252 | productRefGroup = 6BB101B61E7044BA000CA36F /* Products */;
253 | projectDirPath = "";
254 | projectRoot = "";
255 | targets = (
256 | 6BB101B41E7044BA000CA36F /* arek */,
257 | );
258 | };
259 | /* End PBXProject section */
260 |
261 | /* Begin PBXResourcesBuildPhase section */
262 | 6BB101B31E7044BA000CA36F /* Resources */ = {
263 | isa = PBXResourcesBuildPhase;
264 | buildActionMask = 2147483647;
265 | files = (
266 | 6BB101E51E70450B000CA36F /* arek_contacts.png in Resources */,
267 | 6BB101E41E70450B000CA36F /* arek.png in Resources */,
268 | 6BB101E31E70450B000CA36F /* .gitkeep in Resources */,
269 | 6BB101E61E70450B000CA36F /* .gitkeep in Resources */,
270 | );
271 | runOnlyForDeploymentPostprocessing = 0;
272 | };
273 | /* End PBXResourcesBuildPhase section */
274 |
275 | /* Begin PBXSourcesBuildPhase section */
276 | 6BB101B01E7044BA000CA36F /* Sources */ = {
277 | isa = PBXSourcesBuildPhase;
278 | buildActionMask = 2147483647;
279 | files = (
280 | 6BB101F81E70450B000CA36F /* ArekSpeechRecognizer.swift in Sources */,
281 | 6BB101F11E70450B000CA36F /* ArekHealth.swift in Sources */,
282 | 6BB101FA1E70450B000CA36F /* ArekBluetoothDelegate.swift in Sources */,
283 | 6BB101E91E70450B000CA36F /* ArekLocalizationManager.swift in Sources */,
284 | 6BB101F01E70450B000CA36F /* ArekEvents.swift in Sources */,
285 | 6BB101F91E70450B000CA36F /* ArekBluetooth.swift in Sources */,
286 | 6BB101EC1E70450B000CA36F /* ArekPopupData.swift in Sources */,
287 | 6BB101ED1E70450B000CA36F /* ArekCamera.swift in Sources */,
288 | 6BB101E71E70450B000CA36F /* Arek.swift in Sources */,
289 | 6BB101F71E70450B000CA36F /* ArekReminders.swift in Sources */,
290 | 6BB101EA1E70450B000CA36F /* ArekPermissionFrequency.swift in Sources */,
291 | 6BB101F61E70450B000CA36F /* ArekPhoto.swift in Sources */,
292 | 6BB101E81E70450B000CA36F /* ArekConfiguration.swift in Sources */,
293 | 6BB101F41E70450B000CA36F /* ArekMotion.swift in Sources */,
294 | 6BB101F51E70450B000CA36F /* ArekNotifications.swift in Sources */,
295 | 6BB101FD1E70450B000CA36F /* ArekLocationAlways.swift in Sources */,
296 | 6BB101FE1E70450B000CA36F /* ArekLocationWhenInUse.swift in Sources */,
297 | 6BB101F31E70450B000CA36F /* ArekMicrophone.swift in Sources */,
298 | 6BB101EB1E70450B000CA36F /* ArekPermissionStatus.swift in Sources */,
299 | 6BB101FC1E70450B000CA36F /* ArekBaseLocationDelegate.swift in Sources */,
300 | 6BB101F21E70450B000CA36F /* ArekMediaLibrary.swift in Sources */,
301 | 6BB101EF1E70450B000CA36F /* ArekContacts.swift in Sources */,
302 | 6BB101FB1E70450B000CA36F /* ArekBaseLocation.swift in Sources */,
303 | 6BB101EE1E70450B000CA36F /* ArekCloudKit.swift in Sources */,
304 | );
305 | runOnlyForDeploymentPostprocessing = 0;
306 | };
307 | /* End PBXSourcesBuildPhase section */
308 |
309 | /* Begin XCBuildConfiguration section */
310 | 6BB101BB1E7044BA000CA36F /* Debug */ = {
311 | isa = XCBuildConfiguration;
312 | buildSettings = {
313 | ALWAYS_SEARCH_USER_PATHS = NO;
314 | CLANG_ANALYZER_NONNULL = YES;
315 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
316 | CLANG_CXX_LIBRARY = "libc++";
317 | CLANG_ENABLE_MODULES = YES;
318 | CLANG_ENABLE_OBJC_ARC = YES;
319 | CLANG_WARN_BOOL_CONVERSION = YES;
320 | CLANG_WARN_CONSTANT_CONVERSION = YES;
321 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
322 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
323 | CLANG_WARN_EMPTY_BODY = YES;
324 | CLANG_WARN_ENUM_CONVERSION = YES;
325 | CLANG_WARN_INFINITE_RECURSION = YES;
326 | CLANG_WARN_INT_CONVERSION = YES;
327 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
328 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
329 | CLANG_WARN_UNREACHABLE_CODE = YES;
330 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
331 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
332 | COPY_PHASE_STRIP = NO;
333 | CURRENT_PROJECT_VERSION = 1;
334 | DEBUG_INFORMATION_FORMAT = dwarf;
335 | ENABLE_STRICT_OBJC_MSGSEND = YES;
336 | ENABLE_TESTABILITY = YES;
337 | FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/Carthage/Build/iOS/**";
338 | GCC_C_LANGUAGE_STANDARD = gnu99;
339 | GCC_DYNAMIC_NO_PIC = NO;
340 | GCC_NO_COMMON_BLOCKS = YES;
341 | GCC_OPTIMIZATION_LEVEL = 0;
342 | GCC_PREPROCESSOR_DEFINITIONS = (
343 | "DEBUG=1",
344 | "$(inherited)",
345 | );
346 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
347 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
348 | GCC_WARN_UNDECLARED_SELECTOR = YES;
349 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
350 | GCC_WARN_UNUSED_FUNCTION = YES;
351 | GCC_WARN_UNUSED_VARIABLE = YES;
352 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
353 | MTL_ENABLE_DEBUG_INFO = YES;
354 | ONLY_ACTIVE_ARCH = YES;
355 | SDKROOT = iphoneos;
356 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
357 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
358 | TARGETED_DEVICE_FAMILY = "1,2";
359 | VERSIONING_SYSTEM = "apple-generic";
360 | VERSION_INFO_PREFIX = "";
361 | };
362 | name = Debug;
363 | };
364 | 6BB101BC1E7044BA000CA36F /* Release */ = {
365 | isa = XCBuildConfiguration;
366 | buildSettings = {
367 | ALWAYS_SEARCH_USER_PATHS = NO;
368 | CLANG_ANALYZER_NONNULL = YES;
369 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
370 | CLANG_CXX_LIBRARY = "libc++";
371 | CLANG_ENABLE_MODULES = YES;
372 | CLANG_ENABLE_OBJC_ARC = YES;
373 | CLANG_WARN_BOOL_CONVERSION = YES;
374 | CLANG_WARN_CONSTANT_CONVERSION = YES;
375 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
376 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
377 | CLANG_WARN_EMPTY_BODY = YES;
378 | CLANG_WARN_ENUM_CONVERSION = YES;
379 | CLANG_WARN_INFINITE_RECURSION = YES;
380 | CLANG_WARN_INT_CONVERSION = YES;
381 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
382 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
383 | CLANG_WARN_UNREACHABLE_CODE = YES;
384 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
385 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
386 | COPY_PHASE_STRIP = NO;
387 | CURRENT_PROJECT_VERSION = 1;
388 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
389 | ENABLE_NS_ASSERTIONS = NO;
390 | ENABLE_STRICT_OBJC_MSGSEND = YES;
391 | FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/Carthage/Build/iOS/**";
392 | GCC_C_LANGUAGE_STANDARD = gnu99;
393 | GCC_NO_COMMON_BLOCKS = YES;
394 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
395 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
396 | GCC_WARN_UNDECLARED_SELECTOR = YES;
397 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
398 | GCC_WARN_UNUSED_FUNCTION = YES;
399 | GCC_WARN_UNUSED_VARIABLE = YES;
400 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
401 | MTL_ENABLE_DEBUG_INFO = NO;
402 | SDKROOT = iphoneos;
403 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
404 | TARGETED_DEVICE_FAMILY = "1,2";
405 | VALIDATE_PRODUCT = YES;
406 | VERSIONING_SYSTEM = "apple-generic";
407 | VERSION_INFO_PREFIX = "";
408 | };
409 | name = Release;
410 | };
411 | 6BB101BE1E7044BA000CA36F /* Debug */ = {
412 | isa = XCBuildConfiguration;
413 | buildSettings = {
414 | CODE_SIGN_IDENTITY = "";
415 | DEFINES_MODULE = YES;
416 | DYLIB_COMPATIBILITY_VERSION = 1;
417 | DYLIB_CURRENT_VERSION = 1;
418 | DYLIB_INSTALL_NAME_BASE = "@rpath";
419 | INFOPLIST_FILE = arek/Info.plist;
420 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
421 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
422 | PRODUCT_BUNDLE_IDENTIFIER = ennioma.arek;
423 | PRODUCT_NAME = "$(TARGET_NAME)";
424 | SKIP_INSTALL = YES;
425 | SWIFT_VERSION = 3.0;
426 | };
427 | name = Debug;
428 | };
429 | 6BB101BF1E7044BA000CA36F /* Release */ = {
430 | isa = XCBuildConfiguration;
431 | buildSettings = {
432 | CODE_SIGN_IDENTITY = "";
433 | DEFINES_MODULE = YES;
434 | DYLIB_COMPATIBILITY_VERSION = 1;
435 | DYLIB_CURRENT_VERSION = 1;
436 | DYLIB_INSTALL_NAME_BASE = "@rpath";
437 | INFOPLIST_FILE = arek/Info.plist;
438 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
439 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
440 | PRODUCT_BUNDLE_IDENTIFIER = ennioma.arek;
441 | PRODUCT_NAME = "$(TARGET_NAME)";
442 | SKIP_INSTALL = YES;
443 | SWIFT_VERSION = 3.0;
444 | };
445 | name = Release;
446 | };
447 | /* End XCBuildConfiguration section */
448 |
449 | /* Begin XCConfigurationList section */
450 | 6BB101AF1E7044BA000CA36F /* Build configuration list for PBXProject "arek" */ = {
451 | isa = XCConfigurationList;
452 | buildConfigurations = (
453 | 6BB101BB1E7044BA000CA36F /* Debug */,
454 | 6BB101BC1E7044BA000CA36F /* Release */,
455 | );
456 | defaultConfigurationIsVisible = 0;
457 | defaultConfigurationName = Release;
458 | };
459 | 6BB101BD1E7044BA000CA36F /* Build configuration list for PBXNativeTarget "arek" */ = {
460 | isa = XCConfigurationList;
461 | buildConfigurations = (
462 | 6BB101BE1E7044BA000CA36F /* Debug */,
463 | 6BB101BF1E7044BA000CA36F /* Release */,
464 | );
465 | defaultConfigurationIsVisible = 0;
466 | defaultConfigurationName = Release;
467 | };
468 | /* End XCConfigurationList section */
469 | };
470 | rootObject = 6BB101AC1E7044BA000CA36F /* Project object */;
471 | }
472 |
--------------------------------------------------------------------------------
/Example/arek_example.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 6B3633601F0D8CC700F3B300 /* ArekCellVMServiceProgrammatically.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B36335F1F0D8CC700F3B300 /* ArekCellVMServiceProgrammatically.swift */; };
11 | 6B3633621F0D8CEE00F3B300 /* ArekCellVMServiceLocalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B3633611F0D8CEE00F3B300 /* ArekCellVMServiceLocalizable.swift */; };
12 | 6B6654181F0CF3D80093A15E /* ArekCellVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B6654171F0CF3D80093A15E /* ArekCellVM.swift */; };
13 | 6BAB53331F0D1ACE00E02E1D /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6BAB53351F0D1ACE00E02E1D /* Localizable.strings */; };
14 | 7569AF911E7447F300E81C95 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7569AF901E7447F300E81C95 /* AppDelegate.swift */; };
15 | 7569AF931E7447F300E81C95 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7569AF921E7447F300E81C95 /* ViewController.swift */; };
16 | 7569AF961E7447F300E81C95 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7569AF941E7447F300E81C95 /* Main.storyboard */; };
17 | 7569AF981E7447F300E81C95 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7569AF971E7447F300E81C95 /* Assets.xcassets */; };
18 | 7569AF9B1E7447F300E81C95 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7569AF991E7447F300E81C95 /* LaunchScreen.storyboard */; };
19 | 7569AFA61E7447F300E81C95 /* arek_exampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7569AFA51E7447F300E81C95 /* arek_exampleTests.swift */; };
20 | 7569AFB11E7447F300E81C95 /* arek_exampleUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7569AFB01E7447F300E81C95 /* arek_exampleUITests.swift */; };
21 | 756DA0AF1F0C285900F0460B /* ArekCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 756DA0AE1F0C285900F0460B /* ArekCell.swift */; };
22 | A6424BD252FDA4DBE85428FA /* Pods_arek_example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B038FF5906D8EF852F54CE42 /* Pods_arek_example.framework */; };
23 | /* End PBXBuildFile section */
24 |
25 | /* Begin PBXContainerItemProxy section */
26 | 7569AFA21E7447F300E81C95 /* PBXContainerItemProxy */ = {
27 | isa = PBXContainerItemProxy;
28 | containerPortal = 7569AF851E7447F300E81C95 /* Project object */;
29 | proxyType = 1;
30 | remoteGlobalIDString = 7569AF8C1E7447F300E81C95;
31 | remoteInfo = arek_example;
32 | };
33 | 7569AFAD1E7447F300E81C95 /* PBXContainerItemProxy */ = {
34 | isa = PBXContainerItemProxy;
35 | containerPortal = 7569AF851E7447F300E81C95 /* Project object */;
36 | proxyType = 1;
37 | remoteGlobalIDString = 7569AF8C1E7447F300E81C95;
38 | remoteInfo = arek_example;
39 | };
40 | /* End PBXContainerItemProxy section */
41 |
42 | /* Begin PBXFileReference section */
43 | 6B36335F1F0D8CC700F3B300 /* ArekCellVMServiceProgrammatically.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekCellVMServiceProgrammatically.swift; sourceTree = ""; };
44 | 6B3633611F0D8CEE00F3B300 /* ArekCellVMServiceLocalizable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekCellVMServiceLocalizable.swift; sourceTree = ""; };
45 | 6B6654171F0CF3D80093A15E /* ArekCellVM.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekCellVM.swift; sourceTree = ""; };
46 | 6BAB53341F0D1ACE00E02E1D /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = ""; };
47 | 7569AF8D1E7447F300E81C95 /* arek_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = arek_example.app; sourceTree = BUILT_PRODUCTS_DIR; };
48 | 7569AF901E7447F300E81C95 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
49 | 7569AF921E7447F300E81C95 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
50 | 7569AF951E7447F300E81C95 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
51 | 7569AF971E7447F300E81C95 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
52 | 7569AF9A1E7447F300E81C95 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
53 | 7569AF9C1E7447F300E81C95 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
54 | 7569AFA11E7447F300E81C95 /* arek_exampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = arek_exampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
55 | 7569AFA51E7447F300E81C95 /* arek_exampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = arek_exampleTests.swift; sourceTree = ""; };
56 | 7569AFA71E7447F300E81C95 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
57 | 7569AFAC1E7447F300E81C95 /* arek_exampleUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = arek_exampleUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
58 | 7569AFB01E7447F300E81C95 /* arek_exampleUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = arek_exampleUITests.swift; sourceTree = ""; };
59 | 7569AFB21E7447F300E81C95 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
60 | 756DA0AE1F0C285900F0460B /* ArekCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekCell.swift; sourceTree = ""; };
61 | B038FF5906D8EF852F54CE42 /* Pods_arek_example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_arek_example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
62 | C463D6F479D0910995B14428 /* Pods-arek_example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-arek_example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-arek_example/Pods-arek_example.debug.xcconfig"; sourceTree = ""; };
63 | F2873BC2E9EC460C1FF497D9 /* Pods-arek_example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-arek_example.release.xcconfig"; path = "Pods/Target Support Files/Pods-arek_example/Pods-arek_example.release.xcconfig"; sourceTree = ""; };
64 | /* End PBXFileReference section */
65 |
66 | /* Begin PBXFrameworksBuildPhase section */
67 | 7569AF8A1E7447F300E81C95 /* Frameworks */ = {
68 | isa = PBXFrameworksBuildPhase;
69 | buildActionMask = 2147483647;
70 | files = (
71 | A6424BD252FDA4DBE85428FA /* Pods_arek_example.framework in Frameworks */,
72 | );
73 | runOnlyForDeploymentPostprocessing = 0;
74 | };
75 | 7569AF9E1E7447F300E81C95 /* Frameworks */ = {
76 | isa = PBXFrameworksBuildPhase;
77 | buildActionMask = 2147483647;
78 | files = (
79 | );
80 | runOnlyForDeploymentPostprocessing = 0;
81 | };
82 | 7569AFA91E7447F300E81C95 /* Frameworks */ = {
83 | isa = PBXFrameworksBuildPhase;
84 | buildActionMask = 2147483647;
85 | files = (
86 | );
87 | runOnlyForDeploymentPostprocessing = 0;
88 | };
89 | /* End PBXFrameworksBuildPhase section */
90 |
91 | /* Begin PBXGroup section */
92 | 63E9D54A7AAF6A35062AFC58 /* Pods */ = {
93 | isa = PBXGroup;
94 | children = (
95 | C463D6F479D0910995B14428 /* Pods-arek_example.debug.xcconfig */,
96 | F2873BC2E9EC460C1FF497D9 /* Pods-arek_example.release.xcconfig */,
97 | );
98 | name = Pods;
99 | sourceTree = "";
100 | };
101 | 6B6654161F0CF3CA0093A15E /* ArekCell */ = {
102 | isa = PBXGroup;
103 | children = (
104 | 756DA0AE1F0C285900F0460B /* ArekCell.swift */,
105 | 6B6654171F0CF3D80093A15E /* ArekCellVM.swift */,
106 | 6B36335F1F0D8CC700F3B300 /* ArekCellVMServiceProgrammatically.swift */,
107 | 6B3633611F0D8CEE00F3B300 /* ArekCellVMServiceLocalizable.swift */,
108 | );
109 | name = ArekCell;
110 | sourceTree = "";
111 | };
112 | 7569AF841E7447F300E81C95 = {
113 | isa = PBXGroup;
114 | children = (
115 | 7569AF8F1E7447F300E81C95 /* arek_example */,
116 | 7569AFA41E7447F300E81C95 /* arek_exampleTests */,
117 | 7569AFAF1E7447F300E81C95 /* arek_exampleUITests */,
118 | 7569AF8E1E7447F300E81C95 /* Products */,
119 | 63E9D54A7AAF6A35062AFC58 /* Pods */,
120 | 8694E42A5C95D8F13E875D0F /* Frameworks */,
121 | );
122 | sourceTree = "";
123 | };
124 | 7569AF8E1E7447F300E81C95 /* Products */ = {
125 | isa = PBXGroup;
126 | children = (
127 | 7569AF8D1E7447F300E81C95 /* arek_example.app */,
128 | 7569AFA11E7447F300E81C95 /* arek_exampleTests.xctest */,
129 | 7569AFAC1E7447F300E81C95 /* arek_exampleUITests.xctest */,
130 | );
131 | name = Products;
132 | sourceTree = "";
133 | };
134 | 7569AF8F1E7447F300E81C95 /* arek_example */ = {
135 | isa = PBXGroup;
136 | children = (
137 | 6B6654161F0CF3CA0093A15E /* ArekCell */,
138 | 7569AF901E7447F300E81C95 /* AppDelegate.swift */,
139 | 7569AF971E7447F300E81C95 /* Assets.xcassets */,
140 | 7569AF9C1E7447F300E81C95 /* Info.plist */,
141 | 7569AF991E7447F300E81C95 /* LaunchScreen.storyboard */,
142 | 7569AF941E7447F300E81C95 /* Main.storyboard */,
143 | 7569AF921E7447F300E81C95 /* ViewController.swift */,
144 | 6BAB53351F0D1ACE00E02E1D /* Localizable.strings */,
145 | );
146 | path = arek_example;
147 | sourceTree = "";
148 | };
149 | 7569AFA41E7447F300E81C95 /* arek_exampleTests */ = {
150 | isa = PBXGroup;
151 | children = (
152 | 7569AFA51E7447F300E81C95 /* arek_exampleTests.swift */,
153 | 7569AFA71E7447F300E81C95 /* Info.plist */,
154 | );
155 | path = arek_exampleTests;
156 | sourceTree = "";
157 | };
158 | 7569AFAF1E7447F300E81C95 /* arek_exampleUITests */ = {
159 | isa = PBXGroup;
160 | children = (
161 | 7569AFB01E7447F300E81C95 /* arek_exampleUITests.swift */,
162 | 7569AFB21E7447F300E81C95 /* Info.plist */,
163 | );
164 | path = arek_exampleUITests;
165 | sourceTree = "";
166 | };
167 | 8694E42A5C95D8F13E875D0F /* Frameworks */ = {
168 | isa = PBXGroup;
169 | children = (
170 | B038FF5906D8EF852F54CE42 /* Pods_arek_example.framework */,
171 | );
172 | name = Frameworks;
173 | sourceTree = "";
174 | };
175 | /* End PBXGroup section */
176 |
177 | /* Begin PBXNativeTarget section */
178 | 7569AF8C1E7447F300E81C95 /* arek_example */ = {
179 | isa = PBXNativeTarget;
180 | buildConfigurationList = 7569AFB51E7447F300E81C95 /* Build configuration list for PBXNativeTarget "arek_example" */;
181 | buildPhases = (
182 | 749983BE198146DE8643834E /* [CP] Check Pods Manifest.lock */,
183 | 7569AF891E7447F300E81C95 /* Sources */,
184 | 7569AF8A1E7447F300E81C95 /* Frameworks */,
185 | 7569AF8B1E7447F300E81C95 /* Resources */,
186 | C9C6CBF2904F6DB01B9F8DA2 /* [CP] Embed Pods Frameworks */,
187 | C54E242E1C3F92433CB472A3 /* [CP] Copy Pods Resources */,
188 | );
189 | buildRules = (
190 | );
191 | dependencies = (
192 | );
193 | name = arek_example;
194 | productName = arek_example;
195 | productReference = 7569AF8D1E7447F300E81C95 /* arek_example.app */;
196 | productType = "com.apple.product-type.application";
197 | };
198 | 7569AFA01E7447F300E81C95 /* arek_exampleTests */ = {
199 | isa = PBXNativeTarget;
200 | buildConfigurationList = 7569AFB81E7447F300E81C95 /* Build configuration list for PBXNativeTarget "arek_exampleTests" */;
201 | buildPhases = (
202 | 7569AF9D1E7447F300E81C95 /* Sources */,
203 | 7569AF9E1E7447F300E81C95 /* Frameworks */,
204 | 7569AF9F1E7447F300E81C95 /* Resources */,
205 | );
206 | buildRules = (
207 | );
208 | dependencies = (
209 | 7569AFA31E7447F300E81C95 /* PBXTargetDependency */,
210 | );
211 | name = arek_exampleTests;
212 | productName = arek_exampleTests;
213 | productReference = 7569AFA11E7447F300E81C95 /* arek_exampleTests.xctest */;
214 | productType = "com.apple.product-type.bundle.unit-test";
215 | };
216 | 7569AFAB1E7447F300E81C95 /* arek_exampleUITests */ = {
217 | isa = PBXNativeTarget;
218 | buildConfigurationList = 7569AFBB1E7447F300E81C95 /* Build configuration list for PBXNativeTarget "arek_exampleUITests" */;
219 | buildPhases = (
220 | 7569AFA81E7447F300E81C95 /* Sources */,
221 | 7569AFA91E7447F300E81C95 /* Frameworks */,
222 | 7569AFAA1E7447F300E81C95 /* Resources */,
223 | );
224 | buildRules = (
225 | );
226 | dependencies = (
227 | 7569AFAE1E7447F300E81C95 /* PBXTargetDependency */,
228 | );
229 | name = arek_exampleUITests;
230 | productName = arek_exampleUITests;
231 | productReference = 7569AFAC1E7447F300E81C95 /* arek_exampleUITests.xctest */;
232 | productType = "com.apple.product-type.bundle.ui-testing";
233 | };
234 | /* End PBXNativeTarget section */
235 |
236 | /* Begin PBXProject section */
237 | 7569AF851E7447F300E81C95 /* Project object */ = {
238 | isa = PBXProject;
239 | attributes = {
240 | LastSwiftUpdateCheck = 0820;
241 | LastUpgradeCheck = 0830;
242 | ORGANIZATIONNAME = ennioma;
243 | TargetAttributes = {
244 | 7569AF8C1E7447F300E81C95 = {
245 | CreatedOnToolsVersion = 8.2.1;
246 | DevelopmentTeam = MQ7M5YR8SU;
247 | ProvisioningStyle = Automatic;
248 | SystemCapabilities = {
249 | com.apple.Siri = {
250 | enabled = 1;
251 | };
252 | };
253 | };
254 | 7569AFA01E7447F300E81C95 = {
255 | CreatedOnToolsVersion = 8.2.1;
256 | ProvisioningStyle = Automatic;
257 | TestTargetID = 7569AF8C1E7447F300E81C95;
258 | };
259 | 7569AFAB1E7447F300E81C95 = {
260 | CreatedOnToolsVersion = 8.2.1;
261 | ProvisioningStyle = Automatic;
262 | TestTargetID = 7569AF8C1E7447F300E81C95;
263 | };
264 | };
265 | };
266 | buildConfigurationList = 7569AF881E7447F300E81C95 /* Build configuration list for PBXProject "arek_example" */;
267 | compatibilityVersion = "Xcode 3.2";
268 | developmentRegion = English;
269 | hasScannedForEncodings = 0;
270 | knownRegions = (
271 | en,
272 | Base,
273 | );
274 | mainGroup = 7569AF841E7447F300E81C95;
275 | productRefGroup = 7569AF8E1E7447F300E81C95 /* Products */;
276 | projectDirPath = "";
277 | projectRoot = "";
278 | targets = (
279 | 7569AF8C1E7447F300E81C95 /* arek_example */,
280 | 7569AFA01E7447F300E81C95 /* arek_exampleTests */,
281 | 7569AFAB1E7447F300E81C95 /* arek_exampleUITests */,
282 | );
283 | };
284 | /* End PBXProject section */
285 |
286 | /* Begin PBXResourcesBuildPhase section */
287 | 7569AF8B1E7447F300E81C95 /* Resources */ = {
288 | isa = PBXResourcesBuildPhase;
289 | buildActionMask = 2147483647;
290 | files = (
291 | 7569AF9B1E7447F300E81C95 /* LaunchScreen.storyboard in Resources */,
292 | 6BAB53331F0D1ACE00E02E1D /* Localizable.strings in Resources */,
293 | 7569AF981E7447F300E81C95 /* Assets.xcassets in Resources */,
294 | 7569AF961E7447F300E81C95 /* Main.storyboard in Resources */,
295 | );
296 | runOnlyForDeploymentPostprocessing = 0;
297 | };
298 | 7569AF9F1E7447F300E81C95 /* Resources */ = {
299 | isa = PBXResourcesBuildPhase;
300 | buildActionMask = 2147483647;
301 | files = (
302 | );
303 | runOnlyForDeploymentPostprocessing = 0;
304 | };
305 | 7569AFAA1E7447F300E81C95 /* Resources */ = {
306 | isa = PBXResourcesBuildPhase;
307 | buildActionMask = 2147483647;
308 | files = (
309 | );
310 | runOnlyForDeploymentPostprocessing = 0;
311 | };
312 | /* End PBXResourcesBuildPhase section */
313 |
314 | /* Begin PBXShellScriptBuildPhase section */
315 | 749983BE198146DE8643834E /* [CP] Check Pods Manifest.lock */ = {
316 | isa = PBXShellScriptBuildPhase;
317 | buildActionMask = 2147483647;
318 | files = (
319 | );
320 | inputPaths = (
321 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
322 | "${PODS_ROOT}/Manifest.lock",
323 | );
324 | name = "[CP] Check Pods Manifest.lock";
325 | outputPaths = (
326 | "$(DERIVED_FILE_DIR)/Pods-arek_example-checkManifestLockResult.txt",
327 | );
328 | runOnlyForDeploymentPostprocessing = 0;
329 | shellPath = /bin/sh;
330 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
331 | showEnvVarsInLog = 0;
332 | };
333 | C54E242E1C3F92433CB472A3 /* [CP] Copy Pods Resources */ = {
334 | isa = PBXShellScriptBuildPhase;
335 | buildActionMask = 2147483647;
336 | files = (
337 | );
338 | inputPaths = (
339 | );
340 | name = "[CP] Copy Pods Resources";
341 | outputPaths = (
342 | );
343 | runOnlyForDeploymentPostprocessing = 0;
344 | shellPath = /bin/sh;
345 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-arek_example/Pods-arek_example-resources.sh\"\n";
346 | showEnvVarsInLog = 0;
347 | };
348 | C9C6CBF2904F6DB01B9F8DA2 /* [CP] Embed Pods Frameworks */ = {
349 | isa = PBXShellScriptBuildPhase;
350 | buildActionMask = 2147483647;
351 | files = (
352 | );
353 | inputPaths = (
354 | "${SRCROOT}/Pods/Target Support Files/Pods-arek_example/Pods-arek_example-frameworks.sh",
355 | "${BUILT_PRODUCTS_DIR}/PMAlertController/PMAlertController.framework",
356 | "${BUILT_PRODUCTS_DIR}/arek/arek.framework",
357 | );
358 | name = "[CP] Embed Pods Frameworks";
359 | outputPaths = (
360 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PMAlertController.framework",
361 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/arek.framework",
362 | );
363 | runOnlyForDeploymentPostprocessing = 0;
364 | shellPath = /bin/sh;
365 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-arek_example/Pods-arek_example-frameworks.sh\"\n";
366 | showEnvVarsInLog = 0;
367 | };
368 | /* End PBXShellScriptBuildPhase section */
369 |
370 | /* Begin PBXSourcesBuildPhase section */
371 | 7569AF891E7447F300E81C95 /* Sources */ = {
372 | isa = PBXSourcesBuildPhase;
373 | buildActionMask = 2147483647;
374 | files = (
375 | 756DA0AF1F0C285900F0460B /* ArekCell.swift in Sources */,
376 | 6B6654181F0CF3D80093A15E /* ArekCellVM.swift in Sources */,
377 | 6B3633621F0D8CEE00F3B300 /* ArekCellVMServiceLocalizable.swift in Sources */,
378 | 6B3633601F0D8CC700F3B300 /* ArekCellVMServiceProgrammatically.swift in Sources */,
379 | 7569AF931E7447F300E81C95 /* ViewController.swift in Sources */,
380 | 7569AF911E7447F300E81C95 /* AppDelegate.swift in Sources */,
381 | );
382 | runOnlyForDeploymentPostprocessing = 0;
383 | };
384 | 7569AF9D1E7447F300E81C95 /* Sources */ = {
385 | isa = PBXSourcesBuildPhase;
386 | buildActionMask = 2147483647;
387 | files = (
388 | 7569AFA61E7447F300E81C95 /* arek_exampleTests.swift in Sources */,
389 | );
390 | runOnlyForDeploymentPostprocessing = 0;
391 | };
392 | 7569AFA81E7447F300E81C95 /* Sources */ = {
393 | isa = PBXSourcesBuildPhase;
394 | buildActionMask = 2147483647;
395 | files = (
396 | 7569AFB11E7447F300E81C95 /* arek_exampleUITests.swift in Sources */,
397 | );
398 | runOnlyForDeploymentPostprocessing = 0;
399 | };
400 | /* End PBXSourcesBuildPhase section */
401 |
402 | /* Begin PBXTargetDependency section */
403 | 7569AFA31E7447F300E81C95 /* PBXTargetDependency */ = {
404 | isa = PBXTargetDependency;
405 | target = 7569AF8C1E7447F300E81C95 /* arek_example */;
406 | targetProxy = 7569AFA21E7447F300E81C95 /* PBXContainerItemProxy */;
407 | };
408 | 7569AFAE1E7447F300E81C95 /* PBXTargetDependency */ = {
409 | isa = PBXTargetDependency;
410 | target = 7569AF8C1E7447F300E81C95 /* arek_example */;
411 | targetProxy = 7569AFAD1E7447F300E81C95 /* PBXContainerItemProxy */;
412 | };
413 | /* End PBXTargetDependency section */
414 |
415 | /* Begin PBXVariantGroup section */
416 | 6BAB53351F0D1ACE00E02E1D /* Localizable.strings */ = {
417 | isa = PBXVariantGroup;
418 | children = (
419 | 6BAB53341F0D1ACE00E02E1D /* Base */,
420 | );
421 | name = Localizable.strings;
422 | sourceTree = "";
423 | };
424 | 7569AF941E7447F300E81C95 /* Main.storyboard */ = {
425 | isa = PBXVariantGroup;
426 | children = (
427 | 7569AF951E7447F300E81C95 /* Base */,
428 | );
429 | name = Main.storyboard;
430 | sourceTree = "";
431 | };
432 | 7569AF991E7447F300E81C95 /* LaunchScreen.storyboard */ = {
433 | isa = PBXVariantGroup;
434 | children = (
435 | 7569AF9A1E7447F300E81C95 /* Base */,
436 | );
437 | name = LaunchScreen.storyboard;
438 | sourceTree = "";
439 | };
440 | /* End PBXVariantGroup section */
441 |
442 | /* Begin XCBuildConfiguration section */
443 | 7569AFB31E7447F300E81C95 /* Debug */ = {
444 | isa = XCBuildConfiguration;
445 | buildSettings = {
446 | ALWAYS_SEARCH_USER_PATHS = NO;
447 | CLANG_ANALYZER_NONNULL = YES;
448 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
449 | CLANG_CXX_LIBRARY = "libc++";
450 | CLANG_ENABLE_MODULES = YES;
451 | CLANG_ENABLE_OBJC_ARC = YES;
452 | CLANG_WARN_BOOL_CONVERSION = YES;
453 | CLANG_WARN_CONSTANT_CONVERSION = YES;
454 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
455 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
456 | CLANG_WARN_EMPTY_BODY = YES;
457 | CLANG_WARN_ENUM_CONVERSION = YES;
458 | CLANG_WARN_INFINITE_RECURSION = YES;
459 | CLANG_WARN_INT_CONVERSION = YES;
460 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
461 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
462 | CLANG_WARN_UNREACHABLE_CODE = YES;
463 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
464 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
465 | COPY_PHASE_STRIP = NO;
466 | DEBUG_INFORMATION_FORMAT = dwarf;
467 | ENABLE_STRICT_OBJC_MSGSEND = YES;
468 | ENABLE_TESTABILITY = YES;
469 | GCC_C_LANGUAGE_STANDARD = gnu99;
470 | GCC_DYNAMIC_NO_PIC = NO;
471 | GCC_NO_COMMON_BLOCKS = YES;
472 | GCC_OPTIMIZATION_LEVEL = 0;
473 | GCC_PREPROCESSOR_DEFINITIONS = (
474 | "DEBUG=1",
475 | "$(inherited)",
476 | );
477 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
478 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
479 | GCC_WARN_UNDECLARED_SELECTOR = YES;
480 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
481 | GCC_WARN_UNUSED_FUNCTION = YES;
482 | GCC_WARN_UNUSED_VARIABLE = YES;
483 | IPHONEOS_DEPLOYMENT_TARGET = 10.2;
484 | MTL_ENABLE_DEBUG_INFO = YES;
485 | ONLY_ACTIVE_ARCH = YES;
486 | SDKROOT = iphoneos;
487 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
488 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
489 | };
490 | name = Debug;
491 | };
492 | 7569AFB41E7447F300E81C95 /* Release */ = {
493 | isa = XCBuildConfiguration;
494 | buildSettings = {
495 | ALWAYS_SEARCH_USER_PATHS = NO;
496 | CLANG_ANALYZER_NONNULL = YES;
497 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
498 | CLANG_CXX_LIBRARY = "libc++";
499 | CLANG_ENABLE_MODULES = YES;
500 | CLANG_ENABLE_OBJC_ARC = YES;
501 | CLANG_WARN_BOOL_CONVERSION = YES;
502 | CLANG_WARN_CONSTANT_CONVERSION = YES;
503 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
504 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
505 | CLANG_WARN_EMPTY_BODY = YES;
506 | CLANG_WARN_ENUM_CONVERSION = YES;
507 | CLANG_WARN_INFINITE_RECURSION = YES;
508 | CLANG_WARN_INT_CONVERSION = YES;
509 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
510 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
511 | CLANG_WARN_UNREACHABLE_CODE = YES;
512 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
513 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
514 | COPY_PHASE_STRIP = NO;
515 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
516 | ENABLE_NS_ASSERTIONS = NO;
517 | ENABLE_STRICT_OBJC_MSGSEND = YES;
518 | GCC_C_LANGUAGE_STANDARD = gnu99;
519 | GCC_NO_COMMON_BLOCKS = YES;
520 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
521 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
522 | GCC_WARN_UNDECLARED_SELECTOR = YES;
523 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
524 | GCC_WARN_UNUSED_FUNCTION = YES;
525 | GCC_WARN_UNUSED_VARIABLE = YES;
526 | IPHONEOS_DEPLOYMENT_TARGET = 10.2;
527 | MTL_ENABLE_DEBUG_INFO = NO;
528 | SDKROOT = iphoneos;
529 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
530 | VALIDATE_PRODUCT = YES;
531 | };
532 | name = Release;
533 | };
534 | 7569AFB61E7447F300E81C95 /* Debug */ = {
535 | isa = XCBuildConfiguration;
536 | baseConfigurationReference = C463D6F479D0910995B14428 /* Pods-arek_example.debug.xcconfig */;
537 | buildSettings = {
538 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
539 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
540 | CODE_SIGN_ENTITLEMENTS = "";
541 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
542 | CODE_SIGN_STYLE = Automatic;
543 | DEVELOPMENT_TEAM = MQ7M5YR8SU;
544 | INFOPLIST_FILE = arek_example/Info.plist;
545 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
546 | PRODUCT_BUNDLE_IDENTIFIER = com.ennioma.arek;
547 | PRODUCT_NAME = "$(TARGET_NAME)";
548 | PROVISIONING_PROFILE_SPECIFIER = "";
549 | SWIFT_VERSION = 3.0;
550 | };
551 | name = Debug;
552 | };
553 | 7569AFB71E7447F300E81C95 /* Release */ = {
554 | isa = XCBuildConfiguration;
555 | baseConfigurationReference = F2873BC2E9EC460C1FF497D9 /* Pods-arek_example.release.xcconfig */;
556 | buildSettings = {
557 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
558 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
559 | CODE_SIGN_ENTITLEMENTS = "";
560 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
561 | CODE_SIGN_STYLE = Automatic;
562 | DEVELOPMENT_TEAM = MQ7M5YR8SU;
563 | INFOPLIST_FILE = arek_example/Info.plist;
564 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
565 | PRODUCT_BUNDLE_IDENTIFIER = com.ennioma.arek;
566 | PRODUCT_NAME = "$(TARGET_NAME)";
567 | PROVISIONING_PROFILE_SPECIFIER = "";
568 | SWIFT_VERSION = 3.0;
569 | };
570 | name = Release;
571 | };
572 | 7569AFB91E7447F300E81C95 /* Debug */ = {
573 | isa = XCBuildConfiguration;
574 | buildSettings = {
575 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
576 | BUNDLE_LOADER = "$(TEST_HOST)";
577 | INFOPLIST_FILE = arek_exampleTests/Info.plist;
578 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
579 | PRODUCT_BUNDLE_IDENTIFIER = "com.ennioma.arek-exampleTests";
580 | PRODUCT_NAME = "$(TARGET_NAME)";
581 | SWIFT_VERSION = 3.0;
582 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/arek_example.app/arek_example";
583 | };
584 | name = Debug;
585 | };
586 | 7569AFBA1E7447F300E81C95 /* Release */ = {
587 | isa = XCBuildConfiguration;
588 | buildSettings = {
589 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
590 | BUNDLE_LOADER = "$(TEST_HOST)";
591 | INFOPLIST_FILE = arek_exampleTests/Info.plist;
592 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
593 | PRODUCT_BUNDLE_IDENTIFIER = "com.ennioma.arek-exampleTests";
594 | PRODUCT_NAME = "$(TARGET_NAME)";
595 | SWIFT_VERSION = 3.0;
596 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/arek_example.app/arek_example";
597 | };
598 | name = Release;
599 | };
600 | 7569AFBC1E7447F300E81C95 /* Debug */ = {
601 | isa = XCBuildConfiguration;
602 | buildSettings = {
603 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
604 | INFOPLIST_FILE = arek_exampleUITests/Info.plist;
605 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
606 | PRODUCT_BUNDLE_IDENTIFIER = "com.ennioma.arek-exampleUITests";
607 | PRODUCT_NAME = "$(TARGET_NAME)";
608 | SWIFT_VERSION = 3.0;
609 | TEST_TARGET_NAME = arek_example;
610 | };
611 | name = Debug;
612 | };
613 | 7569AFBD1E7447F300E81C95 /* Release */ = {
614 | isa = XCBuildConfiguration;
615 | buildSettings = {
616 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
617 | INFOPLIST_FILE = arek_exampleUITests/Info.plist;
618 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
619 | PRODUCT_BUNDLE_IDENTIFIER = "com.ennioma.arek-exampleUITests";
620 | PRODUCT_NAME = "$(TARGET_NAME)";
621 | SWIFT_VERSION = 3.0;
622 | TEST_TARGET_NAME = arek_example;
623 | };
624 | name = Release;
625 | };
626 | /* End XCBuildConfiguration section */
627 |
628 | /* Begin XCConfigurationList section */
629 | 7569AF881E7447F300E81C95 /* Build configuration list for PBXProject "arek_example" */ = {
630 | isa = XCConfigurationList;
631 | buildConfigurations = (
632 | 7569AFB31E7447F300E81C95 /* Debug */,
633 | 7569AFB41E7447F300E81C95 /* Release */,
634 | );
635 | defaultConfigurationIsVisible = 0;
636 | defaultConfigurationName = Release;
637 | };
638 | 7569AFB51E7447F300E81C95 /* Build configuration list for PBXNativeTarget "arek_example" */ = {
639 | isa = XCConfigurationList;
640 | buildConfigurations = (
641 | 7569AFB61E7447F300E81C95 /* Debug */,
642 | 7569AFB71E7447F300E81C95 /* Release */,
643 | );
644 | defaultConfigurationIsVisible = 0;
645 | defaultConfigurationName = Release;
646 | };
647 | 7569AFB81E7447F300E81C95 /* Build configuration list for PBXNativeTarget "arek_exampleTests" */ = {
648 | isa = XCConfigurationList;
649 | buildConfigurations = (
650 | 7569AFB91E7447F300E81C95 /* Debug */,
651 | 7569AFBA1E7447F300E81C95 /* Release */,
652 | );
653 | defaultConfigurationIsVisible = 0;
654 | defaultConfigurationName = Release;
655 | };
656 | 7569AFBB1E7447F300E81C95 /* Build configuration list for PBXNativeTarget "arek_exampleUITests" */ = {
657 | isa = XCConfigurationList;
658 | buildConfigurations = (
659 | 7569AFBC1E7447F300E81C95 /* Debug */,
660 | 7569AFBD1E7447F300E81C95 /* Release */,
661 | );
662 | defaultConfigurationIsVisible = 0;
663 | defaultConfigurationName = Release;
664 | };
665 | /* End XCConfigurationList section */
666 | };
667 | rootObject = 7569AF851E7447F300E81C95 /* Project object */;
668 | }
669 |
--------------------------------------------------------------------------------