Skip to content

Commit 0089e1c

Browse files
authored
Merge pull request #31 from ngageoint/brent_contact_us_master
Added Contact Us button
2 parents a0900bf + ba110b5 commit 0089e1c

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

mapcache-ios.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,7 @@
11261126
);
11271127
inputPaths = (
11281128
"${PODS_ROOT}/Target Support Files/Pods-mapcache-ios/Pods-mapcache-ios-resources.sh",
1129+
"${PODS_CONFIGURATION_BUILD_DIR}/MatomoTracker/MatomoTracker_Privacy.bundle",
11291130
"${PODS_CONFIGURATION_BUILD_DIR}/PROJ/PROJ.bundle",
11301131
"${PODS_CONFIGURATION_BUILD_DIR}/gars-ios/gars-ios.bundle",
11311132
"${PODS_CONFIGURATION_BUILD_DIR}/geopackage-ios/geopackage-ios.bundle",
@@ -1134,6 +1135,7 @@
11341135
);
11351136
name = "[CP] Copy Pods Resources";
11361137
outputPaths = (
1138+
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MatomoTracker_Privacy.bundle",
11371139
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/PROJ.bundle",
11381140
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gars-ios.bundle",
11391141
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/geopackage-ios.bundle",

mapcache-ios/settings/MCSettingsViewController.m

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
NSString *const SHOW_NOTICE = @"showNotice";
1313
NSString *const SHOW_TILE_URL_MANAGER =@"showTileURLManager";
14+
NSString *const CONTACT_US = @"contactUs";
1415

1516
@interface MCSettingsViewController ()
1617
@property (nonatomic, strong) NSMutableArray *cellArray;
@@ -225,6 +226,21 @@ - (void)initCellArray {
225226
}
226227
[bottomCells addObject:_zoomSwitchCell];
227228

229+
MCButtonCell *contactUsButtonCell = [self.tableView dequeueReusableCellWithIdentifier:@"buttonCell"];
230+
[contactUsButtonCell setButtonLabel:@"Contact Us"];
231+
contactUsButtonCell.action = CONTACT_US;
232+
contactUsButtonCell.delegate = self;
233+
234+
[contactUsButtonCell useSecondaryColors];
235+
236+
UIImage *envelopeIcon = [UIImage systemImageNamed:@"envelope.fill"];
237+
[contactUsButtonCell.button setImage:envelopeIcon forState:UIControlStateNormal];
238+
239+
contactUsButtonCell.button.tintColor = contactUsButtonCell.button.titleLabel.textColor;
240+
241+
contactUsButtonCell.button.imageEdgeInsets = UIEdgeInsetsMake(0, -4, 0, 4);
242+
[bottomCells addObject:contactUsButtonCell];
243+
228244
MCButtonCell *showNoticesButtonCell = [self.tableView dequeueReusableCellWithIdentifier:@"buttonCell"];
229245
[showNoticesButtonCell setButtonLabel:@"About MapCache"];
230246
showNoticesButtonCell.action = SHOW_NOTICE;
@@ -551,13 +567,27 @@ - (void) switchChanged:(id)sender {
551567

552568
}
553569

570+
- (void)openMailClient {
571+
NSString *email = @"[email protected]";
572+
NSString *encoded = [NSString stringWithFormat:@"mailto:%@", email];
573+
NSString *escaped = [encoded stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
574+
NSURL *url = [NSURL URLWithString:escaped];
575+
576+
if ([[UIApplication sharedApplication] canOpenURL:url]) {
577+
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
578+
} else {
579+
NSLog(@"Cannot open mail client");
580+
}
581+
}
554582

555583
#pragma mark - ButtonCell delegate
556584
- (void)performButtonAction:(NSString *)action {
557585
if ([action isEqualToString:SHOW_NOTICE]) {
558586
[self.settingsDelegate showNoticeAndAttributeView];
559587
} else if ([action isEqualToString:SHOW_TILE_URL_MANAGER]) {
560588
[self.settingsDelegate showTileURLManager];
589+
} else if ([action isEqualToString:CONTACT_US]) {
590+
[self openMailClient];
561591
}
562592
}
563593

0 commit comments

Comments
 (0)