Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TRCL-3207} Add FF settings to load custom deployment URL #21

Merged
merged 1 commit into from
Nov 10, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@ public class FieldInputTextsInputViewModel: FieldInputBaseViewModel {
Spacer()
PlatformInputModel(value: self.inputBinding,
currentValue: self.input?.value as? String,
keyboardType: .default)
keyboardType: .default,
onEditingChanged: { [weak self] focused in
if (focused == false) {
self?.valueChanged?(self?.input?.value)
}
})
.createView(parentStyle: style)
.padding(.vertical, 2)
.padding(.horizontal, 8)
.themeColor(background: .layer0)
.themeColor(background: .layer5)
}
.padding()
)
Expand Down
8 changes: 2 additions & 6 deletions dydx/dydxFormatter/dydxFormatter/_Utils/dydxFeatureFlag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ import Utilities
public enum dydxBoolFeatureFlag: String, CaseIterable {
case push_notification
case full_story
case magic_link
case fixed_gas_estimate
case deposit_feature
case withdrawal_feature
case transfer_out_feature
case force_mainnet

private static let obj = NSObject()

Expand All @@ -32,7 +28,7 @@ public enum dydxBoolFeatureFlag: String, CaseIterable {
}

public enum dydxStringFeatureFlag: String {
case v4_theme
case deployment_url

private static let obj = NSObject()

Expand Down
216 changes: 7 additions & 209 deletions dydx/dydxPresenters/dydxPresenters/_Features/features.json
Original file line number Diff line number Diff line change
@@ -1,148 +1,26 @@
[
{
"title":"Under Construction",
"input":"1",
"fields":[
{
"title":{
"text":"Deposit"
},
"field":{
"field":"deposit_feature",
"type":"bool",
"optional":true,
"options" : [
{
"text": "yes",
"value" : "1"
},
{
"text": "no",
"value" : "0"
}
]
}
},
{
"title":{
"text":"Withdrawal"
},
"field":{
"field":"withdrawal_feature",
"type":"bool",
"optional":true,
"options" : [
{
"text": "yes",
"value" : "1"
},
{
"text": "no",
"value" : "0"
}
]
}
},
{
"title":{
"text":"TransferOut"
},
"field":{
"field":"transfer_out_feature",
"type":"bool",
"optional":true,
"options" : [
{
"text": "yes",
"value" : "1"
},
{
"text": "no",
"value" : "0"
}
]
}
}
]
},
{
"title":"Restrictions and Compliances",
"input":"1",
"fields":[
{
"title":{
"text":"Compliance Enabled"
},
"field":{
"field":"compliance_enabled",
"type":"bool",
"optional":true,
"options" : [
{
"text": "yes",
"value" : "1"
},
{
"text": "no",
"value" : "0"
}
]
}
}
]
},
{
"title":"AB Testing",
"title":"Dev Testing",
"input":"1",
"fields":[
{
"title":{
"text":"Skip onboarding check"
"text":"Deployment Config"
},
"field":{
"field":"skip_onboarding_check",
"field":"deployment_url",
"optional":true,
"type" : "bool",
"options" : [
{
"text": "yes",
"value" : "1"
},
{
"text": "no",
"value" : "0"
}
]
}
},
{
"title":{
"text":"Fixed Gas Estimate"
},
"field":{
"field":"fixed_gas_estimate",
"type":"bool",
"optional":true,
"options" : [
{
"text": "yes",
"value" : "1"
},
{
"text": "no",
"value" : "0"
}
]
"type" : "text"
}
},
{
"title":{
"text":"Requires Username"
"text":"Force Mainnet"
},
"field":{
"field":"username_required",
"type":"bool",
"field":"force_mainnet",
"optional":true,
"type" : "text",
"options" : [
{
"text": "yes",
Expand All @@ -155,62 +33,6 @@
]
}
},
{
"title":{
"text":"Enable Leagues"
},
"field":{
"field":"leagues_enabled",
"type":"bool",
"optional":true,
"options" : [
{
"text": "yes",
"value" : "1"
},
{
"text": "no",
"value" : "<null>"
}
]
}
},
{
"title":{
"text":"Enable Combined Markets Graph"
},
"field":{
"field":"combined_markets_graph_enabled",
"type":"bool",
"optional":true,
"options" : [
{
"text": "yes",
"value" : "1"
},
{
"text": "no",
"value" : "<null>"
}
]
}
}
]
},
{
"title":"Dev Testing",
"input":"1",
"fields":[
{
"title":{
"text":"Wallet Connect Bridge Server"
},
"field":{
"field":"walletconnect_bridge_url",
"optional":true,
"type" : "text"
}
},
{
"title":{
"text":"Push Notification"
Expand Down Expand Up @@ -250,30 +72,6 @@
}
]
}
},
{
"title":{
"text":"V4 Theme"
},
"field":{
"field":"v4_theme",
"optional":true,
"type" : "text",
"options" : [
{
"text": "Dark",
"value" : "dark"
},
{
"text": "Light",
"value" : "light"
},
{
"text": "System",
"value" : "system"
}
]
}
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ extension WalletConnectV2Config {

extension WalletSegueConfig {
init?(environment: V4Environment) {
guard let callbackUrl = environment.walletConnection?.walletSegue?.callbackUrl else {
guard let callbackUrl = environment.walletConnection?.walletSegue?.callbackUrl,
let _ = URL(string: callbackUrl) else {
return nil
}

Expand Down
10 changes: 7 additions & 3 deletions dydx/dydxStateManager/dydxStateManager/AbacusStateManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import Abacus
import Combine
import Utilities
import ParticlesKit
import dydxFormatter

public final class AbacusStateManager: NSObject {
public static let shared = AbacusStateManager()

public let deploymentUri = (CredientialConfig.shared.key(for: "webAppUrl"))!
public let deploymentUri = dydxStringFeatureFlag.deployment_url.string ?? (CredientialConfig.shared.key(for: "webAppUrl"))!

public var isMainNet: Bool {
asyncStateManager.environment?.isMainNet ?? false
Expand Down Expand Up @@ -128,7 +129,10 @@ public final class AbacusStateManager: NSObject {

let deployment: String
let appConfigs: AppConfigs
if DebugEnabled.enabled {
if dydxBoolFeatureFlag.force_mainnet.isEnabled {
deployment = "MAINNET"
appConfigs = AppConfigs.companion.forApp
} else if DebugEnabled.enabled {
// For debugging only
deployment = "DEV"
#if DEBUG
Expand All @@ -143,7 +147,7 @@ public final class AbacusStateManager: NSObject {
}

return AsyncAbacusStateManager(
deploymentUri: deploymentUri + "/",
deploymentUri: deploymentUri,
deployment: deployment,
appConfigs: appConfigs,
ioImplementations: IOImplementations.shared,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ final public class AbacusWebSocketImp: NSObject, Abacus.WebSocketProtocol {
}

public func connect(url: String, connected: @escaping (KotlinBoolean) -> Void, received: @escaping (String) -> Void) {
guard url.starts(with: "ws") else {
return
}

self.url = url
self.connected = connected
self.received = received
Expand Down
Loading