Skip to content

Commit

Permalink
remove unnecessary pre-scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
flovilmart committed Dec 2, 2015
1 parent db03c04 commit 7386095
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 33 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ xcode_scheme: ParseZero
xcode_project: ParseZero.xcodeproj
xcode_sdk: iphonesimulator9.1
before_install:
- brew update; brew update;
- brew install carthage
- brew upgrade xctool
before_script:
- carthage update
#script: xctool -scheme ParseZero -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.1' -sdk iphonesimulator test
Expand Down
8 changes: 0 additions & 8 deletions ParseZero.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
4A26C3681C049ED200E5F505 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4AF827C11C038BFE00C51B6B /* SystemConfiguration.framework */; };
4A26C3691C049ED800E5F505 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4AF827BF1C038BF400C51B6B /* libsqlite3.tbd */; };
4A89679A1C0DFC3000D52EBE /* PFObject+Additions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A8967991C0DFC3000D52EBE /* PFObject+Additions.swift */; };
4A8E7F871C080C0300E8AF28 /* Bolts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A8E7F851C080C0300E8AF28 /* Bolts.framework */; };
4A8E7F881C080C0400E8AF28 /* Parse.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A8E7F861C080C0300E8AF28 /* Parse.framework */; };
4A8E7F891C080E4400E8AF28 /* Bolts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A8E7F851C080C0300E8AF28 /* Bolts.framework */; };
4A8E7F8A1C080E4500E8AF28 /* Parse.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A8E7F861C080C0300E8AF28 /* Parse.framework */; };
4A8E7F8B1C080E4500E8AF28 /* Bolts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A8E7F851C080C0300E8AF28 /* Bolts.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
Expand Down Expand Up @@ -133,8 +131,6 @@
4AF827C61C038C1300C51B6B /* AudioToolbox.framework in Frameworks */,
4AF827C21C038BFE00C51B6B /* SystemConfiguration.framework in Frameworks */,
4AF827C01C038BF400C51B6B /* libsqlite3.tbd in Frameworks */,
4A8E7F871C080C0300E8AF28 /* Bolts.framework in Frameworks */,
4A8E7F881C080C0400E8AF28 /* Parse.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -620,8 +616,6 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/ParseZero",
"$(PROJECT_DIR)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
Expand Down Expand Up @@ -649,8 +643,6 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/ParseZero",
"$(PROJECT_DIR)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
Expand Down
54 changes: 31 additions & 23 deletions ParseZero/PFObject+Additions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,41 @@
// Copyright © 2015 flovilmart. All rights reserved.
//

import Foundation
import Parse

extension PFObject {
static func mockedServerObject(className: String, objectId:String,var data:JSONObject) -> PFObject {
let parseObject = PFObject(className: className, dictionary: data)
parseObject.objectId = objectId
if let ACLDict = data["ACL"] as? JSONObject {
let ACL = PFACL()
for (k,v) in ACLDict {
let setReadAccess = v["read"] as? Bool == true
let setWriteAccess = v["write"] as? Bool == true

if k == "*" {
ACL.publicReadAccess = setReadAccess
ACL.publicWriteAccess = setWriteAccess
} else if let _ = k.rangeOfString("role:") {
let roleName = k.stringByReplacingOccurrencesOfString("role:", withString: "")
ACL.setReadAccess(setReadAccess, forRoleWithName: roleName)
ACL.setWriteAccess(setWriteAccess, forRoleWithName: roleName)
} else {
ACL.setReadAccess(setReadAccess, forUserId: k)
ACL.setWriteAccess(setWriteAccess, forUserId: k)
}
extension PFACL {
convenience init(dictionary:JSONObject) {
self.init()
for (k,v) in dictionary {
let setReadAccess = v["read"] as? Bool == true
let setWriteAccess = v["write"] as? Bool == true

if k == "*" {
self.publicReadAccess = setReadAccess
self.publicWriteAccess = setWriteAccess
} else if let _ = k.rangeOfString("role:") {
let roleName = k.stringByReplacingOccurrencesOfString("role:", withString: "")
self.setReadAccess(setReadAccess, forRoleWithName: roleName)
self.setWriteAccess(setWriteAccess, forRoleWithName: roleName)
} else {
self.setReadAccess(setReadAccess, forUserId: k)
self.setWriteAccess(setWriteAccess, forUserId: k)
}
parseObject.ACL = ACL
}
}
}

extension PFObject {
static func mockedServerObject(className: String, objectId:String,data:JSONObject) -> PFObject {

var dictionary = data;
if let acl = data["ACL"] as? JSONObject {
dictionary["ACL"] = PFACL(dictionary: acl)
}
// Remove objectId
dictionary["objectId"] = nil
let parseObject = PFObject(className: className, dictionary: dictionary)
parseObject.objectId = objectId
// Let parse SDK think it was updated from the server
parseObject.setValue(data, forKeyPath: "_estimatedData._dataDictionary")
parseObject.setValue(data, forKeyPath: "_pfinternal_state._serverData")
Expand Down

0 comments on commit 7386095

Please sign in to comment.