Skip to content
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Round Sync - Rclone for Android
[![license: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/gulp79/Round-Sync/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/v/release/gulp79/Round-Sync?include_prereleases)](https://github.com/gulp79/Round-Sync/releases/latest)
![Downloads](https://img.shields.io/github/downloads/gulp79/Round-Sync/total) ![Latest Downloads](https://img.shields.io/github/downloads/gulp79/Round-Sync/latest/total)
![Latest Downloads](https://img.shields.io/github/downloads/gulp79/Round-Sync/total)


> ⚠️ **Unofficial Fork Disclaimer**
Expand Down
11 changes: 6 additions & 5 deletions app/src/main/java/ca/pkay/rcloneexplorer/Rclone.java
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ public Process configCreate(List<String> options) {
public Process configUpdate(List<String> options) {
return configCreate(options);
}

public Process config(String task, List<String> options) {
String[] command = createCommand("config", task);
String[] opt = options.toArray(new String[0]);
Expand Down Expand Up @@ -558,7 +558,7 @@ public HashMap<String, String> getConfig(String name) {

options.put(RCLONE_CONFIG_NAME_KEY, name);
return options;

}

public Process configInteractive() throws IOException {
Expand Down Expand Up @@ -688,7 +688,8 @@ public Process sync(RemoteItem remoteItem, String localPath, String remotePath,
String localRemotePath = (remoteItem.isRemoteType(RemoteItem.LOCAL)) ? getLocalRemotePathPrefix(remoteItem, context) + "/" : "";
String remoteSection = (remotePath.compareTo("//" + remoteName) == 0) ? remoteName + ":" + localRemotePath : remoteName + ":" + localRemotePath + remotePath;

ArrayList<String> defaultParameter = new ArrayList<>(Arrays.asList("--transfers", "1", "--stats=1s", "--stats-log-level", "NOTICE", "--use-json-log"));
ArrayList<String> defaultParameter = new ArrayList<>(Arrays.asList("-v", "--transfers", "1", "--stats=1s", "--stats-log-level", "NOTICE", "--use-json-log"));

ArrayList<String> directionParameter = new ArrayList<>();

if(useMD5Sum){
Expand Down Expand Up @@ -751,7 +752,7 @@ public Process downloadFile(RemoteItem remote, FileItem downloadItem, String dow

localFilePath = encodePath(localFilePath);

command = createCommandWithOptions("copy", remoteFilePath, localFilePath, "--transfers", "1", "--stats=1s", "--stats-log-level", "NOTICE", "--use-json-log");
command = createCommandWithOptions("copy", remoteFilePath, localFilePath, "-v", "--transfers", "1", "--stats=1s", "--stats-log-level", "NOTICE", "--use-json-log");

String[] env = getRcloneEnv();
try {
Expand Down Expand Up @@ -783,7 +784,7 @@ public Process uploadFile(RemoteItem remote, String uploadPath, String uploadFil
path = (uploadPath.compareTo("//" + remoteName) == 0) ? remoteName + ":" + localRemotePath : remoteName + ":" + localRemotePath + uploadPath;
}

command = createCommandWithOptions("copy", uploadFile, path, "--transfers", "1", "--stats=1s", "--stats-log-level", "NOTICE", "--use-json-log");
command = createCommandWithOptions("copy", uploadFile, path, "-v", "--transfers", "1", "--stats=1s", "--stats-log-level", "NOTICE", "--use-json-log");

String[] env = getRcloneEnv();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ private void showFileMenu(View view, final Task task) {
createShortcut(context, task);
}
break;
case R.id.action_view_log:
showLogDialog(task);
break;

default:
return false;
}
Expand Down Expand Up @@ -233,6 +237,44 @@ public static class ViewHolder extends RecyclerView.ViewHolder {
}
}

private void showLogDialog(Task task) {
// Kotlin'deki task.title değişkeni Java'da getTitle() olarak çağrılır
String taskName = task.getTitle();
java.io.File logFile = new java.io.File(context.getExternalFilesDir(null).getAbsolutePath() + "/logs/" + taskName + "_log.txt");

if (!logFile.exists()) {
android.widget.Toast.makeText(context, "Log henüz oluşmamış: " + logFile.getName(), android.widget.Toast.LENGTH_LONG).show();
return;
}

try {
StringBuilder logContent = new StringBuilder();
java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.FileReader(logFile));
String line;
int lineCount = 0;

// Uygulamanın donmaması için logun ilk 100 satırını okuyoruz
while ((line = reader.readLine()) != null && lineCount < 100) {
logContent.append(line).append("\n\n");
lineCount++;
}
reader.close();

if (lineCount >= 100) {
logContent.append("... (Log çok uzun olduğu için kesildi) ...");
}

new androidx.appcompat.app.AlertDialog.Builder(context)
.setTitle("Log: " + taskName)
.setMessage(logContent.toString())
.setPositiveButton("Kapat", null)
.show();

} catch (Exception e) {
android.widget.Toast.makeText(context, "Log okunamadı: " + e.getMessage(), android.widget.Toast.LENGTH_SHORT).show();
}
}

private static void createShortcut(Context c, Task task) {
Intent intent = new Intent(TASK_SYNC_ACTION, Uri.EMPTY, c, ShortcutServiceActivity.class);
intent.setAction(TASK_SYNC_ACTION);
Expand All @@ -252,3 +294,5 @@ private static void createShortcut(Context c, Task task) {
}

}


Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
import ca.pkay.rcloneexplorer.R;
import ca.pkay.rcloneexplorer.Services.TriggerService;
import es.dmoral.toasty.Toasty;

// #---Alps Begin
import androidx.appcompat.app.AlertDialog;
// #---Alps End
public class TriggerRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{

private List<Trigger> triggers;
Expand Down Expand Up @@ -162,6 +164,7 @@ public void deleteTrigger(Trigger trigger) {
}
}

// #---Alps Begin
private void showFileMenu(View view, final Trigger trigger) {
PopupMenu popupMenu = new PopupMenu(context, view);
popupMenu.getMenuInflater().inflate(R.menu.trigger_item_menu, popupMenu.getMenu());
Expand All @@ -176,6 +179,9 @@ private void showFileMenu(View view, final Trigger trigger) {
case R.id.action_delete_trigger:
deleteTrigger(trigger);
break;
case R.id.action_view_log: // YENİ EKLENEN SATIR
showLogDialog(trigger);
break;
default:
return false;
}
Expand All @@ -184,6 +190,35 @@ private void showFileMenu(View view, final Trigger trigger) {
popupMenu.show();
}

private void showLogDialog(Trigger trigger) {
// Dosya yolunu SyncWorker/SyncService içinde belirttiğin yol ile birebir aynı yapmalısın
java.io.File logDir = new java.io.File(context.getExternalFilesDir(null), "logs");
java.io.File logFile = new java.io.File(logDir, trigger.getTitle() + "_log.txt");

if (logFile.exists()) {
StringBuilder logContent = new StringBuilder();
try (java.io.BufferedReader br = new java.io.BufferedReader(new java.io.FileReader(logFile))) {
String line;
while ((line = br.readLine()) != null) {
logContent.append(line).append("\n");
}
} catch (java.io.IOException e) {
e.printStackTrace();
android.widget.Toast.makeText(context, "Log dosyası okunurken hata oluştu.", android.widget.Toast.LENGTH_SHORT).show();
return;
}

// Log içeriğini Alert Dialog ile ekranda göster
new androidx.appcompat.app.AlertDialog.Builder(context)
.setTitle(trigger.getTitle() + " Log")
.setMessage(logContent.toString())
.setPositiveButton("Kapat", null)
.show();
} else {
android.widget.Toast.makeText(context, "Bu işlem için henüz log oluşturulmamış.", android.widget.Toast.LENGTH_SHORT).show();
}
}
// #---Alps End
public static class ScheduleViewHolder extends RecyclerView.ViewHolder {

final View mView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class SyncService: IntentService("ca.pkay.rcexplorer.SYNC_SERCVICE"){
// Todo: Allow SyncWorker to run in silent mode, or remove this!
val silentRun = intent.getBooleanExtra("notification", true)


if (action.equals("START_TASK")) {
val db = DatabaseHandler(this)
for (task in db.allTasks) {
Expand All @@ -34,4 +33,4 @@ class SyncService: IntentService("ca.pkay.rcexplorer.SYNC_SERCVICE"){
}
}
}
}
}
Loading
Loading