Skip to content

Commit

Permalink
change api to use futures, add java demo, add mockk
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarken committed Jul 3, 2024
1 parent 2815490 commit 747bf95
Show file tree
Hide file tree
Showing 40 changed files with 728 additions and 123 deletions.
39 changes: 39 additions & 0 deletions .idea/androidTestResultsUserPreferences.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ junitVersion = "1.1.5"
appcompat = "1.6.1"
kotlinxCoroutinesCore = "1.7.3"
material = "1.11.0"
mockk = "1.13.11"
nabtoVersion = "master-SNAPSHOT"
navigationFragmentKtx = "2.7.7"
runner = "1.5.2"
startupRuntime = "1.1.1"
webrtcVersion = "1.0.5"
nexusPlugin = "1.3.0"
lifecycleLivedataKtx = "2.7.0"
lifecycleViewmodelKtx = "2.7.0"

[libraries]
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
Expand All @@ -41,13 +44,18 @@ junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "jun
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinxCoroutinesCore" }
material = { module = "com.google.android.material:material", version.ref = "material" }
mockk = { module = "io.mockk:mockk", version.ref = "mockk" }
mockk-android = { module = "io.mockk:mockk-android", version.ref = "mockk" }
mockk-agent = { module = "io.mockk:mockk-agent", version.ref = "mockk" }
nabto-library = { module = "com.nabto.edge.client:library", version.ref = "nabtoVersion" }
nabto-library-ktx = { module = "com.nabto.edge.client:library-ktx", version.ref = "nabtoVersion" }
nabto-iamutil = { module = "com.nabto.edge.client:iam-util", version.ref = "nabtoVersion" }
nabto-iamutil-ktx = { module = "com.nabto.edge.client:iam-util-ktx", version.ref = "nabtoVersion" }
stream-webrtc-android = { module = "io.getstream:stream-webrtc-android", version.ref = "webrtcVersion" }
stream-webrtc-android-ui = { module = "io.getstream:stream-webrtc-android-ui", version.ref = "webrtcVersion" }
stream-webrtc-android-ktx = { module = "io.getstream:stream-webrtc-android-ktx", version.ref = "webrtcVersion" }
androidx-lifecycle-livedata-ktx = { group = "androidx.lifecycle", name = "lifecycle-livedata-ktx", version.ref = "lifecycleLivedataKtx" }
androidx-lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycleViewmodelKtx" }

[bundles]
jackson = ["jackson-core", "jackson-module-kotlin", "jackson-annotations", "jackson-databind", "jackson-dataformat-cbor"]
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ dependencyResolutionManagement {
rootProject.name = "webrtc"
include(":webrtc")
include(":webrtc-demo")
include(":webrtc-demo-java")
1 change: 1 addition & 0 deletions webrtc-demo-java/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
49 changes: 49 additions & 0 deletions webrtc-demo-java/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
plugins {
alias(libs.plugins.androidApplication)
}

android {
namespace = "com.example.webrtc_demo_java"
compileSdk = 34

defaultConfig {
applicationId = "com.example.webrtc_demo_java"
minSdk = 26
targetSdk = 34
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}

dependencies {
implementation(libs.nabto.library)
implementation(libs.nabto.library.ktx)
implementation(libs.nabto.iamutil)
implementation(libs.nabto.iamutil.ktx)
implementation(project(":webrtc"))

implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.lifecycle.livedata.ktx)
implementation(libs.androidx.lifecycle.viewmodel.ktx)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}
21 changes: 21 additions & 0 deletions webrtc-demo-java/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.example.webrtc_demo_java;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.webrtc_demo_java", appContext.getPackageName());
}
}
22 changes: 22 additions & 0 deletions webrtc-demo-java/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Webrtc">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.example.webrtc_demo_java;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.example.webrtc_demo_java.ui.main.MainFragment;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.container, MainFragment.newInstance())
.commitNow();
}
}
}
Loading

0 comments on commit 747bf95

Please sign in to comment.