Skip to content

Commit

Permalink
Public source code release.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewromanenco committed Jul 7, 2013
0 parents commit 744b673
Show file tree
Hide file tree
Showing 175 changed files with 21,481 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Xcode
.DS_Store
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap

Binary file added [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Default-Landscape@2x~ipad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Default-Landscape~ipad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Default-Portrait@2x~ipad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Default-Portrait~ipad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added [email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
597 changes: 597 additions & 0 deletions Gitt.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Gitt.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions Gitt/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// AppDelegate.h
// Git ios app
//
// Created by Andrew Romanenco on 2013-06-23.
// Copyright (c) 2013 Andrew Romanenco. All rights reserved.
//
// This file is part of Git ios app.
//
// GitApp is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GitApp is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with GitApp. If not, see <http://www.gnu.org/licenses/>.
//

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end
62 changes: 62 additions & 0 deletions Gitt/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//
// AppDelegate.m
// Git ios app
//
// Created by Andrew Romanenco on 2013-06-23.
// Copyright (c) 2013 Andrew Romanenco. All rights reserved.
//
// This file is part of Git ios app.
//
// GitApp is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GitApp is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with GitApp. If not, see <http://www.gnu.org/licenses/>.
//


#import "AppDelegate.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
38 changes: 38 additions & 0 deletions Gitt/BrowseController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// BrowseController.h
// Git iso app
//
// Created by Andrew Romanenco on 2013-06-27.
// Copyright (c) 2013 Andrew Romanenco. All rights reserved.
//
// This file is part of Git ios app.
//
// GitApp is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GitApp is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with GitApp. If not, see <http://www.gnu.org/licenses/>.
//


#import <UIKit/UIKit.h>
#import "LocalDAO.h"

//
// File listing from sandbox file storage.
//
@interface BrowseController : UITableViewController <UIActionSheetDelegate, UIAlertViewDelegate>

@property(strong) GitRepo *repo;
@property(strong) NSString *path;

- (IBAction)actionMenu:(id)sender;

@end
198 changes: 198 additions & 0 deletions Gitt/BrowseController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
//
// BrowseController.m
// Git ios app
//
// Created by Andrew Romanenco on 2013-06-27.
// Copyright (c) 2013 Andrew Romanenco. All rights reserved.
//
// This file is part of Git ios app.
//
// GitApp is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GitApp is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with GitApp. If not, see <http://www.gnu.org/licenses/>.
//


#import "BrowseController.h"
#import "SourceViewController.h"
#import "ObjectiveGit/ObjectiveGit.h"
#import "CheckoutController.h"
#import "GitActionController.h"

#define __SEGUE_CHECKOUT__ @"segueCheckout"
#define __SEGUE_GIT_ACTION__ @"segueGitAction"
#define __SEGUE_SOURCE__ @"segueViewSource"

@interface BrowseController ()

- (void)readCurrentFolder;
- (bool)isFolder:(NSString*)path;

@end

@implementation BrowseController {

NSString *root;
NSString *currentDir;
int deep;
NSArray *list;
UIAlertView *busy;
bool refreshNextShow;

}

#pragma mark Init

- (void)viewDidLoad
{
[super viewDidLoad];
refreshNextShow = YES;
root = [self.repo fullPathToThisRepo];
}

- (void)viewWillAppear:(BOOL)animated {
if (refreshNextShow) {
refreshNextShow = NO;

currentDir = root;
deep = 0;
[self readCurrentFolder];

NSURL *repoUrl = [NSURL fileURLWithPath:root];
NSError *err;
GTRepository *git = [GTRepository repositoryWithURL:repoUrl error:&err];
if (!err) {
NSString *currentBranch = [git currentRefNameWithError:&err];
self.title = [NSString stringWithFormat:@"%@ (%@)", self.repo.name, [currentBranch lastPathComponent]];
} else {
self.title = self.repo.name;
}
[self.tableView reloadData];
}
}

- (void)readCurrentFolder {
list = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:currentDir error:nil];
list = [NSMutableArray arrayWithArray:list];

if (deep == 0) {
[(NSMutableArray*)list removeObject:@".git"]; // user should not browse in .git
} else {
[(NSMutableArray*)list insertObject:@".." atIndex:0];
}
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [list count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
NSString *item = [list objectAtIndex:indexPath.row];
NSString *path = [currentDir stringByAppendingPathComponent:item];
if ([self isFolder:path]) {
cell.textLabel.text = [NSString stringWithFormat:@"/%@", item];
} else {
cell.textLabel.text = item;
}
return cell;
}

#pragma mark Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];

if (deep && indexPath.row == 0) { // upper dir .. is always first
deep--;
currentDir = [currentDir stringByDeletingLastPathComponent];
[self readCurrentFolder];
[self.tableView reloadData];
} else {
NSString *path = [currentDir stringByAppendingPathComponent:[list objectAtIndex:indexPath.row]];
if ([self isFolder:path]) {
deep++;
currentDir = path;
[self readCurrentFolder];
[self.tableView reloadData];
} else {
[self performSegueWithIdentifier:__SEGUE_SOURCE__ sender:path];
}
}
}

#pragma mark Segue

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if([segue.identifier isEqualToString:__SEGUE_SOURCE__]) {

SourceViewController *controller = segue.destinationViewController;
controller.path = sender;

} else if ([segue.identifier isEqualToString:__SEGUE_CHECKOUT__]) {

CheckoutController *controller = segue.destinationViewController;
controller.repo = self.repo;

} else if ([segue.identifier isEqualToString:__SEGUE_GIT_ACTION__]) {

GitActionController *controller = segue.destinationViewController;
controller.repo = self.repo;
controller.command = pull;

}
}

#pragma mark Action

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
switch (buttonIndex) {
case 0:// Checkout
refreshNextShow = YES; // refresh next time
[self performSegueWithIdentifier:__SEGUE_CHECKOUT__ sender:nil];
break;

case 1:// Pull
refreshNextShow = YES;
[self performSegueWithIdentifier:__SEGUE_GIT_ACTION__ sender:nil];
break;
}
}

- (IBAction)actionMenu:(id)sender {
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:nil
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Checkout...", @"Pull from origin", nil];
[actionSheet showInView:self.view];
}

- (bool)isFolder:(NSString*)path {
BOOL isDir;
[NSFileManager.defaultManager fileExistsAtPath:path isDirectory:&isDir];
return isDir;
}

@end
35 changes: 35 additions & 0 deletions Gitt/CheckoutController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// CheckoutController.h
// Git ios app
//
// Created by Andrew Romanenco on 2013-07-03.
// Copyright (c) 2013 Andrew Romanenco. All rights reserved.
//
// This file is part of Git ios app.
//
// GitApp is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GitApp is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with GitApp. If not, see <http://www.gnu.org/licenses/>.
//


#import <UIKit/UIKit.h>
#import "LocalDAO.h"

//
// Display all remote branches and tags. Checkout when user taps.
//
@interface CheckoutController : UITableViewController

@property(strong) GitRepo *repo;

@end
Loading

0 comments on commit 744b673

Please sign in to comment.