Skip to content

Commit

Permalink
Merge pull request #182 from opendocument-app/development
Browse files Browse the repository at this point in the history
v3.3.2
  • Loading branch information
TomTasche authored May 30, 2020
2 parents b4ca735 + 574c847 commit 3125959
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 8 deletions.
2 changes: 1 addition & 1 deletion OpenDocument.core
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
xmlns:tools="http://schemas.android.com/tools"
package="at.tomtasche.reader"
android:installLocation="auto"
android:versionCode="131"
android:versionName="3.3.1"
android:versionCode="132"
android:versionName="3.3.2"
tools:ignore="GoogleAppIndexingWarning">

<uses-permission
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public boolean hasPurchased() {
return false;
}

return sharedPreferences.getBoolean("purchased", false);
return sharedPreferences.getBoolean("purchaseAcknowledged", false);
}

public void setPurchased(boolean purchased) {
Expand All @@ -27,7 +27,7 @@ public void setPurchased(boolean purchased) {
}

Editor editor = sharedPreferences.edit();
editor.putBoolean("purchased", purchased);
editor.putBoolean("purchaseAcknowledged", purchased);
editor.apply();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import android.content.Context;

import com.android.billingclient.api.AcknowledgePurchaseParams;
import com.android.billingclient.api.AcknowledgePurchaseResponseListener;
import com.android.billingclient.api.BillingClient;
import com.android.billingclient.api.BillingClientStateListener;
import com.android.billingclient.api.BillingFlowParams;
Expand Down Expand Up @@ -118,8 +120,29 @@ private void refreshPurchased() {
return;
}

boolean hasPurchased = false;

Purchase.PurchasesResult purchasesResult = billingClient.queryPurchases(BillingClient.SkuType.INAPP);
boolean hasPurchased = purchasesResult != null && purchasesResult.getPurchasesList() != null && !purchasesResult.getPurchasesList().isEmpty();
if (purchasesResult.getPurchasesList() != null) {
for (Purchase purchase : purchasesResult.getPurchasesList()) {
if (!purchase.isAcknowledged()) {
AcknowledgePurchaseParams.Builder builder = AcknowledgePurchaseParams.newBuilder();
builder.setPurchaseToken(purchase.getPurchaseToken());

billingClient.acknowledgePurchase(builder.build(), new AcknowledgePurchaseResponseListener() {
@Override
public void onAcknowledgePurchaseResponse(BillingResult billingResult) {
// TODO: in the best case we would set hasPurchased to true only now. not worth the effort in my opinion
}
});
}

hasPurchased = true;

break;
}
}

billingPreferences.setPurchased(hasPurchased);
}

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<string name="menu_recent">Documentos abertos recentemente</string>
<string name="menu_search">Pesquisa</string>
<string name="menu_open">Abrir</string>
<string name="menu_open_with">Abrir com...</string>
<string name="menu_share">Compartilhar documento</string>
<string name="menu_edit">Editar</string>
<string name="menu_remove_ads">Remover anúncios</string>
<string name="menu_fullscreen">Modo de tela inteira</string>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values-tr-rTR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<string name="toast_error_save_nofile">Seçilen dosyayı kaydetmek için yer yok.</string>
<string name="toast_error_save_failed">Dosya kaydedilemedi. Lütfen [email protected] ile iletişime geçin</string>
<string name="toast_error_out_of_memory">Aygıt belleği yetersiz! Çok fazla resim var veya dosya çok büyük.</string>
<string name="toast_error_password_protected">Belge parola korumalı</string>
<string name="toast_error_password_protected">Bu belge parola korumalı</string>
<string name="toast_error_permission_required">Belgeleri okumak ve kaydetmek için izin gerekli</string>
<string name="dialog_recent_title">Son kullanılan belgeler</string>
<string name="dialog_choose_filemanager">Belgeyi şununla aç:</string>
Expand All @@ -21,7 +21,7 @@
<string name="dialog_remove_ads_title">Reklamları küçük bir ücret karşılığında kaldırın:</string>
<string name="dialog_upload_file">Bu belgeyi açamıyoruz, çünkü biçimini desteklemiyoruz. Görüntüleyebilmeniz için geçici olarak sunucumuza yüklemek ister misiniz? Yüklenen dosyalar özeldir ve 24 saat sonra otomatik olarak silinir.</string>
<string name="dialog_title_choose_file">Aygıttan dosya seçin</string>
<string name="dialog_list_no_documents_found">Belge nulunamadı</string>
<string name="dialog_list_no_documents_found">Belge bulunamadı</string>
<string name="menu_recent">En son açılmış belgeler</string>
<string name="menu_search">Belgelerde ara</string>
<string name="menu_open">Belgeyi Aç</string>
Expand Down

0 comments on commit 3125959

Please sign in to comment.