Skip to content

Commit 19a9a9c

Browse files
committed
Configure android secret plugin
1 parent f57e457 commit 19a9a9c

File tree

9 files changed

+87
-3
lines changed

9 files changed

+87
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ build/
1919

2020
# Local configuration file (sdk path, etc)
2121
local.properties
22+
secrets.properties
2223

2324
# Proguard folder generated by Eclipse
2425
proguard/

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ plugins {
1313
alias(libs.plugins.kotlin.serialization) apply false
1414
alias(libs.plugins.ksp) apply false
1515
alias(libs.plugins.hilt) apply false
16+
alias(libs.plugins.google.secrets) apply false
1617
alias(libs.plugins.spotless) apply false
1718
}

features/chats/build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,20 @@ plugins {
1919
id("getstream.android.feature")
2020
id("getstream.android.hilt")
2121
id("getstream.spotless")
22+
id(libs.plugins.google.secrets.get().pluginId)
2223
}
2324

2425
android {
2526
namespace = "io.getstream.whatsappclone.chats"
2627
}
2728

29+
secrets {
30+
propertiesFileName = "secrets.properties"
31+
defaultPropertiesFileName = "secrets.defaults.properties"
32+
ignoreList.add("keyToIgnore") // Ignore the key "keyToIgnore"
33+
ignoreList.add("sdk.*") // Ignore all keys matching the regexp "sdk.*"
34+
}
35+
2836
dependencies {
2937
// core modules
3038
implementation(project(":core:uistate"))

features/chats/src/main/kotlin/io/getstream/whatsappclone/chats/initializer/StreamChatInitializer.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import io.getstream.chat.android.offline.plugin.configuration.Config
2626
import io.getstream.chat.android.offline.plugin.factory.StreamOfflinePluginFactory
2727
import io.getstream.log.streamLog
2828
import io.getstream.whatsappclone.chats.BuildConfig
29-
import io.getstream.whatsappclone.chats.R
3029

3130
/**
3231
* StreamChatInitializer initializes all Stream Client components.
@@ -51,7 +50,7 @@ class StreamChatInitializer : Initializer<Unit> {
5150
),
5251
appContext = context
5352
)
54-
val chatClient = ChatClient.Builder(context.getString(R.string.stream_api_key), context)
53+
val chatClient = ChatClient.Builder(BuildConfig.STREAM_API_KEY, context)
5554
.withPlugin(offlinePluginFactory)
5655
.logLevel(logLevel)
5756
.build()

features/chats/src/main/res/values/strings.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@
1616
-->
1717
<resources>
1818
<string name="stream_top_bar">Stream</string>
19-
<string name="stream_api_key">6wj48bfwxg4h</string>
2019
</resources>

features/video/build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,20 @@ plugins {
1919
id("getstream.android.feature")
2020
id("getstream.android.hilt")
2121
id("getstream.spotless")
22+
id(libs.plugins.google.secrets.get().pluginId)
2223
}
2324

2425
android {
2526
namespace = "io.getstream.whatsappclone.video"
2627
}
2728

29+
secrets {
30+
propertiesFileName = "secrets.properties"
31+
defaultPropertiesFileName = "secrets.defaults.properties"
32+
ignoreList.add("keyToIgnore") // Ignore the key "keyToIgnore"
33+
ignoreList.add("sdk.*") // Ignore all keys matching the regexp "sdk.*"
34+
}
35+
2836
dependencies {
2937
// core modules
3038
implementation(project(":core:uistate"))
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Copyright 2023 Stream.IO, Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.getstream.whatsappclone.video
18+
19+
import androidx.compose.runtime.Composable
20+
import androidx.compose.runtime.getValue
21+
import androidx.compose.runtime.mutableStateOf
22+
import androidx.compose.runtime.remember
23+
import androidx.compose.runtime.setValue
24+
import androidx.compose.ui.platform.LocalContext
25+
import io.getstream.video.android.core.Call
26+
27+
@Composable
28+
fun WhatsAppVideoCall(id: String) {
29+
val context = LocalContext.current
30+
31+
var call: Call? by remember { mutableStateOf(null) }
32+
33+
// LaunchedEffect(key1 = Unit) {
34+
// val userToken =
35+
// "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiQmVuX1NreXdhbGtlciIsImlzcyI6InByb250byIsInN1YiI6InVzZXIvQmVuX1NreXdhbGtlciIsImlhdCI6MTY5Njk4NDE3MywiZXhwIjoxNjk3NTg4OTc4fQ.Cdq_sw1ZA_PiGNXmOIZdxZjmlBKK8DuW8Oy_YjKloZw"
36+
// val userId = "Ben_Skywalker"
37+
// val callId = "dE8AsD5Qxqrt"
38+
//
39+
// // step1 - create a user.
40+
// val user = User(
41+
// id = userId, // any string
42+
// name = "Tutorial", // name and image are used in the UI
43+
// role = "admin",
44+
// )
45+
//
46+
// // step2 - initialize StreamVideo. For a production app we recommend adding the client to your Application class or di module.
47+
// val client = StreamVideoBuilder(
48+
// context = context,
49+
// apiKey = stringResource(id = R.string.),
50+
// geo = GEO.GlobalEdgeNetwork,
51+
// user = user,
52+
// token = userToken,
53+
// ensureSingleInstance = false,
54+
// ).build()
55+
//
56+
// // step3 - join a call, which type is `default` and id is `123`.
57+
// call = client.call("livestream", callId)
58+
//
59+
// // join the cal
60+
// val result = call?.join()
61+
// result?.onError {
62+
// Toast.makeText(context, "uh oh $it", Toast.LENGTH_SHORT).show()
63+
// }
64+
// }
65+
}

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ okhttp = "4.12.0"
3939
retrofit = "2.9.0"
4040
retrofitResultAdapter = "1.0.9"
4141
retrofitKotlinxSerializationJson = "1.0.0"
42+
googleSecretPlugin = "2.0.1"
4243
spotless = "6.7.0"
4344
turbine = "1.0.0"
4445

@@ -109,3 +110,4 @@ kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
109110
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
110111
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
111112
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
113+
google-secrets = { id = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin", version.ref = "googleSecretPlugin" }

secrets.defaults.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STREAM_API_KEY=aaaaaaaaaa

0 commit comments

Comments
 (0)