Skip to content

Commit

Permalink
Hide more log if Limited log enable in CI Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
vineetchoudhary committed Jan 14, 2019
1 parent f3785e5 commit c81def5
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 34 deletions.
2 changes: 1 addition & 1 deletion AppBox.xcodeproj/xcshareddata/xcschemes/AppBox.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "ipa=/Users/vineetchoudhary/Desktop/IPAs/PayloadIpad10.0.ipa [email protected],[email protected] message=&apos;Hello there!!&apos;"
argument = "ipa=/Volumes/LongTime/ProjectWorking/fastlane-plugin-appbox/AppBox-Fastlane-Demo-Project/AppBox-Fastlane-Demo.ipa [email protected],[email protected] message=&apos;Hello there!!&apos; keepsamelink=true"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
Expand Down
8 changes: 4 additions & 4 deletions AppBox/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ -(BOOL)application:(NSApplication *)sender openFile:(NSString *)filename{

-(void)openFileWithPath:(NSString *)filePath{
if (self.isReadyToBuild) {
[self addSessionLog:@"AppBox is ready to use open file."];
[ABLog log:@"AppBox is ready to use."];
[[NSNotificationCenter defaultCenter] postNotificationName:abUseOpenFilesNotification object:filePath];
} else {
[[NSNotificationCenter defaultCenter] addObserverForName:abAppBoxReadyToUseNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {
[self addSessionLog:@"AppBox is ready to use open file. [Block]"];
[ABLog log:@"AppBox is ready to use. [Block]"];
[[NSNotificationCenter defaultCenter] postNotificationName:abUseOpenFilesNotification object:filePath];
}];
}
Expand Down Expand Up @@ -180,11 +180,11 @@ -(void)handleProjectAtPath:(NSString *)projectPath {
-(void)handleIPAAtPath:(NSString *)ipaPath {
XCProject *project = [CIProjectBuilder xcProjectWithIPAPath:ipaPath];
if (self.isReadyToBuild) {
[self addSessionLog:@"AppBox is ready to build."];
[self addSessionLog:@"AppBox is ready to upload IPA."];
[[NSNotificationCenter defaultCenter] postNotificationName:abBuildRepoNotification object:project];
} else {
[[NSNotificationCenter defaultCenter] addObserverForName:abAppBoxReadyToUseNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {
[self addSessionLog:@"AppBox is ready to build. [Block]"];
[self addSessionLog:@"AppBox is ready to upload IPA. [Block]"];
[[NSNotificationCenter defaultCenter] postNotificationName:abBuildRepoNotification object:project];
}];
}
Expand Down
36 changes: 19 additions & 17 deletions AppBox/Common/CIProjectBuilder/CIProjectBuilder.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ + (XCProject *)xcProjectWithRepoPath:(NSString *)repoPath andSettingFilePath:(NS
//Dropbox keep same link
if ([projectRawSetting.allKeys containsObject:RepoKeepSameLinkKey]) {
project.keepSameLink = [projectRawSetting valueForKey:RepoKeepSameLinkKey];
project.isKeepSameLinkEnabled = project.keepSameLink.boolValue;
}

//Dropbox folder name
Expand Down Expand Up @@ -157,6 +156,10 @@ + (void)setProjectSettingFromProject:(XCProject *)repoProject toProject:(XCProje
[project setTeamId: [team valueForKey:abTeamId]];
}

[project setKeepSameLink:repoProject.keepSameLink];
[project setBundleDirectory:repoProject.bundleDirectory];
[project setIsKeepSameLinkEnabled:repoProject.keepSameLink.boolValue];

[project setItcUserName:repoProject.itcUserName];
[project setItcPasswod:repoProject.itcPasswod];

Expand Down Expand Up @@ -206,10 +209,10 @@ +(void)setCommonArgumentsToProject:(XCProject *)project {
NSArray *components = [argument componentsSeparatedByString:abArgsScheme];
[ABLog log:@"Scheme Components = %@",components];
if (components.count == 2) {
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Changing project scheme to %@ from %@", [components lastObject], project.selectedSchemes]];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Changing project scheme to \"%@\" from \"%@\"", [components lastObject], project.selectedSchemes]];
project.selectedSchemes = [components lastObject];
} else {
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Invalid Scheme Argument %@",arguments]];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Invalid Scheme Argument \"%@\"",arguments]];
exit(abExitCodeForInvalidCommand);
}
}
Expand All @@ -219,10 +222,10 @@ +(void)setCommonArgumentsToProject:(XCProject *)project {
NSArray *components = [argument componentsSeparatedByString:abArgsBuildType];
[ABLog log:@"BuildType Components = %@",components];
if (components.count == 2) {
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Changing project build type to %@ from %@", [components lastObject], project.buildType]];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Changing project build type to \"%@\" from \"%@\"", [components lastObject], project.buildType]];
project.buildType = [components lastObject];
} else {
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Invalid BuildType Argument %@",arguments]];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Invalid BuildType Argument \"%@\"",arguments]];
exit(abExitCodeForInvalidCommand);
}
}
Expand All @@ -232,10 +235,10 @@ +(void)setCommonArgumentsToProject:(XCProject *)project {
NSArray *components = [argument componentsSeparatedByString:abArgsTeamId];
[ABLog log:@"TeamId Components = %@",components];
if (components.count == 2) {
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Changing project TeamId to %@ from %@", [components lastObject], project.teamId]];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Changing project TeamId to \"%@\" from \"%@\"", [components lastObject], project.teamId]];
project.teamId = [components lastObject];
} else {
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Invalid TeamId Argument %@",arguments]];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Invalid TeamId Argument \"%@\"",arguments]];
exit(abExitCodeForInvalidCommand);
}
}
Expand All @@ -245,10 +248,10 @@ +(void)setCommonArgumentsToProject:(XCProject *)project {
NSArray *components = [argument componentsSeparatedByString:abArgsEmails];
[ABLog log:@"Email Components = %@", components];
if (components.count == 2) {
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Changing project Emails to %@ from %@", [components lastObject], project.emails]];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Changing project Emails to \"%@\" from \"%@\"", [components lastObject], project.emails]];
project.emails = [components lastObject];
} else {
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Invalid Emails Argument %@",arguments]];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Invalid Emails Argument \"%@\"",arguments]];
exit(abExitCodeForInvalidCommand);
}
}
Expand All @@ -258,10 +261,10 @@ +(void)setCommonArgumentsToProject:(XCProject *)project {
NSArray *components = [argument componentsSeparatedByString:abArgsPersonalMessage];
[ABLog log:@"Personal Message Components = %@", components];
if (components.count == 2) {
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Changing project personal message to %@ from %@", [components lastObject], project.personalMessage]];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Changing project personal message to \"%@\" from \"%@\"", [components lastObject], project.personalMessage]];
project.personalMessage = [components lastObject];
} else {
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Invalid Personal Message Argument %@",arguments]];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Invalid Personal Message Argument \"%@\"",arguments]];
exit(abExitCodeForInvalidCommand);
}
}
Expand All @@ -271,11 +274,10 @@ +(void)setCommonArgumentsToProject:(XCProject *)project {
NSArray *components = [argument componentsSeparatedByString:abArgsKeepSameLink];
[ABLog log:@"Keep Same Links Components = %@", components];
if (components.count == 2) {
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Changing Keep Same Link to %@ from %@", [components lastObject], project.personalMessage]];
project.keepSameLink = [[components lastObject] isEqualToString:@"0"] ? @0 : @1;
project.isKeepSameLinkEnabled = project.keepSameLink.boolValue;
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Changing Keep Same Link to \"%@\" from \"%@\"", [components lastObject], project.keepSameLink]];
project.keepSameLink = ([[components lastObject] isEqualToString:@"0"] || ((BOOL)[[components lastObject] boolValue]) == NO) ? @0 : @1;
} else {
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Invalid Keep Same Link Argument %@",arguments]];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Invalid Keep Same Link Argument \"%@\"",arguments]];
exit(abExitCodeForInvalidCommand);
}
}
Expand All @@ -285,12 +287,12 @@ +(void)setCommonArgumentsToProject:(XCProject *)project {
NSArray *components = [argument componentsSeparatedByString:abArgsDropBoxFolderName];
[ABLog log:@"Dropbox folder Components = %@", components];
if (components.count == 2) {
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Changing Dropbox folder name to %@ from %@", [components lastObject], project.personalMessage]];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Changing Dropbox folder name to \"%@\" from \"%@\"", [components lastObject], project.personalMessage]];
NSString *bundlePath = [NSString stringWithFormat:@"/%@",[components lastObject]];
bundlePath = [bundlePath stringByReplacingOccurrencesOfString:@" " withString:abEmptyString];
project.bundleDirectory = [NSURL URLWithString:bundlePath];
} else {
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Invalid Dropbox Folder Name Argument %@",arguments]];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Invalid Dropbox Folder Name Argument \"%@\"",arguments]];
exit(abExitCodeForInvalidCommand);
}
}
Expand Down
10 changes: 5 additions & 5 deletions AppBox/Common/UploadManager/UploadManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ -(void)uploadIPAFile:(NSURL *)ipaFileURL{
}

