-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
81 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
app/src/main/java/io/agora/flat/common/android/ProtocolUrlManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package io.agora.flat.common.android | ||
|
||
import android.app.Application | ||
import android.content.Context | ||
import io.agora.flat.data.AppEnv | ||
import io.agora.flat.data.AppEnv.Companion.ENV_CN_DEV | ||
import io.agora.flat.data.AppEnv.Companion.ENV_CN_PROD | ||
import io.agora.flat.data.AppEnv.Companion.ENV_SG_DEV | ||
import io.agora.flat.data.AppEnv.Companion.ENV_SG_PROD | ||
|
||
object ProtocolUrlManager { | ||
private const val PRIVACY = "privacy" | ||
private const val SERVICE = "service" | ||
|
||
private lateinit var application: Context | ||
|
||
private val appEnv by lazy { AppEnv(application) } | ||
|
||
private val urls: Map<String, Map<String, Map<String, String>>> = mapOf( | ||
PRIVACY to mapOf( | ||
ENV_CN_PROD to mapOf( | ||
"en" to "https://www.flat.apprtc.cn/en/privacy.html", "zh" to "https://www.flat.apprtc.cn/privacy.html" | ||
), ENV_CN_DEV to mapOf( | ||
"en" to "https://www.flat.apprtc.cn/en/privacy.html", "zh" to "https://www.flat.apprtc.cn/privacy.html" | ||
), ENV_SG_PROD to mapOf( | ||
"en" to "https://flat.agora.io/privacy.html", "zh" to "https://flat.agora.io/zh/privacy.html" | ||
), ENV_SG_DEV to mapOf( | ||
"en" to "https://flat.agora.io/privacy.html", "zh" to "https://flat.agora.io/zh/privacy.html" | ||
) | ||
), | ||
SERVICE to mapOf( | ||
ENV_CN_PROD to mapOf( | ||
"en" to "https://www.flat.apprtc.cn/en/service.html", "zh" to "https://www.flat.apprtc.cn/service.html" | ||
), ENV_CN_DEV to mapOf( | ||
"en" to "https://www.flat.apprtc.cn/en/service.html", "zh" to "https://www.flat.apprtc.cn/service.html" | ||
), ENV_SG_PROD to mapOf( | ||
"en" to "https://flat.agora.io/en/service.html", "zh" to "https://flat.agora.io/zh/service.html" | ||
), ENV_SG_DEV to mapOf( | ||
"en" to "https://flat.agora.io/en/service.html", "zh" to "https://flat.agora.io/zh/service.html" | ||
) | ||
), | ||
) | ||
|
||
fun init(app: Application) { | ||
application = app | ||
} | ||
|
||
val Service: String | ||
get() { | ||
val env = appEnv.getEnv() | ||
val lang = LanguageManager.currentLocale().language | ||
return urls[SERVICE]!![env]?.get(lang) ?: "https://www.flat.apprtc.cn/service.html" | ||
} | ||
|
||
val Privacy: String | ||
get() { | ||
val env = appEnv.getEnv() | ||
val lang = LanguageManager.currentLocale().language | ||
return urls[PRIVACY]!![env]?.get(lang) ?: "https://www.flat.apprtc.cn/privacy.html" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters