Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-dydx committed Mar 5, 2024
1 parent 9ad8ae2 commit 646ed55
Show file tree
Hide file tree
Showing 19 changed files with 205 additions and 162 deletions.
4 changes: 0 additions & 4 deletions PlatformRouting/PlatformRouting.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
278A4EDE2B92C639003898EB /* TransitionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 278A4EDD2B92C639003898EB /* TransitionDelegate.swift */; };
310CDBAD21C6FA44009665CF /* UIToolkits.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 313EBC0D21BB7B7E00BEF926 /* UIToolkits.framework */; };
311BAFEB255083C1004331D8 /* Mail.xib in Resources */ = {isa = PBXBuildFile; fileRef = 311BAFDE255083C1004331D8 /* Mail.xib */; };
311BB0182550843C004331D8 /* ShareAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 311BB0172550843C004331D8 /* ShareAction.swift */; };
311BB01F2550845A004331D8 /* Share.xib in Resources */ = {isa = PBXBuildFile; fileRef = 311BB01E2550845A004331D8 /* Share.xib */; };
311D6FA92176F04900655040 /* Utilities.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 311D6F702176EF7B00655040 /* Utilities.framework */; };
311D6FAA2176F04900655040 /* RoutingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 311D6F5E2176EF6E00655040 /* RoutingKit.framework */; };
Expand Down Expand Up @@ -322,7 +321,6 @@
278A4EDD2B92C639003898EB /* TransitionDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransitionDelegate.swift; sourceTree = "<group>"; };
306E17287D7FE48D8EEA3648 /* Pods-iOS-PlatformRouting.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iOS-PlatformRouting.debug.xcconfig"; path = "Target Support Files/Pods-iOS-PlatformRouting/Pods-iOS-PlatformRouting.debug.xcconfig"; sourceTree = "<group>"; };
311BAFDE255083C1004331D8 /* Mail.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Mail.xib; sourceTree = "<group>"; };
311BB0172550843C004331D8 /* ShareAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareAction.swift; sourceTree = "<group>"; };
311BB01E2550845A004331D8 /* Share.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Share.xib; sourceTree = "<group>"; };
311D6F582176EF6E00655040 /* RoutingKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RoutingKit.xcodeproj; path = ../RoutingKit/RoutingKit.xcodeproj; sourceTree = "<group>"; };
311D6F612176EF7500655040 /* UIToolkits.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = UIToolkits.xcodeproj; path = ../UIToolkits/UIToolkits.xcodeproj; sourceTree = "<group>"; };
Expand Down Expand Up @@ -692,7 +690,6 @@
isa = PBXGroup;
children = (
314C35B524C7C29600695F7E /* DebugEnableAction.swift */,
311BB0172550843C004331D8 /* ShareAction.swift */,
);
path = _Actions;
sourceTree = "<group>";
Expand Down Expand Up @@ -1289,7 +1286,6 @@
buildActionMask = 2147483647;
files = (
314B627823DCCE8900139EB3 /* RoutingEmbeddingController.swift in Sources */,
311BB0182550843C004331D8 /* ShareAction.swift in Sources */,
314B627D23DCCE8900139EB3 /* TelAction.swift in Sources */,
314B628223DCCE8900139EB3 /* MappedUIKitAppRouter.swift in Sources */,
314B626D23DCCE8900139EB3 /* RoutingDrawerController.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"destination":"Refresh.xib"
},
"/action/share":{
"destination":"PlatformRouting.ShareActionBuilder"
"destination":"dydxPresenters.dydxShareActionBuilder"
},
"/action/wallet":{
"destination":"Wallet.xib"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// PointedRating.swift
// Utilities
//
// Created by Qiang Huang on 9/19/19.
// Copyright © 2019 dYdX. All rights reserved.
//

import Foundation

open class PointsRating: NSObject, RatingProtocol {
public func add(points: Int) {
self.points = self.points + points
}

private var pointsKey: String {
return "\(String(describing: className)).points"
}

private var threshold: Int

open var points: Int {
get {
return UserDefaults.standard.integer(forKey: pointsKey)
}
set {
if newValue >= threshold {
promptForRating()
UserDefaults.standard.set(0, forKey: pointsKey)
} else {
UserDefaults.standard.set(newValue, forKey: pointsKey)
}
}
}

public init(threshold: Int) {
self.threshold = threshold
super.init()
}

open func promptForRating() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// RatingService.swift
// Utilities
//
// Created by Qiang Huang on 9/19/19.
// Copyright © 2019 dYdX. All rights reserved.
//

import Foundation

public protocol RatingProtocol: NSObjectProtocol {
func add(points: Int)
}

public class RatingService {
public static var shared: RatingProtocol?
}
2 changes: 1 addition & 1 deletion Shared/CommonAppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ open class CommonAppDelegate: ParticlesAppDelegate {
open override func applicationDidBecomeActive(_ application: UIApplication) {
super.applicationDidBecomeActive(application)
Tracking.shared?.log(event: "AppStart", data: nil)
RatingService.shared?.launchedApp()
dydxRatingService.shared?.launchedApp()
}

open func injectNotification() {
Expand Down
32 changes: 0 additions & 32 deletions Utilities/Utilities.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
02EE90552829A95600225B56 /* NSObject+ObservingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02EE90542829A95600225B56 /* NSObject+ObservingTests.swift */; };
02F958032A18278B00828F9A /* SecureStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02F958022A18278B00828F9A /* SecureStore.swift */; };
02F958052A182BC400828F9A /* SecureStoreProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02F958042A182BC400828F9A /* SecureStoreProtocol.swift */; };
278A4DEA2B915D82003898EB /* PointsRatingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 278A4DE92B915D82003898EB /* PointsRatingTests.swift */; };
3101F94725112C4100AC4010 /* AuthProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3101F94625112C4100AC4010 /* AuthProtocol.swift */; };
3101F94A25112C5900AC4010 /* AuthService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3101F94925112C5900AC4010 /* AuthService.swift */; };
310E61E9216C0F910043BB33 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 310E61E8216C0F910043BB33 /* Security.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
Expand All @@ -52,12 +51,6 @@
31471F7024BA2F1E00057221 /* UserAgent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31471F6F24BA2F1E00057221 /* UserAgent.swift */; };
31471F7124BA2F1E00057221 /* UserAgent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31471F6F24BA2F1E00057221 /* UserAgent.swift */; };
31471F7224BA2F1E00057221 /* UserAgent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31471F6F24BA2F1E00057221 /* UserAgent.swift */; };
314B63E023DCCF0200139EB3 /* PointsRating.swift in Sources */ = {isa = PBXBuildFile; fileRef = 314B638523DCCF0100139EB3 /* PointsRating.swift */; };
314B63E123DCCF0200139EB3 /* PointsRating.swift in Sources */ = {isa = PBXBuildFile; fileRef = 314B638523DCCF0100139EB3 /* PointsRating.swift */; };
314B63E223DCCF0200139EB3 /* PointsRating.swift in Sources */ = {isa = PBXBuildFile; fileRef = 314B638523DCCF0100139EB3 /* PointsRating.swift */; };
314B63E423DCCF0200139EB3 /* RatingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 314B638623DCCF0100139EB3 /* RatingService.swift */; };
314B63E523DCCF0200139EB3 /* RatingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 314B638623DCCF0100139EB3 /* RatingService.swift */; };
314B63E623DCCF0200139EB3 /* RatingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 314B638623DCCF0100139EB3 /* RatingService.swift */; };
314B63E823DCCF0200139EB3 /* Directory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 314B638823DCCF0100139EB3 /* Directory.swift */; };
314B63E923DCCF0200139EB3 /* Directory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 314B638823DCCF0100139EB3 /* Directory.swift */; };
314B63EA23DCCF0200139EB3 /* Directory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 314B638823DCCF0100139EB3 /* Directory.swift */; };
Expand Down Expand Up @@ -258,7 +251,6 @@
31CB2B53256DB261008A26A7 /* LocalizerBuffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31CB2B52256DB261008A26A7 /* LocalizerBuffer.swift */; };
31DEFEAC277543E8009BEBF6 /* ExportProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31DEFEAB277543E8009BEBF6 /* ExportProtocol.swift */; };
31E65AC3216BC9C9008ABEE9 /* Utilities.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 31E65AB9216BC9C9008ABEE9 /* Utilities.framework */; };
31E65AC8216BC9C9008ABEE9 /* UtilitiesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31E65AC7216BC9C9008ABEE9 /* UtilitiesTests.swift */; };
31E65ACA216BC9C9008ABEE9 /* Utilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 31E65ABC216BC9C9008ABEE9 /* Utilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
35EE5B244960774B9B6D4D55 /* Pods_iOS_UtilitiesTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF030595A23E85168A3AD589 /* Pods_iOS_UtilitiesTests.framework */; };
4EDE0B13DB89059A45D982F2 /* Pods_iOS_Utilities.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3A32AA5C7AC3D4879568CFBD /* Pods_iOS_Utilities.framework */; };
Expand Down Expand Up @@ -306,7 +298,6 @@
02EE90542829A95600225B56 /* NSObject+ObservingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+ObservingTests.swift"; sourceTree = "<group>"; };
02F958022A18278B00828F9A /* SecureStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureStore.swift; sourceTree = "<group>"; };
02F958042A182BC400828F9A /* SecureStoreProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureStoreProtocol.swift; sourceTree = "<group>"; };
278A4DE92B915D82003898EB /* PointsRatingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PointsRatingTests.swift; sourceTree = "<group>"; };
3101F94625112C4100AC4010 /* AuthProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthProtocol.swift; sourceTree = "<group>"; };
3101F94925112C5900AC4010 /* AuthService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthService.swift; sourceTree = "<group>"; };
310E61E8216C0F910043BB33 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
Expand All @@ -324,8 +315,6 @@
313A537421B9805F00A92D62 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
313B1AA625CB08CE006D369F /* Sequence+Reduce.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Sequence+Reduce.swift"; sourceTree = "<group>"; };
31471F6F24BA2F1E00057221 /* UserAgent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserAgent.swift; sourceTree = "<group>"; };
314B638523DCCF0100139EB3 /* PointsRating.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PointsRating.swift; sourceTree = "<group>"; };
314B638623DCCF0100139EB3 /* RatingService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RatingService.swift; sourceTree = "<group>"; };
314B638823DCCF0100139EB3 /* Directory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Directory.swift; sourceTree = "<group>"; };
314B638923DCCF0100139EB3 /* File.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = "<group>"; };
314B638B23DCCF0100139EB3 /* UrlHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UrlHandler.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -409,7 +398,6 @@
31E65ABC216BC9C9008ABEE9 /* Utilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Utilities.h; sourceTree = "<group>"; };
31E65ABD216BC9C9008ABEE9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
31E65AC2216BC9C9008ABEE9 /* UtilitiesTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UtilitiesTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
31E65AC7216BC9C9008ABEE9 /* UtilitiesTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UtilitiesTests.swift; sourceTree = "<group>"; };
31E65AC9216BC9C9008ABEE9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3A32AA5C7AC3D4879568CFBD /* Pods_iOS_Utilities.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iOS_Utilities.framework; sourceTree = BUILT_PRODUCTS_DIR; };
439FD4525821BD140CEE8DB1 /* Pods-iOS-UtilitiesTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iOS-UtilitiesTests.release.xcconfig"; path = "Target Support Files/Pods-iOS-UtilitiesTests/Pods-iOS-UtilitiesTests.release.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -566,15 +554,6 @@
path = _UserAgent;
sourceTree = "<group>";
};
314B638423DCCF0100139EB3 /* _Rating */ = {
isa = PBXGroup;
children = (
314B638523DCCF0100139EB3 /* PointsRating.swift */,
314B638623DCCF0100139EB3 /* RatingService.swift */,
);
path = _Rating;
sourceTree = "<group>";
};
314B638723DCCF0100139EB3 /* _Files */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -858,7 +837,6 @@
3162C00D24C3781D00DE648C /* _Permissions */,
3162C00424C377BF00DE648C /* _Prompter */,
314B63D823DCCF0100139EB3 /* _Protocols */,
314B638423DCCF0100139EB3 /* _Rating */,
314B63CE23DCCF0100139EB3 /* _Time */,
314B63D123DCCF0100139EB3 /* _Tracker */,
314B638A23DCCF0100139EB3 /* _URL */,
Expand All @@ -876,9 +854,7 @@
children = (
02EE90532829A93400225B56 /* _Extensions */,
02EE8FDF2828305C00225B56 /* _Observing */,
31E65AC7216BC9C9008ABEE9 /* UtilitiesTests.swift */,
31E65AC9216BC9C9008ABEE9 /* Info.plist */,
278A4DE92B915D82003898EB /* PointsRatingTests.swift */,
);
path = UtilitiesTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -1208,7 +1184,6 @@
314B64DA23DCCF0200139EB3 /* Tracking.swift in Sources */,
314B64A223DCCF0200139EB3 /* Collection+Random.swift in Sources */,
314B647223DCCF0200139EB3 /* Weak.swift in Sources */,
314B63E623DCCF0200139EB3 /* RatingService.swift in Sources */,
314B649E23DCCF0200139EB3 /* DispatchQueue+Utils.swift in Sources */,
3162C00C24C377EF00DE648C /* PrompterFactory.swift in Sources */,
314B646223DCCF0200139EB3 /* JsonWriter.swift in Sources */,
Expand All @@ -1231,7 +1206,6 @@
314B644223DCCF0200139EB3 /* FeatureService.swift in Sources */,
314B644623DCCF0200139EB3 /* LoadingStatus.swift in Sources */,
313B1AA925CB08CE006D369F /* Sequence+Reduce.swift in Sources */,
314B63E223DCCF0200139EB3 /* PointsRating.swift in Sources */,
312CE38E2630A38700C519C0 /* JavascriptRunner.swift in Sources */,
314B64EA23DCCF0200139EB3 /* ProgressProtocol.swift in Sources */,
314B64CA23DCCF0200139EB3 /* Date+Utils.swift in Sources */,
Expand Down Expand Up @@ -1287,7 +1261,6 @@
314B64D923DCCF0200139EB3 /* Tracking.swift in Sources */,
314B64A123DCCF0200139EB3 /* Collection+Random.swift in Sources */,
314B647123DCCF0200139EB3 /* Weak.swift in Sources */,
314B63E523DCCF0200139EB3 /* RatingService.swift in Sources */,
314B649D23DCCF0200139EB3 /* DispatchQueue+Utils.swift in Sources */,
314B646123DCCF0200139EB3 /* JsonWriter.swift in Sources */,
3162C00B24C377EF00DE648C /* PrompterFactory.swift in Sources */,
Expand All @@ -1312,7 +1285,6 @@
314B644123DCCF0200139EB3 /* FeatureService.swift in Sources */,
314B644523DCCF0200139EB3 /* LoadingStatus.swift in Sources */,
317F16E12572CF5B00D178B8 /* Double+String.swift in Sources */,
314B63E123DCCF0200139EB3 /* PointsRating.swift in Sources */,
314B64E923DCCF0200139EB3 /* ProgressProtocol.swift in Sources */,
314B64C923DCCF0200139EB3 /* Date+Utils.swift in Sources */,
314B649123DCCF0200139EB3 /* Bundle+UIBundle.swift in Sources */,
Expand Down Expand Up @@ -1373,7 +1345,6 @@
314B647023DCCF0200139EB3 /* Weak.swift in Sources */,
3162B55126E18183000209E1 /* WebCrypto.swift in Sources */,
3112B53B25264670009D19B6 /* NotificationBridge.swift in Sources */,
314B63E423DCCF0200139EB3 /* RatingService.swift in Sources */,
314B649C23DCCF0200139EB3 /* DispatchQueue+Utils.swift in Sources */,
02ABF37D2AD72314005D799B /* AttributedString+Ext.swift in Sources */,
023FA97028A2C5B4008352E3 /* UIColor+Hex.swift in Sources */,
Expand Down Expand Up @@ -1416,7 +1387,6 @@
02F958032A18278B00828F9A /* SecureStore.swift in Sources */,
314B644423DCCF0200139EB3 /* LoadingStatus.swift in Sources */,
0253CEC42AA009D70033F064 /* DebugEnabled.swift in Sources */,
314B63E023DCCF0200139EB3 /* PointsRating.swift in Sources */,
312CE39A2630A48B00C519C0 /* StringLoader.swift in Sources */,
020F758C298806F600DA2D87 /* AsyncEvent.swift in Sources */,
318A5C07272DD357000DA46C /* HapticFeedbackProtocol.swift in Sources */,
Expand Down Expand Up @@ -1462,10 +1432,8 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
31E65AC8216BC9C9008ABEE9 /* UtilitiesTests.swift in Sources */,
02EE90552829A95600225B56 /* NSObject+ObservingTests.swift in Sources */,
02EE8FE12828307900225B56 /* CombineObservingTests.swift in Sources */,
278A4DEA2B915D82003898EB /* PointsRatingTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Loading

0 comments on commit 646ed55

Please sign in to comment.