Skip to content

Commit

Permalink
Merge pull request #92 from ennioma/develop
Browse files Browse the repository at this point in the history
Add Core Motion fix to master
  • Loading branch information
ennioma authored Oct 20, 2017
2 parents 1e07e8f + 50e41ba commit a7ef183
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 111 deletions.
21 changes: 13 additions & 8 deletions Example/arek_example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
6B3633611F0D8CEE00F3B300 /* ArekCellVMServiceLocalizable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekCellVMServiceLocalizable.swift; sourceTree = "<group>"; };
6B6654171F0CF3D80093A15E /* ArekCellVM.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArekCellVM.swift; sourceTree = "<group>"; };
6BAB53341F0D1ACE00E02E1D /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; };
752A54701E77416E006F9B3E /* arek_example.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = arek_example.entitlements; sourceTree = "<group>"; };
7569AF8D1E7447F300E81C95 /* arek_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = arek_example.app; sourceTree = BUILT_PRODUCTS_DIR; };
7569AF901E7447F300E81C95 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7569AF921E7447F300E81C95 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -137,7 +136,6 @@
children = (
6B6654161F0CF3CA0093A15E /* ArekCell */,
7569AF901E7447F300E81C95 /* AppDelegate.swift */,
752A54701E77416E006F9B3E /* arek_example.entitlements */,
7569AF971E7447F300E81C95 /* Assets.xcassets */,
7569AF9C1E7447F300E81C95 /* Info.plist */,
7569AF991E7447F300E81C95 /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -245,6 +243,7 @@
TargetAttributes = {
7569AF8C1E7447F300E81C95 = {
CreatedOnToolsVersion = 8.2.1;
DevelopmentTeam = MQ7M5YR8SU;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.Siri = {
Expand Down Expand Up @@ -538,12 +537,15 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = arek_example/arek_example.entitlements;
DEVELOPMENT_TEAM = "";
CODE_SIGN_ENTITLEMENTS = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = MQ7M5YR8SU;
INFOPLIST_FILE = arek_example/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = ennioma.arek;
PRODUCT_BUNDLE_IDENTIFIER = com.ennioma.arek;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 3.0;
};
name = Debug;
Expand All @@ -554,12 +556,15 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = arek_example/arek_example.entitlements;
DEVELOPMENT_TEAM = "";
CODE_SIGN_ENTITLEMENTS = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = MQ7M5YR8SU;
INFOPLIST_FILE = arek_example/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = ennioma.arek;
PRODUCT_BUNDLE_IDENTIFIER = com.ennioma.arek;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 3.0;
};
name = Release;
Expand Down
26 changes: 0 additions & 26 deletions Example/arek_example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}

func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


}

2 changes: 0 additions & 2 deletions Example/arek_example/ArekCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class ArekCell: UITableViewCell {
if clicked, (viewModel?.permission != nil) {

self.managePermission()

}
}
}
Expand All @@ -59,7 +58,6 @@ class ArekCell: UITableViewCell {
viewModel?.permission.manage(completion: { (status) in

self.updateUI(status)

})
}

