Skip to content

Commit

Permalink
Add sync
Browse files Browse the repository at this point in the history
  • Loading branch information
icodesign committed Aug 6, 2016
1 parent 64dcb8c commit 363f7dd
Show file tree
Hide file tree
Showing 13 changed files with 345 additions and 166 deletions.
16 changes: 16 additions & 0 deletions Potatso.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@
B803A6961D0165EA003EA9AA /* CloudViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B803A6951D0165EA003EA9AA /* CloudViewController.swift */; };
B803A6981D02B768003EA9AA /* API.swift in Sources */ = {isa = PBXBuildFile; fileRef = B803A6971D02B768003EA9AA /* API.swift */; };
B821B0F01D51DD8F0061E7B9 /* KeychainUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = B821B0EF1D51DD8F0061E7B9 /* KeychainUtils.swift */; };
B821B0F31D5334D50061E7B9 /* ActionRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = B821B0F21D5334D50061E7B9 /* ActionRow.swift */; };
B821B0F51D5335DA0061E7B9 /* FeedbackManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B821B0F41D5335DA0061E7B9 /* FeedbackManager.swift */; };
B821B0F71D539CFD0061E7B9 /* SyncVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B821B0F61D539CFD0061E7B9 /* SyncVC.swift */; };
B82574A91D1D98CF007BAF40 /* Pollution.swift in Sources */ = {isa = PBXBuildFile; fileRef = B82574A81D1D98CF007BAF40 /* Pollution.swift */; };
B829C1721D4395BC00C17B82 /* QRCodeScannerVC.m in Sources */ = {isa = PBXBuildFile; fileRef = B829C1711D4395BC00C17B82 /* QRCodeScannerVC.m */; };
B8319A0A1D1B975C001E50C2 /* RegexUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8319A091D1B975C001E50C2 /* RegexUtils.swift */; };
Expand Down Expand Up @@ -183,6 +186,7 @@
B88559EC1D21319D00B1243E /* YAML.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B88559EA1D21319D00B1243E /* YAML.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
B88559F01D21371A00B1243E /* PotatsoModel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9BC6FFEA1CB28B4B00E5EA61 /* PotatsoModel.framework */; };
B88874491D18186100AEF002 /* ShadowPath.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B86B08E91D17F84900613014 /* ShadowPath.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
B896A8401D548AAC009E4BF5 /* ICloudSetupOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = B896A83F1D548AAC009E4BF5 /* ICloudSetupOperation.swift */; };
B8A09D691D51B42B00A9A989 /* CloudKitRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8A09D681D51B42B00A9A989 /* CloudKitRecord.swift */; };
B8A09D7B1D51B9A900A9A989 /* AlertOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8A09D741D51B9A900A9A989 /* AlertOperation.swift */; };
B8A09D7C1D51B9A900A9A989 /* FetchCloudChangesOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8A09D751D51B9A900A9A989 /* FetchCloudChangesOperation.swift */; };
Expand Down Expand Up @@ -848,6 +852,9 @@
B803A6951D0165EA003EA9AA /* CloudViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CloudViewController.swift; sourceTree = "<group>"; };
B803A6971D02B768003EA9AA /* API.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = API.swift; sourceTree = "<group>"; };
B821B0EF1D51DD8F0061E7B9 /* KeychainUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainUtils.swift; sourceTree = "<group>"; };
B821B0F21D5334D50061E7B9 /* ActionRow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionRow.swift; sourceTree = "<group>"; };
B821B0F41D5335DA0061E7B9 /* FeedbackManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedbackManager.swift; sourceTree = "<group>"; };
B821B0F61D539CFD0061E7B9 /* SyncVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SyncVC.swift; sourceTree = "<group>"; };
B82574A81D1D98CF007BAF40 /* Pollution.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Pollution.swift; sourceTree = "<group>"; };
B829C1701D4395BC00C17B82 /* QRCodeScannerVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QRCodeScannerVC.h; sourceTree = "<group>"; };
B829C1711D4395BC00C17B82 /* QRCodeScannerVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QRCodeScannerVC.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -875,6 +882,7 @@
B8822CD21D2B81C400AD252C /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = "Library/ShadowPath/ShadowPath/shadowsocks-libev/libopenssl/lib/libssl.a"; sourceTree = "<group>"; };
B8822CD51D2B861E00AD252C /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
B88559EA1D21319D00B1243E /* YAML.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = YAML.framework; path = Carthage/Build/iOS/YAML.framework; sourceTree = "<group>"; };
B896A83F1D548AAC009E4BF5 /* ICloudSetupOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ICloudSetupOperation.swift; sourceTree = "<group>"; };
B8A09D681D51B42B00A9A989 /* CloudKitRecord.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CloudKitRecord.swift; sourceTree = "<group>"; };
B8A09D741D51B9A900A9A989 /* AlertOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertOperation.swift; sourceTree = "<group>"; };
B8A09D751D51B9A900A9A989 /* FetchCloudChangesOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchCloudChangesOperation.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1301,6 +1309,7 @@
9B1F74751C3164AC0028C1A6 /* VPN.swift */,
9B3247891CC0F1D200A3BAFF /* Importer.swift */,
B803A6971D02B768003EA9AA /* API.swift */,
B821B0F41D5335DA0061E7B9 /* FeedbackManager.swift */,
);
path = Core;
sourceTree = "<group>";
Expand Down Expand Up @@ -1973,6 +1982,7 @@
isa = PBXGroup;
children = (
B8D8CC121D50D5DB00CE6C0D /* ICloudSyncService.swift */,
B896A83F1D548AAC009E4BF5 /* ICloudSetupOperation.swift */,
B8A09D681D51B42B00A9A989 /* CloudKitRecord.swift */,
B8A09D741D51B9A900A9A989 /* AlertOperation.swift */,
B8A09D751D51B9A900A9A989 /* FetchCloudChangesOperation.swift */,
Expand All @@ -1990,6 +2000,7 @@
B8CCC6EA1CFF1501000E7E2E /* ProxyRow.swift */,
B87B98091D3B64BE00FA66BF /* RequestEventRow.swift */,
B8367A801D1B6D5400D50C25 /* BaseButtonRow.swift */,
B821B0F21D5334D50061E7B9 /* ActionRow.swift */,
);
name = Row;
sourceTree = "<group>";
Expand Down Expand Up @@ -2017,6 +2028,7 @@
isa = PBXGroup;
children = (
B8D8CC101D50D5CD00CE6C0D /* SyncManager.swift */,
B821B0F61D539CFD0061E7B9 /* SyncVC.swift */,
B821B0F11D5318F80061E7B9 /* iCloud */,
);
path = Sync;
Expand Down Expand Up @@ -2862,6 +2874,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B821B0F31D5334D50061E7B9 /* ActionRow.swift in Sources */,
B8D8CC111D50D5CD00CE6C0D /* SyncManager.swift in Sources */,
B83AA5701D38E6F7007905B4 /* RequestDetailVC.swift in Sources */,
B83D3E7D1D2BA8C8007655CE /* Receipt.swift in Sources */,
Expand All @@ -2873,6 +2886,7 @@
B8C256AE1D1A93DA0074D3B1 /* FlatButton.swift in Sources */,
9B8193ED1CBE4DCA00BE320D /* UrlHandler.swift in Sources */,
9B1F74761C3164AD0028C1A6 /* VPN.swift in Sources */,
B821B0F51D5335DA0061E7B9 /* FeedbackManager.swift in Sources */,
B8A09D7B1D51B9A900A9A989 /* AlertOperation.swift in Sources */,
9B8750551CC761D000A11715 /* RequestModel.swift in Sources */,
B87A043A1D193ABC001132F2 /* LoggerUtils.swift in Sources */,
Expand Down Expand Up @@ -2919,9 +2933,11 @@
9B76EEB71C90740C002BF5D1 /* RuleSetsSelectionViewController.swift in Sources */,
B83AA5741D38E728007905B4 /* SegmentPageVC.swift in Sources */,
9BB3F74F1CC6308000C2DD05 /* RecentRequestsVC.swift in Sources */,
B821B0F71D539CFD0061E7B9 /* SyncVC.swift in Sources */,
B8A09D811D51B9A900A9A989 /* SyncOperation.swift in Sources */,
9B8285481CE20DE40027D15C /* HMScanner.m in Sources */,
B8A09D7C1D51B9A900A9A989 /* FetchCloudChangesOperation.swift in Sources */,
B896A8401D548AAC009E4BF5 /* ICloudSetupOperation.swift in Sources */,
B8A09D691D51B42B00A9A989 /* CloudKitRecord.swift in Sources */,
9BB3F7441CC60B6F00C2DD05 /* Error.swift in Sources */,
9B76EEAD1C9005D2002BF5D1 /* RuleConfigurationViewController.swift in Sources */,
Expand Down
29 changes: 29 additions & 0 deletions Potatso/Base/ActionRow.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// ActionRow.swift
// Potatso
//
// Created by LEI on 8/4/16.
// Copyright © 2016 TouchingApp. All rights reserved.
//

