Changeset 1387 for trunk


Ignore:
Timestamp:
05/28/19 11:15:25 (5 years ago)
Author:
bln4
Message:

When sharing contact details. If we can detect that the recipient is present on the same filesystem as the sender (due to the presence of a resources-recipient directory) then instead of providing directions, just copy the credentials-sender directory.

Location:
trunk/src/org/expeditee/auth
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/auth/Actions.java

    r1386 r1387  
    11package org.expeditee.auth;
    22
    3 import java.awt.Desktop;
    43import java.io.File;
    54import java.io.FileNotFoundException;
    65import java.io.IOException;
    7 import java.net.URI;
    8 import java.net.URISyntaxException;
    9 import java.net.URL;
    106import java.nio.file.Files;
    117import java.nio.file.Path;
     
    4440import org.expeditee.auth.account.Authenticate;
    4541import org.expeditee.auth.account.Authenticate.AuthenticationResult;
     42import org.expeditee.auth.account.Contacts;
    4643import org.expeditee.auth.account.Create;
    4744import org.expeditee.auth.account.Create.CreateResult;
     
    208205        }
    209206        public static String AuthDistributeContactDetails(String username) {
    210                 StringBuilder sb = new StringBuilder();
    211                 String nl = System.getProperty("line.separator");
    212                 String me = UserSettings.UserName.get();
    213                 Path profilePath = Paths.get(FrameIO.PROFILE_PATH).resolve(me);
    214                 try {
    215                         Desktop.getDesktop().open(profilePath.toFile());
    216                         sb.append("1. We have opened your profile directory for you.  Tab to it and right click on the " + me + "-credentials directory." + nl);
    217                 } catch (IOException e) {
    218                         sb.append("1. Open your profile directory (" + profilePath + ") and right click on the " + me + "-credentials directory." + nl);
    219                 }
    220                
    221                 sb.append("2. Click on 'Share with Google Drive'." + nl);
    222                 sb.append("3. Enter " + username + "'s in the text box." + nl);
    223                 sb.append("4. Click on the button to the right of the text box in order to set the share to 'View Only'." + nl);
    224                 sb.append("5. Optionally add a note for " + username + " to read.  Click the send button.");
    225                
    226                 return sb.toString();
     207                return Contacts.distributeContactDetails(username);
    227208        }
    228209        public static void AuthAddContactDetails() {
     
    230211        }
    231212        public static String AuthAddContactDetails(String username) {
    232                 StringBuilder sb = new StringBuilder();
    233                 String nl = System.getProperty("line.separator");
    234                 String me = UserSettings.UserName.get();
    235                 String driveSharedWithMeString = "https://drive.google.com/drive/shared-with-me";
    236                 try {
    237                         URI driveSharedWithMeURL = new URL(driveSharedWithMeString).toURI();
    238                         Desktop.getDesktop().browse(driveSharedWithMeURL);
    239                         sb.append("1. We have opened Google Drive to the 'Shared With Me' page in your browser.  Right click on " + username + "-credentials and click on 'Add To My Drive'." + nl);
    240                 } catch (IOException | URISyntaxException e) {
    241                         sb.append("1. Open your web browser to " + driveSharedWithMeString + ".  Right click on " + username + "-credentials and click on 'Add To My Drive'." + nl);
    242                 }
    243                
    244                 sb.append("2. Click organise and navigate the dialog to resources-" + me + "/contacts and click the 'Move Here' button to relocate your copy of " + username + "'s credentials folder.");
    245                
    246                 return sb.toString();
     213                return Contacts.addContactDetails(username);
    247214        }
    248215        //      End Making Contacts Actions
Note: See TracChangeset for help on using the changeset viewer.