Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions AppConstants/MCAConstant.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

//Main URL
#define URL_MAIN @"http://122.176.45.15:8080/careerdefine/api/"
#define URL_APPLESTORE @"https://itunes.apple.com/"

//Message
#define INVALID_PWD @"Please enter valid password."
Expand Down Expand Up @@ -84,9 +85,18 @@
#define NOTIFICATION_NOTES_CATEGORY_SUCCESS @"notificationNotesCategorySuccess"
#define NOTIFICATION_NOTES_CATEGORY_FAILED @"notificationNotesCategoryFailed"

#define NOTIFICATION_RESOURCE_CATEGORY_SUCCESS @"notificationResourceCategorySuccess"
#define NOTIFICATION_RESOURCE_CATEGORY_FAILED @"notificationResourceCategoryFailed"

#define NOTIFICATION_NOTES_SUCCESS @"notificationNotesSuccess"
#define NOTIFICATION_NOTES_FAILED @"notificationNotesFailed"

#define NOTIFICATION_RESOURCE_SUCCESS @"notificationResourcesSuccess"
#define NOTIFICATION_RESOURCE_FAILED @"notificationResourcesFailed"

#define NOTIFICATION_RESOURCE_BOOK_SUCCESS @"notificationResourcesBookSuccess"
#define NOTIFICATION_RESOURCE_BOOK_FAILED @"notificationResourcesBookFailed"

#define NOTIFICATION_USER_PROFILE_EDIT_SUCCESS @"notificationUserProfileEditSuccess"
#define NOTIFICATION_USER_PROFILE_EDIT_FAILED @"notificationUserProfileEditFailed"

Expand Down
6 changes: 6 additions & 0 deletions AppCoreData/MCADBIntraction.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,10 @@

-(void)insertNotesCatList:(NSMutableArray*)arr_notesCatList;
-(NSMutableArray*)retrieveNotesCatList:(id)sender;

#pragma mark - RESOURCE_QUERY
-(void)insertResourceCatList:(NSMutableArray*)arr_resourceList;
-(NSMutableArray*)retrieveResourceCatList:(id)sender;


@end
58 changes: 58 additions & 0 deletions AppCoreData/MCADBIntraction.m
Original file line number Diff line number Diff line change
Expand Up @@ -430,4 +430,62 @@ -(NSMutableArray*)retrieveNotesCatList:(id)sender{
return arr_dbNotesCatList;
}

#pragma mark - RESOURCE_CATEGORY QUERY
-(void)insertResourceCatList:(NSMutableArray*)arr_resourceList{

for (int i=0; i<arr_resourceList.count;i++)
{
MCAResourcesCatDHolder *reDHolder=[arr_resourceList objectAtIndex:i];

NSString *query=[NSString stringWithFormat:@"insert into tbl_resource(reCatId,reCatImage,reCatName) values(\"%@\",\"%@\",\"%@\")",reDHolder.str_resourcesCatId, reDHolder.str_resourcesCatImage, reDHolder.str_resourcesCatName];

@try
{
[dBCollgeAdmin open];
if ([dBCollgeAdmin executeUpdate:query])
{
NSLog(@"successfully inserted");
}
}
@catch (NSException *e)
{
NSLog(@"%@",e);
}
@finally
{
[dBCollgeAdmin close];
}
}
}
-(NSMutableArray*)retrieveResourceCatList:(id)sender{

NSMutableArray *arr_dbResourceCatList=[[NSMutableArray alloc]init];
NSString *query = @"Select * from tbl_resource";

@try
{
[dBCollgeAdmin open];
FMResultSet *resultSet=[dBCollgeAdmin executeQuery:query];
while ([resultSet next])
{
MCAResourcesCatDHolder *reDHolder = [MCAResourcesCatDHolder new];
reDHolder.str_resourcesCatId = [resultSet stringForColumn:@"reCatId"];
reDHolder.str_resourcesCatImage = [resultSet stringForColumn:@"reCatImage"];
reDHolder.str_resourcesCatName = [resultSet stringForColumn:@"reCatName"];
[arr_dbResourceCatList addObject:reDHolder];
}
[resultSet close];
}
@catch (NSException *exception)
{
NSLog(@"%@",exception);
}
@finally
{
[dBCollgeAdmin close];
}
return arr_dbResourceCatList;
}


