Skip to content
Open
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
42 changes: 28 additions & 14 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ plugins {
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
id("com.google.devtools.ksp")
id("com.google.dagger.hilt.android")
kotlin("plugin.serialization").version("2.2.21")
}

android {
Expand All @@ -27,11 +29,12 @@ android {
"proguard-rules.pro"
)

buildConfigField("String", "BASE_API_URL", "\"https://videochat-signaling-app.ue.r.appspot.com\"")
buildConfigField("String", "BASE_API_URL", "\"https://meechie.techkit.xyz\"")
buildConfigField("String", "BASE_WS_API_URL", "\"wss://videochat-signaling-app.ue.r.appspot.com\"")
buildConfigField("int", "PORT", "443")
buildConfigField("int", "PORT", "444")
buildConfigField("boolean", "SECURE", "true") // yes use HTTPS
buildConfigField("String", "API_POST_URL","\"https://videochat-signaling-app.ue.r.appspot.com/key=peerjs/post\"")
buildConfigField("String", "API_POST_URL","\"https://meechie.techkit.xyz:444/key=peerjs/post\"")
buildConfigField("String", "API_GET_ID_URL", "\"https://meechie.techkit.xyz:444/key=peerjs/id\"")
buildConfigField("String", "API_GET_PEERS_URL","\"https://videochat-signaling-app.ue.r.appspot.com/key=peerjs/peers\"")
signingConfig = signingConfigs.getByName("debug")
}
Expand All @@ -43,11 +46,12 @@ android {
"proguard-rules.pro"
)

