-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add delegate for implementing custom prompting behavior (#65)
Add delegate for implementing custom prompting behavior via the `ARKEmailBugReporterPromptingDelegate` protocol. Also fixes a bug where the email dialog isn't shown when no log messages are included in the report. Previously, this could happen when the log stores are empty or the `emailAttachmentAdditionsDelegate` returns false for all log stores. The custom prompt adds another case of this bug by offering users the chance to filter out all log store.
- Loading branch information
Showing
8 changed files
with
349 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// ARKEmailBugReportConfiguration.h | ||
// Aardvark | ||
// | ||
// Created by Nick Entin on 4/14/18. | ||
// Copyright 2018 Square, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@class ARKLogStore; | ||
@class ARKEmailAttachment; | ||
|
||
|
||
/// Configuration object describing the contents of an email bug report. | ||
@interface ARKEmailBugReportConfiguration : NSObject | ||
|
||
- (nonnull instancetype)init NS_UNAVAILABLE; | ||
+ (nonnull instancetype)new NS_UNAVAILABLE; | ||
|
||
/// The email subject that will be prefilled when the email dialog is presented to the user. Defaults to an empty string. | ||
@property (nonnull, nonatomic, copy) NSString *prefilledEmailSubject; | ||
|
||
/// The log stores that will be included as attachments on the email. Defaults to an empty array. | ||
@property (nonnull, nonatomic, copy) NSArray<ARKLogStore *> *logStores; | ||
|
||
/// Controls whether or not a screenshot should be attached to the email, when available. Defaults to NO. | ||
@property (nonatomic, readonly) BOOL includesScreenshot; | ||
|
||
/// Controls whether or not a view hierarchy description should be attached to the email, when available. Defaults to NO. | ||
@property (nonatomic, readonly) BOOL includesViewHierarchyDescription; | ||
|
||
/// Additional attachments to include on the email. Defaults to an empty array. | ||
@property (nonnull, nonatomic, copy) NSArray<ARKEmailAttachment *> *additionalAttachments; | ||
|
||
/// Excludes the screenshot from the bug report, if one is included. | ||
- (void)excludeScreenshot; | ||
|
||
/// Excludes the view hierarchy description from the bug report, if one is included. | ||
- (void)excludeViewHierarchyDescription; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// ARKEmailBugReportConfiguration.m | ||
// Aardvark | ||
// | ||
// Created by Nick Entin on 4/14/18. | ||
// Copyright 2018 Square, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#import "ARKEmailBugReportConfiguration.h" | ||
#import "ARKEmailBugReportConfiguration_Protected.h" | ||
|
||
|
||
@interface ARKEmailBugReportConfiguration () | ||
|
||
@property (nonatomic, readwrite) BOOL includesScreenshot; | ||
@property (nonatomic, readwrite) BOOL includesViewHierarchyDescription; | ||
|
||
@end | ||
|
||
|
||
@implementation ARKEmailBugReportConfiguration | ||
|
||
- (instancetype)initWithScreenshot:(BOOL)includesScreenshot viewHierarchyDescription:(BOOL)includesViewHierarchyDescription; | ||
{ | ||
self = [super init]; | ||
|
||
_prefilledEmailSubject = @""; | ||
_logStores = @[]; | ||
_includesScreenshot = includesScreenshot; | ||
_includesViewHierarchyDescription = includesViewHierarchyDescription; | ||
_additionalAttachments = @[]; | ||
|
||
return self; | ||
} | ||
|
||
- (void)excludeScreenshot; | ||
{ | ||
self.includesScreenshot = NO; | ||
} | ||
|
||
- (void)excludeViewHierarchyDescription; | ||
{ | ||
self.includesViewHierarchyDescription = NO; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// ARKEmailBugReportConfiguration_Protected.h | ||
// Aardvark | ||
// | ||
// Created by Nick Entin on 5/14/18. | ||
// Copyright 2018 Square, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
@import Foundation; | ||
|
||
#import "ARKEmailBugReportConfiguration.h" | ||
|
||
|
||
@interface ARKEmailBugReportConfiguration (Protected) | ||
|
||
- (nonnull instancetype)initWithScreenshot:(BOOL)includesScreenshot viewHierarchyDescription:(BOOL)includesViewHierarchyDescription; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.