@end
Binary file modified AppCoreData/MobileCollegeAdmin.sqlite
Binary file not shown.
18 changes: 18 additions & 0 deletions AppExternal/RFRateMe.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// RFRateMe.h
// RFRateMeDemo
//
// Created by Ricardo Funk on 1/2/14.
// Copyright (c) 2014 Ricardo Funk. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface RFRateMe : NSObject

+(void)showRateAlert;
+(void)showRateAlertAfterTimesOpened:(int)times;
+(void)showRateAlertAfterDays:(int)days;


@end
148 changes: 148 additions & 0 deletions AppExternal/RFRateMe.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
//
// RFRateMe.m
// RFRateMeDemo
//
// Created by Ricardo Funk on 1/2/14.
// Copyright (c) 2014 Ricardo Funk. All rights reserved.
//

#import "RFRateMe.h"
#import "UIAlertView+NSCookbook.h"
#import "MCAConstant.h"

#define kNumberOfDaysUntilShowAgain 3
#define kAppStoreAddress URL_APPLESTORE
#define kAppName @"Moblie College Admin"

@implementation RFRateMe

+(void)showRateAlert {

//If rate was completed, we just return if True
BOOL rateCompleted = [[NSUserDefaults standardUserDefaults] boolForKey:@"RFRateCompleted"];
if (rateCompleted) return;

//Check if the user asked not to be prompted again for 3 days (remind me later)
BOOL remindMeLater = [[NSUserDefaults standardUserDefaults] boolForKey:@"RFRemindMeLater"];

if (remindMeLater) {

NSDateFormatter *DateFormatter=[[NSDateFormatter alloc] init];
[DateFormatter setDateFormat:@"yyyy-MM-dd"];

NSString *start = [[NSUserDefaults standardUserDefaults] objectForKey:@"RFStartDate"];
NSString *end = [DateFormatter stringFromDate:[NSDate date]];

NSDateFormatter *f = [[NSDateFormatter alloc] init];
[f setDateFormat:@"yyyy-MM-dd"];
NSDate *startDate = [f dateFromString:start];
NSDate *endDate = [f dateFromString:end];

NSCalendar *gregorianCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *components = [gregorianCalendar components:NSDayCalendarUnit
fromDate:startDate
toDate:endDate
options:0];

if ((long)[components day] <= kNumberOfDaysUntilShowAgain) return;

}

//Show rate alert
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(kAppName, @"")
message:[NSString stringWithFormat:@"If you enjoy %@, would you mind taking a moment to rate it? It won’t take more than a minute. Thanks for your support!",kAppName]
delegate:nil
cancelButtonTitle:NSLocalizedString(@"Never ask me again", @"")
otherButtonTitles:NSLocalizedString(@"Rate it now", @""),NSLocalizedString(@"Remind me later",@""), nil];

[alertView showWithCompletion:^(UIAlertView *alertView, NSInteger buttonIndex) {

switch (buttonIndex) {
case 0:

NSLog(@"No, thanks");
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"RFRateCompleted"];
[[NSUserDefaults standardUserDefaults] synchronize];

break;
case 1:

NSLog(@"Rate it now");
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"RFRateCompleted"];
[[NSUserDefaults standardUserDefaults] synchronize];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:kAppStoreAddress]];

break;
case 2:

NSLog(@"Remind me later");
NSDateFormatter *dateFormatter=[[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSDate *now = [NSDate date];
[[NSUserDefaults standardUserDefaults] setObject:[dateFormatter stringFromDate:now] forKey:@"RFStartDate"];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"RFRemindMeLater"];
[[NSUserDefaults standardUserDefaults] synchronize];

break;
}
}];
}

+(void)showRateAlertAfterTimesOpened:(int)times {
//Thanks @kylnew for feedback and idea!

BOOL rateCompleted = [[NSUserDefaults standardUserDefaults] boolForKey:@"RFRateCompleted"];
if (rateCompleted) return;

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
int timesOpened = (int)[defaults integerForKey:@"timesOpened"];
[defaults setInteger:timesOpened+1 forKey:@"timesOpened"];
[defaults synchronize];
NSLog(@"App has been opened %ld times", (long)[defaults integerForKey:@"timesOpened"]);
if([defaults integerForKey:@"timesOpened"] >= times){
[RFRateMe showRateAlert];
}


}


