Skip to content

Commit

Permalink
Merge pull request #106 from clover/r320
Browse files Browse the repository at this point in the history
Release 320
  • Loading branch information
mtomko-clover authored Jan 27, 2025
2 parents d609a0d + 2822ca1 commit 5d7dd8f
Show file tree
Hide file tree
Showing 123 changed files with 9,213 additions and 410 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ To generate your own local copy of the javadoc,

```
$ pwd
.../clover-android-sdk/clover-android-sdk
$ gradle clean javadocRelease
.../clover-android-sdk
$ gradle clean dokkaHtmlMultiModule
```
Docs can be found in `build/docs/javadoc/release`.
Docs can be found in `build/dokka/htmlMultiModule`.

Latest Apps for Testing
=======================
Expand Down
4 changes: 0 additions & 4 deletions app.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,4 @@ android {
exclude 'META-INF/NOTICE'
pickFirst 'META-INF/ASL2.0'
}

lintOptions {
abortOnError false
}
}
29 changes: 21 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ buildscript {
classpath detektPlugin
}
}

plugins {
id("org.jetbrains.dokka") version "1.9.20"
}

repositories {
mavenLocal()
if (project.properties.containsKey("localArtifactoryUrl")) {
maven { url localArtifactoryUrl }
}
mavenCentral()
}

Expand All @@ -60,6 +62,7 @@ defaultTasks 'clean', 'install'

