Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Auto-Capture Mode #21

Merged
merged 1 commit into from

2 participants

@vermiculus

Added Autocapture Mode that does exactly what was asked for in issue/request #14 -- but more polishing could be done

  • minimum time elapse for a new note to be created rather than just going back to where you were (the 'oops, I nicked the home button' scenario)
  • true cancel functionality in the newNoteController (it could get a little annoying to keep having to delete such an auto-created note and have the sync count keep incrementing)

(screen shot)

vermiculus Added Autocapture Mode that does exactly what was asked for in issue/…
…request #14 -- although I think two things should be done further: a) minimum time elapse for a new note to be created rather than just going back to where you were (the 'oops, I nicked the home button' scenario) and b) true cancel functionality in the `newNoteController`.
a8b8a21
@webframp
Owner

nicely done. I'll take a look and test this branch over the weekend when I have some time.

@vermiculus

Thanks a bunch!

@vermiculus vermiculus commented on the diff
Classes/Settings/SettingsController.m
@@ -134,7 +134,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
return 2;
break;
case SettingsGroup:
- return 1;
+ return 2;

Although, I do think that these should be #define constants up at the top of the file. This kind of thing is just asking for bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@webframp
Owner

Testing this weekend, will try and get it merged soon pending results. Thanks!

@webframp
Owner

Looks good to me, haven't heard much from anyone else about testing but I'll go ahead and get this merged in to develop.

@webframp webframp merged commit 5bda921 into MobileOrg:develop
@vermiculus vermiculus deleted the vermiculus:feature/auto-capture-mode branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 15, 2013
  1. Added Autocapture Mode that does exactly what was asked for in issue/…

    vermiculus authored
    …request #14 -- although I think two things should be done further: a) minimum time elapse for a new note to be created rather than just going back to where you were (the 'oops, I nicked the home button' scenario) and b) true cancel functionality in the `newNoteController`.
