-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a send feedback button to the login/signup failure dialogs
- Loading branch information
Showing
5 changed files
with
85 additions
and
58 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 |
---|---|---|
|
@@ -4976,63 +4976,7 @@ -(void)actionSheetActionClicked:(NSString *)action { | |
[[NetworkConnection sharedInstance] whois:self->_buffer.name server:ircserver.length?ircserver:nil cid:self->_buffer.cid handler:nil]; | ||
} | ||
} else if([action isEqualToString:@"Send Feedback"]) { | ||
CLS_LOG(@"Feedback Requested"); | ||
NSString *version = [NSString stringWithFormat:@"%@ (%@)",[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"], [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]]; | ||
NSMutableString *report = [[NSMutableString alloc] initWithFormat: | ||
@"Briefly describe the issue below:\n\ | ||
\n\ | ||
\n\ | ||
\n\ | ||
==========\n\ | ||
UID: %@\n\ | ||
App Version: %@\n\ | ||
OS Version: %@\n\ | ||
Device type: %@\n\ | ||
Network type: %@\n", | ||
[[NetworkConnection sharedInstance].userInfo objectForKey:@"id"],version,[UIDevice currentDevice].systemVersion,[UIDevice currentDevice].model,[NetworkConnection sharedInstance].isWifi ? @"Wi-Fi" : @"Mobile"]; | ||
[report appendString:@"==========\nPrefs:\n"]; | ||
[report appendFormat:@"%@\n", [[NetworkConnection sharedInstance] prefs]]; | ||
[report appendString:@"==========\nNSUserDefaults:\n"]; | ||
NSMutableDictionary *d = [NSUserDefaults standardUserDefaults].dictionaryRepresentation.mutableCopy; | ||
[d removeObjectForKey:@"logs_cache"]; | ||
[d removeObjectForKey:@"AppleITunesStoreItemKinds"]; | ||
[report appendFormat:@"%@\n", d]; | ||
|
||
#ifdef ENTERPRISE | ||
NSURL *sharedcontainer = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:@"group.com.irccloud.enterprise.share"]; | ||
#else | ||
NSURL *sharedcontainer = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:@"group.com.irccloud.share"]; | ||
#endif | ||
if(sharedcontainer) { | ||
fflush(stderr); | ||
NSURL *logfile = [[[[NSFileManager defaultManager] URLsForDirectory:NSCachesDirectory inDomains:NSUserDomainMask] objectAtIndex:0] URLByAppendingPathComponent:@"log.txt"]; | ||
|
||
[report appendString:@"==========\nConsole log:\n"]; | ||
[report appendFormat:@"%@\n", [NSString stringWithContentsOfURL:logfile encoding:NSUTF8StringEncoding error:nil]]; | ||
} | ||
|
||
if(report.length) { | ||
MFMailComposeViewController *mfmc = [MFMailComposeViewController canSendMail] ? [[MFMailComposeViewController alloc] init] : nil; | ||
if(mfmc) { | ||
mfmc.mailComposeDelegate = self; | ||
[mfmc setToRecipients:@[@"[email protected]"]]; | ||
[mfmc setSubject:@"IRCCloud for iOS"]; | ||
[mfmc setMessageBody:report isHTML:NO]; | ||
if([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad && ![[UIDevice currentDevice] isBigPhone]) | ||
mfmc.modalPresentationStyle = UIModalPresentationFormSheet; | ||
else | ||
mfmc.modalPresentationStyle = UIModalPresentationCurrentContext; | ||
[self presentViewController:mfmc animated:YES completion:nil]; | ||
} else { | ||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Email Unavailable" message:@"Email is not configured on this device. Please copy the report to the clipboard and send it to [email protected]." preferredStyle:UIAlertControllerStyleAlert]; | ||
[alert addAction:[UIAlertAction actionWithTitle:@"Close" style:UIAlertActionStyleCancel handler:nil]]; | ||
[alert addAction:[UIAlertAction actionWithTitle:@"Copy to Clipboard" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { | ||
UIPasteboard *pb = [UIPasteboard generalPasteboard]; | ||
[pb setValue:report forPasteboardType:(NSString *)kUTTypeUTF8PlainText]; | ||
}]]; | ||
[self presentViewController:alert animated:YES completion:nil]; | ||
} | ||
} | ||
[[NetworkConnection sharedInstance] sendFeedbackReport:self]; | ||
} | ||
|
||
if(!_selectedUser || !_selectedUser.nick || _selectedUser.nick.length < 1) | ||
|
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 |
---|---|---|
|
@@ -15,12 +15,15 @@ | |
// limitations under the License. | ||
|
||
#import <CoreTelephony/CTTelephonyNetworkInfo.h> | ||
#import <MessageUI/MFMailComposeViewController.h> | ||
#import <MobileCoreServices/UTCoreTypes.h> | ||
#import "NetworkConnection.h" | ||
#import "HandshakeHeader.h" | ||
#import "IRCCloudJSONObject.h" | ||
#import "UIColor+IRCCloud.h" | ||
#import "ImageCache.h" | ||
#import "TrustKit.h" | ||
#import "UIDevice+UIDevice_iPhone6Hax.h" | ||
@import Firebase; | ||
@import FirebasePerformance; | ||
|
||
|
@@ -1383,6 +1386,7 @@ -(void)_get:(NSURL *)url handler:(IRCCloudAPIResultHandler)resultHandler { | |
} | ||
|
||
-(void)requestConfigurationWithHandler:(IRCCloudAPIResultHandler)handler { | ||
CLS_LOG(@"Requesting configuration"); | ||
[self _get:[NSURL URLWithString:[NSString stringWithFormat:@"https://%@/config", IRCCLOUD_HOST]] handler:^(IRCCloudJSONObject *object) { | ||
if(object) { | ||
self->_config = object.dictionary; | ||
|
@@ -1418,6 +1422,8 @@ -(void)_configLoaded { | |
[[NSUserDefaults standardUserDefaults] setObject:IRCCLOUD_HOST forKey:@"host"]; | ||
[[NSUserDefaults standardUserDefaults] synchronize]; | ||
} | ||
|
||
CLS_LOG(@"API Host: %@", IRCCLOUD_HOST); | ||
} | ||
|
||
-(void)propertiesForFile:(NSString *)fileID handler:(IRCCloudAPIResultHandler)handler { | ||
|
@@ -2680,4 +2686,65 @@ -(FIRHTTPMetric *)httpMetric { | |
-(void)setHttpMetric:(FIRHTTPMetric *)metric { | ||
self->_httpMetric = metric; | ||
} | ||
|
||
-(void)sendFeedbackReport:(UIViewController *)delegate { | ||
CLS_LOG(@"Feedback Requested"); | ||
NSString *version = [NSString stringWithFormat:@"%@ (%@)",[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"], [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]]; | ||
NSMutableString *report = [[NSMutableString alloc] initWithFormat: | ||
@"Briefly describe the issue below:\n\ | ||
\n\ | ||
\n\ | ||
\n\ | ||
==========\n\ | ||
UID: %@\n\ | ||
App Version: %@\n\ | ||
OS Version: %@\n\ | ||
Device type: %@\n\ | ||
Network type: %@\n", | ||
[[NetworkConnection sharedInstance].userInfo objectForKey:@"id"],version,[UIDevice currentDevice].systemVersion,[UIDevice currentDevice].model,[NetworkConnection sharedInstance].isWifi ? @"Wi-Fi" : @"Mobile"]; | ||
[report appendString:@"==========\nPrefs:\n"]; | ||
[report appendFormat:@"%@\n", [[NetworkConnection sharedInstance] prefs]]; | ||
[report appendString:@"==========\nNSUserDefaults:\n"]; | ||
NSMutableDictionary *d = [NSUserDefaults standardUserDefaults].dictionaryRepresentation.mutableCopy; | ||
[d removeObjectForKey:@"logs_cache"]; | ||
[d removeObjectForKey:@"AppleITunesStoreItemKinds"]; | ||
[report appendFormat:@"%@\n", d]; | ||
|
||
#ifdef ENTERPRISE | ||
NSURL *sharedcontainer = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:@"group.com.irccloud.enterprise.share"]; | ||
#else | ||
NSURL *sharedcontainer = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:@"group.com.irccloud.share"]; | ||
#endif | ||
if(sharedcontainer) { | ||
fflush(stderr); | ||
NSURL *logfile = [[[[NSFileManager defaultManager] URLsForDirectory:NSCachesDirectory inDomains:NSUserDomainMask] objectAtIndex:0] URLByAppendingPathComponent:@"log.txt"]; | ||
|
||
[report appendString:@"==========\nConsole log:\n"]; | ||
[report appendFormat:@"%@\n", [NSString stringWithContentsOfURL:logfile encoding:NSUTF8StringEncoding error:nil]]; | ||
} | ||
|
||
if(report.length) { | ||
MFMailComposeViewController *mfmc = [MFMailComposeViewController canSendMail] ? [[MFMailComposeViewController alloc] init] : nil; | ||
if(mfmc) { | ||
mfmc.mailComposeDelegate = (UIViewController<MFMailComposeViewControllerDelegate> *)delegate; | ||
[mfmc setToRecipients:@[@"[email protected]"]]; | ||
[mfmc setSubject:@"IRCCloud for iOS"]; | ||
[mfmc setMessageBody:report isHTML:NO]; | ||
if([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad && ![[UIDevice currentDevice] isBigPhone]) | ||
mfmc.modalPresentationStyle = UIModalPresentationFormSheet; | ||
else | ||
mfmc.modalPresentationStyle = UIModalPresentationCurrentContext; | ||
[delegate presentViewController:mfmc animated:YES completion:nil]; | ||
} else { | ||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Email Unavailable" message:@"Email is not configured on this device. Please copy the report to the clipboard and send it to [email protected]." preferredStyle:UIAlertControllerStyleAlert]; | ||
[alert addAction:[UIAlertAction actionWithTitle:@"Close" style:UIAlertActionStyleCancel handler:nil]]; | ||
[alert addAction:[UIAlertAction actionWithTitle:@"Copy to Clipboard" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { | ||
UIPasteboard *pb = [UIPasteboard generalPasteboard]; | ||
[pb setValue:report forPasteboardType:(NSString *)kUTTypeUTF8PlainText]; | ||
}]]; | ||
[delegate presentViewController:alert animated:YES completion:nil]; | ||
} | ||
} | ||
|
||
} | ||
@end |