Skip to content
Merged

Pl #190

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
5 changes: 4 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ android {
minSdk = 24
targetSdk = 36
versionCode = 43
versionName = "4.7.1.1"
versionName = "4.8.3.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "OMDB_API_KEY", "\"$omdbApiKey\"")
Expand Down Expand Up @@ -139,6 +139,9 @@ dependencies {
"fullImplementation"("androidx.credentials:credentials-play-services-auth:1.6.0")
"fullImplementation"("com.google.android.libraries.identity.googleid:googleid:1.2.0")
"fullImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.11.0")

"fullImplementation"("com.android.billingclient:billing:8.3.0")
"fullImplementation"("com.android.billingclient:billing-ktx:8.3.0")

testImplementation ("junit:junit:4.13.2")
androidTestImplementation ("androidx.test.ext:junit:1.3.0")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* This file is part of "ShowCase" formerly Movie DB. <https://github.com/WirelessAlien/MovieDB>
* forked from <https://notabug.org/nvb/MovieDB>
*
* Copyright (C) 2024 WirelessAlien <https://github.com/WirelessAlien>
*
* ShowCase is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ShowCase is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with "ShowCase". If not, see <https://www.gnu.org/licenses/>.
*/

package com.wirelessalien.android.moviedb.data

enum class PurchaseStatus {
PURCHASED,
NOT_PURCHASED,
PENDING,
ERROR
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* This file is part of "ShowCase" formerly Movie DB. <https://github.com/WirelessAlien/MovieDB>
* forked from <https://notabug.org/nvb/MovieDB>
*
* Copyright (C) 2024 WirelessAlien <https://github.com/WirelessAlien>
*
* ShowCase is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ShowCase is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with "ShowCase". If not, see <https://www.gnu.org/licenses/>.
*/

package com.wirelessalien.android.moviedb.fragment

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.preference.PreferenceManager
import androidx.core.content.edit
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.wirelessalien.android.moviedb.R
import com.wirelessalien.android.moviedb.databinding.FragmentBillingBottomSheetBinding
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch

class BillingBottomSheetFragment : BottomSheetDialogFragment() {
private var _binding: FragmentBillingBottomSheetBinding? = null
private val binding get() = _binding!!

var onPurchaseSuccess: (() -> Unit)? = null

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_binding = FragmentBillingBottomSheetBinding.inflate(inflater, container, false)
return binding.root
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

binding.btnBuyLifetime.isEnabled = false
binding.btnSubscribe.isEnabled = false

binding.btnContinueAds.setOnClickListener {
binding.btnContinueAds.text = getString(R.string.please_wait)
binding.btnContinueAds.isEnabled = false

CoroutineScope(Dispatchers.Main).launch {
val preferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
preferences.edit { putBoolean("user_is_free_user", true) }
onPurchaseSuccess?.invoke()
parentFragmentManager.setFragmentResult(REQUEST_KEY, Bundle().apply {
putBoolean(RESULT_KEY, true)
})
dismissAllowingStateLoss()
}
}

binding.adsTitle.text = getString(R.string.continue_with_ads)
binding.btnContinueAds.text = getString(R.string.continue_with_ads)
}

companion object {
const val TAG = "BillingBottomSheetFragment"
const val REQUEST_KEY = "billing_request_key"
const val RESULT_KEY = "billing_result_key"
}

override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* This file is part of "ShowCase" formerly Movie DB. <https://github.com/WirelessAlien/MovieDB>
* forked from <https://notabug.org/nvb/MovieDB>
*
* Copyright (C) 2024 WirelessAlien <https://github.com/WirelessAlien>
*
* ShowCase is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ShowCase is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with "ShowCase". If not, see <https://www.gnu.org/licenses/>.
*/

package com.wirelessalien.android.moviedb.helper

import android.content.Context
import com.wirelessalien.android.moviedb.data.PurchaseStatus
import kotlinx.coroutines.CoroutineScope

class BillingHelper(
private val context: Context,
private val coroutineScope: CoroutineScope,
private val onPurchaseFinished: (PurchaseStatus, String?) -> Unit
) {
fun startConnection(onConnectionResult: (Boolean) -> Unit) {
onConnectionResult(false)
}

fun endConnection() {
}

suspend fun checkPurchasesSuspend(): PurchaseStatus {
return PurchaseStatus.PURCHASED
}

fun checkPurchases(onResult: (PurchaseStatus) -> Unit) {
onResult(PurchaseStatus.PURCHASED)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* This file is part of "ShowCase" formerly Movie DB. <https://github.com/WirelessAlien/MovieDB>
* forked from <https://notabug.org/nvb/MovieDB>
*
* Copyright (C) 2024 WirelessAlien <https://github.com/WirelessAlien>
*
* ShowCase is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ShowCase is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with "ShowCase". If not, see <https://www.gnu.org/licenses/>.
*/

package com.wirelessalien.android.moviedb.work

import android.content.Context
import androidx.work.CoroutineWorker
import androidx.work.WorkerParameters

class BillingCheckWorker(
appContext: Context,
workerParams: WorkerParameters
) : CoroutineWorker(appContext, workerParams) {
override suspend fun doWork(): Result {
return Result.success()
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* This file is part of "ShowCase" formerly Movie DB. <https://github.com/WirelessAlien/MovieDB>
* forked from <https://notabug.org/nvb/MovieDB>
*
* Copyright (C) 2024 WirelessAlien <https://github.com/WirelessAlien>
*
* ShowCase is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ShowCase is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with "ShowCase". If not, see <https://www.gnu.org/licenses/>.
*/

package com.wirelessalien.android.moviedb.data

enum class PurchaseStatus {
PURCHASED,
NOT_PURCHASED,
PENDING,
ERROR
}

Loading
Loading