Skip to content

Commit

Permalink
Remove tell friends and website
Browse files Browse the repository at this point in the history
  • Loading branch information
lilthree committed Dec 29, 2019
1 parent b067d57 commit a281b4c
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 331 deletions.
1 change: 1 addition & 0 deletions seafile/SeafDetailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ - (void)sendMailInApp:(NSString *)name shareLink:(NSString *)shareLink
SeafAppDelegate *appdelegate = (SeafAppDelegate *)[[UIApplication sharedApplication] delegate];
MFMailComposeViewController *mailPicker = appdelegate.globalMailComposer;
mailPicker.mailComposeDelegate = self;
mailPicker.modalPresentationStyle = UIModalPresentationFullScreen;

[mailPicker setSubject:[NSString stringWithFormat:NSLocalizedString(@"File '%@' is shared with you using %@", @"Seafile"), name, APP_NAME]];
NSString *emailBody = [NSString stringWithFormat:NSLocalizedString(@"Hi,<br/><br/>Here is a link to <b>'%@'</b> in my %@:<br/><br/> <a href=\"%@\">%@</a>\n\n", @"Seafile"), name, APP_NAME, shareLink, shareLink];
Expand Down
1 change: 1 addition & 0 deletions seafile/SeafFileViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,7 @@ - (void)sendMailInApp:(SeafBase *)entry
}
[mailPicker setSubject:emailSubject];
[mailPicker setMessageBody:emailBody isHTML:YES];
mailPicker.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:mailPicker animated:YES completion:nil];
}

Expand Down
81 changes: 2 additions & 79 deletions seafile/SeafSettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,28 +63,23 @@
};

enum {
CELL_INVITATION = 0,
CELL_WEBSITE,
CELL_SERVER,
CELL_SERVER = 0,
CELL_VERSION,
CELL_PRIVACY,
};

#define SEAFILE_SITE @"http://www.seafile.com"
#define MSG_RESET_UPLOADED NSLocalizedString(@"Do you want reset the uploaded photos?", @"Seafile")
#define MSG_CLEAR_CACHE NSLocalizedString(@"Are you sure to clear all the cache?", @"Seafile")
#define MSG_LOG_OUT NSLocalizedString(@"Are you sure to log out?", @"Seafile")

@interface SeafSettingsViewController ()<SeafPhotoSyncWatcherDelegate, MFMailComposeViewControllerDelegate, CLLocationManagerDelegate>
@interface SeafSettingsViewController ()<SeafPhotoSyncWatcherDelegate, CLLocationManagerDelegate>
@property (strong, nonatomic) IBOutlet UITableViewCell *nameCell;
@property (strong, nonatomic) IBOutlet UITableViewCell *usedspaceCell;
@property (strong, nonatomic) IBOutlet UITableViewCell *serverCell;
@property (strong, nonatomic) IBOutlet UITableViewCell *cacheCell;
@property (strong, nonatomic) IBOutlet UITableViewCell *versionCell;
@property (strong, nonatomic) IBOutlet UITableViewCell *autoSyncCell;
@property (strong, nonatomic) IBOutlet UITableViewCell *syncRepoCell;
@property (strong, nonatomic) IBOutlet UITableViewCell *tellFriendCell;
@property (strong, nonatomic) IBOutlet UITableViewCell *websiteCell;
@property (strong, nonatomic) IBOutlet UITableViewCell *videoSyncCell;
@property (strong, nonatomic) IBOutlet UITableViewCell *backgroundSyncCell;
@property (strong, nonatomic) IBOutlet UITableViewCell *clearEncRepoPasswordCell;
Expand Down Expand Up @@ -310,9 +305,6 @@ - (void)viewDidLoad
_autoClearPasswdLabel.text = NSLocalizedString(@"Auto clear passwords", @"Auto cleay library password");
_localDecryLabel.text = NSLocalizedString(@"Local decryption", @"Local decryption");

_tellFriendCell.textLabel.text = [NSString stringWithFormat:NSLocalizedString(@"Tell Friends about %@", @"Seafile"), APP_NAME];
_websiteCell.textLabel.text = NSLocalizedString(@"Website", @"Seafile");
_websiteCell.detailTextLabel.text = @"www.seafile.com";
_serverCell.textLabel.text = NSLocalizedString(@"Server", @"Seafile");
_versionCell.textLabel.text = NSLocalizedString(@"Version", @"Seafile");
_logOutLabel.text = NSLocalizedString(@"Log out", @"Seafile");
Expand Down Expand Up @@ -506,14 +498,6 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
} else if (indexPath.section == SECTION_ABOUT) {
_state = (int)indexPath.row;
switch ((indexPath.row)) {
case CELL_INVITATION:
[self sendMailInApp];
break;

case CELL_WEBSITE:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:SEAFILE_SITE]];
break;

case CELL_SERVER:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/", _connection.address]]];
break;
Expand Down Expand Up @@ -594,67 +578,6 @@ - (void)viewDidUnload {
[super viewDidUnload];
}


#pragma mark - sena mail inside app
- (void)sendMailInApp
{
Class mailClass = NSClassFromString(@"MFMailComposeViewController");
if (!mailClass) {
[self alertWithTitle:NSLocalizedString(@"This function is not supportted yet", @"Seafile")];
return;
}
if (![mailClass canSendMail]) {
[self alertWithTitle:NSLocalizedString(@"The mail account has not been set yet", @"Seafile")];
return;
}
[self displayMailPicker];
}

- (void)configureInvitationMail:(MFMailComposeViewController *)mailPicker
{
[mailPicker setSubject:[NSString stringWithFormat:NSLocalizedString(@"%@ invite you to %@", @"Seafile"), NSFullUserName(), APP_NAME]];
NSString *emailBody = [NSString stringWithFormat:NSLocalizedString(@"Hey there!<br/><br/> I've been using %@ and thought you might like it. It is a free way to bring all you files anywhere and share them easily.<br/><br/>Go to the official website of %@:</br></br> <a href=\"%@\">%@</a>\n\n", @"Seafile"), APP_NAME, APP_NAME, SEAFILE_SITE, SEAFILE_SITE];

[mailPicker setMessageBody:emailBody isHTML:YES];
}

- (void)displayMailPicker
{
SeafAppDelegate *appdelegate = (SeafAppDelegate *)[[UIApplication sharedApplication] delegate];
MFMailComposeViewController *mailPicker = appdelegate.globalMailComposer;
mailPicker.mailComposeDelegate = self;
[self configureInvitationMail:mailPicker];
[appdelegate.window.rootViewController presentViewController:mailPicker animated:YES completion:nil];
}

#pragma mark - MFMailComposeViewControllerDelegate
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
NSString *msg;
switch (result) {
case MFMailComposeResultCancelled:
msg = @"cancalled";
break;
case MFMailComposeResultSaved:
msg = @"saved";
break;
case MFMailComposeResultSent:
msg = @"sent";
break;
case MFMailComposeResultFailed:
msg = @"failed";
break;
default:
msg = @"";
break;
}
Debug("state=%d:send mail %@\n", _state, msg);
[self dismissViewControllerAnimated:YES completion:^{
SeafAppDelegate *appdelegate = (SeafAppDelegate *)[[UIApplication sharedApplication] delegate];
[appdelegate cycleTheGlobalMailComposer];
}];
}

#pragma mark - SeafDirDelegate
- (void)setSyncRepo:(SeafRepo *)repo
{
Expand Down
Loading

0 comments on commit a281b4c

Please sign in to comment.