Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stefan-niedermann/nextcloud-deck.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Niedermann <info@niedermann.it>2020-12-17 18:29:42 +0300
committerStefan Niedermann <info@niedermann.it>2020-12-17 18:29:42 +0300
commit31d87729ece6c431ee104c3dfb5650a6cbe09bb8 (patch)
tree72234dcdea84b130977bc1ff389139b9fca4c73f
parentcdccd97f47913dad61880116da90ff8885cb070b (diff)
version bump to 1.13.41.13.4
Signed-off-by: Stefan Niedermann <info@niedermann.it>
-rw-r--r--app/build.gradle4
-rw-r--r--app/src/main/java/it/niedermann/nextcloud/deck/ui/PushNotificationActivity.java183
-rw-r--r--fastlane/metadata/android/en-US/changelogs/1013004.txt3
3 files changed, 100 insertions, 90 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 633d23360..026def452 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -6,8 +6,8 @@ android {
applicationId "it.niedermann.nextcloud.deck"
minSdkVersion 19
targetSdkVersion 29
- versionCode 1013003
- versionName "1.13.3"
+ versionCode 1013004
+ versionName "1.13.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
javaCompileOptions {
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/PushNotificationActivity.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/PushNotificationActivity.java
index 85e5f944a..2e3337948 100644
--- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/PushNotificationActivity.java
+++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/PushNotificationActivity.java
@@ -18,6 +18,7 @@ import it.niedermann.nextcloud.deck.api.IResponseCallback;
import it.niedermann.nextcloud.deck.databinding.ActivityPushNotificationBinding;
import it.niedermann.nextcloud.deck.model.Account;
import it.niedermann.nextcloud.deck.ui.card.EditActivity;
+import it.niedermann.nextcloud.deck.ui.exception.ExceptionDialogFragment;
import it.niedermann.nextcloud.deck.ui.exception.ExceptionHandler;
import it.niedermann.nextcloud.deck.util.ProjectUtil;
@@ -40,8 +41,9 @@ public class PushNotificationActivity extends AppCompatActivity {
super.onResume();
Thread.currentThread().setUncaughtExceptionHandler(new ExceptionHandler(this));
+ final Intent intent = getIntent();
- if (getIntent() == null) {
+ if (intent == null) {
throw new IllegalArgumentException("Could not retrieve intent");
}
@@ -51,108 +53,113 @@ public class PushNotificationActivity extends AppCompatActivity {
setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar);
- binding.subject.setText(getIntent().getStringExtra(KEY_SUBJECT));
+ binding.subject.setText(intent.getStringExtra(KEY_SUBJECT));
- final String message = getIntent().getStringExtra(KEY_MESSAGE);
+ final String message = intent.getStringExtra(KEY_MESSAGE);
if (!TextUtils.isEmpty(message)) {
binding.message.setText(message);
binding.message.setVisibility(View.VISIBLE);
}
- final String link = getIntent().getStringExtra(KEY_LINK);
+ final String link = intent.getStringExtra(KEY_LINK);
final long[] ids;
try {
ids = ProjectUtil.extractBoardIdAndCardIdFromUrl(link);
- } catch (Throwable t) {
- DeckLog.logError(t);
- finish();
- return;
- }
- binding.cancel.setOnClickListener((v) -> finish());
-
- final String cardRemoteIdString = getIntent().getStringExtra(KEY_CARD_REMOTE_ID);
- final String accountString = getIntent().getStringExtra(KEY_ACCOUNT);
-
- DeckLog.verbose("cardRemoteIdString = " + cardRemoteIdString);
- if (ids.length == 2) {
- if (cardRemoteIdString != null) {
- try {
- final int cardRemoteId = Integer.parseInt(cardRemoteIdString);
- observeOnce(viewModel.readAccount(accountString), this, (account -> {
- if (account != null) {
- viewModel.setAccount(account.getName());
- DeckLog.verbose("account: " + account);
- observeOnce(viewModel.getBoardByRemoteId(account.getId(), ids[0]), PushNotificationActivity.this, (board -> {
- DeckLog.verbose("BoardLocalId " + board);
- if (board != null) {
- observeOnce(viewModel.getCardByRemoteID(account.getId(), cardRemoteId), PushNotificationActivity.this, (card -> {
- DeckLog.verbose("Card: " + card);
- if (card != null) {
- viewModel.synchronizeCard(new IResponseCallback<Boolean>(account) {
- @Override
- public void onResponse(Boolean response) {
- openCardOnSubmit(account, board.getLocalId(), card.getLocalId());
- }
-
- @Override
- public void onError(Throwable throwable) {
- super.onError(throwable);
- openCardOnSubmit(account, board.getLocalId(), card.getLocalId());
- }
- }, card);
- } else {
- DeckLog.info("Card is not yet available locally. Synchronize board with localId " + board);
-
- viewModel.synchronizeBoard(new IResponseCallback<Boolean>(account) {
- @Override
- public void onResponse(Boolean response) {
- runOnUiThread(() -> {
- observeOnce(viewModel.getCardByRemoteID(account.getId(), cardRemoteId), PushNotificationActivity.this, (card -> {
- DeckLog.verbose("Card: " + card);
- if (card != null) {
- openCardOnSubmit(account, board.getLocalId(), card.getLocalId());
- } else {
- DeckLog.warn("Something went wrong while synchronizing the card " + cardRemoteId + " (cardRemoteId). Given fullCard is null.");
- applyBrandToSubmitButton(account);
- fallbackToBrowser(link);
- }
- }));
- });
- }
-
- @Override
- public void onError(Throwable throwable) {
- super.onError(throwable);
- DeckLog.warn("Something went wrong while synchronizing the board with localId " + board + ".");
- applyBrandToSubmitButton(account);
- fallbackToBrowser(link);
- }
- }, board.getLocalId());
- }
- }));
- } else {
- DeckLog.warn("Given localBoardId for cardRemoteId " + cardRemoteId + " is null.");
- applyBrandToSubmitButton(account);
- fallbackToBrowser(link);
- }
- }));
- } else {
- DeckLog.warn("Given account for " + accountString + " is null.");
- fallbackToBrowser(link);
- }
- }));
- } catch (NumberFormatException e) {
- DeckLog.logError(e);
+ binding.cancel.setOnClickListener((v) -> finish());
+
+ final String cardRemoteIdString = intent.getStringExtra(KEY_CARD_REMOTE_ID);
+ final String accountString = intent.getStringExtra(KEY_ACCOUNT);
+
+ DeckLog.verbose("cardRemoteIdString = " + cardRemoteIdString);
+ if (ids.length == 2) {
+ if (cardRemoteIdString != null) {
+ try {
+ final int cardRemoteId = Integer.parseInt(cardRemoteIdString);
+ observeOnce(viewModel.readAccount(accountString), this, (account -> {
+ if (account != null) {
+ viewModel.setAccount(account.getName());
+ DeckLog.verbose("account: " + account);
+ observeOnce(viewModel.getBoardByRemoteId(account.getId(), ids[0]), PushNotificationActivity.this, (board -> {
+ DeckLog.verbose("BoardLocalId " + board);
+ if (board != null) {
+ observeOnce(viewModel.getCardByRemoteID(account.getId(), cardRemoteId), PushNotificationActivity.this, (card -> {
+ DeckLog.verbose("Card: " + card);
+ if (card != null) {
+ viewModel.synchronizeCard(new IResponseCallback<Boolean>(account) {
+ @Override
+ public void onResponse(Boolean response) {
+ openCardOnSubmit(account, board.getLocalId(), card.getLocalId());
+ }
+
+ @Override
+ public void onError(Throwable throwable) {
+ super.onError(throwable);
+ openCardOnSubmit(account, board.getLocalId(), card.getLocalId());
+ }
+ }, card);
+ } else {
+ DeckLog.info("Card is not yet available locally. Synchronize board with localId " + board);
+
+ viewModel.synchronizeBoard(new IResponseCallback<Boolean>(account) {
+ @Override
+ public void onResponse(Boolean response) {
+ runOnUiThread(() -> {
+ observeOnce(viewModel.getCardByRemoteID(account.getId(), cardRemoteId), PushNotificationActivity.this, (card -> {
+ DeckLog.verbose("Card: " + card);
+ if (card != null) {
+ openCardOnSubmit(account, board.getLocalId(), card.getLocalId());
+ } else {
+ DeckLog.warn("Something went wrong while synchronizing the card " + cardRemoteId + " (cardRemoteId). Given fullCard is null.");
+ applyBrandToSubmitButton(account);
+ fallbackToBrowser(link);
+ }
+ }));
+ });
+ }
+
+ @Override
+ public void onError(Throwable throwable) {
+ super.onError(throwable);
+ DeckLog.warn("Something went wrong while synchronizing the board with localId " + board + ".");
+ applyBrandToSubmitButton(account);
+ fallbackToBrowser(link);
+ }
+ }, board.getLocalId());
+ }
+ }));
+ } else {
+ DeckLog.warn("Given localBoardId for cardRemoteId " + cardRemoteId + " is null.");
+ applyBrandToSubmitButton(account);
+ fallbackToBrowser(link);
+ }
+ }));
+ } else {
+ DeckLog.warn("Given account for " + accountString + " is null.");
+ fallbackToBrowser(link);
+ }
+ }));
+ } catch (NumberFormatException e) {
+ DeckLog.logError(e);
+ fallbackToBrowser(link);
+ }
+ } else {
+ DeckLog.warn(KEY_CARD_REMOTE_ID + " is null.");
fallbackToBrowser(link);
}
} else {
- DeckLog.warn(KEY_CARD_REMOTE_ID + " is null.");
+ DeckLog.warn("Link does not contain two IDs (expected one board id and one card id): " + link);
fallbackToBrowser(link);
}
- } else {
- DeckLog.warn("Link does not contain two IDs (expected one board id and one card id): " + link);
- fallbackToBrowser(link);
+ } catch (Throwable t) {
+ final String params = "Error while receiving push notification:\n"
+ + KEY_SUBJECT + ": [" + intent.getStringExtra(KEY_SUBJECT) + "]\n"
+ + KEY_MESSAGE + ": [" + intent.getStringExtra(KEY_MESSAGE) + "]\n"
+ + KEY_LINK + ": [" + intent.getStringExtra(KEY_LINK) + "]\n"
+ + KEY_CARD_REMOTE_ID + ": [" + intent.getStringExtra(KEY_CARD_REMOTE_ID) + "]\n"
+ + KEY_ACCOUNT + ": [" + intent.getStringExtra(KEY_ACCOUNT) + "]";
+ ExceptionDialogFragment.newInstance(new Exception(params, t), null).show(getSupportFragmentManager(), ExceptionDialogFragment.class.getSimpleName());
+ DeckLog.logError(t);
}
}
diff --git a/fastlane/metadata/android/en-US/changelogs/1013004.txt b/fastlane/metadata/android/en-US/changelogs/1013004.txt
new file mode 100644
index 000000000..25106dd8c
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/1013004.txt
@@ -0,0 +1,3 @@
+- 📝 Context based formatting
+- ℹī¸ Display more information when a unexpected push notification arrives
+- 🌎 Updated translations \ No newline at end of file