Skip to content

Commit

Permalink
AHOYAPPS-91: General Code Cleanup (#10)
Browse files Browse the repository at this point in the history
* Move common functions to top level build.gradle

* Remove unneeded global gradle versions

* Upgrade to latest rxjava2 versions

* Remove guava dependency

- Replaced stats ImmutableList guava dependency with Kotlin Immutable list

* Upgrade to latest crashlytics version

* Use Kotlin isNullOrEmpty method instead of Guava

* Upgrade from deprecated dagger version

* Upgrade gradle, google services, and kotlin to latest versions

* Apply formatter

* Set kotlin spotless formatter

* Ran formatter on kotlin files

* Remove unused gradle functions

* Remove IDE generated instrumentation test

* Replace 2017 license text with 2019

* Add licensing to files that were missing it

* Use Timber formatter

* Log exception instead of message

* Remove unused twilioapi directory

* Reduce scope of variables to local

* Clean up java syntax and access modifiers

* Remove unneeded public access modifers

* Remove unused code

* Clean up JavaDoc

* Change development flavor to community flavor to show display name

* Fix potential NPE pug and accessibility warning

* Add null checking to various areas with potential NPEs

* Remove unused code

* Cleanup assignment for field and remove unused boolean field

* Add todos linking to JIRA stories

* Apply Formatter
  • Loading branch information
John Qualls committed Nov 8, 2019
1 parent 572f949 commit 3b1f5a0
Show file tree
Hide file tree
Showing 89 changed files with 931 additions and 2,412 deletions.
2 changes: 1 addition & 1 deletion ACKNOWLEDGEMENTS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Acknowledgements

This software includes the following software dependencies under their corresponding licenses:

- Twilio Video Android - https://www.twilio.com/legal/tos.

- Generic [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0.txt).
Expand Down
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### 0.1.0
#### 0.1.0

This is the initial release of this application as an open source project. The full release
to the Google Play Store will be part of the first major release.
This is the initial release of this application as an open source project. The full release
to the Google Play Store will be part of the first major release.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
This project demonstrates a multi-party voice and video application built with the Twilio Android Video SDK.

# Setup
Before running the app, follow the steps below to provide an access token required to connect to a Twilio room.
Before running the app, follow the steps below to provide an access token required to connect to a Twilio room.

1. Ensure you are using the community build variant.
<img width="700px" src="images/community-variant/community-variant.png"/>
Expand All @@ -12,9 +12,9 @@ Before running the app, follow the steps below to provide an access token requir
3. Type in an identity and click on "Generate Access Token" from the [Testing Tools Page](https://www.twilio.com/console/video/runtime/testing-tools).
<img width="700px" src="images/community-variant/generate_access_token.png"/>

4. Add the access token string copied from the console to a variable named `TWILIO_ACCESS_TOKEN`
4. Add the access token string copied from the console to a variable named `TWILIO_ACCESS_TOKEN`
in your **local.properties** file.

```
TWILIO_ACCESS_TOKEN=abcdef0123456789
```
```
46 changes: 23 additions & 23 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion versions.compileSdk
buildToolsVersion "${versions.buildTools}"
compileSdkVersion 28
buildToolsVersion '28.0.3'

lintOptions {
warningsAsErrors true
Expand All @@ -20,8 +20,8 @@ android {
defaultConfig {
applicationId "com.twilio.video.app"

minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
minSdkVersion 16
targetSdkVersion 28

versionName "0.1.0"
versionCode 1
Expand All @@ -32,8 +32,8 @@ android {
}

compileOptions {
sourceCompatibility versions.java
targetCompatibility versions.java
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

signingConfigs {
Expand Down Expand Up @@ -104,43 +104,43 @@ android {

dependencies {
def butterknife = '10.2.0'
def dagger = '2.15'
def retrofit = '2.1.0'
implementation 'com.twilio:twilio-android-env:1.0.0'
implementation "com.twilio:video-android:5.0.0"
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation "com.appyvet:materialrangebar:${versions.materialrangebar}"
implementation "com.appyvet:materialrangebar:1.3"
implementation "com.jakewharton:butterknife:$butterknife"
implementation "com.google.guava:guava:${versions.guava}"
implementation 'androidx.multidex:multidex:2.0.1'
implementation "com.google.firebase:firebase-core:${versions.firebase}"
implementation "com.google.firebase:firebase-auth:${versions.firebaseAuth}"
implementation "com.crashlytics.sdk.android:crashlytics:${versions.crashlytics}"
implementation "com.google.android.gms:play-services-auth:${versions.playServicesAuth}"
implementation "com.google.firebase:firebase-core:16.0.1"
implementation "com.google.firebase:firebase-auth:16.0.2"
implementation "com.crashlytics.sdk.android:crashlytics:2.10.1"
implementation "com.google.android.gms:play-services-auth:15.0.1"

implementation "com.google.dagger:dagger:${versions.dagger}"
implementation "com.google.dagger:dagger-android:${versions.dagger}"
annotationProcessor "com.google.dagger:dagger-compiler:${versions.dagger}"
implementation "com.google.dagger:dagger:$dagger"
implementation "com.google.dagger:dagger-android:$dagger"
annotationProcessor "com.google.dagger:dagger-compiler:$dagger"

implementation "io.reactivex.rxjava2:rxjava:${versions.rxJava2}"
implementation "io.reactivex.rxjava2:rxandroid:${versions.rxAndroid2}"
implementation "io.reactivex.rxjava2:rxjava:2.2.10"
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"

implementation "com.squareup.retrofit2:retrofit:${versions.retrofit2}"
implementation "com.squareup.retrofit2:converter-gson:${versions.retrofit2}"
implementation "com.squareup.retrofit2:converter-scalars:${versions.retrofit2}"
implementation "com.squareup.retrofit2:retrofit:$retrofit"
implementation "com.squareup.retrofit2:converter-gson:$retrofit"
implementation "com.squareup.retrofit2:converter-scalars:$retrofit"

implementation "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:${versions.rxJava2Adapter}"
implementation "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0"

annotationProcessor "com.jakewharton:butterknife-compiler:$butterknife"
}

def getLocalProperty(key) {
def value = null
if (project.rootProject.file('local.properties').exists()) {
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
value = properties.getProperty(key)
def value = properties.getProperty(key)
return value
} else {
logger.log(LogLevel.WARN, "Could not find local.properties in " +
Expand Down
27 changes: 0 additions & 27 deletions app/src/androidTest/java/com/twilio/video/app/ApplicationTest.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (C) 2019 Twilio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.twilio.video.app;

import com.twilio.video.LogLevel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (C) 2019 Twilio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.twilio.video.app;

import com.twilio.video.app.auth.CommunityAuthModule;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (C) 2019 Twilio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.twilio.video.app.auth;

import android.content.SharedPreferences;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2019 Twilio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.twilio.video.app.auth

import android.content.SharedPreferences
import com.twilio.video.app.base.BaseActivity
import com.twilio.video.app.data.Preferences
import com.twilio.video.app.ui.login.CommunityLoginActivity

class CommunityAuthenticator(private val preferences: SharedPreferences) : Authenticator {

override fun getLoginActivity(): Class<out BaseActivity> {
return CommunityLoginActivity::class.java
}

override fun loggedIn(): Boolean {
return !preferences.getString(Preferences.DISPLAY_NAME, null).isNullOrEmpty()
}

override fun logout() {
preferences.edit().remove(Preferences.DISPLAY_NAME).apply()
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (C) 2019 Twilio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.twilio.video.app.data;

import com.twilio.video.app.ApplicationScope;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
/*
* Copyright (C) 2019 Twilio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.twilio.video.app.data;

import com.twilio.video.app.BuildConfig;
import com.twilio.video.app.data.api.TokenService;
import com.twilio.video.app.data.api.model.RoomProperties;

import io.reactivex.Single;

public class CommunityTokenService implements TokenService {
Expand All @@ -13,7 +28,6 @@ public class CommunityTokenService implements TokenService {
*/
@Override
public Single<String> getToken(final String identity, final RoomProperties roomProperties) {
return Single.fromCallable(
() -> BuildConfig.TWILIO_ACCESS_TOKEN);
return Single.fromCallable(() -> BuildConfig.TWILIO_ACCESS_TOKEN);
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (C) 2019 Twilio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.twilio.video.app.ui.login;

import android.content.Intent;
Expand All @@ -8,9 +24,7 @@
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import androidx.core.content.res.ResourcesCompat;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
Expand Down Expand Up @@ -53,7 +67,7 @@ public void onTextChanged(Editable editable) {
@OnClick(R.id.login_button)
public void onLoginButton(View view) {
String name = nameEditText.getText().toString();
if (name != null && name.length() > 0) {
if (name.length() > 0) {
saveIdentity(name);
startLobbyActivity();
}
Expand Down
Loading

0 comments on commit 3b1f5a0

Please sign in to comment.