├── .gitignore
├── .travis.yml
├── ADAppRater.podspec
├── ADAppRater.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── xcshareddata
│ └── xcschemes
│ └── ADAppRater.xcscheme
├── ADAppRater.xcworkspace
└── contents.xcworkspacedata
├── ADAppRater
├── ADARCustomViewsDelegate.h
├── ADARDelegate.h
├── ADAppRater.bundle
│ ├── de.lproj
│ │ └── Localizable.strings
│ ├── en.lproj
│ │ └── Localizable.strings
│ ├── es.lproj
│ │ └── Localizable.strings
│ ├── fr.lproj
│ │ └── Localizable.strings
│ ├── it.lproj
│ │ └── Localizable.strings
│ ├── ja.lproj
│ │ └── Localizable.strings
│ ├── ko.lproj
│ │ └── Localizable.strings
│ ├── pt.lproj
│ │ └── Localizable.strings
│ ├── ru.lproj
│ │ └── Localizable.strings
│ ├── zh-Hans.lproj
│ │ └── Localizable.strings
│ └── zh-Hant.lproj
│ │ └── Localizable.strings
├── ADAppRater.h
├── ADAppRater.m
├── ADAppRater_Protected.h
├── ADAppStoreConnector.h
├── ADAppStoreConnector.m
├── Info.plist
└── Model Layer
│ ├── ADAppRaterTexts.h
│ ├── ADAppRaterTexts.m
│ ├── ADEventCriteria.h
│ ├── ADEventCriteria.m
│ ├── ADEventScenario.h
│ └── ADEventScenario.m
├── ADAppRaterTests
├── ADARManagerBaseTestCase.h
├── ADARManagerBaseTestCase.m
├── ADAppRaterManagerTests.m
├── ADAppRaterManager_TestsInternal.h
├── ADAppRaterPropertiesTests.m
├── ADAppRatingFlowTests.m
├── AppStore Connector Tests
│ ├── ADAppStoreConnectorTests.m
│ └── ADAppStoreConnector_TestsInternal.h
├── Info.plist
├── Model Object Tests
│ ├── ADAppRaterTextsTests.m
│ ├── ADEventCriteriaTests.m
│ └── ADEventScenarioTests.m
└── Test Helpers
│ ├── ADMockingHelpers.h
│ ├── ADMockingHelpers.m
│ ├── ADTestCase.h
│ └── ADTestCase.m
├── Assets
├── AppsUsing
│ └── acad_128x128.png
├── Icons
│ ├── icon120.png
│ ├── icon180.png
│ └── icon80.png
└── Screenshots
│ ├── Screenshot1_Satisfaction.png
│ ├── Screenshot2_Rate.png
│ └── Screenshot3_Feedback.png
├── CHANGELOG.md
├── Contributing.md
├── Examples
└── ADAppRater Demo
│ ├── ADAppRater Demo.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── ADAppRater Demo.xcscheme
│ └── ADAppRater Demo
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Base.lproj
│ ├── LaunchScreen.xib
│ └── Main.storyboard
│ ├── Images.xcassets
│ ├── AppIcon.appiconset
│ │ ├── 120.png
│ │ ├── 152.png
│ │ ├── 167.png
│ │ ├── 180.png
│ │ ├── 76.png
│ │ └── Contents.json
│ └── Contents.json
│ ├── Info.plist
│ ├── View Controllers
│ ├── ADBasicFlowViewController.h
│ ├── ADBasicFlowViewController.m
│ ├── ADCustomFlowViewController.h
│ ├── ADCustomFlowViewController.m
│ ├── ADLocalizedTextViewController.h
│ ├── ADLocalizedTextViewController.m
│ ├── ADScenariosFlowViewController.h
│ └── ADScenariosFlowViewController.m
│ └── main.m
├── LICENCE.md
├── Podfile
├── Podfile.lock
├── Pods
├── Manifest.lock
├── OCMock
│ ├── License.txt
│ ├── README.md
│ └── Source
│ │ └── OCMock
│ │ ├── NSInvocation+OCMAdditions.h
│ │ ├── NSInvocation+OCMAdditions.m
│ │ ├── NSMethodSignature+OCMAdditions.h
│ │ ├── NSMethodSignature+OCMAdditions.m
│ │ ├── NSNotificationCenter+OCMAdditions.h
│ │ ├── NSNotificationCenter+OCMAdditions.m
│ │ ├── NSObject+OCMAdditions.h
│ │ ├── NSObject+OCMAdditions.m
│ │ ├── NSValue+OCMAdditions.h
│ │ ├── NSValue+OCMAdditions.m
│ │ ├── OCClassMockObject.h
│ │ ├── OCClassMockObject.m
│ │ ├── OCMArg.h
│ │ ├── OCMArg.m
│ │ ├── OCMArgAction.h
│ │ ├── OCMArgAction.m
│ │ ├── OCMBlockArgCaller.h
│ │ ├── OCMBlockArgCaller.m
│ │ ├── OCMBlockCaller.h
│ │ ├── OCMBlockCaller.m
│ │ ├── OCMBoxedReturnValueProvider.h
│ │ ├── OCMBoxedReturnValueProvider.m
│ │ ├── OCMConstraint.h
│ │ ├── OCMConstraint.m
│ │ ├── OCMExceptionReturnValueProvider.h
│ │ ├── OCMExceptionReturnValueProvider.m
│ │ ├── OCMExpectationRecorder.h
│ │ ├── OCMExpectationRecorder.m
│ │ ├── OCMFunctions.h
│ │ ├── OCMFunctions.m
│ │ ├── OCMFunctionsPrivate.h
│ │ ├── OCMIndirectReturnValueProvider.h
│ │ ├── OCMIndirectReturnValueProvider.m
│ │ ├── OCMInvocationExpectation.h
│ │ ├── OCMInvocationExpectation.m
│ │ ├── OCMInvocationMatcher.h
│ │ ├── OCMInvocationMatcher.m
│ │ ├── OCMInvocationStub.h
│ │ ├── OCMInvocationStub.m
│ │ ├── OCMLocation.h
│ │ ├── OCMLocation.m
│ │ ├── OCMMacroState.h
│ │ ├── OCMMacroState.m
│ │ ├── OCMNotificationPoster.h
│ │ ├── OCMNotificationPoster.m
│ │ ├── OCMObserverRecorder.h
│ │ ├── OCMObserverRecorder.m
│ │ ├── OCMPassByRefSetter.h
│ │ ├── OCMPassByRefSetter.m
│ │ ├── OCMRealObjectForwarder.h
│ │ ├── OCMRealObjectForwarder.m
│ │ ├── OCMRecorder.h
│ │ ├── OCMRecorder.m
│ │ ├── OCMReturnValueProvider.h
│ │ ├── OCMReturnValueProvider.m
│ │ ├── OCMStubRecorder.h
│ │ ├── OCMStubRecorder.m
│ │ ├── OCMVerifier.h
│ │ ├── OCMVerifier.m
│ │ ├── OCMock.h
│ │ ├── OCMockObject.h
│ │ ├── OCMockObject.m
│ │ ├── OCObserverMockObject.h
│ │ ├── OCObserverMockObject.m
│ │ ├── OCPartialMockObject.h
│ │ ├── OCPartialMockObject.m
│ │ ├── OCProtocolMockObject.h
│ │ └── OCProtocolMockObject.m
├── Pods.xcodeproj
│ └── project.pbxproj
└── Target Support Files
│ ├── OCMock
│ ├── Info.plist
│ ├── OCMock-dummy.m
│ ├── OCMock-prefix.pch
│ ├── OCMock-umbrella.h
│ ├── OCMock.modulemap
│ └── OCMock.xcconfig
│ ├── Pods-ADAppRater
│ ├── Info.plist
│ ├── Pods-ADAppRater-acknowledgements.markdown
│ ├── Pods-ADAppRater-acknowledgements.plist
│ ├── Pods-ADAppRater-dummy.m
│ ├── Pods-ADAppRater-resources.sh
│ ├── Pods-ADAppRater-umbrella.h
│ ├── Pods-ADAppRater.debug.xcconfig
│ ├── Pods-ADAppRater.modulemap
│ └── Pods-ADAppRater.release.xcconfig
│ └── Pods-ADAppRaterTests
│ ├── Info.plist
│ ├── Pods-ADAppRaterTests-acknowledgements.markdown
│ ├── Pods-ADAppRaterTests-acknowledgements.plist
│ ├── Pods-ADAppRaterTests-dummy.m
│ ├── Pods-ADAppRaterTests-frameworks.sh
│ ├── Pods-ADAppRaterTests-resources.sh
│ ├── Pods-ADAppRaterTests-umbrella.h
│ ├── Pods-ADAppRaterTests.debug.xcconfig
│ ├── Pods-ADAppRaterTests.modulemap
│ └── Pods-ADAppRaterTests.release.xcconfig
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
3 | # Xcode
4 | #
5 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
6 |
7 | ## Build generated
8 | build/
9 | DerivedData
10 |
11 | ## App Code
12 | .idea
13 |
14 | ## Various settings
15 | *.pbxuser
16 | !default.pbxuser
17 | *.mode1v3
18 | !default.mode1v3
19 | *.mode2v3
20 | !default.mode2v3
21 | *.perspectivev3
22 | !default.perspectivev3
23 | xcuserdata
24 | *.xcuserdatad
25 | *.xcuserstate
26 |
27 | ## Other
28 | *.xccheckout
29 | *.moved-aside
30 | *.xcuserstate
31 | *.xcscmblueprint
32 |
33 | ## Obj-C/Swift specific
34 | *.hmap
35 | *.ipa
36 |
37 | # CocoaPods
38 | #
39 | # We recommend against adding the Pods directory to your .gitignore. However
40 | # you should judge for yourself, the pros and cons are mentioned at:
41 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
42 | #
43 | #Pods/
44 |
45 | # Carthage
46 | #
47 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
48 | # Carthage/Checkouts
49 |
50 | #Carthage/Build
51 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | osx_image: xcode7.2
2 | language: objective-c
3 | xcode_sdk: iphonesimulator
4 |
5 | xcode_workspace: ADAppRater.xcworkspace
6 | xcode_scheme: 'ADAppRater'
7 |
8 | podfile: Podfile
9 | cache: cocoapods
10 |
--------------------------------------------------------------------------------
/ADAppRater.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 |
3 | s.name = "ADAppRater"
4 | s.version = "1.1.3"
5 | s.summary = "ADAppRater promotes your apps by targeting satisfied users and asking them to rate your app"
6 | s.description = <<-DESC
7 | ADAppRater is a component intended to help you promote your apps in the App Store by targeting satisfied users and asking them to rate your app.
8 | By pinpointing users who regularly engage with and think highly of your app, this approach is one of the best ways to earn positive app reviews. Following a simple installation process, you can see drastic improvements in your store rating in a matter of weeks.
9 | Features:
10 | 1. Target only satisfied users to achieve a higher App Store rating
11 | 2. Collect valuable feedback and complaints from dissatisfied users
12 | 3. Easy to define usage parameters to target only experienced users
13 | 4. Supports multiple scenarios of significant events to target users who have completed a flow
14 | 5. You can create your own custom UI
15 | DESC
16 |
17 | s.author = { "Amir Shavit" => "amir.shavit@autodesk.com" }
18 | s.social_media_url = "https://twitter.com/ashavit3"
19 |
20 | s.homepage = "http://www.autodesk.com"
21 | s.screenshots = [ "https://raw.githubusercontent.com/Autodesk/ADAppRater-iOS/master/Assets/Screenshots/Screenshot1_Satisfaction.png",
22 | "https://raw.githubusercontent.com/Autodesk/ADAppRater-iOS/master/Assets/Screenshots/Screenshot2_Rate.png",
23 | "https://raw.githubusercontent.com/Autodesk/ADAppRater-iOS/master/Assets/Screenshots/Screenshot3_Feedback.png" ]
24 | s.license = { :type => "MIT", :file => "LICENCE.md" }
25 |
26 | s.source = { :git => "https://github.com/Autodesk/ADAppRater-iOS.git", :tag => '1.1.3' }
27 | s.platform = :ios, '8.0'
28 | s.source_files = 'ADAppRater/**/*.{h,m}'
29 | s.resources = 'ADAppRater/ADAppRater.bundle'
30 |
31 | s.frameworks = 'Foundation', 'UIKit'
32 | s.requires_arc = true
33 |
34 | end
35 |
--------------------------------------------------------------------------------
/ADAppRater.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ADAppRater.xcodeproj/xcshareddata/xcschemes/ADAppRater.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
34 |
40 |
41 |
42 |
43 |
44 |
50 |
51 |
52 |
53 |
54 |
55 |
66 |
67 |
73 |
74 |
75 |
76 |
77 |
78 |
84 |
85 |
91 |
92 |
93 |
94 |
96 |
97 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/ADAppRater.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ADAppRater/ADARDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // ADARDelegate.h
3 | // ADAppRater
4 | //
5 | // Created by Amir Shavit on 6/24/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**
12 | * @brief `ADARDelegate` protocol defines methods that are called by the `ADAppRater` class in response to events in the rating prompt flow.
13 | * @discussion All protocol methods are optional.
14 | */
15 | @protocol ADARDelegate
16 |
17 | @optional
18 |
19 | - (void)appRaterWillPromptUserSatisfaction;
20 | - (void)appRaterWillPromptUserRating;
21 | - (void)appRaterWillPromptFeedbackRequest;
22 | - (void)appRaterWillDisplayThankYouAlert;
23 |
24 | - (void)appRaterUserDidAgreeToRateApp;
25 | - (void)appRaterUserDidDeclineToRateApp;
26 | - (void)appRaterUserDidRequestReminderToRateApp;
27 |
28 | - (void)appRaterUserDidAgreeToSendFeedback;
29 | - (void)appRaterUserDidDeclineToSendFeedback;
30 |
31 | - (void)appRaterAppStoreDidOpen;
32 | - (void)appRaterAppStoreCouldNotConnect:(NSError *)error;
33 |
34 |
35 | /**
36 | * Tells the delegate a message should be logged to console.
37 | * @discussion Implement this method to provide a custom logging component (instead of NSLog).
38 | * @discussion Optional
39 | * @param message message to print out to console
40 | */
41 | - (void)appRaterLogToConsole:(NSString*)message;
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/ADAppRater/ADAppRater.bundle/de.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 |
2 | // Ask for user satisfation
3 | "localUserSatisfactionAlertMessageFormat" = "Finden Sie %@ nützlich?";
4 | "localUserSatisfactionAlertAnswerYes" = "Ja";
5 | "localUserSatisfactionAlertAnswerNo" = "Nein";
6 |
7 | // Request user to rate app
8 | "localAppRatingAlertTitle" = "Vielen Dank";
9 | "localAppRatingAlertMessageFormat" = "Wir freuen uns, dass Sie %@ nützlich finden! Es wäre sehr hilfreich, wenn Sie uns bewerten.";
10 | "localAppRatingAlertAnswerRateFormat" = "%@ bewerten";
11 | "localAppRatingAlertAnswerRemindMe" = "Später erinnern";
12 | "localAppRatingAlertAnswerDontRate" = "Nein, danke";
13 |
14 | // Request user feedback
15 | "localUserFeedbackAlertMessageFormat" = "Lassen Sie uns wissen, wie wir %@ für Sie verbessern können!";
16 | "localUserFeedbackAlertAnswerYes" = "Kontakt";
17 | "localUserFeedbackAlertAnswerNo" = "Nein, danke";
18 |
19 | // Thank user for feedback
20 | "localThankUserAlertTitle" = "Vielen Dank!";
21 | "localThankUserAlertMessage" = "Vielen Dank für Ihr Feedback!";
22 | "localThankUserAlertDismiss" = "Schließen";
23 |
24 | "localFeedbackFormSubject" = "Feedback";
25 |
--------------------------------------------------------------------------------
/ADAppRater/ADAppRater.bundle/en.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 |
2 | // Ask for user satisfation
3 | "localUserSatisfactionAlertMessageFormat" = "Do you find %@ useful?";
4 | "localUserSatisfactionAlertAnswerYes" = "Yes";
5 | "localUserSatisfactionAlertAnswerNo" = "No";
6 |
7 | // Request user to rate app
8 | "localAppRatingAlertTitle" = "Thank You";
9 | "localAppRatingAlertMessageFormat" = "We're happy that you find %@ useful! It'd be really helpful if you rated us.";
10 | "localAppRatingAlertAnswerRateFormat" = "Rate %@";
11 | "localAppRatingAlertAnswerRemindMe" = "Remind Me Later";
12 | "localAppRatingAlertAnswerDontRate" = "No, Thanks";
13 |
14 | // Request user feedback
15 | "localUserFeedbackAlertMessageFormat" = "Please let us know how to make %@ better for you!";
16 | "localUserFeedbackAlertAnswerYes" = "Contact us";
17 | "localUserFeedbackAlertAnswerNo" = "No thanks";
18 |
19 | // Thank user for feedback
20 | "localThankUserAlertTitle" = "Thanks!";
21 | "localThankUserAlertMessage" = "Thank you for your feedback!";
22 | "localThankUserAlertDismiss" = "Close";
23 |
24 | "localFeedbackFormSubject" = "Feedback";
25 |
--------------------------------------------------------------------------------
/ADAppRater/ADAppRater.bundle/es.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 |
2 | // Ask for user satisfation
3 | "localUserSatisfactionAlertMessageFormat" = "¿Le parece útil %@?";
4 | "localUserSatisfactionAlertAnswerYes" = "Sí";
5 | "localUserSatisfactionAlertAnswerNo" = "No";
6 |
7 | // Request user to rate app
8 | "localAppRatingAlertTitle" = "Gracias";
9 | "localAppRatingAlertMessageFormat" = "Nos encanta que le resulte útil %@. Nos sería de gran ayuda si pudiera darnos su valoración.";
10 | "localAppRatingAlertAnswerRateFormat" = "Valorar %@";
11 | "localAppRatingAlertAnswerRemindMe" = "Recordar más tarde";
12 | "localAppRatingAlertAnswerDontRate" = "No, gracias";
13 |
14 | // Request user feedback
15 | "localUserFeedbackAlertMessageFormat" = "Indíquenos cómo mejorar %@ para usted.";
16 | "localUserFeedbackAlertAnswerYes" = "Póngase en contacto con nosotros";
17 | "localUserFeedbackAlertAnswerNo" = "No, gracias";
18 |
19 | // Thank user for feedback
20 | "localThankUserAlertTitle" = "Gracias.";
21 | "localThankUserAlertMessage" = "Gracias por sus comentarios.";
22 | "localThankUserAlertDismiss" = "Cerrar";
23 |
24 | "localFeedbackFormSubject" = "Comentarios";
25 |
--------------------------------------------------------------------------------
/ADAppRater/ADAppRater.bundle/fr.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 |
2 | // Ask for user satisfation
3 | "localUserSatisfactionAlertMessageFormat" = "Trouvez-vous %@ utile ?";
4 | "localUserSatisfactionAlertAnswerYes" = "Oui";
5 | "localUserSatisfactionAlertAnswerNo" = "Non";
6 |
7 | // Request user to rate app
8 | "localAppRatingAlertTitle" = "Merci";
9 | "localAppRatingAlertMessageFormat" = "Nous sommes heureux que vous trouviez %@ pratique ! Votre évalaluation nous serait vraiment utile.";
10 | "localAppRatingAlertAnswerRateFormat" = "Evaluez %@";
11 | "localAppRatingAlertAnswerRemindMe" = "Me le rappeler ultérieurement";
12 | "localAppRatingAlertAnswerDontRate" = "Non merci";
13 |
14 | // Request user feedback
15 | "localUserFeedbackAlertMessageFormat" = "Indiquez-nous comment améliorer %@ pour vous !";
16 | "localUserFeedbackAlertAnswerYes" = "Nous contacter";
17 | "localUserFeedbackAlertAnswerNo" = "Non merci";
18 |
19 | // Thank user for feedback
20 | "localThankUserAlertTitle" = "Merci !";
21 | "localThankUserAlertMessage" = "Merci pour vos commentaires.";
22 | "localThankUserAlertDismiss" = "Fermer";
23 |
24 | "localFeedbackFormSubject" = "Commentaires";
25 |
--------------------------------------------------------------------------------
/ADAppRater/ADAppRater.bundle/it.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 |
2 | // Ask for user satisfation
3 | "localUserSatisfactionAlertMessageFormat" = "Hai trovato utile %@?";
4 | "localUserSatisfactionAlertAnswerYes" = "Sì";
5 | "localUserSatisfactionAlertAnswerNo" = "No";
6 |
7 | // Request user to rate app
8 | "localAppRatingAlertTitle" = "Grazie";
9 | "localAppRatingAlertMessageFormat" = "Autodesk è lieta di ricevere il tuo apprezzamento per %@. La tua valutazione sarà molto utile.";
10 | "localAppRatingAlertAnswerRateFormat" = "Valuta %@";
11 | "localAppRatingAlertAnswerRemindMe" = "Ricordamelo in seguito";
12 | "localAppRatingAlertAnswerDontRate" = "No, grazie";
13 |
14 | // Request user feedback
15 | "localUserFeedbackAlertMessageFormat" = "Invia commenti per migliorare %@.";
16 | "localUserFeedbackAlertAnswerYes" = "Contatta Autodesk";
17 | "localUserFeedbackAlertAnswerNo" = "No, grazie";
18 |
19 | // Thank user for feedback
20 | "localThankUserAlertTitle" = "Grazie";
21 | "localThankUserAlertMessage" = "Grazie per il contributo.";
22 | "localThankUserAlertDismiss" = "Chiudi";
23 |
24 | "localFeedbackFormSubject" = "Commenti";
25 |
--------------------------------------------------------------------------------
/ADAppRater/ADAppRater.bundle/ja.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 |
2 | // Ask for user satisfation
3 | "localUserSatisfactionAlertMessageFormat" = "%@ は役立ちますか?";
4 | "localUserSatisfactionAlertAnswerYes" = "はい";
5 | "localUserSatisfactionAlertAnswerNo" = "いいえ";
6 |
7 | // Request user to rate app
8 | "localAppRatingAlertTitle" = "ありがとうございます";
9 | "localAppRatingAlertMessageFormat" = "%@ の良さを見つけてくださり、ありがとうございます。私たちを評価してくださると幸いです。";
10 | "localAppRatingAlertAnswerRateFormat" = "評価 %@";
11 | "localAppRatingAlertAnswerRemindMe" = "後で通知する";
12 | "localAppRatingAlertAnswerDontRate" = "いいえ、遠慮します";
13 |
14 | // Request user feedback
15 | "localUserFeedbackAlertMessageFormat" = "%@ についてのフィードバックをお寄せください。";
16 | "localUserFeedbackAlertAnswerYes" = "お問い合わせ";
17 | "localUserFeedbackAlertAnswerNo" = "いいえ結構です";
18 |
19 | // Thank user for feedback
20 | "localThankUserAlertTitle" = "ありがとうございます。";
21 | "localThankUserAlertMessage" = "フィードバックをいただき、ありがとうございます!";
22 | "localThankUserAlertDismiss" = "閉じる";
23 |
24 | "localFeedbackFormSubject" = "フィードバック";
25 |
--------------------------------------------------------------------------------
/ADAppRater/ADAppRater.bundle/ko.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 |
2 | // Ask for user satisfation
3 | "localUserSatisfactionAlertMessageFormat" = "%@이(가) 도움이 되셨습니까?";
4 | "localUserSatisfactionAlertAnswerYes" = "예";
5 | "localUserSatisfactionAlertAnswerNo" = "아니오";
6 |
7 | // Request user to rate app
8 | "localAppRatingAlertTitle" = "감사합니다.";
9 | "localAppRatingAlertMessageFormat" = "%@이(가) 도움이 되셨다니 다행입니다. Autodek에 대한 평가를 해 주시면 큰 도움이 될 것입니다.";
10 | "localAppRatingAlertAnswerRateFormat" = "%@ 평가하기";
11 | "localAppRatingAlertAnswerRemindMe" = "나중에 알리기";
12 | "localAppRatingAlertAnswerDontRate" = "참여하지 않음";
13 |
14 | // Request user feedback
15 | "localUserFeedbackAlertMessageFormat" = "%@을(를) 사용자에게 더욱 유용하게 개선할 수 있는 방법을 알려 주십시오.";
16 | "localUserFeedbackAlertAnswerYes" = "Autodesk에 연락";
17 | "localUserFeedbackAlertAnswerNo" = "참여하지 않음";
18 |
19 | // Thank user for feedback
20 | "localThankUserAlertTitle" = "감사합니다!";
21 | "localThankUserAlertMessage" = "의견을 주셔서 감사합니다!";
22 | "localThankUserAlertDismiss" = "닫기";
23 |
24 | "localFeedbackFormSubject" = "피드백";
25 |
--------------------------------------------------------------------------------
/ADAppRater/ADAppRater.bundle/pt.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 |
2 | // Ask for user satisfation
3 | "localUserSatisfactionAlertMessageFormat" = "Achou %@ útil?";
4 | "localUserSatisfactionAlertAnswerYes" = "Sim";
5 | "localUserSatisfactionAlertAnswerNo" = "Não";
6 |
7 | // Request user to rate app
8 | "localAppRatingAlertTitle" = "Obrigado";
9 | "localAppRatingAlertMessageFormat" = "Ficamos satisfeitos por achar %@ útil! Seria muito útil para nós receber a sua avaliação.";
10 | "localAppRatingAlertAnswerRateFormat" = "Avaliar %@";
11 | "localAppRatingAlertAnswerRemindMe" = "Lembrar mais tarde";
12 | "localAppRatingAlertAnswerDontRate" = "Não, obrigado";
13 |
14 | // Request user feedback
15 | "localUserFeedbackAlertMessageFormat" = "Diga-nos de que forma podemos melhorar %@ para você!";
16 | "localUserFeedbackAlertAnswerYes" = "Entre em contato conosco";
17 | "localUserFeedbackAlertAnswerNo" = "Não, obrigado";
18 |
19 | // Thank user for feedback
20 | "localThankUserAlertTitle" = "Obrigado!";
21 | "localThankUserAlertMessage" = "Obrigado pelos seus comentários!";
22 | "localThankUserAlertDismiss" = "Fechar";
23 |
24 | "localFeedbackFormSubject" = "Comentários";
25 |
--------------------------------------------------------------------------------
/ADAppRater/ADAppRater.bundle/ru.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 |
2 | // Ask for user satisfation
3 | "localUserSatisfactionAlertMessageFormat" = "Вам понравилось приложение %@?";
4 | "localUserSatisfactionAlertAnswerYes" = "Да";
5 | "localUserSatisfactionAlertAnswerNo" = "Нет";
6 |
7 | // Request user to rate app
8 | "localAppRatingAlertTitle" = "Спасибо";
9 | "localAppRatingAlertMessageFormat" = "Мы очень рады, что вам понравилось приложение %@! Хотели бы вы поставить оценку приложению?";
10 | "localAppRatingAlertAnswerRateFormat" = "Оценить %@";
11 | "localAppRatingAlertAnswerRemindMe" = "Напомнить позже";
12 | "localAppRatingAlertAnswerDontRate" = "Нет, спасибо";
13 |
14 | // Request user feedback
15 | "localUserFeedbackAlertMessageFormat" = "Пожалуйста напишите, как мы можем улучшить %@?";
16 | "localUserFeedbackAlertAnswerYes" = "Написать";
17 | "localUserFeedbackAlertAnswerNo" = "Нет, спасибо";
18 |
19 | // Thank user for feedback
20 | "localThankUserAlertTitle" = "Спасибо!";
21 | "localThankUserAlertMessage" = "Спасибо за ваш отзыв!";
22 | "localThankUserAlertDismiss" = "Закрыть";
23 |
24 | "localFeedbackFormSubject" = "Отзыв";
25 |
--------------------------------------------------------------------------------
/ADAppRater/ADAppRater.bundle/zh-Hans.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 |
2 | // Ask for user satisfation
3 | "localUserSatisfactionAlertMessageFormat" = "您觉得 %@ 有用吗?";
4 | "localUserSatisfactionAlertAnswerYes" = "有用";
5 | "localUserSatisfactionAlertAnswerNo" = "无用";
6 |
7 | // Request user to rate app
8 | "localAppRatingAlertTitle" = "谢谢!";
9 | "localAppRatingAlertMessageFormat" = "我们很高兴您觉得 %@ 有用!如果您提供评分,会对我们非常有帮助。";
10 | "localAppRatingAlertAnswerRateFormat" = "对 %@ 评分";
11 | "localAppRatingAlertAnswerRemindMe" = "稍后提醒我";
12 | "localAppRatingAlertAnswerDontRate" = "不,谢谢";
13 |
14 | // Request user feedback
15 | "localUserFeedbackAlertMessageFormat" = "请让我们了解如何使 %@ 更好地为您服务!";
16 | "localUserFeedbackAlertAnswerYes" = "联系我们";
17 | "localUserFeedbackAlertAnswerNo" = "不,谢谢";
18 |
19 | // Thank user for feedback
20 | "localThankUserAlertTitle" = "谢谢!";
21 | "localThankUserAlertMessage" = "感谢您的反馈!";
22 | "localThankUserAlertDismiss" = "关闭";
23 |
24 | "localFeedbackFormSubject" = "反馈";
25 |
--------------------------------------------------------------------------------
/ADAppRater/ADAppRater.bundle/zh-Hant.lproj/Localizable.strings:
--------------------------------------------------------------------------------
1 |
2 | // Ask for user satisfation
3 | "localUserSatisfactionAlertMessageFormat" = "您是否認為 %@ 有所助益?";
4 | "localUserSatisfactionAlertAnswerYes" = "是";
5 | "localUserSatisfactionAlertAnswerNo" = "否";
6 |
7 | // Request user to rate app
8 | "localAppRatingAlertTitle" = "感謝您";
9 | "localAppRatingAlertMessageFormat" = "我們很高興得知您認為 %@ 有所助益!若您願意給予我們評分,對我們會很有幫助。";
10 | "localAppRatingAlertAnswerRateFormat" = "對 %@ 進行評分";
11 | "localAppRatingAlertAnswerRemindMe" = "稍後提醒我";
12 | "localAppRatingAlertAnswerDontRate" = "不用了,謝謝";
13 |
14 | // Request user feedback
15 | "localUserFeedbackAlertMessageFormat" = "請讓我們知道如何改善 %@ 以符合您的需求!";
16 | "localUserFeedbackAlertAnswerYes" = "與我們聯絡";
17 | "localUserFeedbackAlertAnswerNo" = "不用了,謝謝";
18 |
19 | // Thank user for feedback
20 | "localThankUserAlertTitle" = "謝謝!";
21 | "localThankUserAlertMessage" = "感謝您的回饋!";
22 | "localThankUserAlertDismiss" = "關閉";
23 |
24 | "localFeedbackFormSubject" = "回饋";
25 |
--------------------------------------------------------------------------------
/ADAppRater/ADAppRater_Protected.h:
--------------------------------------------------------------------------------
1 | //
2 | // ADAppRater.h
3 | // ADAppRater
4 | //
5 | // Created by Amir Shavit on 7/21/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import "ADAppRater.h"
10 |
11 | @interface ADAppRater ()
12 |
13 | + (void)AR_logConsole:(NSString*)message;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/ADAppRater/ADAppStoreConnector.h:
--------------------------------------------------------------------------------
1 | //
2 | // ADAppStoreConnector.h
3 | // ADAppRater
4 | //
5 | // Created by Amir Shavit on 6/14/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ADARDelegate.h"
11 |
12 | /**
13 | * @brief `ADAppStoreConnector` class is used privatly by the `ADAppRater` class, to handle communication with the App Store.
14 | */
15 | @interface ADAppStoreConnector : NSObject
16 |
17 | @property (nonatomic, weak) id delegate;
18 |
19 | - (void)setApplicationBundleID:(NSString *)applicationBundleID;
20 | - (void)setAppStoreID:(NSUInteger)appStoreID;
21 |
22 | /**
23 | * @brief ADAppStoreConnector uses updated store urls by default.
24 | * @discussion Use this to revert to old URLs, if functionality is broken.
25 | * @deprecated Use this as a toggle only. Old URLs are soon to be removed, along with this function.
26 | */
27 | - (void)useOldApiFlow DEPRECATED_MSG_ATTRIBUTE("Use this as a toggle only. Old URLs are soon to be removed, along with this function.");
28 |
29 | - (BOOL)isAppStoreAvailable;
30 | - (void)openRatingsPageInAppStore;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/ADAppRater/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.1.3
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ADAppRater/Model Layer/ADAppRaterTexts.h:
--------------------------------------------------------------------------------
1 | //
2 | // ADAppRaterTexts.h
3 | // ADAppRater
4 | //
5 | // Created by Amir Shavit on 7/20/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**
12 | * @brief `ADAppRaterTexts` class bunles the text strings used for the default UI flow.
13 | * @discussion To change the default strings, you can either access the default instance: `[ADAppRater sharedInstance].localStrings`
14 | * @discussion Or create a new instance `[ADAppRater sharedInstance].localStrings = [[ADAppRaterTexts alloc] initWithApplicationName:@"App Name" feedbackRecipientEmail:@"support@your.mail"]`
15 | * @discussion To customize the texts ADAppRater will display, insert your customized strings to the appropriate `ADAppRaterTexts` property.
16 | * @discussion If you have implemented every method of the `ADARCustomViewsDelegate` protocol, you do not have to set your strings to this class, as your custom view will handle the texts.
17 | * @warning Leaving this class unchanged will use the default strings (localized to available laguages).
18 | */
19 | @interface ADAppRaterTexts : NSObject
20 |
21 | @property (nonatomic, strong) NSString* applicationName;
22 |
23 | @property (nonatomic, strong) NSString* userSatisfactionAlertTitle;
24 | @property (nonatomic, strong) NSString* userSatisfactionAlertMessage;
25 | @property (nonatomic, strong) NSString* userSatisfactionAlertAnswerYes;
26 | @property (nonatomic, strong) NSString* userSatisfactionAlertAnswerNo;
27 |
28 | @property (nonatomic, strong) NSString* appRatingAlertTitle;
29 | @property (nonatomic, strong) NSString* appRatingAlertMessage;
30 | @property (nonatomic, strong) NSString* appRatingAlertAnswerRate;
31 | @property (nonatomic, strong) NSString* appRatingAlertAnswerRemindMe;
32 | @property (nonatomic, strong) NSString* appRatingAlertAnswerDontRate;
33 |
34 | @property (nonatomic, strong) NSString* userFeedbackAlertTitle;
35 | @property (nonatomic, strong) NSString* userFeedbackAlertMessage;
36 | @property (nonatomic, strong) NSString* userFeedbackAlertAnswerYes;
37 | @property (nonatomic, strong) NSString* userFeedbackAlertAnswerNo;
38 |
39 | @property (nonatomic, strong) NSString* thankUserAlertTitle;
40 | @property (nonatomic, strong) NSString* thankUserAlertMessage;
41 | @property (nonatomic, strong) NSString* thankUserAlertDismiss;
42 |
43 | @property (nonatomic, strong) NSString* feedbackFormRecipient;
44 | @property (nonatomic, strong) NSString* feedbackFormSubject;
45 | @property (nonatomic, strong) NSString* feedbackFormBody;
46 |
47 |
48 | /**
49 | * Instantiate a new text strings file using default text strings
50 | * @param applicationName Application name to insert in some text strings format
51 | */
52 | - (instancetype)initWithApplicationName:(NSString*)applicationName;
53 |
54 | /**
55 | * Instantiate a new text strings file using default text strings
56 | * @param applicationName Application name to insert in some text strings format
57 | * @param email Email address to use as reciepient for default feedback form
58 | */
59 | - (instancetype)initWithApplicationName:(NSString*)applicationName
60 | feedbackRecipientEmail:(NSString*)email;
61 |
62 | @end
63 |
--------------------------------------------------------------------------------
/ADAppRater/Model Layer/ADEventCriteria.h:
--------------------------------------------------------------------------------
1 | //
2 | // EventCriteria.h
3 | // ADAppRater
4 | //
5 | // Created by Amir Shavit on 6/16/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**
12 | * A single criteria that describes one term that should be completed before the user should be prompted to rate the app.
13 | * This criteria is part of a bigger scenraio of criteria.
14 | * @see ADEventScenario
15 | */
16 | @interface ADEventCriteria : NSObject
17 |
18 | @property (nonatomic, readonly) NSString* eventName;
19 | @property (nonatomic, readonly) NSInteger eventCount;
20 |
21 | - (instancetype)initWithEventName:(NSString*)eventName eventCount:(NSInteger)eventCount;
22 |
23 | - (BOOL)isCreteriaFulfilled:(NSNumber*)registeredCount;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/ADAppRater/Model Layer/ADEventCriteria.m:
--------------------------------------------------------------------------------
1 | //
2 | // EventCriteria.m
3 | // ADAppRater
4 | //
5 | // Created by Amir Shavit on 6/16/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import "ADEventCriteria.h"
10 |
11 | @interface ADEventCriteria ()
12 |
13 | /// TODO: Add support for more relationships / Operators
14 | @property (nonatomic, strong) NSString* eventName;
15 | @property (nonatomic) NSInteger eventCount;
16 |
17 | @end
18 |
19 | @implementation ADEventCriteria
20 |
21 | - (instancetype)initWithEventName:(NSString*)eventName eventCount:(NSInteger)eventCount
22 | {
23 | self = [super init];
24 | if (self)
25 | {
26 | self.eventName = eventName;
27 | self.eventCount = eventCount;
28 | }
29 | return self;
30 | }
31 |
32 | - (BOOL)isCreteriaFulfilled:(NSNumber*)registeredCount
33 | {
34 | // First make sure event name is real
35 | if (self.eventName.length == 0)
36 | {
37 | return NO;
38 | }
39 |
40 | return (self.eventCount <= registeredCount.integerValue);
41 | }
42 |
43 | #pragma mark - NSObject
44 |
45 | - (BOOL)isEqual:(id)object
46 | {
47 | BOOL isEqual = NO;
48 | if ([object isKindOfClass:[self class]])
49 | {
50 | ADEventCriteria* other = (ADEventCriteria*)object;
51 | isEqual = ([self.eventName isEqual:other.eventName] &&
52 | self.eventCount == other.eventCount);
53 | }
54 | return isEqual;
55 | }
56 |
57 | - (NSString *)description
58 | {
59 | return [NSString stringWithFormat:@"ADEventCriteria.name = %@, minimum times = %d", self.eventName, (int)self.eventCount];
60 | }
61 |
62 | @end
63 |
--------------------------------------------------------------------------------
/ADAppRater/Model Layer/ADEventScenario.h:
--------------------------------------------------------------------------------
1 | //
2 | // EventScenario.h
3 | // ADAppRater
4 | //
5 | // Created by Amir Shavit on 6/16/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ADEventCriteria.h"
11 |
12 | /**
13 | * Scenario in which the user should be prompted to rate the app.
14 | * In order for te scenario to complete, a list of criterias should be met and fullfilled.
15 | * @see ADEventCriteria
16 | */
17 | @interface ADEventScenario : NSObject
18 |
19 | /**
20 | * List of criterias that define the scenario in which to prompt user to rate the app.
21 | * @see ADEventCriteria
22 | */
23 | @property (nonatomic, readonly) NSArray* eventCriterias;
24 |
25 | - (instancetype)initWithEventCriterias:(NSArray*)eventCriterias;
26 |
27 | - (BOOL)isValid;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/ADAppRater/Model Layer/ADEventScenario.m:
--------------------------------------------------------------------------------
1 | //
2 | // EventScenario.m
3 | // ADAppRater
4 | //
5 | // Created by Amir Shavit on 6/16/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import "ADEventScenario.h"
10 |
11 | @interface ADEventScenario ()
12 | @property (nonatomic, strong) NSArray* eventCriterias;
13 | @end
14 |
15 | @implementation ADEventScenario
16 |
17 | - (instancetype)initWithEventCriterias:(NSArray*)eventCriterias
18 | {
19 | self = [super init];
20 | if (self) {
21 | self.eventCriterias = eventCriterias;
22 | }
23 | return self;
24 | }
25 |
26 | - (BOOL)isValid
27 | {
28 | return (self.eventCriterias.count > 0);
29 | }
30 |
31 | #pragma mark - NSObject
32 |
33 | - (BOOL)isEqual:(id)object
34 | {
35 | BOOL isEqual = NO;
36 | if ([object isKindOfClass:[self class]])
37 | {
38 | ADEventScenario* other = (ADEventScenario*)object;
39 | if (self.eventCriterias.count == other.eventCriterias.count)
40 | {
41 | isEqual = YES;
42 | for (ADEventCriteria* currCriteria in self.eventCriterias)
43 | {
44 | if (![other.eventCriterias containsObject:currCriteria])
45 | {
46 | isEqual = NO;
47 | break;
48 | }
49 | }
50 | }
51 | }
52 | return isEqual;
53 | }
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/ADAppRaterTests/ADARManagerBaseTestCase.h:
--------------------------------------------------------------------------------
1 | //
2 | // ADARManagerBaseTestCase.h
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 6/16/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import "ADTestCase.h"
10 | #import "ADAppRater.h"
11 | #import "ADAppStoreConnector.h"
12 |
13 | @interface ADARManagerBaseTestCase : ADTestCase
14 |
15 | @property (nonatomic, strong) ADAppRater* raterManager;
16 |
17 | // Dependencies
18 | @property (nonatomic, strong) id mockUserDefaults;
19 | @property (nonatomic, strong) id mockAppStoreConnector;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/ADAppRaterTests/ADARManagerBaseTestCase.m:
--------------------------------------------------------------------------------
1 | //
2 | // ADARManagerBaseTestCase.m
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 6/16/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import "ADARManagerBaseTestCase.h"
10 | #import "ADAppRaterManager_TestsInternal.h"
11 |
12 | @interface ADARManagerBaseTestCase ()
13 | @property (nonatomic, strong) id mockBundle;
14 | @property (nonatomic, strong) id mockLocale;
15 | @end
16 |
17 | @implementation ADARManagerBaseTestCase
18 |
19 | - (void)setUp
20 | {
21 | [super setUp];
22 |
23 | [self unmockObjects];
24 | self.mockUserDefaults = OCMClassMock([NSUserDefaults class]);
25 |
26 | self.mockBundle = OCMClassMock([NSBundle class]);
27 | OCMStub([self.mockBundle mainBundle]).andReturn([NSBundle bundleForClass:[ADAppRater class]]);
28 |
29 | self.mockLocale = OCMClassMock([NSLocale class]);
30 | OCMStub([self.mockLocale preferredLanguages]).andReturn(@[@"en"]);
31 |
32 | self.mockAppStoreConnector = OCMStrictClassMock([ADAppStoreConnector class]);
33 |
34 | self.raterManager = [[ADAppRater alloc] initWithUserDefaults:self.mockUserDefaults
35 | appStoreConnector:self.mockAppStoreConnector];
36 | }
37 |
38 | - (void)tearDown
39 | {
40 | self.raterManager = nil;
41 | self.mockUserDefaults = nil;
42 | self.mockAppStoreConnector = nil;
43 | self.mockLocale = nil;
44 |
45 | [self unmockObjects];
46 |
47 | [super tearDown];
48 | }
49 |
50 | - (void)unmockObjects
51 | {
52 | [ADMockingHelpers unmockForClass:[NSUserDefaults class]];
53 | [ADMockingHelpers unmockForClass:[NSBundle class]];
54 | [ADMockingHelpers unmockForClass:[NSLocale class]];
55 | }
56 |
57 | @end
58 |
--------------------------------------------------------------------------------
/ADAppRaterTests/ADAppRaterManager_TestsInternal.h:
--------------------------------------------------------------------------------
1 | //
2 | // ADAppRaterManager_TestsInternal.h
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 6/11/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import "ADAppRater.h"
10 |
11 | @interface ADAppRater ()
12 |
13 | @property (nonatomic, strong) NSDate *userLastPromptedToRate;
14 | @property (nonatomic, strong) NSDictionary* tempOldVersionEventCounters;
15 |
16 | @property (nonatomic, strong) UIAlertController* currentAlert;
17 |
18 | - (instancetype)initWithUserDefaults:(NSUserDefaults*)userDefaults appStoreConnector:(ADAppStoreConnector*)storeConnector;
19 |
20 | - (void)startRaterFlowFromViewController:(__weak UIViewController*)viewController online:(BOOL)isOnline;
21 | - (void)promptDirectRatingFromViewController:(__weak UIViewController*)viewController online:(BOOL)isOnline;
22 |
23 | - (void)promptUserSatisfationAlertFromViewController:(__weak UIViewController*)viewController;
24 | - (void)promptFeedbackRequestAlertFromViewController:(UIViewController*)viewController;
25 | - (void)promptAppRatingAlertFromViewController:(UIViewController*)viewController;
26 | - (void)displayThankYouAlertFromViewController:(UIViewController*)viewController;
27 | - (void)presentFeedbackMailComposerFromViewController:(UIViewController*)viewController;
28 |
29 | - (BOOL)isScenarioComplete:(ADEventScenario *)scenario eventList:(NSDictionary*)eventList;
30 |
31 | #pragma mark User Rating Alert - User Response
32 |
33 | - (void)userResponse_ratingAlert_rateApp;
34 | - (void)userResponse_ratingAlert_remindRateApp;
35 | - (void)userResponse_ratingAlert_declineRateApp;
36 |
37 | #pragma mark Feedback Request Alert - User Response
38 |
39 | - (void)userResponse_feedbackRequestAlert_sendFeedbackFromViewController:(UIViewController*)viewController;
40 | - (void)userResponse_feedbackRequestAlert_declineFeedback;
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/ADAppRaterTests/ADAppRaterPropertiesTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // ADAppRaterPropertiesTests.m
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 6/15/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import "ADARManagerBaseTestCase.h"
10 |
11 | #import "ADAppRaterManager_TestsInternal.h"
12 |
13 | @interface ADAppRaterPropertiesTests : ADARManagerBaseTestCase
14 |
15 | @end
16 |
17 | @implementation ADAppRaterPropertiesTests
18 |
19 | - (void)setUp
20 | {
21 | [super setUp];
22 | }
23 |
24 | - (void)tearDown
25 | {
26 | [super tearDown];
27 | }
28 |
29 | #pragma mark - Default Params
30 |
31 | - (void)testInitializeManager_shouldHaveDefaultProperties
32 | {
33 | // Arrange
34 | NSString* name = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString*)kCFBundleNameKey];
35 | NSString* version = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
36 | NSString* bundle = [[NSBundle mainBundle] bundleIdentifier];
37 |
38 | // Act
39 |
40 | // Assert
41 | XCTAssertEqualObjects(self.raterManager.applicationName, name);
42 | XCTAssertEqualObjects(self.raterManager.applicationVersion, version);
43 | XCTAssertEqualObjects(self.raterManager.applicationBundleID, bundle);
44 | XCTAssertEqual(self.raterManager.currentVersionDaysUntilPrompt, 1);
45 | XCTAssertEqual(self.raterManager.currentVersionLaunchesUntilPrompt, 3);
46 | XCTAssertEqual(self.raterManager.remindWaitPeriod, 5);
47 | XCTAssertEqual(self.raterManager.limitPromptFrequency, 30);
48 | XCTAssertEqual(self.raterManager.invalidateLastResponsePeriod, 180);
49 | XCTAssertFalse(self.raterManager.promptForNewVersionIfUserRated);
50 | XCTAssertFalse(self.raterManager.enableLog);
51 |
52 | #ifdef DEBUG
53 | XCTAssertFalse(self.raterManager.previewMode);
54 | #endif
55 | }
56 |
57 | #pragma mark - User Reactions
58 |
59 | - (void)testUserRatedApp_shouldSaveToPersistent
60 | {
61 | // Arrange
62 |
63 | // Act
64 | self.raterManager.ratedThisVersion = YES;
65 |
66 | // Assert
67 | OCMVerify([self.mockUserDefaults setObject:[OCMArg any] forKey:@"AD_AppRaterLastRatedVersion"]);
68 | }
69 |
70 | - (void)testUserRatedKeyFoundInPersistent_shouldReturnRatedFlagsTrue
71 | {
72 | // Arrange
73 | OCMStub([self.mockUserDefaults objectForKey:@"AD_AppRaterLastRatedVersion"]).andReturn(self.raterManager.applicationVersion);
74 |
75 | // Act
76 |
77 | // Assert
78 | XCTAssertTrue(self.raterManager.ratedThisVersion);
79 | XCTAssertTrue(self.raterManager.ratedAnyVersion);
80 | }
81 |
82 | - (void)testUserRatedKeyFoundInPersistent_oldVersion_shouldReturnRatedAnyFlagTrue
83 | {
84 | // Arrange
85 | OCMStub([self.mockUserDefaults objectForKey:@"AD_AppRaterLastRatedVersion"]).andReturn(@"old version");
86 |
87 | // Act
88 |
89 | // Assert
90 | XCTAssertFalse(self.raterManager.ratedThisVersion);
91 | XCTAssertTrue(self.raterManager.ratedAnyVersion);
92 | }
93 |
94 | - (void)testUserRatedKeyNotFoundInPersistent_shouldReturnRatedFlagsFalse
95 | {
96 | // Arrange
97 |
98 | // Act
99 |
100 | // Assert
101 | XCTAssertFalse(self.raterManager.ratedThisVersion);
102 | XCTAssertFalse(self.raterManager.ratedAnyVersion);
103 | }
104 |
105 | - (void)testUserDeclinedRated_shouldSaveToPersistent
106 | {
107 | // Arrange
108 |
109 | // Act
110 | self.raterManager.declinedThisVersion = YES;
111 |
112 | // Assert
113 | OCMVerify([self.mockUserDefaults setObject:[OCMArg any] forKey:@"AD_AppRaterLastDeclinedVersion"]);
114 | }
115 |
116 | - (void)testUserDeclinedKeyFoundInPersistent_shouldReturnDeclinedFlagsTrue
117 | {
118 | // Arrange
119 | OCMStub([self.mockUserDefaults objectForKey:@"AD_AppRaterLastDeclinedVersion"]).andReturn(self.raterManager.applicationVersion);
120 |
121 | // Act
122 |
123 | // Assert
124 | XCTAssertTrue(self.raterManager.declinedThisVersion);
125 | XCTAssertTrue(self.raterManager.declinedAnyVersion);
126 | }
127 |
128 | - (void)testUserDeclinedKeyFoundInPersistent_oldVersion_shouldReturnDeclinedAnyFlagTrue
129 | {
130 | // Arrange
131 | OCMStub([self.mockUserDefaults objectForKey:@"AD_AppRaterLastDeclinedVersion"]).andReturn(@"old version");
132 |
133 | // Act
134 |
135 | // Assert
136 | XCTAssertFalse(self.raterManager.declinedThisVersion);
137 | XCTAssertTrue(self.raterManager.declinedAnyVersion);
138 | }
139 |
140 | - (void)testUserDeclinedKeyFoundInPersistent_shouldReturnDeclinedFlagsFalse
141 | {
142 | // Arrange
143 |
144 | // Act
145 |
146 | // Assert
147 | XCTAssertFalse(self.raterManager.declinedThisVersion);
148 | XCTAssertFalse(self.raterManager.declinedAnyVersion);
149 | }
150 |
151 | @end
152 |
--------------------------------------------------------------------------------
/ADAppRaterTests/AppStore Connector Tests/ADAppStoreConnector_TestsInternal.h:
--------------------------------------------------------------------------------
1 | //
2 | // ADAppStoreConnector_TestsInternal.h
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 6/24/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import "ADAppStoreConnector.h"
10 |
11 | @interface ADAppStoreConnector ()
12 |
13 | @property (nonatomic, readonly) NSUInteger appStoreID;
14 | @property (nonatomic, readonly) NSUInteger appStoreGenreID;
15 | @property (nonatomic, readonly) NSString *applicationBundleID;
16 | @property (nonatomic, readonly) NSString *appStoreCountry;
17 | @property (nonatomic, readonly) NSURL *ratingsURL;
18 |
19 | - (void)checkForConnectivityInBackground;
20 | - (NSInteger)checkForConnectivity:(NSError **)error;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/ADAppRaterTests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/ADAppRaterTests/Model Object Tests/ADEventCriteriaTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // ADEventCriteriaTests.m
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 6/16/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import "ADTestCase.h"
10 | #import "ADEventCriteria.h"
11 |
12 | @interface ADEventCriteriaTests : ADTestCase
13 |
14 | @end
15 |
16 | @implementation ADEventCriteriaTests
17 |
18 | - (void)setUp
19 | {
20 | [super setUp];
21 | // Put setup code here. This method is called before the invocation of each test method in the class.
22 | }
23 |
24 | - (void)tearDown
25 | {
26 | // Put teardown code here. This method is called after the invocation of each test method in the class.
27 | [super tearDown];
28 | }
29 |
30 | - (void)testObjectInit
31 | {
32 | // Arrange
33 | NSString* name = @"some name";
34 | NSInteger count = 98;
35 |
36 | // Act
37 | ADEventCriteria* criteria = [[ADEventCriteria alloc]
38 | initWithEventName:name eventCount:count];
39 |
40 | // Assert
41 | XCTAssertEqualObjects(criteria.eventName, name);
42 | XCTAssertEqual(criteria.eventCount, count);
43 | }
44 |
45 | #pragma mark - Is Equal
46 |
47 | - (void)testIsCriteriasEqual_shouldReturnTrue
48 | {
49 | // Arrange
50 | NSString* name = @"an event";
51 | NSInteger count = 98;
52 | ADEventCriteria* criteria1 = [[ADEventCriteria alloc]
53 | initWithEventName:name eventCount:count];
54 | ADEventCriteria* criteria2 = [[ADEventCriteria alloc]
55 | initWithEventName:name eventCount:(count)];
56 |
57 | // Act
58 | BOOL isEqual = [criteria1 isEqual:criteria2];
59 |
60 | // Assert
61 | XCTAssertTrue(isEqual);
62 | }
63 |
64 | - (void)testIsCriteriasEqual_shouldReturnFalse
65 | {
66 | // Arrange
67 | NSString* name = @"an event";
68 | NSInteger count = 98;
69 | ADEventCriteria* criteria1 = [[ADEventCriteria alloc]
70 | initWithEventName:name eventCount:count];
71 | ADEventCriteria* criteria2 = [[ADEventCriteria alloc]
72 | initWithEventName:name eventCount:(count+1)];
73 |
74 | // Act
75 | BOOL isEqual = [criteria1 isEqual:criteria2];
76 |
77 | // Assert
78 | XCTAssertFalse(isEqual);
79 | }
80 |
81 | #pragma mark - Completions
82 |
83 | - (void)testIsCriteriaComplete_eventNameIsNil_shouldReturnFalse
84 | {
85 | // Arrange
86 | NSInteger count = 98;
87 | ADEventCriteria* criteria = [[ADEventCriteria alloc]
88 | initWithEventName:nil eventCount:count];
89 |
90 | // Act
91 | BOOL isComplete = [criteria isCreteriaFulfilled:@(count + 1)];
92 |
93 | // Assert
94 | XCTAssertFalse(isComplete);
95 | }
96 |
97 | - (void)testIsCriteriaComplete_eventNameIsEmpty_shouldReturnFalse
98 | {
99 | // Arrange
100 | NSString* name = @"";
101 | NSInteger count = 98;
102 | ADEventCriteria* criteria = [[ADEventCriteria alloc]
103 | initWithEventName:name eventCount:count];
104 |
105 | // Act
106 | BOOL isComplete = [criteria isCreteriaFulfilled:@(count + 1)];
107 |
108 | // Assert
109 | XCTAssertFalse(isComplete);
110 | }
111 |
112 | - (void)testIsCriteriaComplete_notOccuredEnoughYet_shouldReturnFalse
113 | {
114 | // Arrange
115 | NSString* name = @"an event";
116 | NSInteger count = 98;
117 | ADEventCriteria* criteria = [[ADEventCriteria alloc]
118 | initWithEventName:name eventCount:count];
119 |
120 | // Act
121 | BOOL isComplete = [criteria isCreteriaFulfilled:@(count - 1)];
122 |
123 | // Assert
124 | XCTAssertFalse(isComplete);
125 | }
126 |
127 | - (void)testIsCriteriaComplete_notOccuredAtAll_shouldReturnFalse
128 | {
129 | // Arrange
130 | NSString* name = @"an event";
131 | NSInteger count = 98;
132 | ADEventCriteria* criteria = [[ADEventCriteria alloc]
133 | initWithEventName:name eventCount:count];
134 |
135 | // Act
136 | BOOL isComplete = [criteria isCreteriaFulfilled:nil];
137 |
138 | // Assert
139 | XCTAssertFalse(isComplete);
140 | }
141 |
142 | - (void)testIsCriteriaComplete_OccuredMoreThenMinimum_shouldReturnTrue
143 | {
144 | // Arrange
145 | NSString* name = @"an event";
146 | NSInteger count = 98;
147 | ADEventCriteria* criteria = [[ADEventCriteria alloc]
148 | initWithEventName:name eventCount:count];
149 |
150 | // Act
151 | BOOL isComplete = [criteria isCreteriaFulfilled:@(count + 1)];
152 |
153 | // Assert
154 | XCTAssertTrue(isComplete);
155 | }
156 |
157 | - (void)testIsCriteriaComplete_OccuredExactTimesNeeded_shouldReturnTrue
158 | {
159 | // Arrange
160 | NSString* name = @"an event";
161 | NSInteger count = 98;
162 | ADEventCriteria* criteria = [[ADEventCriteria alloc]
163 | initWithEventName:name eventCount:count];
164 |
165 | // Act
166 | BOOL isComplete = [criteria isCreteriaFulfilled:@(count)];
167 |
168 | // Assert
169 | XCTAssertTrue(isComplete);
170 | }
171 |
172 |
173 |
174 | @end
175 |
--------------------------------------------------------------------------------
/ADAppRaterTests/Model Object Tests/ADEventScenarioTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // ADEventScenarioTests.m
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 6/16/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import "ADTestCase.h"
10 | #import "ADEventScenario.h"
11 |
12 | @interface ADEventScenarioTests : ADTestCase
13 |
14 | @end
15 |
16 | @implementation ADEventScenarioTests
17 |
18 | - (void)setUp
19 | {
20 | [super setUp];
21 | // Put setup code here. This method is called before the invocation of each test method in the class.
22 | }
23 |
24 | - (void)tearDown
25 | {
26 | // Put teardown code here. This method is called after the invocation of each test method in the class.
27 | [super tearDown];
28 | }
29 |
30 | - (void)testObjectInit_withOneCriteria
31 | {
32 | // Arrange
33 | NSString* name1 = @"some name";
34 | NSInteger count1 = 98;
35 | ADEventCriteria* criteria1 = [[ADEventCriteria alloc] initWithEventName:name1 eventCount:count1];
36 | NSArray* criterias = @[criteria1];
37 |
38 | // Act
39 | ADEventScenario* scenario = [[ADEventScenario alloc] initWithEventCriterias:criterias];
40 |
41 | // Assert
42 | XCTAssertEqualObjects(scenario.eventCriterias, criterias);
43 | XCTAssertEqual(scenario.eventCriterias.count, 1);
44 | }
45 |
46 | - (void)testObjectInit_withTwoCriteria
47 | {
48 | // Arrange
49 | NSString* name1 = @"some name";
50 | NSInteger count1 = 98;
51 | ADEventCriteria* criteria1 = [[ADEventCriteria alloc] initWithEventName:name1 eventCount:count1];
52 |
53 | NSString* name2 = @"another name";
54 | NSInteger count2 = 145;
55 | ADEventCriteria* criteria2 = [[ADEventCriteria alloc] initWithEventName:name2 eventCount:count2];
56 | NSArray* criterias = @[criteria1, criteria2];
57 |
58 | // Act
59 | ADEventScenario* scenario = [[ADEventScenario alloc] initWithEventCriterias:criterias];
60 |
61 | // Assert
62 | XCTAssertEqualObjects(scenario.eventCriterias, criterias);
63 | XCTAssertEqual(scenario.eventCriterias.count, 2);
64 | }
65 |
66 | #pragma mark - Is Equal
67 |
68 | - (void)testIsScenarioEqual_shouldReturnTrue
69 | {
70 | // Arrange
71 | NSString* name1 = @"some name";
72 | NSInteger count1 = 98;
73 | ADEventCriteria* criteria1 = [[ADEventCriteria alloc] initWithEventName:name1 eventCount:count1];
74 |
75 | NSString* name2 = @"another name";
76 | NSInteger count2 = 145;
77 | ADEventCriteria* criteria2 = [[ADEventCriteria alloc] initWithEventName:name2 eventCount:count2];
78 |
79 | ADEventScenario* scenario1 = [[ADEventScenario alloc] initWithEventCriterias:@[criteria1, criteria2]];
80 | ADEventScenario* scenario2 = [[ADEventScenario alloc] initWithEventCriterias:@[criteria2, criteria1]];
81 |
82 | // Act
83 | BOOL isEqual = [scenario1 isEqual:scenario2];
84 |
85 | // Assert
86 | XCTAssertTrue(isEqual);
87 | }
88 |
89 | - (void)testIsScenarioEqual_similiarScenario_shouldReturnFalse
90 | {
91 | // Arrange
92 | NSString* name1 = @"some name";
93 | NSInteger count1 = 98;
94 | ADEventCriteria* criteria1 = [[ADEventCriteria alloc] initWithEventName:name1 eventCount:count1];
95 |
96 | NSString* name2 = @"another name";
97 | NSInteger count2 = 145;
98 | ADEventCriteria* criteria2 = [[ADEventCriteria alloc] initWithEventName:name2 eventCount:count2];
99 |
100 | ADEventScenario* scenario1 = [[ADEventScenario alloc] initWithEventCriterias:@[criteria1, criteria2]];
101 | ADEventScenario* scenario2 = [[ADEventScenario alloc] initWithEventCriterias:@[criteria2]];
102 |
103 | // Act
104 | BOOL isEqual = [scenario1 isEqual:scenario2];
105 |
106 | // Assert
107 | XCTAssertFalse(isEqual);
108 | }
109 |
110 | - (void)testIsScenarioEqual_shouldReturnFalse
111 | {
112 | // Arrange
113 | NSString* name1 = @"some name";
114 | NSInteger count1 = 98;
115 | ADEventCriteria* criteria1 = [[ADEventCriteria alloc] initWithEventName:name1 eventCount:count1];
116 |
117 | NSString* name2 = @"another name";
118 | NSInteger count2 = 145;
119 | ADEventCriteria* criteria2 = [[ADEventCriteria alloc] initWithEventName:name2 eventCount:count2];
120 |
121 | ADEventScenario* scenario1 = [[ADEventScenario alloc] initWithEventCriterias:@[criteria1]];
122 | ADEventScenario* scenario2 = [[ADEventScenario alloc] initWithEventCriterias:@[criteria2]];
123 |
124 | // Act
125 | BOOL isEqual = [scenario1 isEqual:scenario2];
126 |
127 | // Assert
128 | XCTAssertFalse(isEqual);
129 | }
130 |
131 | @end
132 |
--------------------------------------------------------------------------------
/ADAppRaterTests/Test Helpers/ADMockingHelpers.h:
--------------------------------------------------------------------------------
1 | //
2 | // ADMockingHelpers.h
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 6/14/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface ADMockingHelpers : NSObject
13 |
14 | + (void)unmockForClass:(Class)cl;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/ADAppRaterTests/Test Helpers/ADMockingHelpers.m:
--------------------------------------------------------------------------------
1 | //
2 | // ADMockingHelpers.m
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 6/14/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import "ADMockingHelpers.h"
10 |
11 | @implementation ADMockingHelpers
12 |
13 | + (void)unmockForClass:(Class)cl
14 | {
15 | id dummyMock = OCMClassMock(cl);
16 | [dummyMock stopMocking];
17 | }
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/ADAppRaterTests/Test Helpers/ADTestCase.h:
--------------------------------------------------------------------------------
1 | //
2 | // ADTestCase.h
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 6/16/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 | #import
13 |
14 | #import "ADMockingHelpers.h"
15 |
16 | @interface ADTestCase : XCTestCase
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/ADAppRaterTests/Test Helpers/ADTestCase.m:
--------------------------------------------------------------------------------
1 | //
2 | // ADTestCase.m
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 6/16/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import "ADTestCase.h"
10 |
11 | @implementation ADTestCase
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Assets/AppsUsing/acad_128x128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/ADAppRater-iOS/088c8c7d76040e82ee4925712c99ec1a0b638548/Assets/AppsUsing/acad_128x128.png
--------------------------------------------------------------------------------
/Assets/Icons/icon120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/ADAppRater-iOS/088c8c7d76040e82ee4925712c99ec1a0b638548/Assets/Icons/icon120.png
--------------------------------------------------------------------------------
/Assets/Icons/icon180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/ADAppRater-iOS/088c8c7d76040e82ee4925712c99ec1a0b638548/Assets/Icons/icon180.png
--------------------------------------------------------------------------------
/Assets/Icons/icon80.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/ADAppRater-iOS/088c8c7d76040e82ee4925712c99ec1a0b638548/Assets/Icons/icon80.png
--------------------------------------------------------------------------------
/Assets/Screenshots/Screenshot1_Satisfaction.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/ADAppRater-iOS/088c8c7d76040e82ee4925712c99ec1a0b638548/Assets/Screenshots/Screenshot1_Satisfaction.png
--------------------------------------------------------------------------------
/Assets/Screenshots/Screenshot2_Rate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/ADAppRater-iOS/088c8c7d76040e82ee4925712c99ec1a0b638548/Assets/Screenshots/Screenshot2_Rate.png
--------------------------------------------------------------------------------
/Assets/Screenshots/Screenshot3_Feedback.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/ADAppRater-iOS/088c8c7d76040e82ee4925712c99ec1a0b638548/Assets/Screenshots/Screenshot3_Feedback.png
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # ADAppRater-iOS Release Notes
2 |
3 | ##### Version 1.1.3
4 | _Released on November 22, 2017_
5 | * Issue #29: AppStore Connector: Lookup app id regardless to user's locale country
6 | * Issue #30: AppStore Connector: Use unified AppStore URL to rate apps
7 | * Added `useOldApiFlow` method to keep old flows (in case new APIs break functionality)
8 |
9 | ##### Version 1.1.2
10 | _Released on November 14, 2017_
11 | * PR #27: Add ability for direct route to AppStore
12 | * Issue #28: EXC_BAD_ACCESS crash when canceling email
13 | * Issue #29: Doesn't work in some countries
14 |
15 | ##### Version 1.1.1
16 | _Released on October 26, 2017_
17 | * PR #26: Fixed App Store link for iOS 11
18 |
19 | ##### Version 1.1.0
20 | _Released on March 28, 2017_
21 | * Now supporting iOS 8 and newer. (For older iOS versions, use version 1.0.9)
22 | * Add translations for German, Spanish, French, Italian, Portuguese, Japanese, Korean, Chinese
23 | * PR #23: Fix issue - setting a nil title the alert message
24 | * PR #24: Updated App Review URL - Directly open the "Write Review" screen
25 |
26 | ##### Version 1.0.9
27 | _Released on May 30, 2016_
28 | * Issue #18: Add option to re-prompt users to rate the app after a certain period, by invalidating their previous response
29 | * Issue #20: Crashes on first version when setting promptForNewVersionIfUserRated to `YES`
30 | * Improve documentation
31 | * Improve unit testing to cover missing scenarios
32 |
33 | ##### Version 1.0.8
34 | _Released on March 31, 2016_
35 | * PR #17: Add a Russian translation for default texts
36 |
37 | ##### Version 1.0.7
38 | _Released on March 30, 2016_
39 | * Issue #12: Add a localization bundle to component
40 |
41 | ##### Version 1.0.6
42 | _Merged into 1.0.7_
43 | * New API: `[ADAppRater appRaterVersion]`
44 | * iOS 7: Fix bug of broken flow
45 | * Code refactor
46 |
47 | ##### Version 1.0.5
48 | _Released on March 22, 2016_
49 | * PR #15: Handle case where the view controller has no navigation controller
50 |
51 | ##### Version 1.0.4
52 | _Released on February 26, 2016_
53 | * Request: Do not reset event history if not supposed to ask again every version
54 | * ATS: Use HTTPS for querying the App Store
55 |
56 | ##### Version 1.0.3
57 | _Released on September 22, 2015_
58 | * Request: Never show more then once per X days
59 | * Added `limitPromptFrequency` property to AppRater configuration, to define number of days
60 | * Added `userLastPromptedToRate` property to AppRater to return last time user was prompted
61 | * Replaced `currentVersionLastReminded` property with `userLastRemindedToRate`.
62 | * Reminder is no longer related to specific version.
63 | * Before: If a user asks to be reminded, but during the reminder period - the version was updated and usage reset, user would not be prompted again until he re-reached minimum usage.
64 | * Now: If a user asks to be reminded, but during the reminder period - the version was updated and usage reset, user will be reminded anyway, disregarding minimum usage.
65 |
66 | ##### Version 1.0.2
67 | _Released on September 10, 2015_
68 | * Fixed bug related to localizing strings
69 |
70 | ##### Version 1.0.1
71 | _Released on August 31, 2015_
72 | * Add Travis-CI
73 | * Nicer Cocoa pod Description
74 |
75 | ##### Version 1.0.0
76 | _Released on August 23, 2015_
77 | * Initial release.
78 |
--------------------------------------------------------------------------------
/Contributing.md:
--------------------------------------------------------------------------------
1 | ## How To Contribute
2 | 1. Fork the repository
3 | 2. Create your feature branch
4 | 3. Commit and push your work to the feature branch
5 | 4. Create a new Pull Request
6 |
7 |
8 | ## Guidelines
9 | * Please make sure to follow existing conventions and style in order to keep the code as readable as possible.
10 | * Please make sure your changes did not break the unit tests (Text in Xcode with Command + U / Product -> Test)
11 | * Please make sure to comment your changes
12 | * Please make sure to document public API's for other users to understand their purpose
13 | * Please make sure to update the readme file too if needed.
14 | * Try to add unit tests for your changes as well
15 |
16 |
17 | Before your code can be accepted into the project you must also sign the Contributor License Agreement (CLA).
18 | Please contact Amir Shavit for a copy of the CLA.
19 |
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 8/3/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 8/3/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | @interface AppDelegate ()
12 |
13 | @end
14 |
15 | @implementation AppDelegate
16 |
17 |
18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
19 | // Override point for customization after application launch.
20 | return YES;
21 | }
22 |
23 | - (void)applicationWillResignActive:(UIApplication *)application {
24 | // 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.
25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
26 | }
27 |
28 | - (void)applicationDidEnterBackground:(UIApplication *)application {
29 | // 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.
30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
31 | }
32 |
33 | - (void)applicationWillEnterForeground:(UIApplication *)application {
34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
35 | }
36 |
37 | - (void)applicationDidBecomeActive:(UIApplication *)application {
38 | // 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.
39 | }
40 |
41 | - (void)applicationWillTerminate:(UIApplication *)application {
42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
43 | }
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/Images.xcassets/AppIcon.appiconset/120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/ADAppRater-iOS/088c8c7d76040e82ee4925712c99ec1a0b638548/Examples/ADAppRater Demo/ADAppRater Demo/Images.xcassets/AppIcon.appiconset/120.png
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/Images.xcassets/AppIcon.appiconset/152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/ADAppRater-iOS/088c8c7d76040e82ee4925712c99ec1a0b638548/Examples/ADAppRater Demo/ADAppRater Demo/Images.xcassets/AppIcon.appiconset/152.png
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/Images.xcassets/AppIcon.appiconset/167.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/ADAppRater-iOS/088c8c7d76040e82ee4925712c99ec1a0b638548/Examples/ADAppRater Demo/ADAppRater Demo/Images.xcassets/AppIcon.appiconset/167.png
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/Images.xcassets/AppIcon.appiconset/180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/ADAppRater-iOS/088c8c7d76040e82ee4925712c99ec1a0b638548/Examples/ADAppRater Demo/ADAppRater Demo/Images.xcassets/AppIcon.appiconset/180.png
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/Images.xcassets/AppIcon.appiconset/76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Autodesk/ADAppRater-iOS/088c8c7d76040e82ee4925712c99ec1a0b638548/Examples/ADAppRater Demo/ADAppRater Demo/Images.xcassets/AppIcon.appiconset/76.png
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "size" : "60x60",
25 | "idiom" : "iphone",
26 | "filename" : "120.png",
27 | "scale" : "2x"
28 | },
29 | {
30 | "size" : "60x60",
31 | "idiom" : "iphone",
32 | "filename" : "180.png",
33 | "scale" : "3x"
34 | },
35 | {
36 | "idiom" : "ipad",
37 | "size" : "29x29",
38 | "scale" : "1x"
39 | },
40 | {
41 | "idiom" : "ipad",
42 | "size" : "29x29",
43 | "scale" : "2x"
44 | },
45 | {
46 | "idiom" : "ipad",
47 | "size" : "40x40",
48 | "scale" : "1x"
49 | },
50 | {
51 | "idiom" : "ipad",
52 | "size" : "40x40",
53 | "scale" : "2x"
54 | },
55 | {
56 | "size" : "76x76",
57 | "idiom" : "ipad",
58 | "filename" : "76.png",
59 | "scale" : "1x"
60 | },
61 | {
62 | "size" : "76x76",
63 | "idiom" : "ipad",
64 | "filename" : "152.png",
65 | "scale" : "2x"
66 | },
67 | {
68 | "size" : "83.5x83.5",
69 | "idiom" : "ipad",
70 | "filename" : "167.png",
71 | "scale" : "2x"
72 | }
73 | ],
74 | "info" : {
75 | "version" : 1,
76 | "author" : "xcode"
77 | }
78 | }
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/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.1.3
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/View Controllers/ADBasicFlowViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ADBasicFlowViewController.h
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 6/10/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface ADBasicFlowViewController : UIViewController
13 |
14 | - (IBAction)pressedStartFlowButton:(UIButton *)sender;
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/View Controllers/ADBasicFlowViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ADBasicFlowViewController.m
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 6/10/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import "ADBasicFlowViewController.h"
10 |
11 | @implementation ADBasicFlowViewController
12 |
13 | - (void)viewDidLoad
14 | {
15 | [super viewDidLoad];
16 |
17 | // Do any additional setup after loading the view, typically from a nib.
18 | [ADAppRater sharedInstance].enableLog = YES;
19 |
20 | // Insert your domain here to play with the demo:
21 | [ADAppRater sharedInstance].applicationBundleID = @"com.autodesk.autocadws";
22 | }
23 |
24 | - (void)didReceiveMemoryWarning
25 | {
26 | [super didReceiveMemoryWarning];
27 | // Dispose of any resources that can be recreated.
28 | }
29 |
30 | - (IBAction)pressedStartFlowButton:(UIButton *)sender
31 | {
32 | NSLog(@"pressedStartFlowButton");
33 |
34 | [[ADAppRater sharedInstance] startRaterFlowFromViewController:self];
35 | }
36 |
37 | - (IBAction)pressedStartFlowCriteriaCheck:(UIButton *)sender
38 | {
39 | NSLog(@"pressedStartFlowCriteriaCheck");
40 | [ADAppRater sharedInstance].currentVersionDaysUntilPrompt = 0;
41 | [ADAppRater sharedInstance].currentVersionLaunchesUntilPrompt = 0;
42 | [[ADAppRater sharedInstance] startRaterFlowIfCriteriaMetFromViewController:self];
43 | }
44 |
45 | - (IBAction)pressedResetRatingHistory:(UIButton *)sender
46 | {
47 | #ifdef DEBUG
48 | [[ADAppRater sharedInstance] resetUsageHistory];
49 | #else
50 | NSLog(@"Reset function is not available outside DEBUG mode");
51 | #endif
52 | }
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/View Controllers/ADCustomFlowViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ADCustomFlowViewController.h
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 6/11/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface ADCustomFlowViewController : UIViewController
13 |
14 | - (IBAction)pressedStartFlowButton:(UIButton *)sender;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/View Controllers/ADLocalizedTextViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ADLocalizedTextViewController.h
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 9/10/15.
6 | // Copyright © 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface ADLocalizedTextViewController : UIViewController
13 |
14 | - (IBAction)pressedStartFlowButton:(UIButton *)sender;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/View Controllers/ADLocalizedTextViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ADLocalizedTextViewController.m
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 9/10/15.
6 | // Copyright © 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import "ADLocalizedTextViewController.h"
10 |
11 | @implementation ADLocalizedTextViewController
12 |
13 | - (void)viewDidLoad
14 | {
15 | [super viewDidLoad];
16 |
17 | // Do any additional setup after loading the view, typically from a nib.
18 | [ADAppRater sharedInstance].enableLog = YES;
19 |
20 | // Insert your domain here to play with the demo:
21 | [ADAppRater sharedInstance].applicationBundleID = @"com.autodesk.autocadws";
22 |
23 | [self localizeAppRaterStrings];
24 | }
25 |
26 | - (void)didReceiveMemoryWarning
27 | {
28 | [super didReceiveMemoryWarning];
29 | // Dispose of any resources that can be recreated.
30 | }
31 |
32 | - (void)localizeAppRaterStrings
33 | {
34 | ADAppRaterTexts* raterStrings = [ADAppRater sharedInstance].localStrings;
35 |
36 | raterStrings.userSatisfactionAlertTitle = @"Add a localized title here";
37 | raterStrings.userSatisfactionAlertMessage = @"Localize asking the user if he likes the app";
38 | raterStrings.userSatisfactionAlertAnswerYes = @"Local Yes";
39 | raterStrings.userSatisfactionAlertAnswerNo = @"Local No";
40 |
41 | // You can also localize the rest of the strings all or some of them
42 |
43 | // raterStrings.appRatingAlertTitlel
44 | // raterStrings.appRatingAlertMessage;
45 | // raterStrings.appRatingAlertAnswerRate;
46 | // raterStrings.appRatingAlertAnswerRemindMe;
47 | // raterStrings.appRatingAlertAnswerDontRate;
48 |
49 | // raterStrings.userFeedbackAlertTitle;
50 | // raterStrings.userFeedbackAlertMessage;
51 | // raterStrings.userFeedbackAlertAnswerYes;
52 | // raterStrings.userFeedbackAlertAnswerNo;
53 |
54 | // raterStrings.thankUserAlertTitle;
55 | // raterStrings.thankUserAlertMessage;
56 | // raterStrings.thankUserAlertDismiss;
57 |
58 | // raterStrings.feedbackFormRecipient;
59 | // raterStrings.feedbackFormSubject;
60 | // raterStrings.feedbackFormBody;
61 | }
62 |
63 | - (IBAction)pressedStartFlowButton:(UIButton *)sender
64 | {
65 | NSLog(@"pressedStartFlowButton");
66 |
67 | [[ADAppRater sharedInstance] startRaterFlowFromViewController:self];
68 | }
69 |
70 | - (IBAction)pressedResetRatingHistory:(UIButton *)sender
71 | {
72 | #ifdef DEBUG
73 | [[ADAppRater sharedInstance] resetUsageHistory];
74 | #else
75 | NSLog(@"Reset function is not available outside DEBUG mode");
76 | #endif
77 | }
78 |
79 | @end
80 |
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/View Controllers/ADScenariosFlowViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ADScenariosFlowViewController.h
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 6/17/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface ADScenariosFlowViewController : UIViewController
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/View Controllers/ADScenariosFlowViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ADScenariosFlowViewController.m
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 6/17/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import "ADScenariosFlowViewController.h"
10 |
11 | @interface ADScenariosFlowViewController ()
12 |
13 | @property (weak, nonatomic) IBOutlet UILabel *lblEventATitle;
14 | @property (weak, nonatomic) IBOutlet UIButton *btnAddEventA;
15 | @property (weak, nonatomic) IBOutlet UILabel *lblEventACount;
16 |
17 | @property (weak, nonatomic) IBOutlet UILabel *lblEventBTitle;
18 | @property (weak, nonatomic) IBOutlet UIButton *btnAddEventB;
19 | @property (weak, nonatomic) IBOutlet UILabel *lblEventBCount;
20 |
21 | @property (weak, nonatomic) IBOutlet UILabel *lblEventCTitle;
22 | @property (weak, nonatomic) IBOutlet UIButton *btnAddEventC;
23 | @property (weak, nonatomic) IBOutlet UILabel *lblEventCCount;
24 |
25 | @end
26 |
27 | @implementation ADScenariosFlowViewController
28 |
29 | - (void)viewDidLoad
30 | {
31 | [super viewDidLoad];
32 |
33 | // Do any additional setup after loading the view.
34 | [ADAppRater sharedInstance].enableLog = YES;
35 |
36 | // Insert your domain here to play with the demo:
37 | [ADAppRater sharedInstance].applicationBundleID = @"com.autodesk.autocadws";
38 |
39 | // Disable minimum days and sessions conditions
40 | [ADAppRater sharedInstance].currentVersionDaysUntilPrompt = 0;
41 | [ADAppRater sharedInstance].currentVersionLaunchesUntilPrompt = 0;
42 |
43 | // Define some scenarios to complete in order to prompt user rate:
44 | // First Scenario: 3 events of Type A
45 | ADEventCriteria* criteria1_3 = [[ADEventCriteria alloc] initWithEventName:self.lblEventATitle.text eventCount:3];
46 | ADEventScenario* scenario1 = [[ADEventScenario alloc] initWithEventCriterias:@[criteria1_3]];
47 |
48 | // Second Scenario: 3 events of Type B
49 | ADEventCriteria* criteria2_3 = [[ADEventCriteria alloc] initWithEventName:self.lblEventBTitle.text eventCount:3];
50 | ADEventScenario* scenario2 = [[ADEventScenario alloc] initWithEventCriterias:@[criteria2_3]];
51 |
52 | // Third Scenario: 3 events of Type C
53 | ADEventCriteria* criteria3_3 = [[ADEventCriteria alloc] initWithEventName:self.lblEventCTitle.text eventCount:3];
54 | ADEventScenario* scenario3 = [[ADEventScenario alloc] initWithEventCriterias:@[criteria3_3]];
55 |
56 | // Fourth Scenario: 1 event of each of the types
57 | ADEventCriteria* criteria1_1 = [[ADEventCriteria alloc] initWithEventName:self.lblEventATitle.text eventCount:1];
58 | ADEventCriteria* criteria2_1 = [[ADEventCriteria alloc] initWithEventName:self.lblEventBTitle.text eventCount:1];
59 | ADEventCriteria* criteria3_1 = [[ADEventCriteria alloc] initWithEventName:self.lblEventCTitle.text eventCount:1];
60 | ADEventScenario* scenario4 = [[ADEventScenario alloc] initWithEventCriterias:@[criteria1_1, criteria2_1, criteria3_1]];
61 |
62 | [ADAppRater sharedInstance].eventScenariosUntilPrompt = @[scenario1, scenario2, scenario3, scenario4];
63 |
64 | [self resetEvents:nil];
65 | }
66 |
67 | - (void)didReceiveMemoryWarning
68 | {
69 | [super didReceiveMemoryWarning];
70 | // Dispose of any resources that can be recreated.
71 | }
72 |
73 | - (IBAction)pressedAddEventButton:(UIButton *)sender
74 | {
75 | UILabel* eventCounter;
76 | NSString* eventName;
77 | if (sender == self.btnAddEventA)
78 | {
79 | eventCounter = self.lblEventACount;
80 | eventName = self.lblEventATitle.text;
81 | }
82 | else if (sender == self.btnAddEventB)
83 | {
84 | eventCounter = self.lblEventBCount;
85 | eventName = self.lblEventBTitle.text;
86 | }
87 | else if (sender == self.btnAddEventC)
88 | {
89 | eventCounter = self.lblEventCCount;
90 | eventName = self.lblEventCTitle.text;
91 | }
92 |
93 | [self incrementCounter:eventCounter];
94 | [[ADAppRater sharedInstance] registerEvent:eventName
95 | withViewController:self];
96 | }
97 |
98 | - (IBAction)resetEvents:(UIButton*)sender
99 | {
100 | self.lblEventACount.text = @"0";
101 | self.lblEventBCount.text = @"0";
102 | self.lblEventCCount.text = @"0";
103 |
104 | #ifdef DEBUG
105 | [[ADAppRater sharedInstance] resetUsageHistory];
106 | #else
107 | NSLog(@"Reset function is not available outside DEBUG mode");
108 | #endif
109 | }
110 |
111 | - (void)incrementCounter:(UILabel*)counter
112 | {
113 | NSInteger count = counter.text.integerValue;
114 | counter.text = [NSString stringWithFormat:@"%d", (int)(count+1)];
115 | }
116 |
117 | #pragma mark - Flow
118 |
119 | - (IBAction)unwindToScenariosFlowViewController:(UIStoryboardSegue *)segue
120 | {
121 | //nothing goes here
122 | }
123 |
124 | @end
125 |
--------------------------------------------------------------------------------
/Examples/ADAppRater Demo/ADAppRater Demo/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // ADAppRater Demo
4 | //
5 | // Created by Amir Shavit on 8/3/15.
6 | // Copyright (c) 2015 Autodesk. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/LICENCE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Autodesk Inc. http://www.autodesk.com
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 |
--------------------------------------------------------------------------------
/Podfile:
--------------------------------------------------------------------------------
1 | source 'https://github.com/CocoaPods/Specs.git'
2 | use_frameworks!
3 |
4 | platform :ios, '8.0'
5 | inhibit_all_warnings!
6 |
7 | target 'ADAppRater' do
8 |
9 | target 'ADAppRaterTests' do
10 | inherit! :search_paths
11 | pod 'OCMock', '3.2.2'
12 | end
13 |
14 | end
15 |
--------------------------------------------------------------------------------
/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - OCMock (3.2.2)
3 |
4 | DEPENDENCIES:
5 | - OCMock (= 3.2.2)
6 |
7 | SPEC CHECKSUMS:
8 | OCMock: 18c9b7e67d4c2770e95bb77a9cc1ae0c91fe3835
9 |
10 | PODFILE CHECKSUM: 44b0abb7b743a4efde320df819406d5d023cc894
11 |
12 | COCOAPODS: 1.2.1
13 |
--------------------------------------------------------------------------------
/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - OCMock (3.2.2)
3 |
4 | DEPENDENCIES:
5 | - OCMock (= 3.2.2)
6 |
7 | SPEC CHECKSUMS:
8 | OCMock: 18c9b7e67d4c2770e95bb77a9cc1ae0c91fe3835
9 |
10 | PODFILE CHECKSUM: 44b0abb7b743a4efde320df819406d5d023cc894
11 |
12 | COCOAPODS: 1.2.1
13 |
--------------------------------------------------------------------------------
/Pods/OCMock/README.md:
--------------------------------------------------------------------------------
1 | OCMock
2 | ======
3 |
4 | OCMock is an Objective-C implementation of mock objects.
5 |
6 | For downloads, documentation, and support please visit [ocmock.org][].
7 |
8 | [](https://travis-ci.org/erikdoe/ocmock)
9 |
10 | [ocmock.org]: http://ocmock.org/
11 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/NSInvocation+OCMAdditions.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @interface NSInvocation(OCMAdditions)
20 |
21 | + (NSInvocation *)invocationForBlock:(id)block withArguments:(NSArray *)arguments;
22 |
23 | - (BOOL)hasCharPointerArgument;
24 |
25 | - (id)getArgumentAtIndexAsObject:(NSInteger)argIndex;
26 |
27 | - (NSString *)invocationDescription;
28 |
29 | - (NSString *)argumentDescriptionAtIndex:(NSInteger)argIndex;
30 |
31 | - (NSString *)objectDescriptionAtIndex:(NSInteger)anInt;
32 | - (NSString *)charDescriptionAtIndex:(NSInteger)anInt;
33 | - (NSString *)unsignedCharDescriptionAtIndex:(NSInteger)anInt;
34 | - (NSString *)intDescriptionAtIndex:(NSInteger)anInt;
35 | - (NSString *)unsignedIntDescriptionAtIndex:(NSInteger)anInt;
36 | - (NSString *)shortDescriptionAtIndex:(NSInteger)anInt;
37 | - (NSString *)unsignedShortDescriptionAtIndex:(NSInteger)anInt;
38 | - (NSString *)longDescriptionAtIndex:(NSInteger)anInt;
39 | - (NSString *)unsignedLongDescriptionAtIndex:(NSInteger)anInt;
40 | - (NSString *)longLongDescriptionAtIndex:(NSInteger)anInt;
41 | - (NSString *)unsignedLongLongDescriptionAtIndex:(NSInteger)anInt;
42 | - (NSString *)doubleDescriptionAtIndex:(NSInteger)anInt;
43 | - (NSString *)floatDescriptionAtIndex:(NSInteger)anInt;
44 | - (NSString *)structDescriptionAtIndex:(NSInteger)anInt;
45 | - (NSString *)pointerDescriptionAtIndex:(NSInteger)anInt;
46 | - (NSString *)cStringDescriptionAtIndex:(NSInteger)anInt;
47 | - (NSString *)selectorDescriptionAtIndex:(NSInteger)anInt;
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/NSMethodSignature+OCMAdditions.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @interface NSMethodSignature(OCMAdditions)
20 |
21 | + (NSMethodSignature *)signatureForDynamicPropertyAccessedWithSelector:(SEL)selector inClass:(Class)aClass;
22 | + (NSMethodSignature *)signatureForBlock:(id)block;
23 |
24 | - (BOOL)usesSpecialStructureReturn;
25 |
26 | - (NSString *)fullTypeString;
27 | - (const char *)fullObjCTypes;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/NSNotificationCenter+OCMAdditions.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @class OCObserverMockObject;
20 |
21 |
22 | @interface NSNotificationCenter(OCMAdditions)
23 |
24 | - (void)addMockObserver:(OCObserverMockObject *)notificationObserver name:(NSString *)notificationName object:(id)notificationSender;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/NSNotificationCenter+OCMAdditions.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "NSNotificationCenter+OCMAdditions.h"
18 | #import "OCObserverMockObject.h"
19 |
20 |
21 | @implementation NSNotificationCenter(OCMAdditions)
22 |
23 | - (void)addMockObserver:(OCObserverMockObject *)notificationObserver name:(NSString *)notificationName object:(id)notificationSender
24 | {
25 | [notificationObserver autoRemoveFromCenter:self];
26 | [self addObserver:notificationObserver selector:@selector(handleNotification:) name:notificationName object:notificationSender];
27 | }
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/NSObject+OCMAdditions.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @interface NSObject(OCMAdditions)
20 |
21 | + (IMP)instanceMethodForwarderForSelector:(SEL)aSelector;
22 | + (void)enumerateMethodsInClass:(Class)aClass usingBlock:(void (^)(Class cls, SEL sel))aBlock;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/NSObject+OCMAdditions.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "NSObject+OCMAdditions.h"
18 | #import "NSMethodSignature+OCMAdditions.h"
19 | #import
20 |
21 | @implementation NSObject(OCMAdditions)
22 |
23 | + (IMP)instanceMethodForwarderForSelector:(SEL)aSelector
24 | {
25 | // use sel_registerName() and not @selector to avoid warning
26 | SEL selectorWithNoImplementation = sel_registerName("methodWhichMustNotExist::::");
27 |
28 | #ifndef __arm64__
29 | static NSMutableDictionary *_OCMReturnTypeCache;
30 |
31 | if(_OCMReturnTypeCache == nil)
32 | _OCMReturnTypeCache = [[NSMutableDictionary alloc] init];
33 |
34 | BOOL needsStructureReturn;
35 | void *rawCacheKey[2] = { (void *)self, aSelector };
36 | NSData *cacheKey = [NSData dataWithBytes:rawCacheKey length:sizeof(rawCacheKey)];
37 | NSNumber *cachedValue = [_OCMReturnTypeCache objectForKey:cacheKey];
38 |
39 | if(cachedValue == nil)
40 | {
41 | NSMethodSignature *sig = [self instanceMethodSignatureForSelector:aSelector];
42 | needsStructureReturn = [sig usesSpecialStructureReturn];
43 | [_OCMReturnTypeCache setObject:@(needsStructureReturn) forKey:cacheKey];
44 | }
45 | else
46 | {
47 | needsStructureReturn = [cachedValue boolValue];
48 | }
49 |
50 | if(needsStructureReturn)
51 | return class_getMethodImplementation_stret([NSObject class], selectorWithNoImplementation);
52 | #endif
53 |
54 | return class_getMethodImplementation([NSObject class], selectorWithNoImplementation);
55 | }
56 |
57 |
58 | + (void)enumerateMethodsInClass:(Class)aClass usingBlock:(void (^)(Class cls, SEL sel))aBlock
59 | {
60 | for(Class cls = aClass; cls != nil; cls = class_getSuperclass(cls))
61 | {
62 | Method *methodList = class_copyMethodList(cls, NULL);
63 | if(methodList == NULL)
64 | continue;
65 |
66 | for(Method *mPtr = methodList; *mPtr != NULL; mPtr++)
67 | {
68 | SEL sel = method_getName(*mPtr);
69 | aBlock(cls, sel);
70 | }
71 | free(methodList);
72 | }
73 | }
74 |
75 |
76 | @end
77 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/NSValue+OCMAdditions.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @interface NSValue(OCMAdditions)
20 |
21 | - (BOOL)getBytes:(void *)outputBuf objCType:(const char *)targetType;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/NSValue+OCMAdditions.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "NSValue+OCMAdditions.h"
18 | #import "OCMFunctionsPrivate.h"
19 |
20 | @implementation NSValue(OCMAdditions)
21 |
22 | static NSNumber *OCMNumberForValue(NSValue *value)
23 | {
24 | #define CREATE_NUM(_type) ({ _type _v; [value getValue:&_v]; @(_v); })
25 | switch([value objCType][0])
26 | {
27 | case 'c': return CREATE_NUM(char);
28 | case 'C': return CREATE_NUM(unsigned char);
29 | case 'B': return CREATE_NUM(bool);
30 | case 's': return CREATE_NUM(short);
31 | case 'S': return CREATE_NUM(unsigned short);
32 | case 'i': return CREATE_NUM(int);
33 | case 'I': return CREATE_NUM(unsigned int);
34 | case 'l': return CREATE_NUM(long);
35 | case 'L': return CREATE_NUM(unsigned long);
36 | case 'q': return CREATE_NUM(long long);
37 | case 'Q': return CREATE_NUM(unsigned long long);
38 | case 'f': return CREATE_NUM(float);
39 | case 'd': return CREATE_NUM(double);
40 | default: return nil;
41 | }
42 | }
43 |
44 |
45 | - (BOOL)getBytes:(void *)outputBuf objCType:(const char *)targetType
46 | {
47 | /*
48 | * See if they are similar number types, and if we can convert losslessly between them.
49 | * For the most part, we set things up to use CFNumberGetValue, which returns false if
50 | * conversion will be lossy.
51 | */
52 | CFNumberType inputType = OCMNumberTypeForObjCType([self objCType]);
53 | CFNumberType outputType = OCMNumberTypeForObjCType(targetType);
54 |
55 | if(inputType == 0 || outputType == 0) // one or both are non-number types
56 | return NO;
57 |
58 | NSNumber *inputNumber = [self isKindOfClass:[NSNumber class]] ? (NSNumber *)self : OCMNumberForValue(self);
59 |
60 | /*
61 | * Due to some legacy, back-compatible requirements in CFNumber.c, CFNumberGetValue can return true for
62 | * some conversions which should not be allowed (by reading source, conversions from integer types to
63 | * 8-bit or 16-bit integer types). So, check ourselves.
64 | */
65 | long long min;
66 | long long max;
67 | long long val = [inputNumber longLongValue];
68 | switch(targetType[0])
69 | {
70 | case 'B':
71 | case 'c': min = CHAR_MIN; max = CHAR_MAX; break;
72 | case 'C': min = 0; max = UCHAR_MAX; break;
73 | case 's': min = SHRT_MIN; max = SHRT_MAX; break;
74 | case 'S': min = 0; max = USHRT_MAX; break;
75 | default: min = LLONG_MIN; max = LLONG_MAX; break;
76 | }
77 | if(val < min || val > max)
78 | return NO;
79 |
80 | /* Get the number, and return NO if the value was out of range or conversion was lossy */
81 | return CFNumberGetValue((CFNumberRef)inputNumber, outputType, outputBuf);
82 | }
83 |
84 |
85 | @end
86 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCClassMockObject.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @interface OCClassMockObject : OCMockObject
20 | {
21 | Class mockedClass;
22 | Class originalMetaClass;
23 | }
24 |
25 | - (id)initWithClass:(Class)aClass;
26 |
27 | - (Class)mockedClass;
28 | - (Class)mockObjectClass; // since -class returns the mockedClass
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMArg.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @interface OCMArg : NSObject
20 |
21 | // constraining arguments
22 |
23 | + (id)any;
24 | + (SEL)anySelector;
25 | + (void *)anyPointer;
26 | + (id __autoreleasing *)anyObjectRef;
27 | + (id)isNil;
28 | + (id)isNotNil;
29 | + (id)isEqual:(id)value;
30 | + (id)isNotEqual:(id)value;
31 | + (id)isKindOfClass:(Class)cls;
32 | + (id)checkWithSelector:(SEL)selector onObject:(id)anObject;
33 | + (id)checkWithBlock:(BOOL (^)(id obj))block;
34 |
35 | // manipulating arguments
36 |
37 | + (id *)setTo:(id)value;
38 | + (void *)setToValue:(NSValue *)value;
39 | + (id)invokeBlock;
40 | + (id)invokeBlockWithArgs:(id)first,... NS_REQUIRES_NIL_TERMINATION;
41 |
42 | + (id)defaultValue;
43 |
44 | // internal use only
45 |
46 | + (id)resolveSpecialValues:(NSValue *)value;
47 |
48 | @end
49 |
50 | #define OCMOCK_ANY [OCMArg any]
51 |
52 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
53 | #define OCMOCK_VALUE(variable) \
54 | ({ __typeof__(variable) __v = (variable); [NSValue value:&__v withObjCType:@encode(__typeof__(__v))]; })
55 | #else
56 | #define OCMOCK_VALUE(variable) [NSValue value:&variable withObjCType:@encode(__typeof__(variable))]
57 | #endif
58 |
59 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMArg.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 | #import
19 | #import
20 | #import "OCMPassByRefSetter.h"
21 | #import "OCMBlockArgCaller.h"
22 |
23 | @implementation OCMArg
24 |
25 | + (id)any
26 | {
27 | return [OCMAnyConstraint constraint];
28 | }
29 |
30 | + (void *)anyPointer
31 | {
32 | return (void *)0x01234567;
33 | }
34 |
35 | + (id __autoreleasing *)anyObjectRef
36 | {
37 | return (id *)0x01234567;
38 | }
39 |
40 | + (SEL)anySelector
41 | {
42 | return NSSelectorFromString(@"aSelectorThatMatchesAnySelector");
43 | }
44 |
45 | + (id)isNil
46 | {
47 | return [OCMIsNilConstraint constraint];
48 | }
49 |
50 | + (id)isNotNil
51 | {
52 | return [OCMIsNotNilConstraint constraint];
53 | }
54 |
55 | + (id)isEqual:(id)value
56 | {
57 | return value;
58 | }
59 |
60 | + (id)isNotEqual:(id)value
61 | {
62 | OCMIsNotEqualConstraint *constraint = [OCMIsNotEqualConstraint constraint];
63 | constraint->testValue = value;
64 | return constraint;
65 | }
66 |
67 | + (id)isKindOfClass:(Class)cls
68 | {
69 | return [[[OCMBlockConstraint alloc] initWithConstraintBlock:^BOOL(id obj) {
70 | return [obj isKindOfClass:cls];
71 | }] autorelease];
72 | }
73 |
74 | + (id)checkWithSelector:(SEL)selector onObject:(id)anObject
75 | {
76 | return [OCMConstraint constraintWithSelector:selector onObject:anObject];
77 | }
78 |
79 | + (id)checkWithBlock:(BOOL (^)(id))block
80 | {
81 | return [[[OCMBlockConstraint alloc] initWithConstraintBlock:block] autorelease];
82 | }
83 |
84 | + (id *)setTo:(id)value
85 | {
86 | return (id *)[[[OCMPassByRefSetter alloc] initWithValue:value] autorelease];
87 | }
88 |
89 | + (void *)setToValue:(NSValue *)value
90 | {
91 | return (id *)[[[OCMPassByRefSetter alloc] initWithValue:value] autorelease];
92 | }
93 |
94 | + (id)invokeBlock
95 | {
96 | return [[[OCMBlockArgCaller alloc] init] autorelease];
97 | }
98 |
99 | + (id)invokeBlockWithArgs:(id)first,... NS_REQUIRES_NIL_TERMINATION
100 | {
101 |
102 | NSMutableArray *params = [NSMutableArray array];
103 | va_list args;
104 | if(first)
105 | {
106 | [params addObject:first];
107 | va_start(args, first);
108 | id obj;
109 | while((obj = va_arg(args, id)))
110 | {
111 | [params addObject:obj];
112 | }
113 | va_end(args);
114 | }
115 | return [[[OCMBlockArgCaller alloc] initWithBlockArguments:params] autorelease];
116 |
117 | }
118 |
119 | + (id)defaultValue
120 | {
121 | return [NSNull null];
122 | }
123 |
124 |
125 | + (id)resolveSpecialValues:(NSValue *)value
126 | {
127 | const char *type = [value objCType];
128 | if(type[0] == '^')
129 | {
130 | void *pointer = [value pointerValue];
131 | if(pointer == (void *)0x01234567)
132 | return [OCMArg any];
133 | if((pointer != NULL) && (object_getClass((id)pointer) == [OCMPassByRefSetter class]))
134 | return (id)pointer;
135 | }
136 | else if(type[0] == ':')
137 | {
138 | SEL selector;
139 | [value getValue:&selector];
140 | if(selector == NSSelectorFromString(@"aSelectorThatMatchesAnySelector"))
141 | return [OCMArg any];
142 | }
143 | return value;
144 | }
145 |
146 | @end
147 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMArgAction.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @interface OCMArgAction : NSObject
20 |
21 | - (void)handleArgument:(id)argument;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMArgAction.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMArgAction.h"
18 |
19 |
20 | @implementation OCMArgAction
21 |
22 | - (void)handleArgument:(id)argument
23 | {
24 |
25 | }
26 |
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMBlockArgCaller.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMArgAction.h"
18 |
19 | @interface OCMBlockArgCaller : OCMArgAction
20 | {
21 | NSArray *arguments;
22 | }
23 |
24 | - (instancetype)initWithBlockArguments:(NSArray *)someArgs;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMBlockArgCaller.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMBlockArgCaller.h"
18 | #import "NSInvocation+OCMAdditions.h"
19 |
20 |
21 | @implementation OCMBlockArgCaller
22 |
23 | - (instancetype)initWithBlockArguments:(NSArray *)someArgs
24 | {
25 | self = [super init];
26 | if(self)
27 | {
28 | arguments = [someArgs copy];
29 | }
30 | return self;
31 | }
32 |
33 | - (void)dealloc
34 | {
35 | [arguments release];
36 | [super dealloc];
37 | }
38 |
39 | - (id)copyWithZone:(NSZone *)zone
40 | {
41 | return [self retain];
42 | }
43 |
44 | - (void)handleArgument:(id)aBlock
45 | {
46 | if(aBlock)
47 | {
48 | NSInvocation *inv = [NSInvocation invocationForBlock:aBlock withArguments:arguments];
49 | [inv invokeWithTarget:aBlock];
50 | }
51 | }
52 |
53 | @end
54 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMBlockCaller.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2010-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 |
20 | @interface OCMBlockCaller : NSObject
21 | {
22 | void (^block)(NSInvocation *);
23 | }
24 |
25 | - (id)initWithCallBlock:(void (^)(NSInvocation *))theBlock;
26 |
27 | - (void)handleInvocation:(NSInvocation *)anInvocation;
28 |
29 | @end
30 |
31 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMBlockCaller.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2010-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMBlockCaller.h"
18 |
19 |
20 | @implementation OCMBlockCaller
21 |
22 | -(id)initWithCallBlock:(void (^)(NSInvocation *))theBlock
23 | {
24 | if ((self = [super init]))
25 | {
26 | block = [theBlock copy];
27 | }
28 |
29 | return self;
30 | }
31 |
32 | -(void)dealloc
33 | {
34 | [block release];
35 | [super dealloc];
36 | }
37 |
38 | - (void)handleInvocation:(NSInvocation *)anInvocation
39 | {
40 | if (block != nil)
41 | {
42 | block(anInvocation);
43 | }
44 | }
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMBoxedReturnValueProvider.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMReturnValueProvider.h"
18 |
19 | @interface OCMBoxedReturnValueProvider : OCMReturnValueProvider
20 | {
21 | }
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMBoxedReturnValueProvider.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMBoxedReturnValueProvider.h"
18 | #import "OCMFunctionsPrivate.h"
19 | #import "NSValue+OCMAdditions.h"
20 |
21 | @implementation OCMBoxedReturnValueProvider
22 |
23 | - (void)handleInvocation:(NSInvocation *)anInvocation
24 | {
25 | const char *returnType = [[anInvocation methodSignature] methodReturnType];
26 | NSUInteger returnTypeSize = [[anInvocation methodSignature] methodReturnLength];
27 | char valueBuffer[returnTypeSize];
28 | NSValue *returnValueAsNSValue = (NSValue *)returnValue;
29 |
30 | if([self isMethodReturnType:returnType compatibleWithValueType:[returnValueAsNSValue objCType]])
31 | {
32 | [returnValueAsNSValue getValue:valueBuffer];
33 | [anInvocation setReturnValue:valueBuffer];
34 | }
35 | else if([returnValueAsNSValue getBytes:valueBuffer objCType:returnType])
36 | {
37 | [anInvocation setReturnValue:valueBuffer];
38 | }
39 | else
40 | {
41 | [NSException raise:NSInvalidArgumentException
42 | format:@"Return value cannot be used for method; method signature declares '%s' but value is '%s'.", returnType, [returnValueAsNSValue objCType]];
43 | }
44 | }
45 |
46 |
47 | - (BOOL)isMethodReturnType:(const char *)returnType compatibleWithValueType:(const char *)valueType
48 | {
49 | /* Same types are obviously compatible */
50 | if(strcmp(returnType, valueType) == 0)
51 | return YES;
52 |
53 | /* Allow void* for methods that return id, mainly to be able to handle nil */
54 | if(strcmp(returnType, @encode(id)) == 0 && strcmp(valueType, @encode(void *)) == 0)
55 | return YES;
56 |
57 | return OCMEqualTypesAllowingOpaqueStructs(returnType, valueType);
58 | }
59 |
60 |
61 | @end
62 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMConstraint.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2007-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 |
20 | @interface OCMConstraint : NSObject
21 |
22 | + (instancetype)constraint;
23 | - (BOOL)evaluate:(id)value;
24 |
25 | // if you are looking for any, isNil, etc, they have moved to OCMArg
26 |
27 | // try to use [OCMArg checkWith...] instead of the constraintWith... methods below
28 |
29 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject;
30 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue;
31 |
32 |
33 | @end
34 |
35 | @interface OCMAnyConstraint : OCMConstraint
36 | @end
37 |
38 | @interface OCMIsNilConstraint : OCMConstraint
39 | @end
40 |
41 | @interface OCMIsNotNilConstraint : OCMConstraint
42 | @end
43 |
44 | @interface OCMIsNotEqualConstraint : OCMConstraint
45 | {
46 | @public
47 | id testValue;
48 | }
49 |
50 | @end
51 |
52 | @interface OCMInvocationConstraint : OCMConstraint
53 | {
54 | @public
55 | NSInvocation *invocation;
56 | }
57 |
58 | @end
59 |
60 | @interface OCMBlockConstraint : OCMConstraint
61 | {
62 | BOOL (^block)(id);
63 | }
64 |
65 | - (instancetype)initWithConstraintBlock:(BOOL (^)(id))block;
66 |
67 | @end
68 |
69 |
70 | #define CONSTRAINT(aSelector) [OCMConstraint constraintWithSelector:aSelector onObject:self]
71 | #define CONSTRAINTV(aSelector, aValue) [OCMConstraint constraintWithSelector:aSelector onObject:self withValue:(aValue)]
72 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMConstraint.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2007-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 |
20 | @implementation OCMConstraint
21 |
22 | + (instancetype)constraint
23 | {
24 | return [[[self alloc] init] autorelease];
25 | }
26 |
27 | - (BOOL)evaluate:(id)value
28 | {
29 | return NO;
30 | }
31 |
32 | - (id)copyWithZone:(struct _NSZone *)zone
33 | {
34 | return [self retain];
35 | }
36 |
37 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject
38 | {
39 | OCMInvocationConstraint *constraint = [OCMInvocationConstraint constraint];
40 | NSMethodSignature *signature = [anObject methodSignatureForSelector:aSelector];
41 | if(signature == nil)
42 | [NSException raise:NSInvalidArgumentException format:@"Unkown selector %@ used in constraint.", NSStringFromSelector(aSelector)];
43 | NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
44 | [invocation setTarget:anObject];
45 | [invocation setSelector:aSelector];
46 | constraint->invocation = invocation;
47 | return constraint;
48 | }
49 |
50 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue
51 | {
52 | OCMInvocationConstraint *constraint = [self constraintWithSelector:aSelector onObject:anObject];
53 | if([[constraint->invocation methodSignature] numberOfArguments] < 4)
54 | [NSException raise:NSInvalidArgumentException format:@"Constraint with value requires selector with two arguments."];
55 | [constraint->invocation setArgument:&aValue atIndex:3];
56 | return constraint;
57 | }
58 |
59 |
60 | @end
61 |
62 |
63 |
64 | #pragma mark -
65 |
66 | @implementation OCMAnyConstraint
67 |
68 | - (BOOL)evaluate:(id)value
69 | {
70 | return YES;
71 | }
72 |
73 | @end
74 |
75 |
76 |
77 | #pragma mark -
78 |
79 | @implementation OCMIsNilConstraint
80 |
81 | - (BOOL)evaluate:(id)value
82 | {
83 | return value == nil;
84 | }
85 |
86 | @end
87 |
88 |
89 |
90 | #pragma mark -
91 |
92 | @implementation OCMIsNotNilConstraint
93 |
94 | - (BOOL)evaluate:(id)value
95 | {
96 | return value != nil;
97 | }
98 |
99 | @end
100 |
101 |
102 |
103 | #pragma mark -
104 |
105 | @implementation OCMIsNotEqualConstraint
106 |
107 | - (BOOL)evaluate:(id)value
108 | {
109 | return ![value isEqual:testValue];
110 | }
111 |
112 | @end
113 |
114 |
115 |
116 | #pragma mark -
117 |
118 | @implementation OCMInvocationConstraint
119 |
120 | - (BOOL)evaluate:(id)value
121 | {
122 | [invocation setArgument:&value atIndex:2]; // should test if constraint takes arg
123 | [invocation invoke];
124 | BOOL returnValue;
125 | [invocation getReturnValue:&returnValue];
126 | return returnValue;
127 | }
128 |
129 | @end
130 |
131 | #pragma mark -
132 |
133 | @implementation OCMBlockConstraint
134 |
135 | - (instancetype)initWithConstraintBlock:(BOOL (^)(id))aBlock
136 | {
137 | if ((self = [super init]))
138 | {
139 | block = [aBlock copy];
140 | }
141 |
142 | return self;
143 | }
144 |
145 | - (void)dealloc {
146 | [block release];
147 | [super dealloc];
148 | }
149 |
150 | - (BOOL)evaluate:(id)value
151 | {
152 | return block ? block(value) : NO;
153 | }
154 |
155 |
156 | @end
157 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMExceptionReturnValueProvider.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMReturnValueProvider.h"
18 |
19 | extern NSString *OCMStubbedException;
20 |
21 | @interface OCMExceptionReturnValueProvider : OCMReturnValueProvider
22 | {
23 | }
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMExceptionReturnValueProvider.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMExceptionReturnValueProvider.h"
18 |
19 |
20 | @implementation OCMExceptionReturnValueProvider
21 |
22 | NSString *OCMStubbedException = @"OCMStubbedException";
23 |
24 |
25 | - (void)handleInvocation:(NSInvocation *)anInvocation
26 | {
27 | [[NSException exceptionWithName:OCMStubbedException reason:@"Exception stubbed in test." userInfo:@{ @"exception": returnValue }] raise];
28 | }
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMExpectationRecorder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @interface OCMExpectationRecorder : OCMStubRecorder
20 |
21 | - (id)never;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMExpectationRecorder.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMExpectationRecorder.h"
18 | #import "OCMInvocationExpectation.h"
19 |
20 | @implementation OCMExpectationRecorder
21 |
22 | #pragma mark Initialisers, description, accessors, etc.
23 |
24 | - (id)init
25 | {
26 | self = [super init];
27 | [invocationMatcher release];
28 | invocationMatcher = [[OCMInvocationExpectation alloc] init];
29 | return self;
30 | }
31 |
32 | - (OCMInvocationExpectation *)expectation
33 | {
34 | return (OCMInvocationExpectation *)invocationMatcher;
35 | }
36 |
37 |
38 | #pragma mark Modifying the expectation
39 |
40 | - (id)never
41 | {
42 | [[self expectation] setMatchAndReject:YES];
43 | return self;
44 | }
45 |
46 |
47 | #pragma mark Finishing recording
48 |
49 | - (void)forwardInvocation:(NSInvocation *)anInvocation
50 | {
51 | [super forwardInvocation:anInvocation];
52 | [mockObject addExpectation:[self expectation]];
53 | }
54 |
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMFunctions.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 |
20 | #if defined(__cplusplus)
21 | #define OCMOCK_EXTERN extern "C"
22 | #else
23 | #define OCMOCK_EXTERN extern
24 | #endif
25 |
26 |
27 | OCMOCK_EXTERN BOOL OCMIsObjectType(const char *objCType);
28 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMFunctionsPrivate.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | #if defined(__cplusplus)
20 | #define OCMOCK_EXTERN extern "C"
21 | #else
22 | #define OCMOCK_EXTERN extern
23 | #endif
24 |
25 |
26 | @class OCMLocation;
27 | @class OCClassMockObject;
28 | @class OCPartialMockObject;
29 |
30 |
31 | OCMOCK_EXTERN BOOL OCMIsObjectType(const char *objCType);
32 | const char *OCMTypeWithoutQualifiers(const char *objCType);
33 | BOOL OCMEqualTypesAllowingOpaqueStructs(const char *type1, const char *type2);
34 | CFNumberType OCMNumberTypeForObjCType(const char *objcType);
35 |
36 | Class OCMCreateSubclass(Class cls, void *ref);
37 |
38 | BOOL OCMIsAliasSelector(SEL selector);
39 | SEL OCMAliasForOriginalSelector(SEL selector);
40 | SEL OCMOriginalSelectorForAlias(SEL selector);
41 |
42 | void OCMSetAssociatedMockForClass(OCClassMockObject *mock, Class aClass);
43 | OCClassMockObject *OCMGetAssociatedMockForClass(Class aClass, BOOL includeSuperclasses);
44 |
45 | void OCMSetAssociatedMockForObject(OCClassMockObject *mock, id anObject);
46 | OCPartialMockObject *OCMGetAssociatedMockForObject(id anObject);
47 |
48 | void OCMReportFailure(OCMLocation *loc, NSString *description);
49 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMIndirectReturnValueProvider.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @interface OCMIndirectReturnValueProvider : NSObject
20 | {
21 | id provider;
22 | SEL selector;
23 | }
24 |
25 | - (id)initWithProvider:(id)aProvider andSelector:(SEL)aSelector;
26 |
27 | - (void)handleInvocation:(NSInvocation *)anInvocation;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMIndirectReturnValueProvider.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "NSMethodSignature+OCMAdditions.h"
18 | #import "OCMIndirectReturnValueProvider.h"
19 | #import "NSInvocation+OCMAdditions.h"
20 |
21 |
22 | @implementation OCMIndirectReturnValueProvider
23 |
24 | - (id)initWithProvider:(id)aProvider andSelector:(SEL)aSelector
25 | {
26 | if ((self = [super init]))
27 | {
28 | provider = [aProvider retain];
29 | selector = aSelector;
30 | }
31 |
32 | return self;
33 | }
34 |
35 | - (void)dealloc
36 | {
37 | [provider release];
38 | [super dealloc];
39 | }
40 |
41 | - (void)handleInvocation:(NSInvocation *)anInvocation
42 | {
43 | id originalTarget = [anInvocation target];
44 | SEL originalSelector = [anInvocation selector];
45 |
46 | [anInvocation setTarget:provider];
47 | [anInvocation setSelector:selector];
48 | [anInvocation invoke];
49 |
50 | [anInvocation setTarget:originalTarget];
51 | [anInvocation setSelector:originalSelector];
52 | }
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMInvocationExpectation.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMInvocationStub.h"
18 |
19 | @interface OCMInvocationExpectation : OCMInvocationStub
20 | {
21 | BOOL matchAndReject;
22 | BOOL isSatisfied;
23 | }
24 |
25 | - (void)setMatchAndReject:(BOOL)flag;
26 | - (BOOL)isMatchAndReject;
27 |
28 | - (BOOL)isSatisfied;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMInvocationExpectation.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMInvocationExpectation.h"
18 | #import "NSInvocation+OCMAdditions.h"
19 |
20 |
21 | @implementation OCMInvocationExpectation
22 |
23 | - (void)setMatchAndReject:(BOOL)flag
24 | {
25 | matchAndReject = flag;
26 | if(matchAndReject)
27 | isSatisfied = YES;
28 | }
29 |
30 | - (BOOL)isMatchAndReject
31 | {
32 | return matchAndReject;
33 | }
34 |
35 | - (BOOL)isSatisfied
36 | {
37 | return isSatisfied;
38 | }
39 |
40 | - (void)handleInvocation:(NSInvocation *)anInvocation
41 | {
42 | [super handleInvocation:anInvocation];
43 |
44 | if(matchAndReject)
45 | {
46 | isSatisfied = NO;
47 | [NSException raise:NSInternalInconsistencyException format:@"%@: explicitly disallowed method invoked: %@",
48 | [self description], [anInvocation invocationDescription]];
49 | }
50 | else
51 | {
52 | isSatisfied = YES;
53 | }
54 | }
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMInvocationMatcher.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @interface OCMInvocationMatcher : NSObject
20 | {
21 | NSInvocation *recordedInvocation;
22 | BOOL recordedAsClassMethod;
23 | BOOL ignoreNonObjectArgs;
24 | }
25 |
26 | - (void)setInvocation:(NSInvocation *)anInvocation;
27 | - (NSInvocation *)recordedInvocation;
28 |
29 | - (void)setRecordedAsClassMethod:(BOOL)flag;
30 | - (BOOL)recordedAsClassMethod;
31 |
32 | - (void)setIgnoreNonObjectArgs:(BOOL)flag;
33 |
34 | - (BOOL)matchesSelector:(SEL)aSelector;
35 | - (BOOL)matchesInvocation:(NSInvocation *)anInvocation;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMInvocationMatcher.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 | #import
19 | #import
20 | #import "OCMPassByRefSetter.h"
21 | #import "NSInvocation+OCMAdditions.h"
22 | #import "OCMInvocationMatcher.h"
23 | #import "OCClassMockObject.h"
24 | #import "OCMFunctionsPrivate.h"
25 | #import "OCMBlockArgCaller.h"
26 |
27 |
28 | @interface NSObject(HCMatcherDummy)
29 | - (BOOL)matches:(id)item;
30 | @end
31 |
32 |
33 | @implementation OCMInvocationMatcher
34 |
35 | - (void)dealloc
36 | {
37 | [recordedInvocation release];
38 | [super dealloc];
39 | }
40 |
41 | - (void)setInvocation:(NSInvocation *)anInvocation
42 | {
43 | [recordedInvocation release];
44 | // When the method has a char* argument we do not retain the arguments. This makes it possible
45 | // to match char* args literally and with anyPointer. Not retaining the argument means that
46 | // in these cases tests that use their own autorelease pools may fail unexpectedly.
47 | if(![anInvocation hasCharPointerArgument])
48 | [anInvocation retainArguments];
49 | recordedInvocation = [anInvocation retain];
50 | }
51 |
52 | - (void)setRecordedAsClassMethod:(BOOL)flag
53 | {
54 | recordedAsClassMethod = flag;
55 | }
56 |
57 | - (BOOL)recordedAsClassMethod
58 | {
59 | return recordedAsClassMethod;
60 | }
61 |
62 | - (void)setIgnoreNonObjectArgs:(BOOL)flag
63 | {
64 | ignoreNonObjectArgs = flag;
65 | }
66 |
67 | - (NSString *)description
68 | {
69 | return [recordedInvocation invocationDescription];
70 | }
71 |
72 | - (NSInvocation *)recordedInvocation
73 | {
74 | return recordedInvocation;
75 | }
76 |
77 | - (BOOL)matchesSelector:(SEL)sel
78 | {
79 | if(sel == [recordedInvocation selector])
80 | return YES;
81 | if(OCMIsAliasSelector(sel) &&
82 | OCMOriginalSelectorForAlias(sel) == [recordedInvocation selector])
83 | return YES;
84 |
85 | return NO;
86 | }
87 |
88 | - (BOOL)matchesInvocation:(NSInvocation *)anInvocation
89 | {
90 | id target = [anInvocation target];
91 | BOOL isClassMethodInvocation = (target != nil) && (target == [target class]);
92 | if(isClassMethodInvocation != recordedAsClassMethod)
93 | return NO;
94 |
95 | if(![self matchesSelector:[anInvocation selector]])
96 | return NO;
97 |
98 | NSMethodSignature *signature = [recordedInvocation methodSignature];
99 | NSUInteger n = [signature numberOfArguments];
100 | for(NSUInteger i = 2; i < n; i++)
101 | {
102 | if(ignoreNonObjectArgs && !OCMIsObjectType([signature getArgumentTypeAtIndex:i]))
103 | {
104 | continue;
105 | }
106 |
107 | id recordedArg = [recordedInvocation getArgumentAtIndexAsObject:i];
108 | id passedArg = [anInvocation getArgumentAtIndexAsObject:i];
109 |
110 | if([recordedArg isProxy])
111 | {
112 | if(![recordedArg isEqual:passedArg])
113 | return NO;
114 | continue;
115 | }
116 |
117 | if([recordedArg isKindOfClass:[NSValue class]])
118 | recordedArg = [OCMArg resolveSpecialValues:recordedArg];
119 |
120 | if([recordedArg isKindOfClass:[OCMConstraint class]])
121 | {
122 | if([recordedArg evaluate:passedArg] == NO)
123 | return NO;
124 | }
125 | else if([recordedArg isKindOfClass:[OCMArgAction class]])
126 | {
127 | // ignore, will be dealt with in handleInvocation: where applicable
128 | }
129 | else if([recordedArg conformsToProtocol:objc_getProtocol("HCMatcher")])
130 | {
131 | if([recordedArg matches:passedArg] == NO)
132 | return NO;
133 | }
134 | else
135 | {
136 | if(([recordedArg class] == [NSNumber class]) &&
137 | ([(NSNumber*)recordedArg compare:(NSNumber*)passedArg] != NSOrderedSame))
138 | return NO;
139 | if(([recordedArg isEqual:passedArg] == NO) &&
140 | !((recordedArg == nil) && (passedArg == nil)))
141 | return NO;
142 | }
143 | }
144 | return YES;
145 | }
146 |
147 | @end
148 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMInvocationStub.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMInvocationMatcher.h"
18 |
19 | @interface OCMInvocationStub : OCMInvocationMatcher
20 | {
21 | NSMutableArray *invocationActions;
22 | }
23 |
24 | - (void)addInvocationAction:(id)anAction;
25 | - (NSArray *)invocationActions;
26 |
27 | - (void)handleInvocation:(NSInvocation *)anInvocation;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMInvocationStub.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMInvocationStub.h"
18 | #import "OCMFunctionsPrivate.h"
19 | #import "OCMArg.h"
20 | #import "OCMArgAction.h"
21 | #import "NSInvocation+OCMAdditions.h"
22 |
23 | @implementation OCMInvocationStub
24 |
25 | - (id)init
26 | {
27 | self = [super init];
28 | invocationActions = [[NSMutableArray alloc] init];
29 | return self;
30 | }
31 |
32 | - (void)dealloc
33 | {
34 | [invocationActions release];
35 | [super dealloc];
36 | }
37 |
38 |
39 | - (void)addInvocationAction:(id)anAction
40 | {
41 | [invocationActions addObject:anAction];
42 | }
43 |
44 | - (NSArray *)invocationActions
45 | {
46 | return invocationActions;
47 | }
48 |
49 |
50 | - (void)handleInvocation:(NSInvocation *)anInvocation
51 | {
52 | NSMethodSignature *signature = [recordedInvocation methodSignature];
53 | NSUInteger n = [signature numberOfArguments];
54 | for(NSUInteger i = 2; i < n; i++)
55 | {
56 | id recordedArg = [recordedInvocation getArgumentAtIndexAsObject:i];
57 | id passedArg = [anInvocation getArgumentAtIndexAsObject:i];
58 |
59 | if([recordedArg isProxy])
60 | continue;
61 |
62 | if([recordedArg isKindOfClass:[NSValue class]])
63 | recordedArg = [OCMArg resolveSpecialValues:recordedArg];
64 |
65 | if(![recordedArg isKindOfClass:[OCMArgAction class]])
66 | continue;
67 |
68 | [recordedArg handleArgument:passedArg];
69 | }
70 |
71 | [invocationActions makeObjectsPerformSelector:@selector(handleInvocation:) withObject:anInvocation];
72 | }
73 |
74 | @end
75 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMLocation.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 | #import "OCMFunctions.h"
19 |
20 |
21 | @interface OCMLocation : NSObject
22 | {
23 | id testCase;
24 | NSString *file;
25 | NSUInteger line;
26 | }
27 |
28 | + (instancetype)locationWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine;
29 |
30 | - (instancetype)initWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine;
31 |
32 | - (id)testCase;
33 | - (NSString *)file;
34 | - (NSUInteger)line;
35 |
36 | @end
37 |
38 | OCMOCK_EXTERN OCMLocation *OCMMakeLocation(id testCase, const char *file, int line);
39 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMLocation.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMLocation.h"
18 |
19 | @implementation OCMLocation
20 |
21 | + (instancetype)locationWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine
22 | {
23 | return [[[OCMLocation alloc] initWithTestCase:aTestCase file:aFile line:aLine] autorelease];
24 | }
25 |
26 | - (instancetype)initWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine
27 | {
28 | if ((self = [super init]))
29 | {
30 | testCase = aTestCase;
31 | file = [aFile retain];
32 | line = aLine;
33 | }
34 |
35 | return self;
36 | }
37 |
38 | - (void)dealloc
39 | {
40 | [file release];
41 | [super dealloc];
42 | }
43 |
44 | - (id)testCase
45 | {
46 | return testCase;
47 | }
48 |
49 | - (NSString *)file
50 | {
51 | return file;
52 | }
53 |
54 | - (NSUInteger)line
55 | {
56 | return line;
57 | }
58 |
59 | @end
60 |
61 |
62 | OCMLocation *OCMMakeLocation(id testCase, const char *fileCString, int line)
63 | {
64 | return [OCMLocation locationWithTestCase:testCase file:[NSString stringWithUTF8String:fileCString] line:line];
65 | }
66 |
67 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMMacroState.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @class OCMLocation;
20 | @class OCMRecorder;
21 | @class OCMStubRecorder;
22 | @class OCMockObject;
23 |
24 |
25 | @interface OCMMacroState : NSObject
26 | {
27 | OCMRecorder *recorder;
28 | }
29 |
30 | + (void)beginStubMacro;
31 | + (OCMStubRecorder *)endStubMacro;
32 |
33 | + (void)beginExpectMacro;
34 | + (OCMStubRecorder *)endExpectMacro;
35 |
36 | + (void)beginVerifyMacroAtLocation:(OCMLocation *)aLocation;
37 | + (void)endVerifyMacro;
38 |
39 | + (OCMMacroState *)globalState;
40 |
41 | - (OCMRecorder *)recorder;
42 |
43 | - (void)switchToClassMethod;
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMMacroState.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMMacroState.h"
18 | #import "OCMStubRecorder.h"
19 | #import "OCMockObject.h"
20 | #import "OCMExpectationRecorder.h"
21 | #import "OCMVerifier.h"
22 | #import "OCMInvocationMatcher.h"
23 |
24 |
25 | @implementation OCMMacroState
26 |
27 | static OCMMacroState *globalState;
28 |
29 | #pragma mark Methods to begin/end macros
30 |
31 | + (void)beginStubMacro
32 | {
33 | OCMStubRecorder *recorder = [[[OCMStubRecorder alloc] init] autorelease];
34 | globalState = [[[OCMMacroState alloc] initWithRecorder:recorder] autorelease];
35 | }
36 |
37 | + (OCMStubRecorder *)endStubMacro
38 | {
39 | OCMStubRecorder *recorder = (OCMStubRecorder *)[globalState recorder];
40 | globalState = nil;
41 | return recorder;
42 | }
43 |
44 |
45 | + (void)beginExpectMacro
46 | {
47 | OCMExpectationRecorder *recorder = [[[OCMExpectationRecorder alloc] init] autorelease];
48 | globalState = [[[OCMMacroState alloc] initWithRecorder:recorder] autorelease];
49 | }
50 |
51 | + (OCMStubRecorder *)endExpectMacro
52 | {
53 | return [self endStubMacro];
54 | }
55 |
56 |
57 | + (void)beginVerifyMacroAtLocation:(OCMLocation *)aLocation
58 | {
59 | OCMVerifier *recorder = [[[OCMVerifier alloc] init] autorelease];
60 | [recorder setLocation:aLocation];
61 | globalState = [[[OCMMacroState alloc] initWithRecorder:recorder] autorelease];
62 | }
63 |
64 | + (void)endVerifyMacro
65 | {
66 | globalState = nil;
67 | }
68 |
69 |
70 | #pragma mark Accessing global state
71 |
72 | + (OCMMacroState *)globalState
73 | {
74 | return globalState;
75 | }
76 |
77 |
78 | #pragma mark Init, dealloc, accessors
79 |
80 | - (id)initWithRecorder:(OCMRecorder *)aRecorder
81 | {
82 | if ((self = [super init]))
83 | {
84 | recorder = [aRecorder retain];
85 | }
86 |
87 | return self;
88 | }
89 |
90 | - (void)dealloc
91 | {
92 | [recorder release];
93 | if(globalState == self)
94 | globalState = nil;
95 | [super dealloc];
96 | }
97 |
98 | - (OCMRecorder *)recorder
99 | {
100 | return recorder;
101 | }
102 |
103 |
104 | #pragma mark Changing the recorder
105 |
106 | - (void)switchToClassMethod
107 | {
108 | [recorder classMethod];
109 | }
110 |
111 |
112 | @end
113 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMNotificationPoster.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @interface OCMNotificationPoster : NSObject
20 | {
21 | NSNotification *notification;
22 | }
23 |
24 | - (id)initWithNotification:(id)aNotification;
25 |
26 | - (void)handleInvocation:(NSInvocation *)anInvocation;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMNotificationPoster.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMNotificationPoster.h"
18 |
19 |
20 | @implementation OCMNotificationPoster
21 |
22 | - (id)initWithNotification:(id)aNotification
23 | {
24 | if ((self = [super init]))
25 | {
26 | notification = [aNotification retain];
27 | }
28 |
29 | return self;
30 | }
31 |
32 | - (void)dealloc
33 | {
34 | [notification release];
35 | [super dealloc];
36 | }
37 |
38 | - (void)handleInvocation:(NSInvocation *)anInvocation
39 | {
40 | [[NSNotificationCenter defaultCenter] postNotification:notification];
41 | }
42 |
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMObserverRecorder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @interface OCMObserverRecorder : NSObject
20 | {
21 | NSNotification *recordedNotification;
22 | }
23 |
24 | - (NSNotification *)notificationWithName:(NSString *)name object:(id)sender;
25 |
26 | - (NSNotification *)notificationWithName:(NSString *)name object:(id)sender userInfo:(NSDictionary *)userInfo;
27 |
28 | - (BOOL)matchesNotification:(NSNotification *)aNotification;
29 |
30 | - (BOOL)argument:(id)expectedArg matchesArgument:(id)observedArg;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMObserverRecorder.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 | #import
19 | #import "NSInvocation+OCMAdditions.h"
20 | #import "OCMObserverRecorder.h"
21 |
22 | @interface NSObject(HCMatcherDummy)
23 | - (BOOL)matches:(id)item;
24 | @end
25 |
26 | #pragma mark -
27 |
28 |
29 | @implementation OCMObserverRecorder
30 |
31 | #pragma mark Initialisers, description, accessors, etc.
32 |
33 | - (void)dealloc
34 | {
35 | [recordedNotification release];
36 | [super dealloc];
37 | }
38 |
39 |
40 | #pragma mark Recording
41 |
42 | - (NSNotification *)notificationWithName:(NSString *)name object:(id)sender
43 | {
44 | recordedNotification = [[NSNotification notificationWithName:name object:sender] retain];
45 | return nil;
46 | }
47 |
48 | - (NSNotification *)notificationWithName:(NSString *)name object:(id)sender userInfo:(NSDictionary *)userInfo
49 | {
50 | recordedNotification = [[NSNotification notificationWithName:name object:sender userInfo:userInfo] retain];
51 | return nil;
52 | }
53 |
54 |
55 | #pragma mark Verification
56 |
57 | - (BOOL)matchesNotification:(NSNotification *)aNotification
58 | {
59 | return [self argument:[recordedNotification name] matchesArgument:[aNotification name]] &&
60 | [self argument:[recordedNotification object] matchesArgument:[aNotification object]] &&
61 | [self argument:[recordedNotification userInfo] matchesArgument:[aNotification userInfo]];
62 | }
63 |
64 | - (BOOL)argument:(id)expectedArg matchesArgument:(id)observedArg
65 | {
66 | if([expectedArg isKindOfClass:[OCMConstraint class]])
67 | {
68 | return [expectedArg evaluate:observedArg];
69 | }
70 | else if([expectedArg conformsToProtocol:objc_getProtocol("HCMatcher")])
71 | {
72 | return [expectedArg matches:observedArg];
73 | }
74 | else if (expectedArg == observedArg)
75 | {
76 | return YES;
77 | }
78 | else if (expectedArg == nil || observedArg == nil)
79 | {
80 | return NO;
81 | }
82 | else
83 | {
84 | return [expectedArg isEqual:observedArg];
85 | }
86 | }
87 |
88 |
89 | @end
90 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMPassByRefSetter.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMArgAction.h"
18 |
19 | @interface OCMPassByRefSetter : OCMArgAction
20 | {
21 | id value;
22 | }
23 |
24 | - (id)initWithValue:(id)value;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMPassByRefSetter.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMPassByRefSetter.h"
18 |
19 |
20 | @implementation OCMPassByRefSetter
21 |
22 | - (id)initWithValue:(id)aValue
23 | {
24 | if ((self = [super init]))
25 | {
26 | value = [aValue retain];
27 | }
28 |
29 | return self;
30 | }
31 |
32 | - (void)dealloc
33 | {
34 | [value release];
35 | [super dealloc];
36 | }
37 |
38 | - (void)handleArgument:(id)arg
39 | {
40 | void *pointerValue = [arg pointerValue];
41 | if(pointerValue != NULL)
42 | {
43 | if([value isKindOfClass:[NSValue class]])
44 | [(NSValue *)value getValue:pointerValue];
45 | else
46 | *(id *)pointerValue = value;
47 | }
48 | }
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMRealObjectForwarder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2010-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @interface OCMRealObjectForwarder : NSObject
20 | {
21 | }
22 |
23 | - (void)handleInvocation:(NSInvocation *)anInvocation;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMRealObjectForwarder.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2010-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 | #import "OCPartialMockObject.h"
19 | #import "OCMRealObjectForwarder.h"
20 | #import "OCMFunctionsPrivate.h"
21 |
22 |
23 | @implementation OCMRealObjectForwarder
24 |
25 | - (void)handleInvocation:(NSInvocation *)anInvocation
26 | {
27 | id invocationTarget = [anInvocation target];
28 |
29 | [anInvocation setSelector:OCMAliasForOriginalSelector([anInvocation selector])];
30 | if ([invocationTarget isProxy])
31 | {
32 | if (class_getInstanceMethod([invocationTarget mockObjectClass], @selector(realObject)))
33 | {
34 | // the method has been invoked on the mock, we need to change the target to the real object
35 | [anInvocation setTarget:[(OCPartialMockObject *)invocationTarget realObject]];
36 | }
37 | else
38 | {
39 | [NSException raise:NSInternalInconsistencyException
40 | format:@"Method andForwardToRealObject can only be used with partial mocks and class methods."];
41 | }
42 | }
43 |
44 | [anInvocation invoke];
45 | }
46 |
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMRecorder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @class OCMockObject;
20 | @class OCMInvocationMatcher;
21 |
22 |
23 | @interface OCMRecorder : NSProxy
24 | {
25 | OCMockObject *mockObject;
26 | OCMInvocationMatcher *invocationMatcher;
27 | }
28 |
29 | - (instancetype)init;
30 | - (instancetype)initWithMockObject:(OCMockObject *)aMockObject;
31 |
32 | - (void)setMockObject:(OCMockObject *)aMockObject;
33 |
34 | - (OCMInvocationMatcher *)invocationMatcher;
35 |
36 | - (id)classMethod;
37 | - (id)ignoringNonObjectArgs;
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMRecorder.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 | #import "OCMRecorder.h"
19 | #import "OCMockObject.h"
20 | #import "OCMInvocationMatcher.h"
21 | #import "OCClassMockObject.h"
22 |
23 | @implementation OCMRecorder
24 |
25 | - (instancetype)init
26 | {
27 | // no super, we're inheriting from NSProxy
28 | return self;
29 | }
30 |
31 | - (instancetype)initWithMockObject:(OCMockObject *)aMockObject
32 | {
33 | [self init];
34 | [self setMockObject:aMockObject];
35 | return self;
36 | }
37 |
38 | - (void)setMockObject:(OCMockObject *)aMockObject
39 | {
40 | mockObject = aMockObject;
41 | }
42 |
43 | - (void)dealloc
44 | {
45 | [invocationMatcher release];
46 | [super dealloc];
47 | }
48 |
49 | - (NSString *)description
50 | {
51 | return [invocationMatcher description];
52 | }
53 |
54 | - (OCMInvocationMatcher *)invocationMatcher
55 | {
56 | return invocationMatcher;
57 | }
58 |
59 |
60 | #pragma mark Modifying the matcher
61 |
62 | - (id)classMethod
63 | {
64 | // should we handle the case where this is called with a mock that isn't a class mock?
65 | [invocationMatcher setRecordedAsClassMethod:YES];
66 | return self;
67 | }
68 |
69 | - (id)ignoringNonObjectArgs
70 | {
71 | [invocationMatcher setIgnoreNonObjectArgs:YES];
72 | return self;
73 | }
74 |
75 |
76 | #pragma mark Recording the actual invocation
77 |
78 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
79 | {
80 | if([invocationMatcher recordedAsClassMethod])
81 | return [[(OCClassMockObject *)mockObject mockedClass] methodSignatureForSelector:aSelector];
82 |
83 | NSMethodSignature *signature = [mockObject methodSignatureForSelector:aSelector];
84 | if(signature == nil)
85 | {
86 | // if we're a working with a class mock and there is a class method, auto-switch
87 | if(([object_getClass(mockObject) isSubclassOfClass:[OCClassMockObject class]]) &&
88 | ([[(OCClassMockObject *)mockObject mockedClass] respondsToSelector:aSelector]))
89 | {
90 | [self classMethod];
91 | signature = [self methodSignatureForSelector:aSelector];
92 | }
93 | }
94 | return signature;
95 | }
96 |
97 | - (void)forwardInvocation:(NSInvocation *)anInvocation
98 | {
99 | [anInvocation setTarget:nil];
100 | [invocationMatcher setInvocation:anInvocation];
101 | }
102 |
103 | - (void)doesNotRecognizeSelector:(SEL)aSelector
104 | {
105 | [NSException raise:NSInvalidArgumentException format:@"%@: cannot stub/expect/verify method '%@' because no such method exists in the mocked class.", mockObject, NSStringFromSelector(aSelector)];
106 | }
107 |
108 |
109 | @end
110 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMReturnValueProvider.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @interface OCMReturnValueProvider : NSObject
20 | {
21 | id returnValue;
22 | }
23 |
24 | - (instancetype)initWithValue:(id)aValue;
25 |
26 | - (void)handleInvocation:(NSInvocation *)anInvocation;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMReturnValueProvider.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "NSMethodSignature+OCMAdditions.h"
18 | #import "OCMReturnValueProvider.h"
19 | #import "OCMFunctions.h"
20 |
21 |
22 | @implementation OCMReturnValueProvider
23 |
24 | - (instancetype)initWithValue:(id)aValue
25 | {
26 | if ((self = [super init]))
27 | {
28 | returnValue = [aValue retain];
29 | }
30 |
31 | return self;
32 | }
33 |
34 | - (void)dealloc
35 | {
36 | [returnValue release];
37 | [super dealloc];
38 | }
39 |
40 | - (void)handleInvocation:(NSInvocation *)anInvocation
41 | {
42 | if(!OCMIsObjectType([[anInvocation methodSignature] methodReturnType]))
43 | {
44 | @throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"Expected invocation with object return type. Did you mean to use andReturnValue: instead?" userInfo:nil];
45 | }
46 | NSString *sel = NSStringFromSelector([anInvocation selector]);
47 | if([sel hasPrefix:@"alloc"] || [sel hasPrefix:@"new"] || [sel hasPrefix:@"copy"] || [sel hasPrefix:@"mutableCopy"])
48 | {
49 | // methods that "create" an object return it with an extra retain count
50 | [returnValue retain];
51 | }
52 | [anInvocation setReturnValue:&returnValue];
53 | }
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMStubRecorder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 | #import
19 | #import
20 |
21 | @interface OCMStubRecorder : OCMRecorder
22 |
23 | - (id)andReturn:(id)anObject;
24 | - (id)andReturnValue:(NSValue *)aValue;
25 | - (id)andThrow:(NSException *)anException;
26 | - (id)andPost:(NSNotification *)aNotification;
27 | - (id)andCall:(SEL)selector onObject:(id)anObject;
28 | - (id)andDo:(void (^)(NSInvocation *invocation))block;
29 | - (id)andForwardToRealObject;
30 |
31 | @end
32 |
33 |
34 | @interface OCMStubRecorder (Properties)
35 |
36 | #define andReturn(aValue) _andReturn(({ \
37 | __typeof__(aValue) _val = (aValue); \
38 | NSValue *_nsval = [NSValue value:&_val withObjCType:@encode(__typeof__(_val))]; \
39 | if (OCMIsObjectType(@encode(__typeof(_val)))) { \
40 | objc_setAssociatedObject(_nsval, "OCMAssociatedBoxedValue", *(__unsafe_unretained id *) (void *) &_val, OBJC_ASSOCIATION_RETAIN); \
41 | } \
42 | _nsval; \
43 | }))
44 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andReturn)(NSValue *);
45 |
46 | #define andThrow(anException) _andThrow(anException)
47 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andThrow)(NSException *);
48 |
49 | #define andPost(aNotification) _andPost(aNotification)
50 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andPost)(NSNotification *);
51 |
52 | #define andCall(anObject, aSelector) _andCall(anObject, aSelector)
53 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andCall)(id, SEL);
54 |
55 | #define andDo(aBlock) _andDo(aBlock)
56 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andDo)(void (^)(NSInvocation *));
57 |
58 | #define andForwardToRealObject() _andForwardToRealObject()
59 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andForwardToRealObject)(void);
60 |
61 | @end
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMStubRecorder.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMStubRecorder.h"
18 | #import "OCClassMockObject.h"
19 | #import "OCMReturnValueProvider.h"
20 | #import "OCMBoxedReturnValueProvider.h"
21 | #import "OCMExceptionReturnValueProvider.h"
22 | #import "OCMIndirectReturnValueProvider.h"
23 | #import "OCMNotificationPoster.h"
24 | #import "OCMBlockCaller.h"
25 | #import "OCMRealObjectForwarder.h"
26 | #import "OCMFunctions.h"
27 | #import "OCMInvocationStub.h"
28 |
29 |
30 | @implementation OCMStubRecorder
31 |
32 | #pragma mark Initialisers, description, accessors, etc.
33 |
34 | - (id)init
35 | {
36 | self = [super init];
37 | invocationMatcher = [[OCMInvocationStub alloc] init];
38 | return self;
39 | }
40 |
41 | - (OCMInvocationStub *)stub
42 | {
43 | return (OCMInvocationStub *)invocationMatcher;
44 | }
45 |
46 |
47 | #pragma mark Recording invocation actions
48 |
49 | - (id)andReturn:(id)anObject
50 | {
51 | [[self stub] addInvocationAction:[[[OCMReturnValueProvider alloc] initWithValue:anObject] autorelease]];
52 | return self;
53 | }
54 |
55 | - (id)andReturnValue:(NSValue *)aValue
56 | {
57 | [[self stub] addInvocationAction:[[[OCMBoxedReturnValueProvider alloc] initWithValue:aValue] autorelease]];
58 | return self;
59 | }
60 |
61 | - (id)andThrow:(NSException *)anException
62 | {
63 | [[self stub] addInvocationAction:[[[OCMExceptionReturnValueProvider alloc] initWithValue:anException] autorelease]];
64 | return self;
65 | }
66 |
67 | - (id)andPost:(NSNotification *)aNotification
68 | {
69 | [[self stub] addInvocationAction:[[[OCMNotificationPoster alloc] initWithNotification:aNotification] autorelease]];
70 | return self;
71 | }
72 |
73 | - (id)andCall:(SEL)selector onObject:(id)anObject
74 | {
75 | [[self stub] addInvocationAction:[[[OCMIndirectReturnValueProvider alloc] initWithProvider:anObject andSelector:selector] autorelease]];
76 | return self;
77 | }
78 |
79 | - (id)andDo:(void (^)(NSInvocation *))aBlock
80 | {
81 | [[self stub] addInvocationAction:[[[OCMBlockCaller alloc] initWithCallBlock:aBlock] autorelease]];
82 | return self;
83 | }
84 |
85 | - (id)andForwardToRealObject
86 | {
87 | [[self stub] addInvocationAction:[[[OCMRealObjectForwarder alloc] init] autorelease]];
88 | return self;
89 | }
90 |
91 |
92 | #pragma mark Finishing recording
93 |
94 | - (void)forwardInvocation:(NSInvocation *)anInvocation
95 | {
96 | [super forwardInvocation:anInvocation];
97 | [mockObject addStub:[self stub]];
98 | }
99 |
100 |
101 | @end
102 |
103 |
104 | @implementation OCMStubRecorder (Properties)
105 |
106 | @dynamic _andReturn;
107 |
108 | - (OCMStubRecorder *(^)(NSValue *))_andReturn
109 | {
110 | id (^theBlock)(id) = ^ (NSValue *aValue)
111 | {
112 | if(OCMIsObjectType([aValue objCType]))
113 | {
114 | NSValue *objValue = nil;
115 | [aValue getValue:&objValue];
116 | return [self andReturn:objValue];
117 | }
118 | else
119 | {
120 | return [self andReturnValue:aValue];
121 | }
122 | };
123 | return [[theBlock copy] autorelease];
124 | }
125 |
126 |
127 | @dynamic _andThrow;
128 |
129 | - (OCMStubRecorder *(^)(NSException *))_andThrow
130 | {
131 | id (^theBlock)(id) = ^ (NSException * anException)
132 | {
133 | return [self andThrow:anException];
134 | };
135 | return [[theBlock copy] autorelease];
136 | }
137 |
138 |
139 | @dynamic _andPost;
140 |
141 | - (OCMStubRecorder *(^)(NSNotification *))_andPost
142 | {
143 | id (^theBlock)(id) = ^ (NSNotification * aNotification)
144 | {
145 | return [self andPost:aNotification];
146 | };
147 | return [[theBlock copy] autorelease];
148 | }
149 |
150 |
151 | @dynamic _andCall;
152 |
153 | - (OCMStubRecorder *(^)(id, SEL))_andCall
154 | {
155 | id (^theBlock)(id, SEL) = ^ (id anObject, SEL aSelector)
156 | {
157 | return [self andCall:aSelector onObject:anObject];
158 | };
159 | return [[theBlock copy] autorelease];
160 | }
161 |
162 |
163 | @dynamic _andDo;
164 |
165 | - (OCMStubRecorder *(^)(void (^)(NSInvocation *)))_andDo
166 | {
167 | id (^theBlock)(void (^)(NSInvocation *)) = ^ (void (^ blockToCall)(NSInvocation *))
168 | {
169 | return [self andDo:blockToCall];
170 | };
171 | return [[theBlock copy] autorelease];
172 | }
173 |
174 |
175 | @dynamic _andForwardToRealObject;
176 |
177 | - (OCMStubRecorder *(^)(void))_andForwardToRealObject
178 | {
179 | id (^theBlock)(void) = ^ (void)
180 | {
181 | return [self andForwardToRealObject];
182 | };
183 | return [[theBlock copy] autorelease];
184 | }
185 |
186 |
187 | @end
188 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMVerifier.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMRecorder.h"
18 | #import "OCMLocation.h"
19 |
20 |
21 | @interface OCMVerifier : OCMRecorder
22 |
23 | @property(retain) OCMLocation *location;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMVerifier.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 | #import "OCMVerifier.h"
19 | #import "OCMockObject.h"
20 | #import "OCMLocation.h"
21 | #import "OCMInvocationMatcher.h"
22 |
23 |
24 | @implementation OCMVerifier
25 |
26 | - (id)init
27 | {
28 | if ((self = [super init]))
29 | {
30 | invocationMatcher = [[OCMInvocationMatcher alloc] init];
31 | }
32 |
33 | return self;
34 | }
35 |
36 | - (void)forwardInvocation:(NSInvocation *)anInvocation
37 | {
38 | [super forwardInvocation:anInvocation];
39 | [mockObject verifyInvocation:invocationMatcher atLocation:self.location];
40 | }
41 |
42 | - (void)dealloc
43 | {
44 | [_location release];
45 | [super dealloc];
46 | }
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMock.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 | #import
19 | #import
20 | #import
21 | #import
22 | #import
23 | #import
24 | #import
25 | #import
26 |
27 |
28 | #define OCMClassMock(cls) [OCMockObject niceMockForClass:cls]
29 |
30 | #define OCMStrictClassMock(cls) [OCMockObject mockForClass:cls]
31 |
32 | #define OCMProtocolMock(protocol) [OCMockObject niceMockForProtocol:protocol]
33 |
34 | #define OCMStrictProtocolMock(protocol) [OCMockObject mockForProtocol:protocol]
35 |
36 | #define OCMPartialMock(obj) [OCMockObject partialMockForObject:obj]
37 |
38 | #define OCMObserverMock() [OCMockObject observerMock]
39 |
40 |
41 | #define OCMStub(invocation) \
42 | ({ \
43 | _OCMSilenceWarnings( \
44 | [OCMMacroState beginStubMacro]; \
45 | invocation; \
46 | [OCMMacroState endStubMacro]; \
47 | ); \
48 | })
49 |
50 | #define OCMExpect(invocation) \
51 | ({ \
52 | _OCMSilenceWarnings( \
53 | [OCMMacroState beginExpectMacro]; \
54 | invocation; \
55 | [OCMMacroState endExpectMacro]; \
56 | ); \
57 | })
58 |
59 | #define ClassMethod(invocation) \
60 | _OCMSilenceWarnings( \
61 | [[OCMMacroState globalState] switchToClassMethod]; \
62 | invocation; \
63 | );
64 |
65 |
66 | #define OCMVerifyAll(mock) [mock verifyAtLocation:OCMMakeLocation(self, __FILE__, __LINE__)]
67 |
68 | #define OCMVerifyAllWithDelay(mock, delay) [mock verifyWithDelay:delay atLocation:OCMMakeLocation(self, __FILE__, __LINE__)]
69 |
70 | #define OCMVerify(invocation) \
71 | ({ \
72 | _OCMSilenceWarnings( \
73 | [OCMMacroState beginVerifyMacroAtLocation:OCMMakeLocation(self, __FILE__, __LINE__)]; \
74 | invocation; \
75 | [OCMMacroState endVerifyMacro]; \
76 | ); \
77 | })
78 |
79 | #define _OCMSilenceWarnings(macro) \
80 | ({ \
81 | _Pragma("clang diagnostic push") \
82 | _Pragma("clang diagnostic ignored \"-Wunused-value\"") \
83 | _Pragma("clang diagnostic ignored \"-Wunused-getter-return-value\"") \
84 | macro \
85 | _Pragma("clang diagnostic pop") \
86 | })
87 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCMockObject.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @class OCMLocation;
20 | @class OCMInvocationStub;
21 | @class OCMStubRecorder;
22 | @class OCMInvocationMatcher;
23 | @class OCMInvocationExpectation;
24 |
25 |
26 | @interface OCMockObject : NSProxy
27 | {
28 | BOOL isNice;
29 | BOOL expectationOrderMatters;
30 | NSMutableArray *stubs;
31 | NSMutableArray *expectations;
32 | NSMutableArray *exceptions;
33 | NSMutableArray *invocations;
34 | }
35 |
36 | + (id)mockForClass:(Class)aClass;
37 | + (id)mockForProtocol:(Protocol *)aProtocol;
38 | + (id)partialMockForObject:(NSObject *)anObject;
39 |
40 | + (id)niceMockForClass:(Class)aClass;
41 | + (id)niceMockForProtocol:(Protocol *)aProtocol;
42 |
43 | + (id)observerMock;
44 |
45 | - (instancetype)init;
46 |
47 | - (void)setExpectationOrderMatters:(BOOL)flag;
48 |
49 | - (id)stub;
50 | - (id)expect;
51 | - (id)reject;
52 |
53 | - (id)verify;
54 | - (id)verifyAtLocation:(OCMLocation *)location;
55 |
56 | - (void)verifyWithDelay:(NSTimeInterval)delay;
57 | - (void)verifyWithDelay:(NSTimeInterval)delay atLocation:(OCMLocation *)location;
58 |
59 | - (void)stopMocking;
60 |
61 | // internal use only
62 |
63 | - (void)addStub:(OCMInvocationStub *)aStub;
64 | - (void)addExpectation:(OCMInvocationExpectation *)anExpectation;
65 |
66 | - (BOOL)handleInvocation:(NSInvocation *)anInvocation;
67 | - (void)handleUnRecordedInvocation:(NSInvocation *)anInvocation;
68 | - (BOOL)handleSelector:(SEL)sel;
69 |
70 | - (void)verifyInvocation:(OCMInvocationMatcher *)matcher;
71 | - (void)verifyInvocation:(OCMInvocationMatcher *)matcher atLocation:(OCMLocation *)location;
72 |
73 | @end
74 |
75 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCObserverMockObject.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @class OCMLocation;
20 |
21 |
22 | @interface OCObserverMockObject : NSObject
23 | {
24 | BOOL expectationOrderMatters;
25 | NSMutableArray *recorders;
26 | NSMutableArray *centers;
27 | }
28 |
29 | - (void)setExpectationOrderMatters:(BOOL)flag;
30 |
31 | - (id)expect;
32 |
33 | - (void)verify;
34 | - (void)verifyAtLocation:(OCMLocation *)location;
35 |
36 | - (void)handleNotification:(NSNotification *)aNotification;
37 |
38 | // internal use
39 |
40 | - (void)autoRemoveFromCenter:(NSNotificationCenter *)aCenter;
41 | - (NSNotification *)notificationWithName:(NSString *)name object:(id)sender;
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCObserverMockObject.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCObserverMockObject.h"
18 | #import "OCMObserverRecorder.h"
19 | #import "OCMLocation.h"
20 | #import "OCMFunctionsPrivate.h"
21 |
22 |
23 | @implementation OCObserverMockObject
24 |
25 | #pragma mark Initialisers, description, accessors, etc.
26 |
27 | - (id)init
28 | {
29 | if ((self = [super init]))
30 | {
31 | recorders = [[NSMutableArray alloc] init];
32 | centers = [[NSMutableArray alloc] init];
33 | }
34 |
35 | return self;
36 | }
37 |
38 | - (id)retain
39 | {
40 | return [super retain];
41 | }
42 |
43 | - (void)dealloc
44 | {
45 | for(NSNotificationCenter *c in centers)
46 | [c removeObserver:self];
47 | [centers release];
48 | [recorders release];
49 | [super dealloc];
50 | }
51 |
52 | - (NSString *)description
53 | {
54 | return @"OCMockObserver";
55 | }
56 |
57 | - (void)setExpectationOrderMatters:(BOOL)flag
58 | {
59 | expectationOrderMatters = flag;
60 | }
61 |
62 | - (void)autoRemoveFromCenter:(NSNotificationCenter *)aCenter
63 | {
64 | [centers addObject:aCenter];
65 | }
66 |
67 |
68 | #pragma mark Public API
69 |
70 | - (id)expect
71 | {
72 | OCMObserverRecorder *recorder = [[[OCMObserverRecorder alloc] init] autorelease];
73 | [recorders addObject:recorder];
74 | return recorder;
75 | }
76 |
77 | - (void)verify
78 | {
79 | [self verifyAtLocation:nil];
80 | }
81 |
82 | - (void)verifyAtLocation:(OCMLocation *)location
83 | {
84 | if([recorders count] == 1)
85 | {
86 | NSString *description = [NSString stringWithFormat:@"%@: expected notification was not observed: %@",
87 | [self description], [[recorders lastObject] description]];
88 | OCMReportFailure(location, description);
89 | }
90 | else if([recorders count] > 0)
91 | {
92 | NSString *description = [NSString stringWithFormat:@"%@ : %@ expected notifications were not observed.",
93 | [self description], @([recorders count])];
94 | OCMReportFailure(location, description);
95 | }
96 | }
97 |
98 |
99 | #pragma mark Receiving recording requests via macro
100 |
101 | - (NSNotification *)notificationWithName:(NSString *)name object:(id)sender
102 | {
103 | return [[self expect] notificationWithName:name object:sender];
104 | }
105 |
106 |
107 | #pragma mark Receiving notifications
108 |
109 | - (void)handleNotification:(NSNotification *)aNotification
110 | {
111 | NSUInteger i, limit;
112 |
113 | limit = expectationOrderMatters ? 1 : [recorders count];
114 | for(i = 0; i < limit; i++)
115 | {
116 | if([[recorders objectAtIndex:i] matchesNotification:aNotification])
117 | {
118 | [recorders removeObjectAtIndex:i];
119 | return;
120 | }
121 | }
122 | [NSException raise:NSInternalInconsistencyException format:@"%@: unexpected notification observed: %@", [self description],
123 | [aNotification description]];
124 | }
125 |
126 |
127 | @end
128 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCPartialMockObject.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCClassMockObject.h"
18 |
19 | @interface OCPartialMockObject : OCClassMockObject
20 | {
21 | NSObject *realObject;
22 | }
23 |
24 | - (id)initWithObject:(NSObject *)anObject;
25 |
26 | - (NSObject *)realObject;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCProtocolMockObject.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @interface OCProtocolMockObject : OCMockObject
20 | {
21 | Protocol *mockedProtocol;
22 | }
23 |
24 | - (id)initWithProtocol:(Protocol *)aProtocol;
25 |
26 | @end
27 |
28 |
--------------------------------------------------------------------------------
/Pods/OCMock/Source/OCMock/OCProtocolMockObject.m:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005-2016 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 | #import "NSMethodSignature+OCMAdditions.h"
19 | #import "OCProtocolMockObject.h"
20 |
21 | @implementation OCProtocolMockObject
22 |
23 | #pragma mark Initialisers, description, accessors, etc.
24 |
25 | - (id)initWithProtocol:(Protocol *)aProtocol
26 | {
27 | NSParameterAssert(aProtocol != nil);
28 | [super init];
29 | mockedProtocol = aProtocol;
30 | return self;
31 | }
32 |
33 | - (NSString *)description
34 | {
35 | const char* name = protocol_getName(mockedProtocol);
36 | return [NSString stringWithFormat:@"OCMockObject(%s)", name];
37 | }
38 |
39 | #pragma mark Proxy API
40 |
41 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
42 | {
43 | struct { BOOL isRequired; BOOL isInstance; } opts[4] = { {YES, YES}, {NO, YES}, {YES, NO}, {NO, NO} };
44 | for(int i = 0; i < 4; i++)
45 | {
46 | struct objc_method_description methodDescription = protocol_getMethodDescription(mockedProtocol, aSelector, opts[i].isRequired, opts[i].isInstance);
47 | if(methodDescription.name != NULL)
48 | return [NSMethodSignature signatureWithObjCTypes:methodDescription.types];
49 | }
50 | return nil;
51 | }
52 |
53 | - (BOOL)conformsToProtocol:(Protocol *)aProtocol
54 | {
55 | return protocol_conformsToProtocol(mockedProtocol, aProtocol);
56 | }
57 |
58 | - (BOOL)respondsToSelector:(SEL)selector
59 | {
60 | return ([self methodSignatureForSelector:selector] != nil);
61 | }
62 |
63 | @end
64 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/OCMock/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 | 3.2.2
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/OCMock/OCMock-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_OCMock : NSObject
3 | @end
4 | @implementation PodsDummy_OCMock
5 | @end
6 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/OCMock/OCMock-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/OCMock/OCMock-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 | #import "OCMock.h"
14 | #import "OCMockObject.h"
15 | #import "OCMArg.h"
16 | #import "OCMConstraint.h"
17 | #import "OCMLocation.h"
18 | #import "OCMMacroState.h"
19 | #import "OCMRecorder.h"
20 | #import "OCMStubRecorder.h"
21 | #import "NSNotificationCenter+OCMAdditions.h"
22 | #import "OCMFunctions.h"
23 |
24 | FOUNDATION_EXPORT double OCMockVersionNumber;
25 | FOUNDATION_EXPORT const unsigned char OCMockVersionString[];
26 |
27 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/OCMock/OCMock.modulemap:
--------------------------------------------------------------------------------
1 | framework module OCMock {
2 | umbrella header "OCMock-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/OCMock/OCMock.xcconfig:
--------------------------------------------------------------------------------
1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/OCMock
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public"
4 | PODS_BUILD_DIR = $BUILD_DIR
5 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
6 | PODS_ROOT = ${SRCROOT}
7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/OCMock
8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
9 | SKIP_INSTALL = YES
10 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-ADAppRater/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.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-ADAppRater/Pods-ADAppRater-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 | Generated by CocoaPods - https://cocoapods.org
4 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-ADAppRater/Pods-ADAppRater-acknowledgements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreferenceSpecifiers
6 |
7 |
8 | FooterText
9 | This application makes use of the following third party libraries:
10 | Title
11 | Acknowledgements
12 | Type
13 | PSGroupSpecifier
14 |
15 |
16 | FooterText
17 | Generated by CocoaPods - https://cocoapods.org
18 | Title
19 |
20 | Type
21 | PSGroupSpecifier
22 |
23 |
24 | StringsTable
25 | Acknowledgements
26 | Title
27 | Acknowledgements
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-ADAppRater/Pods-ADAppRater-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_ADAppRater : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_ADAppRater
5 | @end
6 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-ADAppRater/Pods-ADAppRater-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
14 | FOUNDATION_EXPORT double Pods_ADAppRaterVersionNumber;
15 | FOUNDATION_EXPORT const unsigned char Pods_ADAppRaterVersionString[];
16 |
17 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-ADAppRater/Pods-ADAppRater.debug.xcconfig:
--------------------------------------------------------------------------------
1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
2 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' '@executable_path/../../Frameworks'
3 | PODS_BUILD_DIR = $BUILD_DIR
4 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
5 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
6 | PODS_ROOT = ${SRCROOT}/Pods
7 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-ADAppRater/Pods-ADAppRater.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_ADAppRater {
2 | umbrella header "Pods-ADAppRater-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-ADAppRater/Pods-ADAppRater.release.xcconfig:
--------------------------------------------------------------------------------
1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
2 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' '@executable_path/../../Frameworks'
3 | PODS_BUILD_DIR = $BUILD_DIR
4 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
5 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
6 | PODS_ROOT = ${SRCROOT}/Pods
7 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-ADAppRaterTests/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.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-ADAppRaterTests/Pods-ADAppRaterTests-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_ADAppRaterTests : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_ADAppRaterTests
5 | @end
6 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-ADAppRaterTests/Pods-ADAppRaterTests-frameworks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
6 |
7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
8 |
9 | install_framework()
10 | {
11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
12 | local source="${BUILT_PRODUCTS_DIR}/$1"
13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
15 | elif [ -r "$1" ]; then
16 | local source="$1"
17 | fi
18 |
19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
20 |
21 | if [ -L "${source}" ]; then
22 | echo "Symlinked..."
23 | source="$(readlink "${source}")"
24 | fi
25 |
26 | # use filter instead of exclude so missing patterns dont' throw errors
27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
29 |
30 | local basename
31 | basename="$(basename -s .framework "$1")"
32 | binary="${destination}/${basename}.framework/${basename}"
33 | if ! [ -r "$binary" ]; then
34 | binary="${destination}/${basename}"
35 | fi
36 |
37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device
38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
39 | strip_invalid_archs "$binary"
40 | fi
41 |
42 | # Resign the code if required by the build settings to avoid unstable apps
43 | code_sign_if_enabled "${destination}/$(basename "$1")"
44 |
45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
47 | local swift_runtime_libs
48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
49 | for lib in $swift_runtime_libs; do
50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
52 | code_sign_if_enabled "${destination}/${lib}"
53 | done
54 | fi
55 | }
56 |
57 | # Signs a framework with the provided identity
58 | code_sign_if_enabled() {
59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
60 | # Use the current code_sign_identitiy
61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
62 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'"
63 |
64 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
65 | code_sign_cmd="$code_sign_cmd &"
66 | fi
67 | echo "$code_sign_cmd"
68 | eval "$code_sign_cmd"
69 | fi
70 | }
71 |
72 | # Strip invalid architectures
73 | strip_invalid_archs() {
74 | binary="$1"
75 | # Get architectures for current file
76 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
77 | stripped=""
78 | for arch in $archs; do
79 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
80 | # Strip non-valid architectures in-place
81 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1
82 | stripped="$stripped $arch"
83 | fi
84 | done
85 | if [[ "$stripped" ]]; then
86 | echo "Stripped $binary of architectures:$stripped"
87 | fi
88 | }
89 |
90 |
91 | if [[ "$CONFIGURATION" == "Debug" ]]; then
92 | install_framework "$BUILT_PRODUCTS_DIR/OCMock/OCMock.framework"
93 | fi
94 | if [[ "$CONFIGURATION" == "Release" ]]; then
95 | install_framework "$BUILT_PRODUCTS_DIR/OCMock/OCMock.framework"
96 | fi
97 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
98 | wait
99 | fi
100 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-ADAppRaterTests/Pods-ADAppRaterTests-umbrella.h:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #else
4 | #ifndef FOUNDATION_EXPORT
5 | #if defined(__cplusplus)
6 | #define FOUNDATION_EXPORT extern "C"
7 | #else
8 | #define FOUNDATION_EXPORT extern
9 | #endif
10 | #endif
11 | #endif
12 |
13 |
14 | FOUNDATION_EXPORT double Pods_ADAppRaterTestsVersionNumber;
15 | FOUNDATION_EXPORT const unsigned char Pods_ADAppRaterTestsVersionString[];
16 |
17 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-ADAppRaterTests/Pods-ADAppRaterTests.debug.xcconfig:
--------------------------------------------------------------------------------
1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/OCMock"
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/OCMock/OCMock.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "OCMock"
6 | PODS_BUILD_DIR = $BUILD_DIR
7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
9 | PODS_ROOT = ${SRCROOT}/Pods
10 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-ADAppRaterTests/Pods-ADAppRaterTests.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods_ADAppRaterTests {
2 | umbrella header "Pods-ADAppRaterTests-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Pods/Target Support Files/Pods-ADAppRaterTests/Pods-ADAppRaterTests.release.xcconfig:
--------------------------------------------------------------------------------
1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/OCMock"
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/OCMock/OCMock.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "OCMock"
6 | PODS_BUILD_DIR = $BUILD_DIR
7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
9 | PODS_ROOT = ${SRCROOT}/Pods
10 |
--------------------------------------------------------------------------------