import Foundation
import Eureka

public final class ActionRow: _LabelRow, RowType {

public required init(tag: String?) {
super.init(tag: tag)
}

public override func updateCell() {
super.updateCell()
cell.selectionStyle = .Default
cell.accessoryType = .DisclosureIndicator
}

public override func didSelect() {
super.didSelect()
cell.setSelected(false, animated: true)
}

}
40 changes: 40 additions & 0 deletions Potatso/Core/FeedbackManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// FeedbackManager.swift
// Potatso
//
// Created by LEI on 8/4/16.
// Copyright © 2016 TouchingApp. All rights reserved.
//

import Foundation
import ICSMainFramework

class FeedbackManager {
static let shared = FeedbackManager()

func showFeedback(inVC vc: UIViewController? = nil) {
guard let currentVC = vc ?? UIApplication.sharedApplication().keyWindow?.rootViewController else {
return
}
let options = [
"gotoConversationAfterContactUs": "YES"
]
let rulesets = Manager.sharedManager.defaultConfigGroup.ruleSets.map({ $0.name }).joinWithSeparator(", ")
let defaultToProxy = Manager.sharedManager.defaultConfigGroup.defaultToProxy
var tags: [String] = []
if AppEnv.isTestFlight {
tags.append("testflight")
} else if AppEnv.isAppStore {
tags.append("store")
}
HelpshiftSupport.setMetadataBlock { () -> [NSObject : AnyObject]! in
return [
"Full Version": AppEnv.fullVersion,
"Default To Proxy": defaultToProxy ? "true": "false",
"Rulesets": rulesets,
HelpshiftSupportTagsKey: tags
]
}
HelpshiftSupport.showConversation(currentVC, withOptions: options)
}
}
Loading

0 comments on commit 363f7dd

Please sign in to comment.