buildConfigField("String", "BASE_API_URL", "\"https://videochat-signaling-app.ue.r.appspot.com\"")
buildConfigField("String", "BASE_API_URL", "\"https://meechie.techkit.xyz\"")
buildConfigField("String", "BASE_WS_API_URL", "\"wss://videochat-signaling-app.ue.r.appspot.com\"")
buildConfigField("int", "PORT", "443")
buildConfigField("int", "PORT", "444")
buildConfigField("boolean", "SECURE", "true") // yes use HTTPS
buildConfigField("String", "API_POST_URL","\"https://videochat-signaling-app.ue.r.appspot.com/key=peerjs/post\"")
buildConfigField("String", "API_POST_URL","\"https://meechie.techkit.xyz:444/key=peerjs/post\"")
buildConfigField("String", "API_GET_ID_URL", "\"https://meechie.techkit.xyz:444/key=peerjs/id\"")
buildConfigField("String", "API_GET_PEERS_URL","\"https://videochat-signaling-app.ue.r.appspot.com/key=peerjs/peers\"")
signingConfig = signingConfigs.getByName("debug")
}
Expand All @@ -62,14 +66,18 @@ android {
applicationIdSuffix = ".local" // e.g., com.example.myapp.local
versionNameSuffix = "-local"

// Override BASE_API_URL to point to your local development server
// Override BASE_API_URL to point to your local development server
// 10.0.2.2 is the special IP for your host machine's loopback on Android Emulator
buildConfigField("String", "BASE_API_URL", "\"localhost\"")
buildConfigField("String", "BASE_WS_API_URL", "\"ws://localhost:9000\"")
buildConfigField("int", "PORT", "9000")
buildConfigField("boolean", "SECURE", "false") // no use HTTPS
buildConfigField("String", "API_POST_URL","\"https://localhost:9000/key=peerjs/post\"")
buildConfigField("String", "API_GET_PEERS_URL","\"http://localhost:9000/key=peerjs/peers\"")
buildConfigField("String", "BASE_API_URL", "\"https://10.0.2.2\"") // Use http for local unless you have SSL set up for this IP
buildConfigField("String", "BASE_WS_API_URL", "\"ws://10.0.2.2:3016\"")
buildConfigField("int", "PORT", "3016")
buildConfigField("boolean", "SECURE", "false") // It's common to use http (not https) for local IP access

// --- THIS IS THE FIX ---
// Replace 127.0.0.1 with 10.0.2.2
buildConfigField("String", "API_POST_URL", "\"http://10.0.2.2:3016/key=peerjs/post\"")
buildConfigField("String", "API_GET_PEERS_URL", "\"http://10.0.2.2:3016/key=peerjs/peers\"")
// ------------------------

// If using a physical device on your local network, replace with your actual local IP:
// buildConfigField("String", "BASE_API_URL", "\"http://192.168.1.XX:8080\"")
Expand Down Expand Up @@ -100,9 +108,15 @@ android {
}

dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0")
implementation("com.google.dagger:hilt-android:2.57.1")
implementation(libs.androidx.runtime)
ksp("com.google.dagger:hilt-android-compiler:2.57.2")
implementation ("com.github.0-u-0:mediasoup-android-sdk:0.0.1")
implementation("com.github.0-u-0:dugon-webrtc-android:100.0.2")
implementation("io.socket:socket.io-client:2.1.1")
implementation ("com.github.franmontiel:PersistentCookieJar:v1.0.1")
implementation("com.squareup.okhttp3:okhttp:5.0.0-alpha.14")
implementation("io.github.webrtc-sdk:android:125.6422.06.1")
implementation("androidx.compose.material:material-icons-extended")
implementation("androidx.room:room-runtime:2.5.0")
implementation(libs.androidx.camera.core)
Expand Down
7 changes: 7 additions & 0 deletions app/src/debug/res/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- This application block will be merged with the main AndroidManifest.xml -->
<!-- It only applies to debug builds -->
<application
android:networkSecurityConfig="@xml/network_security_config" />
</manifest>
6 changes: 4 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
<uses-feature
android:name="android.hardware.microphone"
android:required="false" />
<uses-feature android:name="android.hardware.usb.host" android:required="true" /> <application
<uses-feature android:name="android.hardware.usb.host" android:required="true" />
<application
android:name=".MyApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand Down Expand Up @@ -45,6 +47,6 @@
<activity android:name=".ListNIHFormActivity" android:exported="false" />
<activity android:name=".MainActivity" android:exported="false" />
<activity android:name=".NewNIHFormActivity" android:exported="false" />
<activity android:name=".SavedNIHFormActivity" android:exported="false" />
<activity android:name=".NewSavedNIHFormActivity" android:exported="false" />
</application>
</manifest>
Binary file modified app/src/main/java/com/example/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.example.neurology_project_android

// In: app/src/main/java/com/example/neurology_project_android/di/AppModule.kt
// (It's good practice to put modules in a 'di' package)

import android.content.Context
import android.os.Build
import androidx.annotation.RequiresApi
import com.example.neurology_project_android.SessionManager
import com.example.neurology_project_android.SignalingRepository
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import okhttp3.OkHttpClient
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class) // These dependencies will live as long as the app
object AppModule {

@Provides
@Singleton // Use @Singleton to ensure only one instance is ever created
fun provideOkHttpClient(@ApplicationContext context: Context): OkHttpClient {
// Hilt provides the application context for us
return SessionManager(context).client
}



@RequiresApi(Build.VERSION_CODES.VANILLA_ICE_CREAM)
@Provides // <-- ADD THIS: Tells Hilt this function PROVIDES a dependency.
@Singleton
fun provideSignalingClient(@ApplicationContext context: Context): SignalingClient {
return SignalingClient(context)
}

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.example.neurology_project_android

import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.*
Expand All @@ -15,6 +17,9 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.sp

class CallScreenActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -28,7 +33,7 @@ class CallScreenActivity : ComponentActivity() {
@Composable
fun CallScreen() {
var isMuted by remember { mutableStateOf(false) }

val context = LocalContext.current
Box(
modifier = Modifier
.fillMaxSize()
Expand All @@ -49,46 +54,188 @@ fun CallScreen() {
.padding(16.dp)
.padding(bottom = 20.dp),
horizontalArrangement = Arrangement.SpaceEvenly,
verticalAlignment = Alignment.CenterVertically

) {
IconButton(
onClick = { /* Open Stroke Scale Form */ },
modifier = Modifier
.size(64.dp)
.background(Color.Gray, shape = CircleShape)
Column(
// Center the items horizontally within the column
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.weight(1f).background(Color.DarkGray).clickable(onClick = {
val intent = Intent(
context,
ListNIHFormActivity::class.java
)

context.startActivity(intent)
/* Open Stroke Scale Form */
})

) {
Icon(
painter = painterResource(id = android.R.drawable.ic_menu_edit),
contentDescription = null,
tint = Color.White
IconButton(
onClick = {
val intent = Intent(
context,
ListNIHFormActivity::class.java
)
// 3. Start the new Activity
context.startActivity(intent)
/* Open Stroke Scale Form */ },
modifier = Modifier
.size(64.dp)
.background(Color.DarkGray)
) {
Icon(
painter = painterResource(R.drawable.assignment_add_24px),
contentDescription = null,
tint = Color.White
)
}
// Add the Text composable right below the IconButton
Spacer(modifier = Modifier.height(4.dp)) // Optional: Add a small vertical space
Text(
text = "New Form/View Form",
modifier = Modifier.fillMaxWidth(),


fontSize = 16.sp,


fontWeight = androidx.compose.ui.text.font.FontWeight.Bold,


color = Color.White,

textAlign = TextAlign.Center,
maxLines = 3,
overflow = TextOverflow.Ellipsis
)
}

IconButton(
onClick = { isMuted = !isMuted },
modifier = Modifier
.size(64.dp)
.background(Color.DarkGray, shape = CircleShape)
Column(
// Center the items horizontally within the column
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.weight(1f).background(Color.Gray).clickable(onClick = {

})

) {
Icon(
painter = painterResource(id = if (isMuted) android.R.drawable.ic_lock_silent_mode else android.R.drawable.ic_lock_silent_mode_off),
IconButton(
onClick = {
if(isMuted){
isMuted = false
}
else{
isMuted = true
}

},
modifier = Modifier
.size(64.dp)
.background(Color.Gray)
) {
Icon(
painter = painterResource(id = if (isMuted) R.drawable.mic_off_24px else R.drawable.mic_24px),
contentDescription = null,
tint = Color.White
)
}
// Add the Text composable right below the IconButton
Spacer(modifier = Modifier.height(4.dp)) // Optional: Add a small vertical space
Text(
text = "Mute/Unmute",
modifier = Modifier.fillMaxWidth(),


fontSize = 16.sp,


fontWeight = androidx.compose.ui.text.font.FontWeight.Bold,


color = Color.White,

textAlign = TextAlign.Center,
maxLines = 3,
overflow = TextOverflow.Ellipsis
)
}

IconButton(
onClick = { /* End Call */ },
modifier = Modifier
.size(64.dp)
.background(Color.Red, shape = CircleShape)
Column(
// Center the items horizontally within the column
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.weight(1f).background(Color.Red).clickable(onClick = {
val intent = Intent(context, NewNIHFormActivity::class.java).apply {
putExtra(NewNIHFormActivity.EXTRA_IN_CALL, true)
}
context.startActivity(intent)

/* Open Stroke Scale Form */
})

) {
Icon(
painter = painterResource(id = android.R.drawable.ic_menu_close_clear_cancel),
IconButton(
onClick = {
val intent = Intent(context, NewNIHFormActivity::class.java).apply {
putExtra(NewNIHFormActivity.EXTRA_IN_CALL, true)
}
context.startActivity(intent)

/* Open Stroke Scale Form */ },
modifier = Modifier
.size(64.dp)
.background(Color.Red)
) {
Icon(
painter = painterResource(R.drawable.call_end_24px),
contentDescription = null,
tint = Color.White
)
}
// Add the Text composable right below the IconButton
Spacer(modifier = Modifier.height(4.dp)) // Optional: Add a small vertical space
Text(
text = "End Call",
modifier = Modifier.fillMaxWidth(),


fontSize = 16.sp,


fontWeight = androidx.compose.ui.text.font.FontWeight.Bold,


color = Color.White,

textAlign = TextAlign.Center,
maxLines = 3,
overflow = TextOverflow.Ellipsis
)
}

// IconButton(
// onClick = { isMuted = !isMuted },
// modifier = Modifier
// .size(64.dp)
// .background(Color.DarkGray, shape = CircleShape)
// ) {
// Icon(
// painter = painterResource(id = if (isMuted) R.drawable.mic_off_24px else R.drawable.mic_24px),
// contentDescription = null,
// tint = Color.White
// )
// }
//
// IconButton(
// onClick = { /* End Call */ },
// modifier = Modifier
// .size(64.dp)
// .background(Color.Red, shape = CircleShape)
// ) {
// Icon(
// painter = painterResource(R.drawable.call_end_24px),
// contentDescription = null,
// tint = Color.White
// )
// }
}
}
}
Expand Down
Loading
Loading