Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New apis for upload & delete and auto upload feature #272

Merged
merged 11 commits into from
Aug 29, 2017
24 changes: 24 additions & 0 deletions DEBUG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Debugging

Sometimes you may need to debug with some special purpose server. To do that, add a file like this

src/main/assets/customServers.json

with details of the custom server(s) you need, like this:

```
[
{
"name": "Test Server 1",
"session_token": "12345678901234567",
"local_address": "http://192.168.0.11:4563",
"remote_address": "http://192.168.12.22:4563"
},
{
"name": "Test Server 2",
"session_token": "12345678901234567",
"local_address": "http://192.168.0.11:4563",
"remote_address": "http://192.168.12.22:4563"
}
]
```
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def formatStringField(field) {

dependencies {
repositories {
jcenter()
mavenCentral()
mavenLocal()
maven { url 'https://maven.fabric.io/public' }
Expand Down Expand Up @@ -133,6 +134,7 @@ dependencies {
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.6.0'
compile 'org.videolan:libvlc:2.1.1'
compile 'pub.devrel:easypermissions:0.4.2'
testCompile 'org.robolectric:robolectric:3.1.2'
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:shadows-multidex:3.0'
Expand Down
33 changes: 33 additions & 0 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@

<permission android:name="android.permission.MEDIA_CONTENT_CONTROL" />

<uses-feature
android:name="android.hardware.camera"
android:required="false"/>

<uses-feature
android:name="android.software.leanback"
android:required="false" />
Expand All @@ -62,6 +66,16 @@
android:theme="@style/Theme.Amahi"
android:banner="@drawable/tv_banner">

<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="org.amahi.anywhere.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"/>
</provider>

<activity
android:name=".tv.activity.MainTVActivity"
android:theme="@style/Theme.Leanback.Browse">
Expand Down Expand Up @@ -143,6 +157,7 @@
</intent-filter>
</service>
<service android:name=".service.VideoService"/>
<service android:name=".service.UploadService"/>

<receiver android:name=".receiver.AudioReceiver">
<intent-filter>
Expand All @@ -162,6 +177,24 @@
</intent-filter>
</receiver>

<receiver
android:name=".receiver.CameraReceiver"
android:enabled="true">
<intent-filter>
<!--<action android:name="com.android.camera.NEW_PICTURE" />-->
<action android:name="android.hardware.action.NEW_PICTURE" />
<data android:mimeType="image/*" />
</intent-filter>
</receiver>

<service
android:name=".job.PhotosContentJob"
android:permission="android.permission.BIND_JOB_SERVICE" />

<service
android:name=".job.NetConnectivityJob"
android:permission="android.permission.BIND_JOB_SERVICE" />

<meta-data
android:name="com.crashlytics.ApiKey"
android:value="d7b65346d3cf0028328f006bff447501d70f8996"/>
Expand Down
1 change: 1 addition & 0 deletions src/main/assets/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
customServers.json
28 changes: 26 additions & 2 deletions src/main/java/org/amahi/anywhere/AmahiApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@

import android.app.Application;
import android.content.Context;
import android.os.Build;
import android.os.StrictMode;
import android.support.annotation.RequiresApi;

import com.crashlytics.android.Crashlytics;

import org.amahi.anywhere.job.NetConnectivityJob;
import org.amahi.anywhere.job.PhotosContentJob;

import dagger.ObjectGraph;
import io.fabric.sdk.android.Fabric;
import timber.log.Timber;
Expand All @@ -49,9 +54,13 @@ public void onCreate() {
setUpDetecting();

setUpInjections();
}

private void setUpLogging() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
setUpJobs();
}
}

private void setUpLogging() {
if (isDebugging()) {
Timber.plant(new Timber.DebugTree());
}
Expand Down Expand Up @@ -80,4 +89,19 @@ private void setUpInjections() {
public void inject(Object injectionsConsumer) {
injector.inject(injectionsConsumer);
}

public static class JobIds {
public static final int PHOTOS_CONTENT_JOB = 125;
public static final int NET_CONNECTIVITY_JOB = 126;
}

@RequiresApi(api = Build.VERSION_CODES.N)
private void setUpJobs() {
if (!PhotosContentJob.isScheduled(this)) {
PhotosContentJob.scheduleJob(this);
}
if (!NetConnectivityJob.isScheduled(this)) {
NetConnectivityJob.scheduleJob(this);
}
}
}
6 changes: 6 additions & 0 deletions src/main/java/org/amahi/anywhere/AmahiModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,17 @@
import org.amahi.anywhere.fragment.ServerFilesFragment;
import org.amahi.anywhere.fragment.ServerSharesFragment;
import org.amahi.anywhere.fragment.SettingsFragment;
import org.amahi.anywhere.fragment.UploadSettingsFragment;
import org.amahi.anywhere.server.ApiModule;
import org.amahi.anywhere.service.AudioService;
import org.amahi.anywhere.service.UploadService;
import org.amahi.anywhere.service.VideoService;
import org.amahi.anywhere.tv.activity.TVWebViewActivity;
import org.amahi.anywhere.tv.activity.TvPlaybackAudioActivity;
import org.amahi.anywhere.tv.activity.TvPlaybackVideoActivity;
import org.amahi.anywhere.tv.fragment.MainTVFragment;
import org.amahi.anywhere.tv.fragment.ServerFileTvFragment;
import org.amahi.anywhere.util.UploadManager;
import org.amahi.anywhere.tv.fragment.TvPlaybackAudioFragment;
import org.amahi.anywhere.tv.fragment.TvPlaybackVideoFragment;

Expand Down Expand Up @@ -79,11 +82,14 @@
ServerFileImageFragment.class,
ServerFileDownloadingFragment.class,
SettingsFragment.class,
UploadSettingsFragment.class,
AudioService.class,
VideoService.class,
MainTVFragment.class,
TVWebViewActivity.class,
ServerFileTvFragment.class,
UploadService.class,
UploadManager.class,
TvPlaybackVideoFragment.class,
TvPlaybackVideoActivity.class,
TvPlaybackAudioActivity.class,
Expand Down
Loading