David Liu

upgrade a bunch of stuff and initial sdk layout

正在显示 41 个修改的文件 包含 227 行增加23 行删除
1 <component name="ProjectCodeStyleConfiguration"> 1 <component name="ProjectCodeStyleConfiguration">
2 <code_scheme name="Project" version="173"> 2 <code_scheme name="Project" version="173">
  3 + <AndroidXmlCodeStyleSettings>
  4 + <option name="ARRANGEMENT_SETTINGS_MIGRATED_TO_191" value="true" />
  5 + </AndroidXmlCodeStyleSettings>
3 <JetCodeStyleSettings> 6 <JetCodeStyleSettings>
4 <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> 7 <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
5 </JetCodeStyleSettings> 8 </JetCodeStyleSettings>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="CompilerConfiguration">
  4 + <bytecodeTargetLevel target="1.8" />
  5 + </component>
  6 +</project>
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <project version="4"> 2 <project version="4">
  3 + <component name="GradleMigrationSettings" migrationVersion="1" />
3 <component name="GradleSettings"> 4 <component name="GradleSettings">
4 <option name="linkedExternalProjectsSettings"> 5 <option name="linkedExternalProjectsSettings">
5 <GradleProjectSettings> 6 <GradleProjectSettings>
  7 + <option name="delegatedBuild" value="false" />
  8 + <option name="testRunner" value="PLATFORM" />
6 <option name="distributionType" value="DEFAULT_WRAPPED" /> 9 <option name="distributionType" value="DEFAULT_WRAPPED" />
7 <option name="externalProjectPath" value="$PROJECT_DIR$" /> 10 <option name="externalProjectPath" value="$PROJECT_DIR$" />
8 <option name="modules"> 11 <option name="modules">
9 <set> 12 <set>
10 <option value="$PROJECT_DIR$" /> 13 <option value="$PROJECT_DIR$" />
11 - <option value="$PROJECT_DIR$/app" />  
12 <option value="$PROJECT_DIR$/livekit-android-sdk" /> 14 <option value="$PROJECT_DIR$/livekit-android-sdk" />
  15 + <option value="$PROJECT_DIR$/sample-app" />