This page is out of date. Refresh to see the latest.
View
12 Classes/MobileOrgAppDelegate.m
@@ -34,6 +34,7 @@
#import "DataUtils.h"
#import "Reachability.h"
#import "SessionManager.h"
+#import "Settings.h"
@interface MobileOrgAppDelegate(private)
- (void)updateInterfaceWithReachability:(Reachability*)curReach;
@@ -79,6 +80,17 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application {
[window makeKeyAndVisible];
}
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+ if ([[Settings instance] launchTab] == LaunchTabCapture) {
+ // TODO Add some sort of minimum time-lapse to activate
+ // that is, don't create a new capture if the button was hit accidentally
+ // (Allow maybe a minute or two before this setting 'sctivates' again)
+ // (this can be done by storing the time and doing a difference.)
+ [[self tabBarController] setSelectedIndex:1]; // Capture!!
+ [[self noteListController] addNote];
+ }
+}
+
/**
applicationWillTerminate: saves changes in the application's managed object context before the application terminates.
*/
View
8 Classes/Settings/Settings.h
@@ -34,6 +34,11 @@ typedef enum {
ServerModeDropbox
} ServerMode;
+typedef enum {
+ LaunchTabOutline = 0,
+ LaunchTabCapture,
+} LaunchTab;
+
@interface Settings : NSObject {
NSURL *indexUrl;
@@ -51,6 +56,8 @@ typedef enum {
AppBadgeMode appBadgeMode;
ServerMode serverMode;
+
+ LaunchTab launchTab;
NSString *dropboxIndex;
@@ -68,6 +75,7 @@ typedef enum {
@property (nonatomic, copy) NSMutableArray *priorities;
@property (nonatomic) AppBadgeMode appBadgeMode;
@property (nonatomic) ServerMode serverMode;
+@property (nonatomic) LaunchTab launchTab;
@property (nonatomic, copy) NSString *dropboxIndex;
@property (nonatomic, copy) NSString *encryptionPassword;
View
13 Classes/Settings/Settings.m
@@ -46,6 +46,7 @@
static NSString *kPrioritiesKey = @"Priorities";
static NSString *kAppBadgeModeKey = @"AppBadgeMode";
static NSString *kServerModeKey = @"ServerMode";
+static NSString *kLaunchTabKey = @"LaunchTab";
static NSString *kDropboxIndexKey = @"DropboxIndex";
static NSString *kEncryptionPassKey = @"EncryptionPassword";
@@ -62,6 +63,7 @@ @implementation Settings
@synthesize priorities;
@synthesize appBadgeMode;
@synthesize serverMode;
+@synthesize launchTab;
@synthesize dropboxIndex;
@synthesize encryptionPassword;
@@ -131,6 +133,11 @@ - (id)init {
if (!serverMode) {
self.serverMode = ServerModeWebDav;
}
+
+ launchTab = [[NSUserDefaults standardUserDefaults] integerForKey:kLaunchTabKey];
+ if (!serverMode) {
+ self.launchTab = LaunchTabOutline;
+ }
dropboxIndex = [[NSUserDefaults standardUserDefaults] objectForKey:kDropboxIndexKey];
[dropboxIndex retain];
@@ -309,6 +316,12 @@ - (void)setServerMode:(ServerMode)newServerMode {
[[NSUserDefaults standardUserDefaults] synchronize];
}
+- (void)setLaunchTab:(LaunchTab)newLaunchTab {
+ launchTab = newLaunchTab;
+ [[NSUserDefaults standardUserDefaults] setInteger:launchTab forKey:kLaunchTabKey];
+ [[NSUserDefaults standardUserDefaults] synchronize];
+}
+
- (void)setDropboxIndex:(NSString*)anIndex {
[dropboxIndex release];
dropboxIndex = [anIndex copy];
View
36 Classes/Settings/SettingsController.m
@@ -134,7 +134,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
return 2;
break;
case SettingsGroup:
- return 1;
+ return 2;

Although, I do think that these should be #define constants up at the top of the file. This kind of thing is just asking for bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
break;
case EncryptionGroup:
return 1;
@@ -393,6 +393,31 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
return cell;
}
+ case 1:
+ {
+ static NSString *CellIdentifier = @"SettingsLaunchTabCell";
+
+ UISwitch *launchTabSwitch = nil;
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
+ if (cell == nil) {
+ cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
+ if (IsIpad())
+ launchTabSwitch = [[[UISwitch alloc] initWithFrame:CGRectMake(620,10,200,25)] autorelease];
+ else
+ launchTabSwitch = [[[UISwitch alloc] initWithFrame:CGRectMake(200,10,200,25)] autorelease];
+ [cell addSubview:launchTabSwitch];
+ [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
+ [[cell textLabel] setFont:[UIFont boldSystemFontOfSize:15.0]];
+ } else {
+ launchTabSwitch = (UISwitch*)[cell.contentView viewWithTag:1];
+ }
+
+ [launchTabSwitch addTarget:self action:@selector(launchTabSwitchChanged:) forControlEvents:UIControlEventValueChanged];
+ [[cell textLabel] setText:@"AutoCapture Mode"];
+ [launchTabSwitch setOn:([[Settings instance] launchTab] == LaunchTabCapture)];
+
+ return cell;
+ }
default:
break;
}
@@ -604,6 +629,15 @@ - (void)modeSwitchChanged:(id)sender {
[[self tableView] setNeedsDisplay];
}
+- (void)launchTabSwitchChanged:(id)sender {
+ UISwitch *launchTabSwitch = (UISwitch*)sender;
+ if ([launchTabSwitch isOn]) {
+ [[Settings instance] setLaunchTab:LaunchTabCapture];
+ } else {
+ [[Settings instance] setLaunchTab:LaunchTabOutline];
+ }
+}
+
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 46;
}
Something went wrong with that request. Please try again.