// Adding detekt tasks to all the sub-modules
subprojects {

tasks.withType(DokkaTaskPartial.class).configureEach {
dependsOn compileReleaseAidl
moduleName.set(project.name)
Expand All @@ -81,6 +84,7 @@ subprojects {
suppressGeneratedFiles.set(false)
sourceLink {
// FIXME: source linking just doesn't seem to work
// possibly related to https://github.com/Kotlin/dokka/issues/2876
localDirectory.set(rootDir)
remoteUrl.set(new URL("https://github.com/clover/clover-android-sdk/tree/master"))
remoteLineSuffix.set("#L")
Expand All @@ -92,28 +96,37 @@ subprojects {
url.set(new URL("https://square.github.io/okhttp/3.x/okhttp/"))
}
if(project.name == "clover-android-sdk") includes.from("overview.md")

perPackageOption {
matchingRegex.set("com.clover.sdk.internal.*")
suppress.set(true)
}
}
}

dependencies {
dokkaPlugin('org.jetbrains.dokka:kotlin-as-java-plugin:1.9.20')
dokkaPlugin('org.jetbrains.dokka:android-documentation-plugin:1.9.20')
dokkaPlugin('com.clover:clover-dokka-plugin:1.0-SNAPSHOT')
}
}
}
tasks.dokkaHtmlMultiModule {
moduleName.set("Clover Android SDK")
moduleVersion.set("r"+(project(":clover-android-sdk") as DefaultProject).evaluate().version)
moduleVersion.set("r" + (project(":clover-android-sdk") as DefaultProject).evaluate().version)

String config = """
{
"customAssets": ["${file("assets/logo-icon.svg")}"],
"customStyleSheets": ["${file("assets/clover.css")}"]
}
"""
{
"customAssets": ["${file("assets/logo-icon.svg")}"],
"customStyleSheets": ["${file("assets/clover.css")}"]
}
"""
pluginsMapConfiguration.set([
"org.jetbrains.dokka.base.DokkaBase": config
])
}
dependencies {
dokkaPlugin('org.jetbrains.dokka:kotlin-as-java-plugin:1.9.20')
dokkaPlugin('org.jetbrains.dokka:android-documentation-plugin:1.9.20')
dokkaPlugin('com.clover:clover-dokka-plugin:1.0-SNAPSHOT')
}
2 changes: 1 addition & 1 deletion clover-android-connector-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
* limitations under the License.
*/
group = 'com.clover.sdk'
version = '316'
version = '320'


apply from: file("${project.rootDir}/lib.gradle")
Expand Down
2 changes: 1 addition & 1 deletion clover-android-loyalty-kit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
* limitations under the License.
*/
group = 'com.clover.sdk'
version = '316'
version = '320'


apply from: file("${project.rootDir}/lib.gradle")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public interface ILoyaltyKit {
* Starts a dynamic loyalty service
*
* @param dynamicService - the 'type' of the service to start
* @parem dataExtras - additional data passed when starting services that might be used by the service as runtime initialization
* @param dataExtras - additional data passed when starting services that might be used by the service as runtime initialization
* @param configuration - any runtime configuration information needed to start the service. This can be a json
* object, or some other format. It is up to the service to interpret the configuration
* @return true if an attempt was made to start the service.
Expand Down
2 changes: 1 addition & 1 deletion clover-android-sdk-examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
* limitations under the License.
*/
group = 'com.clover.sdk'
version = '316'
version = '320'

apply from: file("${project.rootDir}/app.gradle")
apply plugin: 'kotlin-android'
Expand Down
3 changes: 2 additions & 1 deletion clover-android-sdk-examples/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ xmlns:tools="http://schemas.android.com/tools"

<activity
android:name="com.clover.android.sdk.examples.CustomReceiptProviderTestActivity"
android:label="@string/custom_receipt_provider_test" />
android:label="@string/custom_receipt_provider_test"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize"/>
<provider
android:name=".CustomReceiptProviderTest"
android:authorities="com.clover.android.sdk.examples.receipt.custom"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ import com.clover.sdk.v1.printer.job.TokenRequestBasedPrintJob
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import java.io.ByteArrayOutputStream
import java.io.FileNotFoundException
Expand All @@ -57,7 +59,8 @@ class CustomReceiptProviderTest : ContentProvider(), OnServiceConnectedListener,
private var printerConnector: PrinterConnector? = null
private var account: Account? = null
private var supportedReceiptWidth: Int? = null
private var selectedFileResId = R.drawable.test_receipt_extra_large
private var selectedFileResId = R.drawable.test_receipt_auto_select
private var delayedResponseBitmaps: Boolean? = false

companion object {
const val AUTHORITY = "com.clover.android.sdk.examples.receipt.custom"
Expand All @@ -77,6 +80,8 @@ class CustomReceiptProviderTest : ContentProvider(), OnServiceConnectedListener,
const val SHARED_PREFS = "customReceiptProviderPrefs"
const val N_CHUNKS = "nChunks"
const val SELECTED_FILE_RES_ID = "selectedFileResId"
const val DELAYED_RESPONSE_URIS = "delayedResponseUris"
const val DELAYED_RESPONSE_BITMAPS = "delayedResponseBitmaps"
const val MAX_RECEIPT_HEIGHT = 2048
const val TAG = "CustomReceiptProviderTest"
}
Expand Down Expand Up @@ -183,7 +188,7 @@ class CustomReceiptProviderTest : ContentProvider(), OnServiceConnectedListener,
@Throws(FileNotFoundException::class)
override fun openFile(contentUri: Uri, mode: String): ParcelFileDescriptor {
val bitmap = getReceiptSegmentBitmap(contentUri)
val rescaledBitmap = if (selectedFileResId == R.drawable.test_receipt_extra_large && bitmap != null && supportedReceiptWidth != null) {
val rescaledBitmap = if (selectedFileResId == R.drawable.test_receipt_auto_select && bitmap != null && supportedReceiptWidth != null) {
// WARNING: Generate the receipt bitmap with width = supportedReceiptWidth and height up to
// CustomReceiptProviderTest.MAX_RECEIPT_HEIGHT. Instead of generating a receipt bitmap
// matching the supportedReceiptWidth, for testing purpose this app resizes the test bitmap
Expand All @@ -193,6 +198,10 @@ class CustomReceiptProviderTest : ContentProvider(), OnServiceConnectedListener,
getReceiptSegmentBitmap(contentUri)
}

if (delayedResponseBitmaps == true) {
runBlocking { delay(ReceiptContentContract.PROVIDER_TIMEOUT + 1000) }
}

return openPipeHelper<Bitmap>(
contentUri, "*/*", null, rescaledBitmap
) { output: ParcelFileDescriptor, uri: Uri, mimeType: String?, opts: Bundle?, args: Bitmap? ->
Expand Down Expand Up @@ -241,8 +250,10 @@ class CustomReceiptProviderTest : ContentProvider(), OnServiceConnectedListener,
val result = Bundle()
val sharedPrefs = context?.getSharedPreferences(SHARED_PREFS, MODE_PRIVATE)
val nChunksToSend = sharedPrefs?.getInt(N_CHUNKS, 3) ?: 3
selectedFileResId = sharedPrefs?.getInt(SELECTED_FILE_RES_ID, R.drawable.test_receipt_extra_large)
?: R.drawable.test_receipt_extra_large
val delayedResponseUris = sharedPrefs?.getBoolean(DELAYED_RESPONSE_URIS, false)
delayedResponseBitmaps = sharedPrefs?.getBoolean(DELAYED_RESPONSE_BITMAPS, false)
selectedFileResId = sharedPrefs?.getInt(SELECTED_FILE_RES_ID, R.drawable.test_receipt_auto_select)
?: R.drawable.test_receipt_auto_select

if (method == ReceiptContentContract.METHOD_GET_RECEIPT_CONTENT_URIS) {
extras?.let {
Expand Down Expand Up @@ -334,6 +345,10 @@ class CustomReceiptProviderTest : ContentProvider(), OnServiceConnectedListener,
val bitmapUri = storeInCP(selectedFileResId)
Log.d(TAG, "bitmapUri: $bitmapUri")

if (delayedResponseUris == true) {
runBlocking { delay(ReceiptContentContract.PROVIDER_TIMEOUT + 1000) }
}

result.putParcelableArrayList(
ReceiptContentContract.EXTRA_RECEIPT_CONTENT_URIS,
ArrayList(List(nChunksToSend){bitmapUri})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import android.widget.Button
import android.widget.EditText
import android.widget.Spinner
import android.widget.Toast
import com.clover.android.sdk.examples.CustomReceiptProviderTest.Companion.DELAYED_RESPONSE_BITMAPS
import com.clover.android.sdk.examples.CustomReceiptProviderTest.Companion.DELAYED_RESPONSE_URIS
import com.clover.android.sdk.examples.CustomReceiptProviderTest.Companion.N_CHUNKS
import com.clover.android.sdk.examples.CustomReceiptProviderTest.Companion.SELECTED_FILE_RES_ID

Expand All @@ -21,13 +23,16 @@ class CustomReceiptProviderTestActivity : Activity() {
lateinit var enableBtn: Button
lateinit var disableBtn: Button
lateinit var save: Button
lateinit var timeoutUris: Button
lateinit var timeoutBitmaps: Button
lateinit var testWithoutTimeout: Button
lateinit var numberOfBitmapChunks: EditText
lateinit var testReceiptSizeSelector: Spinner
lateinit var sharedPrefs: SharedPreferences
var selectedFileResId: Int = R.drawable.test_receipt_extra_large
var selectedFileResId: Int = R.drawable.test_receipt_auto_select
private val receiptRes = ArrayList<Int>(
listOf(
R.drawable.test_receipt_extra_large,
R.drawable.test_receipt_auto_select,
R.drawable.test_receipt_small,
R.drawable.test_receipt_medium,
R.drawable.test_receipt_large
Expand All @@ -50,6 +55,9 @@ class CustomReceiptProviderTestActivity : Activity() {
numberOfBitmapChunks.setText(sharedPrefs.getInt(N_CHUNKS, 3).toString())
testReceiptSizeSelector = findViewById(R.id.test_receipt_size_selector)
save = findViewById(R.id.save_number_of_bitmap_chunks)
timeoutUris = findViewById(R.id.timeout_uris_btn)
timeoutBitmaps = findViewById(R.id.timeout_bitmap_btn)
testWithoutTimeout = findViewById(R.id.test_without_timeout_btn)

ArrayAdapter.createFromResource(
this,
Expand All @@ -74,8 +82,8 @@ class CustomReceiptProviderTestActivity : Activity() {
save.setOnClickListener {
val numberOfBitmapChunks = numberOfBitmapChunks.text.toString()
val nChunks = if (numberOfBitmapChunks.isEmpty()) 3 else numberOfBitmapChunks.toInt()
if (numberOfBitmapChunks.isEmpty() || nChunks < 0 || nChunks > 20) {
Toast.makeText(this, "Entered number of chunks are not between 0 and 20. " +
if (numberOfBitmapChunks.isEmpty() || nChunks < 0 || nChunks > 99) {
Toast.makeText(this, "Entered number of chunks are not between 0 and 99. " +
"Testing with default 3 chunks", Toast.LENGTH_LONG).show()
sharedPrefs.edit().putInt(N_CHUNKS, 3).apply()
} else {
Expand All @@ -84,6 +92,21 @@ class CustomReceiptProviderTestActivity : Activity() {
sharedPrefs.edit().putInt(SELECTED_FILE_RES_ID, selectedFileResId).apply()
}

timeoutUris.setOnClickListener {
sharedPrefs.edit().putBoolean(DELAYED_RESPONSE_URIS, true).apply()
sharedPrefs.edit().putBoolean(DELAYED_RESPONSE_BITMAPS, false).apply()
}

timeoutBitmaps.setOnClickListener {
sharedPrefs.edit().putBoolean(DELAYED_RESPONSE_BITMAPS, true).apply()
sharedPrefs.edit().putBoolean(DELAYED_RESPONSE_URIS, false).apply()
}

testWithoutTimeout.setOnClickListener {
sharedPrefs.edit().putBoolean(DELAYED_RESPONSE_URIS, false).apply()
sharedPrefs.edit().putBoolean(DELAYED_RESPONSE_BITMAPS, false).apply()
}

enableBtn.setOnClickListener {
val conProvCN = ComponentName(this,
"com.clover.android.sdk.examples.CustomReceiptProviderTest")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import com.clover.sdk.v3.inventory.InventoryIntent;
import com.clover.sdk.v3.inventory.Item;
import com.clover.sdk.v3.inventory.ItemGroup;
import com.clover.sdk.v3.inventory.Menu;
import com.clover.sdk.v3.inventory.Modifier;
import com.clover.sdk.v3.inventory.ModifierGroup;
import com.clover.sdk.v3.inventory.Option;
Expand Down Expand Up @@ -820,6 +821,26 @@ public Item getPosMenuItem(String itemId, String menuId, ResultStatus resultStat
return getResult(Item.class, uri, "item", resultStatus);
}

@Override
public List<Menu> getMenusForItem(String itemId, ResultStatus resultStatus) throws RemoteException {
throw new UnsupportedOperationException("Need to implement getMenusForItem()");
}

@Override
public Menu getDefaultPosMenu(ResultStatus resultStatus) throws RemoteException {
throw new UnsupportedOperationException("Need to implement getDefaultPosMenu()");
}

@Override
public void removeMenusFromItem(String itemId, List<String> menuId, ResultStatus resultStatus) throws RemoteException {
throw new UnsupportedOperationException("Need to implement removeMenusFromItem()");
}

@Override
public void assignMenusToItem(String itemId, List<String> mendIds, ResultStatus resultStatus) throws RemoteException {
throw new UnsupportedOperationException("Need to implement assignMenusToItem()");
}

@Override
public Item getItemWithCategories(String itemId, ResultStatus resultStatus) throws RemoteException {
throw new UnsupportedOperationException("getItemWithCategories() not supported through web service API");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* Copyright (C) 2016 Clover Network, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5d7dd8f

Please sign in to comment.