Skip to content

Commit

Permalink
save user daily activity in local database
Browse files Browse the repository at this point in the history
  • Loading branch information
hitenkmr committed Aug 7, 2018
1 parent 9cd918a commit 5fd1e30
Show file tree
Hide file tree
Showing 425 changed files with 116,610 additions and 29 deletions.
Binary file modified Actifit/.DS_Store
Binary file not shown.
113 changes: 107 additions & 6 deletions Actifit/Actifit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,24 @@
objects = {

/* Begin PBXBuildFile section */
BE272632211452890020E32D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE272631211452890020E32D /* AppDelegate.swift */; };
5F912D2BD619DE8C3FE85463 /* Pods_Actifit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0FDABFA1F3E07474B668EE1A /* Pods_Actifit.framework */; };
BE0AB411211A29B1000E9AEA /* Activity.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE0AB410211A29B1000E9AEA /* Activity.swift */; };
BE0AB413211A2C89000E9AEA /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE0AB412211A2C89000E9AEA /* Constants.swift */; };
BE272632211452890020E32D /* AFAppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE272631211452890020E32D /* AFAppDelegate.swift */; };
BE272634211452890020E32D /* ActivityTrackingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE272633211452890020E32D /* ActivityTrackingVC.swift */; };
BE272637211452890020E32D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BE272635211452890020E32D /* Main.storyboard */; };
BE272639211452940020E32D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BE272638211452940020E32D /* Assets.xcassets */; };
BE27263C211452940020E32D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BE27263A211452940020E32D /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
0FDABFA1F3E07474B668EE1A /* Pods_Actifit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Actifit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
2BF616C1E455A6E6AD074981 /* Pods-Actifit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Actifit.release.xcconfig"; path = "Pods/Target Support Files/Pods-Actifit/Pods-Actifit.release.xcconfig"; sourceTree = "<group>"; };
B9C0610DDDC898B29A3927DD /* Pods-Actifit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Actifit.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Actifit/Pods-Actifit.debug.xcconfig"; sourceTree = "<group>"; };
BE0AB410211A29B1000E9AEA /* Activity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Activity.swift; sourceTree = "<group>"; };
BE0AB412211A2C89000E9AEA /* Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
BE27262E211452890020E32D /* Actifit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Actifit.app; sourceTree = BUILT_PRODUCTS_DIR; };
BE272631211452890020E32D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
BE272631211452890020E32D /* AFAppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AFAppDelegate.swift; sourceTree = "<group>"; };
BE272633211452890020E32D /* ActivityTrackingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityTrackingVC.swift; sourceTree = "<group>"; };
BE272636211452890020E32D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
BE272638211452940020E32D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand All @@ -29,17 +37,63 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
5F912D2BD619DE8C3FE85463 /* Pods_Actifit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
5A7B9FC8F5CBC040CCCDA293 /* Pods */ = {
isa = PBXGroup;
children = (
B9C0610DDDC898B29A3927DD /* Pods-Actifit.debug.xcconfig */,
2BF616C1E455A6E6AD074981 /* Pods-Actifit.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
5AA13FC8C3C7E14596880E7C /* Frameworks */ = {
isa = PBXGroup;
children = (
0FDABFA1F3E07474B668EE1A /* Pods_Actifit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
BE0AB40F211A2993000E9AEA /* Models */ = {
isa = PBXGroup;
children = (
BE0AB410211A29B1000E9AEA /* Activity.swift */,
);
path = Models;
sourceTree = "<group>";
};
BE0AB414211A2C8D000E9AEA /* AppDelegate */ = {
isa = PBXGroup;
children = (
BE272631211452890020E32D /* AFAppDelegate.swift */,
BE0AB412211A2C89000E9AEA /* Constants.swift */,
);
path = AppDelegate;
sourceTree = "<group>";
};
BE0AB415211A302D000E9AEA /* Controllers */ = {
isa = PBXGroup;
children = (
BE272635211452890020E32D /* Main.storyboard */,
BE272633211452890020E32D /* ActivityTrackingVC.swift */,
);
path = Controllers;
sourceTree = "<group>";
};
BE272625211452890020E32D = {
isa = PBXGroup;
children = (
BE272630211452890020E32D /* Actifit */,
BE27262F211452890020E32D /* Products */,
5A7B9FC8F5CBC040CCCDA293 /* Pods */,
5AA13FC8C3C7E14596880E7C /* Frameworks */,
);
sourceTree = "<group>";
};
Expand All @@ -54,9 +108,9 @@
BE272630211452890020E32D /* Actifit */ = {
isa = PBXGroup;
children = (
BE272631211452890020E32D /* AppDelegate.swift */,
BE272633211452890020E32D /* ActivityTrackingVC.swift */,
BE272635211452890020E32D /* Main.storyboard */,
BE0AB414211A2C8D000E9AEA /* AppDelegate */,
BE0AB415211A302D000E9AEA /* Controllers */,
BE0AB40F211A2993000E9AEA /* Models */,
BE272638211452940020E32D /* Assets.xcassets */,
BE27263A211452940020E32D /* LaunchScreen.storyboard */,
BE27263D211452940020E32D /* Info.plist */,
Expand All @@ -71,9 +125,11 @@
isa = PBXNativeTarget;
buildConfigurationList = BE272640211452940020E32D /* Build configuration list for PBXNativeTarget "Actifit" */;
buildPhases = (
BB47EEC5E283BA609ECC6596 /* [CP] Check Pods Manifest.lock */,
BE27262A211452890020E32D /* Sources */,
BE27262B211452890020E32D /* Frameworks */,
BE27262C211452890020E32D /* Resources */,
608E413149C4C96DA8AD73FE /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -129,13 +185,56 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
608E413149C4C96DA8AD73FE /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-Actifit/Pods-Actifit-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Realm/Realm.framework",
"${BUILT_PRODUCTS_DIR}/RealmSwift/RealmSwift.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmSwift.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Actifit/Pods-Actifit-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
BB47EEC5E283BA609ECC6596 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Actifit-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
BE27262A211452890020E32D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BE0AB411211A29B1000E9AEA /* Activity.swift in Sources */,
BE272634211452890020E32D /* ActivityTrackingVC.swift in Sources */,
BE272632211452890020E32D /* AppDelegate.swift in Sources */,
BE272632211452890020E32D /* AFAppDelegate.swift in Sources */,
BE0AB413211A2C89000E9AEA /* Constants.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -277,6 +376,7 @@
};
BE272641211452940020E32D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = B9C0610DDDC898B29A3927DD /* Pods-Actifit.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
Expand All @@ -296,6 +396,7 @@
};
BE272642211452940020E32D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 2BF616C1E455A6E6AD074981 /* Pods-Actifit.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>Actifit.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>3</integer>
</dict>
</dict>
</dict>
Expand Down
10 changes: 10 additions & 0 deletions Actifit/Actifit.xcworkspace/contents.xcworkspacedata

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
//
// AppDelegate.swift
// AFAppDelegate.swift
// Actifit
//
// Created by Hitender kumar on 03/08/18.
//

import UIKit
import RealmSwift

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
class AFAppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

Expand Down Expand Up @@ -40,6 +41,22 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

//MARK: Realm Method helpers

func defaultRealm() -> Realm? {
var config = Realm.Configuration.defaultConfiguration
config.schemaVersion = 1
config.migrationBlock = { (migration, oldSchemaVersion) in
// nothing to do
}
do {
let realm = try Realm.init(configuration: config)
return realm
} catch {

}
return nil
}

}

90 changes: 90 additions & 0 deletions Actifit/Actifit/AppDelegate/Constants.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
//
// Constants.swift
// Actifit
//
// Created by Hitender kumar on 06/07/18.
// Copyright © 2018 Hitender kumar. All rights reserved.
//

import Foundation
import UIKit

//MARK: Singletons

let MainBundle = Bundle.main
let Application = UIApplication.shared
let AppDelegate = Application.delegate as! AFAppDelegate
let DeviceType = AFTDeviceType()
let ISSimulator = (UIDevice.current.isSimulator)

//MARK: Device

struct MainScreenSize
{
// let SCREEN_WIDTH = UIScreen.main.bounds.size.width
// let SCREEN_HEIGHT = UIScreen.main.bounds.size.height
static let SCREEN_MAX_LENGTH = max(ScreenWidth, ScreenHeight)
static let SCREEN_MIN_LENGTH = min(ScreenWidth, ScreenHeight)
}

struct AFTDeviceType
{
let IS_IPHONE_5_OR_LESS = UIDevice.current.userInterfaceIdiom == .phone && MainScreenSize.SCREEN_MAX_LENGTH <= 568.0
let IS_IPHONE_5 = UIDevice.current.userInterfaceIdiom == .phone && MainScreenSize.SCREEN_MAX_LENGTH == 568.0
let IS_IPHONE_6 = UIDevice.current.userInterfaceIdiom == .phone && MainScreenSize.SCREEN_MAX_LENGTH == 667.0
let IS_IPHONE_6P = UIDevice.current.userInterfaceIdiom == .phone && MainScreenSize.SCREEN_MAX_LENGTH == 736.0
let IS_IPHONE_X = UIDevice.current.userInterfaceIdiom == .phone && MainScreenSize.SCREEN_MAX_LENGTH == 812.0
let IS_PAD_97INCH = UIDevice.current.userInterfaceIdiom == .pad && MainScreenSize.SCREEN_MAX_LENGTH == 1024
let IS_PAD_105INCH = UIDevice.current.userInterfaceIdiom == .pad && MainScreenSize.SCREEN_MAX_LENGTH == 1112
let IS_PAD_129INCH = UIDevice.current.userInterfaceIdiom == .pad && MainScreenSize.SCREEN_MAX_LENGTH == 1366
}

let IsPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.pad)
let isiPadPro = IsPad && (UIScreen.main.bounds.size.height == 1024)

//MARK: Device Width & Heights

let CurrentDevice = UIDevice.current
let iOSVersion = CurrentDevice.systemVersion

let WindowFrame = UIScreen.main.bounds
var ScreenWidth = WindowFrame.size.width
var ScreenHeight = WindowFrame.size.height

let DeviceWidth = min(ScreenWidth, ScreenHeight)
let DeviceHeight = max(ScreenWidth,ScreenHeight)

let NavBarHeight = (20+44)
let SideBarWidth = IsPad ? 320 : 240
let MasterWidthForSplitVC = 320

func Format(fmt : String) -> String {

return String.init(fmt)

//use
// let floatVal: Float = 3.00

// let str : String = Format(fmt: "\("this is : ")\(floatVal)")
}

extension UIDevice {
var isSimulator: Bool {

#if arch(i386) || arch(x86_64)
return true
#else
return false
#endif

//return UIDevice.current.userInterfaceIdiom.rawValue == 0

//not working

// #if TARGET_IOS_SIMULATOR
// return true
// #else
// return false
// #endif
}
}
Loading

0 comments on commit 5fd1e30

Please sign in to comment.