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:3000\"")
buildConfigField("int", "PORT", "3000")
buildConfigField("boolean", "SECURE", "false") // It's common to use http (not https) for local IP access
buildConfigField("String", "API_GET_ID_URL", "\"https://10.0.2.2:3000/key=peerjs/id\"")
// --- THIS IS THE FIX ---
// Replace 127.0.0.1 with 10.0.2.2
buildConfigField("String", "API_POST_URL", "\"http://10.0.2.2:3000/key=peerjs/post\"")
buildConfigField("String", "API_GET_PEERS_URL", "\"http://10.0.2.2:3000/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>
7 changes: 5 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 All @@ -24,6 +26,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.NeurologyProjectAndroid"
android:networkSecurityConfig="@xml/network_security_config"
tools:targetApi="31">

<service
Expand All @@ -45,6 +48,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)
}

}
Loading
Loading