//get info.plist
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Final Info.plist path = %@",infoPlistPath]];
[ABLog log:@"Final Info.plist path = %@",infoPlistPath];
[self.project setIpaInfoPlist: [NSDictionary dictionaryWithContentsOfFile:[NSTemporaryDirectory() stringByAppendingPathComponent:infoPlistPath]]];

//show error if info.plist is nil or invalid
Expand Down Expand Up @@ -501,7 +501,7 @@ -(void)dbUploadFile:(NSString *)file to:(NSString *)path mode:(DBFILESWriteMode
//Track response with result and error
setResponseBlock:^(DBFILESFileMetadata * _Nullable response, DBFILESUploadError * _Nullable routeError, DBRequestError * _Nullable error) {
if (response) {
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Uploaded file metadata = %@", response]];
[ABLog log:@"Uploaded file metadata = %@", response];

//AppInfo.json file uploaded and creating shared url
if(self.dbFileType == DBFileTypeJson){
Expand Down Expand Up @@ -647,15 +647,15 @@ -(void)handleSharedURLResult:(NSString *)url{
//if same link enable load appinfo.json otherwise Create short shareable url of manifest
else if (self.dbFileType == DBFileTypeManifest){
NSString *shareableLink = [url substringToIndex:url.length-5];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Manifest Sharable link - %@",shareableLink]];
[ABLog log:@"Manifest Sharable link - %@",shareableLink];
self.project.manifestFileSharableURL = [NSURL URLWithString:shareableLink];
if(self.project.isKeepSameLinkEnabled){
//Download previously uploaded appinfo
DBFILESListRevisionsMode *revisionMode = [[DBFILESListRevisionsMode alloc] initWithPath];
[[[DBClientsManager authorizedClient].filesRoutes listRevisions:self.project.dbAppInfoJSONFullPath.absoluteString mode:revisionMode limit:@1] setResponseBlock:^(DBFILESListRevisionsResult * _Nullable response, DBFILESListRevisionsError * _Nullable routeError, DBRequestError * _Nullable error) {
//check there is any rev available
if (response && response.isDeleted.boolValue == NO && response.entries.count > 0){
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Loaded Meta Data %@",response]];
[ABLog log:@"Loaded Meta Data %@",response];
self.project.uniqueLinkJsonMetaData = [response.entries firstObject];
}

Expand All @@ -670,7 +670,7 @@ -(void)handleSharedURLResult:(NSString *)url{
//create app info file short sharable url
else if (self.dbFileType == DBFileTypeJson){
NSString *shareableLink = [url substringToIndex:url.length-5];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"APPInfo Sharable link - %@",shareableLink]];
[ABLog log:@"APPInfo Sharable link - %@",shareableLink];
self.project.uniquelinkShareableURL = [NSURL URLWithString:shareableLink];
NSMutableDictionary *dictUniqueFile = [[self getUniqueJsonDict] mutableCopy];
[dictUniqueFile setObject:shareableLink forKey:UNIQUE_LINK_SHARED];
Expand Down
4 changes: 2 additions & 2 deletions AppBox/Common/XcodeHandler/XCHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ +(void)getXCodePathWithCompletion:(void (^) (NSString *xcodePath, NSString *appl
+(NSString *)checkXCodePath:(NSString *)xcodePath {
xcodePath = [xcodePath stringByRemovingPercentEncoding];
if ([[NSFileManager defaultManager] fileExistsAtPath:xcodePath]){
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"XCode = %@", xcodePath]];
[ABLog log:@"XCode = %@", xcodePath];
return xcodePath;
}else{
return nil;
Expand All @@ -38,7 +38,7 @@ +(NSString *)checkXCodePath:(NSString *)xcodePath {
+(NSString *)checkALPath:(NSString *)xcodePath {
NSString *alPath = [[xcodePath stringByAppendingPathComponent:abApplicationLoaderALToolLocation] stringByRemovingPercentEncoding];
if ([[NSFileManager defaultManager] fileExistsAtPath:alPath]){
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Application Loader = %@", alPath]];
[ABLog log:@"Application Loader = %@", alPath];
return alPath;
} else {
return nil;
Expand Down
4 changes: 2 additions & 2 deletions AppBox/Model/ProjectModel/XCProject.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ -(void)createManifestWithIPAURL:(NSURL *)ipaURL completion:(void(^)(NSURL *manif
NSMutableDictionary *manifestDict = [[NSMutableDictionary alloc] init];
[manifestDict setValue:[NSArray arrayWithObjects:mainItemDict, nil] forKey:@"items"];

[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"\n\n======\nManifest\n======\n\n %@",manifestDict]];
[ABLog log:@"\n\n======\nManifest\n======\n\n %@",manifestDict];

NSString *manifestPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"manifest.plist"];
if ([manifestDict writeToFile:manifestPath atomically:YES]){
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Menifest File Created and Saved at %@", manifestPath]];
[ABLog log:@"Menifest File Created and Saved at %@", manifestPath];
dispatch_async(dispatch_get_main_queue(), ^{
completion([NSURL fileURLWithPath:manifestPath]);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,10 @@ - (void)initIPAUploadProcessForURL:(NSURL *)ipaURL {
[buttonSendMail setState:NSOnState];
}
[project setIpaFullPath:ipaURL];
[selectedFilePath setURL:ipaURL]; 
[selectedFilePath setURL:ipaURL];
[textFieldEmail setStringValue:project.emails];
[textFieldMessage setStringValue:project.personalMessage];
[buttonUniqueLink setState:project.keepSameLink.boolValue ? NSOnState : NSOffState];
[self actionButtonTapped:buttonAction];
}

Expand Down
4 changes: 2 additions & 2 deletions AppBox/ViewController/MenuHandler/NSApplication+MenuHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ - (void)updateDropboxUsage{
[self updateDropboxUsageFileButton];

//log space usage
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Used Space : %@MB", usage]];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"Available Space : %@MB", allocated]];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"DropBox Used Space : %@MB", usage]];
[[AppDelegate appDelegate] addSessionLog:[NSString stringWithFormat:@"DropBox Available Space : %@MB", allocated]];

//check if dopbox running out of space
if ((allocated.integerValue - usage.integerValue) < abDropboxOutOfSpaceWarningSize){
Expand Down

0 comments on commit c81def5

Please sign in to comment.