Skip to content
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

Commit 0c835f5

Browse files
committed
* [f][M] Writing call ended at to RTDB
* [f] Adding app icon * [u] Android gradle plugin
1 parent 1495e4a commit 0c835f5

22 files changed

Lines changed: 44 additions & 14 deletions

app/src/main/ic_launcher-web.png

23.4 KB
Loading

app/src/main/java/io/qtalk/qgamejsinterfacetester/WebViewFragment.kt

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import android.view.View
88
import android.view.ViewGroup
99
import android.webkit.ConsoleMessage
1010
import android.widget.Toast
11+
import com.google.firebase.database.DatabaseReference
1112
import com.google.firebase.database.FirebaseDatabase
1213
import com.google.firebase.database.IgnoreExtraProperties
1314
import com.google.firebase.database.PropertyName
@@ -28,9 +29,9 @@ class WebViewFragment: PermissionAwareWebViewFragment(), JSInterface.JSInterface
2829
private const val ARG_URL_STRING = "arg-url"
2930
private const val ARG_INTERACTION_TYPE = "arg-interaction-type"
3031

31-
private var isTestUrl = false
32-
33-
private lateinit var interactionType: InteractionType
32+
private const val RTDB_CHILD_CALL_DETAILS = "clDts"
33+
private const val RTDB_CHILD_PARTICIPANTS = "prtcpnts"
34+
private const val RTDB_VALUE_CALL_ENDED_AT = "clEdAt"
3435

3536
fun init(url: String, interactionType: InteractionType = InteractionType.IN_CALL): WebViewFragment {
3637
return WebViewFragment().apply {
@@ -42,16 +43,22 @@ class WebViewFragment: PermissionAwareWebViewFragment(), JSInterface.JSInterface
4243
}
4344
}
4445

46+
private var isTestUrl = false
47+
48+
private lateinit var interactionType: InteractionType
49+
4550
private lateinit var jsInterface: JSInterface
4651

52+
private lateinit var rtdbReference: DatabaseReference
53+
4754
private data class TestUserObject(
4855
val tstId: String,
4956
val iPrv: Boolean = true,
5057
val mod: String = "VOIP"
5158
)
5259

5360
@IgnoreExtraProperties
54-
data class RTDBPreviewCallDetails(
61+
private data class RTDBPreviewCallDetails(
5562
@get:PropertyName("rtcClId")
5663
@set:PropertyName("rtcClId")
5764
var rtcCallId: String,
@@ -82,14 +89,15 @@ class WebViewFragment: PermissionAwareWebViewFragment(), JSInterface.JSInterface
8289
val ref = database.getReference("qtalkDebugAndStaging/calls").child(callId)
8390

8491
// store the participant info with the key as the user id
85-
ref.child("prtcpnts").child(selectedUser).setValue(TestUserObject(selectedUser))
92+
ref.child(RTDB_CHILD_PARTICIPANTS).child(selectedUser).setValue(TestUserObject(selectedUser))
8693

8794
// store call details
88-
ref.child("clDts").setValue(RTDBPreviewCallDetails(
95+
ref.child(RTDB_CHILD_CALL_DETAILS).setValue(RTDBPreviewCallDetails(
8996
callId,
9097
System.currentTimeMillis()
9198
))
9299

100+
rtdbReference = ref
93101
}
94102

95103
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
@@ -114,6 +122,13 @@ class WebViewFragment: PermissionAwareWebViewFragment(), JSInterface.JSInterface
114122
if (interactionType == InteractionType.WEB_SHARING) {
115123
// write to QTalks RTDB here as participant information needs to be added in the array.
116124
writeParticipantInfoAndCallDetailsToRTDB()
125+
126+
endCallButton.visibility = View.VISIBLE
127+
128+
endCallButton.setOnClickListener{
129+
rtdbReference.child(RTDB_CHILD_CALL_DETAILS).child(RTDB_VALUE_CALL_ENDED_AT).setValue(System.currentTimeMillis())
130+
activity?.finish()
131+
}
117132
}
118133

119134
jsInterface = JSInterface(this)

app/src/main/res/drawable/ic_launcher_background.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<vector
3-
xmlns:android="http://schemas.android.com/apk/res/android"
4-
android:height="108dp"
5-
android:width="108dp"
6-
android:viewportHeight="108"
7-
android:viewportWidth="108">
3+
android:height="108dp"
4+
android:width="108dp"
5+
android:viewportHeight="108"
6+
android:viewportWidth="108"
7+
xmlns:android="http://schemas.android.com/apk/res/android">
88
<path android:fillColor="#008577"
99
android:pathData="M0,0h108v108h-108z"/>
1010
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"

app/src/main/res/layout/webview_fragment.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,21 @@
6464
android:layout_height="0dp"
6565
app:layout_constraintTop_toBottomOf="@id/logView"
6666
app:layout_constraintBottom_toBottomOf="parent"/>
67+
<androidx.appcompat.widget.AppCompatImageButton
68+
android:layout_width="wrap_content"
69+
app:layout_constraintBottom_toBottomOf="parent"
70+
app:layout_constraintEnd_toEndOf="parent"
71+
android:layout_margin="16dp"
72+
tools:visibility="visible"
73+
android:visibility="gone"
74+
android:id="@+id/endCallButton"
75+
android:rotation="45"
76+
android:elevation="0dp"
77+
android:padding="6dp"
78+
android:src="@android:drawable/ic_menu_call"
79+
android:tint="@android:color/white"
80+
android:background="@drawable/custom_bg_8dp_primary"
81+
android:layout_height="wrap_content"/>
6782
<ProgressBar
6883
app:layout_constraintStart_toStartOf="parent"
6984
app:layout_constraintEnd_toEndOf="parent"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
33
<background android:drawable="@drawable/ic_launcher_background"/>
4-
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
55
</adaptive-icon>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
33
<background android:drawable="@drawable/ic_launcher_background"/>
4-
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
55
</adaptive-icon>
-699 Bytes
Loading
3.41 KB
Loading
-562 Bytes
Loading
-524 Bytes
Loading

0 commit comments

Comments
 (0)