@@ -38,12 +38,7 @@ import kotlinx.coroutines.sync.withLock
3838class BrokerDiscoveryClientFactory {
3939
4040 companion object {
41-
42- private val TAG = BrokerDiscoveryClientFactory ::class .simpleName
43-
44- @Volatile
45- private var IS_NEW_DISCOVERY_ENABLED = false
46-
41+
4742 @Volatile
4843 private var clientSdkInstance: IBrokerDiscoveryClient ? = null
4944
@@ -56,25 +51,11 @@ class BrokerDiscoveryClientFactory {
5651 private val lock = Mutex ()
5752
5853 /* *
59- * If set to true, the new Broker discovery mechanism will be enabled.
60- * This is currently turned off by default - until we're ready to ship the feature .
54+ * Do nothing, since this is always enabled now .
55+ * Keep it for now to prevent breaking OneAuth .
6156 **/
6257 @JvmStatic
6358 fun setNewBrokerDiscoveryEnabled (isEnabled : Boolean ){
64- // If the flag changes, wipe the existing singleton.
65- if (isEnabled != IS_NEW_DISCOVERY_ENABLED ) {
66- clientSdkInstance = null
67- brokerSdkInstance = null
68- IS_NEW_DISCOVERY_ENABLED = isEnabled
69- }
70- }
71-
72- /* *
73- * Returns true if the new Broker discovery mechanism is enabled.
74- **/
75- @JvmStatic
76- fun isNewBrokerDiscoveryEnabled (): Boolean {
77- return BuildConfig .newBrokerDiscoveryEnabledFlag || IS_NEW_DISCOVERY_ENABLED ;
7859 }
7960
8061 /* *
@@ -87,7 +68,7 @@ class BrokerDiscoveryClientFactory {
8768 runBlocking {
8869 lock.withLock {
8970 if (clientSdkInstance == null ) {
90- clientSdkInstance = getInstance (context,
71+ clientSdkInstance = BrokerDiscoveryClient (context,
9172 platformComponents,
9273 ClientActiveBrokerCache .getClientSdkCache(platformComponents.storageSupplier))
9374 }
@@ -108,7 +89,7 @@ class BrokerDiscoveryClientFactory {
10889 runBlocking {
10990 lock.withLock {
11091 if (brokerSdkInstance == null ) {
111- brokerSdkInstance = getInstance (context,
92+ brokerSdkInstance = BrokerDiscoveryClient (context,
11293 platformComponents,
11394 ClientActiveBrokerCache .getBrokerSdkCache(platformComponents.storageSupplier))
11495 }
@@ -117,23 +98,5 @@ class BrokerDiscoveryClientFactory {
11798 }
11899 return brokerSdkInstance!!
119100 }
120-
121- /* *
122- * Initializes a new [IBrokerDiscoveryClient] object.
123- * to be used by OneAuth/MSAL.
124- **/
125- @JvmStatic
126- private fun getInstance (context : Context ,
127- platformComponents : IPlatformComponents ,
128- cache : IClientActiveBrokerCache ) : IBrokerDiscoveryClient {
129- val methodTag = " $TAG :getInstance"
130- return if (isNewBrokerDiscoveryEnabled()) {
131- Logger .info(methodTag, " Broker Discovery is enabled. Use the new logic on the SDK side" )
132- BrokerDiscoveryClient (context, platformComponents, cache)
133- } else {
134- Logger .info(methodTag, " Broker Discovery is disabled. Use AccountManager on the SDK side." )
135- LegacyBrokerDiscoveryClient (context)
136- }
137- }
138101 }
139102}
0 commit comments