13 </set> 16 </set>
14 </option> 17 </option>
15 <option name="resolveModulePerSourceSet" value="false" /> 18 <option name="resolveModulePerSourceSet" value="false" />
16 - <option name="testRunner" value="PLATFORM" /> 19 + <option name="useQualifiedModuleNames" value="true" />
17 </GradleProjectSettings> 20 </GradleProjectSettings>
18 </option> 21 </option>
19 </component> 22 </component>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project version="4">
  3 + <component name="RemoteRepositoriesConfiguration">
  4 + <remote-repository>
  5 + <option name="id" value="central" />
  6 + <option name="name" value="Maven Central repository" />
  7 + <option name="url" value="https://repo1.maven.org/maven2" />
  8 + </remote-repository>
  9 + <remote-repository>
  10 + <option name="id" value="jboss.community" />
  11 + <option name="name" value="JBoss Community repository" />
  12 + <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
  13 + </remote-repository>
  14 + <remote-repository>
  15 + <option name="id" value="BintrayJCenter" />
  16 + <option name="name" value="BintrayJCenter" />
  17 + <option name="url" value="https://jcenter.bintray.com/" />
  18 + </remote-repository>
  19 + <remote-repository>
  20 + <option name="id" value="Google" />
  21 + <option name="name" value="Google" />
  22 + <option name="url" value="https://dl.google.com/dl/android/maven2/" />
  23 + </remote-repository>
  24 + </component>
  25 +</project>
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <project version="4"> 2 <project version="4">
3 - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK"> 3 + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
4 <output url="file://$PROJECT_DIR$/build/classes" /> 4 <output url="file://$PROJECT_DIR$/build/classes" />
5 </component> 5 </component>
6 <component name="ProjectType"> 6 <component name="ProjectType">
1 // Top-level build file where you can add configuration options common to all sub-projects/modules. 1 // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 2
3 buildscript { 3 buildscript {
4 - ext.kotlin_version = '1.3.61' 4 + ext.kotlin_version = '1.4.30'
  5 + ext.java_version = JavaVersion.VERSION_1_8
5 repositories { 6 repositories {
6 google() 7 google()
  8 + mavenCentral()
7 jcenter() 9 jcenter()
8 10
9 } 11 }
10 dependencies { 12 dependencies {
11 - classpath 'com.android.tools.build:gradle:3.5.3' 13 + classpath 'com.android.tools.build:gradle:4.1.2'
12 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
13 // NOTE: Do not place your application dependencies here; they belong 15 // NOTE: Do not place your application dependencies here; they belong
14 // in the individual module build.gradle files 16 // in the individual module build.gradle files
@@ -26,3 +28,20 @@ allprojects { @@ -26,3 +28,20 @@ allprojects {
26 task clean(type: Delete) { 28 task clean(type: Delete) {
27 delete rootProject.buildDir 29 delete rootProject.buildDir
28 } 30 }
  31 +
  32 +ext {
  33 + androidSdk = [
  34 + compileVersion: 29,
  35 + targetVersion : 29,
  36 + minVersion : 21,
  37 + ]
  38 + versions = [
  39 + androidx_core: "1.2.0",
  40 + dagger : "2.27",
  41 + ]
  42 +
  43 + deps = [
  44 + ]
  45 + annotations = [
  46 + ]
  47 +}
1 -#Thu Feb 18 09:54:32 JST 2021 1 +#Sun Feb 21 20:04:38 JST 2021
2 distributionBase=GRADLE_USER_HOME 2 distributionBase=GRADLE_USER_HOME
3 distributionPath=wrapper/dists 3 distributionPath=wrapper/dists
4 zipStoreBase=GRADLE_USER_HOME 4 zipStoreBase=GRADLE_USER_HOME
5 zipStorePath=wrapper/dists 5 zipStorePath=wrapper/dists
6 -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 6 +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
@@ -25,8 +25,8 @@ android { @@ -25,8 +25,8 @@ android {
25 25
26 android { 26 android {
27 compileOptions { 27 compileOptions {
28 - sourceCompatibility 1.8  
29 - targetCompatibility 1.8 28 + sourceCompatibility java_version
  29 + targetCompatibility java_version
30 } 30 }
31 } 31 }
32 } 32 }
@@ -34,8 +34,15 @@ android { @@ -34,8 +34,15 @@ android {
34 dependencies { 34 dependencies {
35 implementation fileTree(dir: 'libs', include: ['*.jar']) 35 implementation fileTree(dir: 'libs', include: ['*.jar'])
36 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 36 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
37 - implementation 'androidx.appcompat:appcompat:1.2.0'  
38 - implementation 'androidx.core:core-ktx:1.3.2' 37 + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2'
  38 + implementation 'org.webrtc:google-webrtc:1.0.32006'
  39 + implementation "com.squareup.okhttp3:okhttp:4.9.0"
  40 +
  41 + implementation 'com.google.dagger:dagger:2.32'
  42 + annotationProcessor 'com.google.dagger:dagger-compiler:2.32'
  43 +
  44 + implementation 'com.github.ajalt:timberkt:1.5.1'
  45 +
39 testImplementation 'junit:junit:4.12' 46 testImplementation 'junit:junit:4.12'
40 androidTestImplementation 'androidx.test.ext:junit:1.1.2' 47 androidTestImplementation 'androidx.test.ext:junit:1.1.2'
41 androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 48 androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
1 -<manifest xmlns:android="http://schemas.android.com/apk/res/android"  
2 - package="io.livekit.android" /> 1 +<manifest package="io.livekit.android" />
  1 +package io.livekit.android
  2 +
  3 +
  4 +data class ConnectOptions(
  5 + val isSecure: Boolean
  6 +)
1 package io.livekit.android 1 package io.livekit.android
2 2
  3 +class LiveKit {
  4 + suspend fun connect(
  5 + url: String,
  6 + token: String,
  7 + options: ConnectOptions?){
  8 +
  9 + }
  10 +}
  1 +package io.livekit.android.room
  2 +
  3 +import com.github.ajalt.timberkt.Timber
  4 +import okhttp3.Request
  5 +import okhttp3.Response
  6 +import okhttp3.WebSocket
  7 +import okhttp3.WebSocketListener
  8 +import okio.ByteString
  9 +import javax.inject.Inject
  10 +
  11 +internal class RTCClient
  12 +@Inject
  13 +constructor(
  14 + private val websocketFactory: WebSocket.Factory,
  15 +) : WebSocketListener() {
  16 +
  17 + private var isConnected = false
  18 + private var currentWs: WebSocket? = null
  19 + fun connect(
  20 + host: String,
  21 + token: String,
  22 + isSecure: Boolean,
  23 + ) {
  24 + val protocol = if (isSecure) "wss" else "ws"
  25 +
  26 + val wsUrlString = "$protocol://$host/rtc?access_token=$token"
  27 + Timber.i { "connecting to $wsUrlString" }
  28 +
  29 + val request = Request.Builder()
  30 + .url(wsUrlString)
  31 + .build()
  32 + currentWs = websocketFactory.newWebSocket(request, this)
  33 + }
  34 +
  35 + override fun onOpen(webSocket: WebSocket, response: Response) {
  36 + super.onOpen(webSocket, response)
  37 + }
  38 +
  39 + override fun onMessage(webSocket: WebSocket, text: String) {
  40 + super.onMessage(webSocket, text)
  41 + }
  42 +
  43 + override fun onMessage(webSocket: WebSocket, bytes: ByteString) {
  44 + super.onMessage(webSocket, bytes)
  45 + }
  46 +
  47 + override fun onClosed(webSocket: WebSocket, code: Int, reason: String) {
  48 + super.onClosed(webSocket, code, reason)
  49 + }
  50 +
  51 + override fun onClosing(webSocket: WebSocket, code: Int, reason: String) {
  52 + super.onClosing(webSocket, code, reason)
  53 + }
  54 +
  55 + override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) {
  56 + super.onFailure(webSocket, t, response)
  57 + }
  58 +
  59 +}
  1 +package io.livekit.android.room
  2 +
  3 +internal class RTCEngine {
  4 +
  5 +}
  1 +package io.livekit.android.room
  2 +
  3 +class Room(
  4 +
  5 +) {
  6 +
  7 +}
1 -<resources>  
2 - <string name="app_name">livekit-android-sdk</string>  
3 -</resources>  
@@ -21,14 +21,22 @@ android { @@ -21,14 +21,22 @@ android {
21 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 } 22 }
23 } 23 }
  24 + android {
  25 + compileOptions {
  26 + sourceCompatibility java_version
  27 + targetCompatibility java_version
  28 + }
  29 + }
24 } 30 }
25 31
26 dependencies { 32 dependencies {
27 implementation fileTree(dir: 'libs', include: ['*.jar']) 33 implementation fileTree(dir: 'libs', include: ['*.jar'])
28 - implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"  
29 - implementation 'androidx.appcompat:appcompat:1.0.2'  
30 - implementation 'androidx.core:core-ktx:1.0.2' 34 + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
  35 + implementation 'com.google.android.material:material:1.3.0'
  36 + implementation 'androidx.appcompat:appcompat:1.2.0'
  37 + implementation 'androidx.core:core-ktx:1.3.2'
  38 + implementation project(":livekit-android-sdk")
31 testImplementation 'junit:junit:4.12' 39 testImplementation 'junit:junit:4.12'
32 - androidTestImplementation 'androidx.test.ext:junit:1.1.0'  
33 - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 40 + androidTestImplementation 'androidx.test.ext:junit:1.1.2'
  41 + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
34 } 42 }
@@ -7,5 +7,7 @@ @@ -7,5 +7,7 @@
7 android:label="@string/app_name" 7 android:label="@string/app_name"
8 android:roundIcon="@mipmap/ic_launcher_round" 8 android:roundIcon="@mipmap/ic_launcher_round"
9 android:supportsRtl="true" 9 android:supportsRtl="true"
10 - android:theme="@style/AppTheme" /> 10 + android:theme="@style/AppTheme" >
  11 + <activity android:name=".sample.MainActivity" />
  12 + </application>
11 </manifest> 13 </manifest>
  1 +package io.livekit.android.sample
  2 +
  3 +import android.os.Bundle
  4 +import androidx.appcompat.app.AppCompatActivity
  5 +
  6 +class MainActivity : AppCompatActivity() {
  7 + override fun onCreate(savedInstanceState: Bundle?) {
  8 + super.onCreate(savedInstanceState)
  9 + }
  10 +}
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + android:orientation="vertical">
  6 +
  7 + <com.google.android.material.textfield.TextInputLayout
  8 + android:id="@+id/url"
  9 + android:layout_width="match_parent"
  10 + android:layout_height="wrap_content"
  11 + android:hint="@string/url">
  12 +
  13 + <com.google.android.material.textfield.TextInputEditText
  14 + android:layout_width="match_parent"
  15 + android:layout_height="wrap_content" />
  16 +
  17 + </com.google.android.material.textfield.TextInputLayout>
  18 +
  19 + <com.google.android.material.textfield.TextInputLayout
  20 + android:id="@+id/token"
  21 + android:layout_width="match_parent"
  22 + android:layout_height="wrap_content"
  23 + android:hint="@string/token">
  24 +
  25 + <com.google.android.material.textfield.TextInputEditText
  26 + android:layout_width="match_parent"
  27 + android:layout_height="wrap_content" />
  28 +
  29 + </com.google.android.material.textfield.TextInputLayout>
  30 +
  31 + <Button
  32 + android:id="@+id/connect_button"
  33 + android:layout_width="match_parent"
  34 + android:layout_height="wrap_content"
  35 + android:text="@string/connect"/>
  36 +
  37 +</LinearLayout>
1 <resources> 1 <resources>
2 <string name="app_name">livekit-android</string> 2 <string name="app_name">livekit-android</string>
  3 + <string name="connect">Connect</string>
  4 + <string name="token">Token</string>
  5 + <string name="url">URL</string>
3 </resources> 6 </resources>
1 -include ':app', ':livekit-android-sdk' 1 +include ':sample-app', ':livekit-android-sdk'
2 rootProject.name='livekit-android' 2 rootProject.name='livekit-android'