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

Recurring Notification improvement #1743

Merged
merged 3 commits into from
Jul 29, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@
*/
package com.money.manager.ex.recurring.transactions;

import static android.app.PendingIntent.getActivity;

import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;

import com.money.manager.ex.PasscodeActivity;
Expand All @@ -36,6 +39,8 @@
import com.money.manager.ex.notifications.RecurringTransactionNotifications;
import com.money.manager.ex.servicelayer.RecurringTransactionService;
import com.money.manager.ex.settings.AppSettings;
import com.money.manager.ex.transactions.CheckingTransactionEditActivity;
import com.money.manager.ex.transactions.EditTransactionActivityConstants;

/**
* Not used.
Expand Down Expand Up @@ -84,7 +89,7 @@ protected void onCreate(Bundle savedInstanceState) {
}

if ( action.equals("SKIP") || action.equals("ENTER")) {
// ToDo Skip or enter Occurrence
// Skip or enter Occurrence
NotificationManager notificationManager = (NotificationManager) getApplication().getApplicationContext()
.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(trxid);
Expand All @@ -103,10 +108,22 @@ protected void onCreate(Bundle savedInstanceState) {
// showCreateTransactionActivity(trxid);
// } else {
RecurringTransactionService service = new RecurringTransactionService(trxid, this);
AccountTransactionRepository accountTransactionRepository = new AccountTransactionRepository(getApplicationContext());
AccountTransaction accountTrx = service.getAccountTransactionFromRecurring();
accountTransactionRepository.insert(accountTrx);
service.moveNextOccurrence();
RecurringTransaction tx = service.load(trxid);
if ( tx.isRecurringModeAuto()) {
AccountTransactionRepository accountTransactionRepository = new AccountTransactionRepository(getApplicationContext());
AccountTransaction accountTrx = service.getAccountTransactionFromRecurring();
accountTransactionRepository.insert(accountTrx);
service.moveNextOccurrence();
} else {
// showCreateTransactionActivity(trxid);
Intent intent = new Intent(this, CheckingTransactionEditActivity.class);
intent.setAction(Intent.ACTION_INSERT);
intent.putExtra(EditTransactionActivityConstants.KEY_BDID_ID, trxid);
intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_SOURCE, "RecurringTransactionListFragment.java");
// start for insert new transaction
startActivity(intent, savedInstanceState);
// startActivityForResult(intent, 1002); // TODO REQUEST_ADD_TRANSACTION
}

// }

Expand Down
Loading