Expand Down
15 changes: 10 additions & 5 deletions Example/arek_example/ArekCellVMServiceProgrammatically.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class ArekCellVMServiceProgrammatically {
static private var permissions = [
["popupDataTitle": "Media Library Access - native", "allowButtonTitle": "Allow 👍🏼", "denyButtonTitle": "No! 👎🏼", "enableTitle": "Please!", "reEnableTitle": "Re-enable please!"],
["popupDataTitle": "Camera Access - PMAlertController", "allowButtonTitle": "Allow 👍🏼", "denyButtonTitle": "No! 👎🏼", "enableTitle": "Please!", "reEnableTitle": "Re-enable please!"],
["popupDataTitle": "Location Always Access - native", "allowButtonTitle": "Allow 👍🏼", "denyButtonTitle": "No! 👎🏼", "enableTitle": "Please!", "reEnableTitle": "Re-enable please!"]
["popupDataTitle": "Location Always Access - native", "allowButtonTitle": "Allow 👍🏼", "denyButtonTitle": "No! 👎🏼", "enableTitle": "Please!", "reEnableTitle": "Re-enable please!"],
["popupDataTitle": "Motion - PMAlertController", "allowButtonTitle": "Allow 👍🏼", "denyButtonTitle": "No! 👎🏼", "enableTitle": "Please!", "reEnableTitle": "Re-enable please!"]
]

static func numberOfVMs() -> Int {
Expand All @@ -40,22 +41,24 @@ class ArekCellVMServiceProgrammatically {
static func buildVM(index: Int) -> ArekCellVM {
let data = permissions[index]

let configuration = ArekConfiguration(frequency: .OnceADay, presentInitialPopup: true, presentReEnablePopup: true)
let initialPopupData = ArekPopupData(title: data["popupDataTitle"]!, message: data["enableTitle"]!, image: "", allowButtonTitle: data["allowButtonTitle"]!, denyButtonTitle: data["denyButtonTitle"]!, type: getPopuptType(index: index))
let reenablePopupData = ArekPopupData(title: data["popupDataTitle"]!, message: data["reEnableTitle"]!, image: "", allowButtonTitle: data["allowButtonTitle"]!, denyButtonTitle: data["denyButtonTitle"]!, type: getPopuptType(index: index))
let configuration = ArekConfiguration(frequency: .Always, presentInitialPopup: true, presentReEnablePopup: true)
let initialPopupData = ArekPopupData(title: data["popupDataTitle"]!, message: data["enableTitle"]!, image: "", allowButtonTitle: data["allowButtonTitle"]!, denyButtonTitle: data["denyButtonTitle"]!, type: getPopupType(index: index))
let reenablePopupData = ArekPopupData(title: data["popupDataTitle"]!, message: data["reEnableTitle"]!, image: "", allowButtonTitle: data["allowButtonTitle"]!, denyButtonTitle: data["denyButtonTitle"]!, type: getPopupType(index: index))

let permission = getPermissionType(index: index, configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reenablePopupData)
return ArekCellVM(permission: permission!, title: data["popupDataTitle"]!)
}

static private func getPopuptType(index: Int) -> ArekPopupType {
static private func getPopupType(index: Int) -> ArekPopupType {
switch index {
case 0:
return .native
case 1:
return .codeido
case 2:
return .native
case 3:
return .codeido
default:
return .native
}
Expand All @@ -70,6 +73,8 @@ class ArekCellVMServiceProgrammatically {
return ArekCamera(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
case 2:
return ArekLocationAlways(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
case 3:
return ArekMotion(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
default:
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
Expand Down
37 changes: 19 additions & 18 deletions Example/arek_example/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,24 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCalendarsUsageDescription</key>
<string>asd lol</string>
<key>NSSiriUsageDescription</key>
<string>usa siri</string>
<key>NSAppleMusicUsageDescription</key>
<string>Oh oh get me your Media!</string>
<key>NSCameraUsageDescription</key>
<string>I want to access your Camera!</string>
<key>NSContactsUsageDescription</key>
<string>Let me read your contacts!</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Get me the Location Dude!</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Want to access your photos!</string>
<key>NSRemindersUsageDescription</key>
<string>Let&apos;s go to your reminders!</string>
<key>NSMotionUsageDescription</key>
<string>Want your motion dataaaa</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Get me the Location Dude!</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Get me the Location Dude!</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand All @@ -35,20 +49,7 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>NSAppleMusicUsageDescription</key>
<string>Oh oh get me your Media!</string>
<key>NSCameraUsageDescription</key>
<string>I want to access your Camera!</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Get me the Location Dude!</string>
<key>NSContactsUsageDescription</key>
<string>Let me read your contacts!</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Want to access your photos!</string>
<key>NSRemindersUsageDescription</key>
<string>Let&apos;s go to your reminders!</string>
</dict>
</plist>
8 changes: 0 additions & 8 deletions Example/arek_example/arek_example.entitlements

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,15 @@ Add AREK to your Podfile
```ruby
use_frameworks!
target 'MyTarget' do
pod 'arek', '~> 1.5.0'
pod 'arek', '~> 1.6.0'
end
```

If you want to install just a specific permission, let's say `Bluetooth`, you have to specify:
```ruby
use_frameworks!
target 'MyTarget' do
pod 'arek/Bluetooth', '~> 1.5.0'
pod 'arek/Bluetooth', '~> 1.6.0'
end
```

Expand All @@ -210,7 +210,7 @@ $ pod install

## Carthage
```ruby
github "ennioma/arek" ~> "1.5.0"
github "ennioma/arek" ~> "1.6.0"
```

Then on your application target *Build Phases* settings tab, add a "New Run Script Phase". Create a Run Script with the following content:
Expand Down
2 changes: 1 addition & 1 deletion arek.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'arek'
s.version = '1.5.0'
s.version = '1.6.0'
s.summary = 'AREK is a clean and easy to use wrapper over any kind of iOS permission.'
s.homepage = 'https://github.com/ennioma/arek'
s.license = { :type => 'MIT', :file => 'LICENSE'}
Expand Down
2 changes: 1 addition & 1 deletion code/Classes/Core/Utilities/ArekPermissionStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import Foundation

public enum ArekPermissionStatus {
public enum ArekPermissionStatus: String {
case authorized
case denied
case notDetermined
Expand Down
Loading

0 comments on commit a7ef183

Please sign in to comment.