+(void)showRateAlertAfterDays:(int)times {

BOOL rateCompleted = [[NSUserDefaults standardUserDefaults] boolForKey:@"RFRateCompleted"];
if (rateCompleted) return;

BOOL showAfterXdays = [[NSUserDefaults standardUserDefaults] boolForKey:@"RFShowAfterXDays"];

if (!showAfterXdays) {
NSDateFormatter *dateFormatter=[[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSDate *now = [NSDate date];
[[NSUserDefaults standardUserDefaults] setObject:[dateFormatter stringFromDate:now] forKey:@"RFGeneralStartDate"];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"RFShowAfterXDays"];
[[NSUserDefaults standardUserDefaults] synchronize];
}

NSDateFormatter *DateFormatter=[[NSDateFormatter alloc] init];
[DateFormatter setDateFormat:@"yyyy-MM-dd"];

NSString *start = [[NSUserDefaults standardUserDefaults] objectForKey:@"RFGeneralStartDate"];
NSString *end = [DateFormatter stringFromDate:[NSDate date]];

NSDateFormatter *f = [[NSDateFormatter alloc] init];
[f setDateFormat:@"yyyy-MM-dd"];
NSDate *startDate = [f dateFromString:start];
NSDate *endDate = [f dateFromString:end];

NSCalendar *gregorianCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *components = [gregorianCalendar components:NSDayCalendarUnit
fromDate:startDate
toDate:endDate
options:0];

if ((long)[components day] <= times) return;


}

@end
31 changes: 31 additions & 0 deletions AppExternal/UIAlertView+NSCookbook.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// UIAlertView+NSCookbook.h
// SimpleAlertViewSampleApp
//
// Copyright (c) 2013 NSCookbook. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <UIKit/UIKit.h>

@interface UIAlertView (NSCookbook)

- (void)showWithCompletion:(void(^)(UIAlertView *alertView, NSInteger buttonIndex))completion;

@end
75 changes: 75 additions & 0 deletions AppExternal/UIAlertView+NSCookbook.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
//
// UIAlertView+NSCookbook.m
// SimpleAlertViewSampleApp
//
// Copyright (c) 2013 NSCookbook. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <objc/runtime.h>
#import "UIAlertView+NSCookbook.h"

@interface NSCBAlertWrapper : NSObject <UIAlertViewDelegate>

@property (copy) void(^completionBlock)(UIAlertView *alertView, NSInteger buttonIndex);

@end

@implementation NSCBAlertWrapper

#pragma mark - UIAlertViewDelegate

// Called when a button is clicked. The view will be automatically dismissed after this call returns
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (self.completionBlock)
self.completionBlock(alertView, buttonIndex);
}

// Called when we cancel a view (eg. the user clicks the Home button). This is not called when the user clicks the cancel button.
// If not defined in the delegate, we simulate a click in the cancel button
- (void)alertViewCancel:(UIAlertView *)alertView
{
// Just simulate a cancel button click
if (self.completionBlock)
self.completionBlock(alertView, alertView.cancelButtonIndex);
}

@end


static const char kNSCBAlertWrapper;
@implementation UIAlertView (NSCookbook)

#pragma mark - Class Public

- (void)showWithCompletion:(void(^)(UIAlertView *alertView, NSInteger buttonIndex))completion
{
NSCBAlertWrapper *alertWrapper = [[NSCBAlertWrapper alloc] init];
alertWrapper.completionBlock = completion;
self.delegate = alertWrapper;

// Set the wrapper as an associated object
objc_setAssociatedObject(self, &kNSCBAlertWrapper, alertWrapper, OBJC_ASSOCIATION_RETAIN_NONATOMIC);

// Show the alert as normal
[self show];
}

@end
16 changes: 16 additions & 0 deletions AppModel/MCAResourcesBookDHolder.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// MCAResourcesBookDHolder.h
// MobileCollegeAdmin
//
// Created by Dongjie Zhang on 9/16/14.
// Copyright (c) 2014 arya. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface MCAResourcesBookDHolder : NSObject

@property(nonatomic,strong)NSString *str_book_name;
@property(nonatomic,strong)NSString *str_url;

@end
Loading