Skip to content

Commit

Permalink
Release 262.2 (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dusty Gutzmann authored Sep 17, 2020
1 parent b726876 commit d9aaed6
Show file tree
Hide file tree
Showing 478 changed files with 14,510 additions and 6,701 deletions.
2 changes: 1 addition & 1 deletion clover-android-connector-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
group = 'com.clover.sdk'
version = '248.4'
version = '262.2'


apply from: file("${project.rootDir}/lib.gradle")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/


/*
* Copyright (C) 2019 Clover Network, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.clover.connector.sdk.v3.session;

import android.os.Parcelable;
import android.os.Parcel;

/**
* This is an auto-generated Clover data enum.
*/
@SuppressWarnings("all")
public enum PropertyAction implements Parcelable {
INSERT, UPDATE, DELETE;

@Override
public int describeContents() {
return 0;
}

@Override
public void writeToParcel(final Parcel dest, final int flags) {
dest.writeString(name());
}

public static final Creator<PropertyAction> CREATOR = new Creator<PropertyAction>() {
@Override
public PropertyAction createFromParcel(final Parcel source) {
return PropertyAction.valueOf(source.readString());
}

@Override
public PropertyAction[] newArray(final int size) {
return new PropertyAction[size];
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.clover.sdk.v3.payments.Transaction;

import android.content.ContentProviderClient;
import android.content.ContentValues;
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
Expand Down Expand Up @@ -62,11 +61,6 @@ public class SessionConnector implements Serializable, SessionListener {

private ContentProviderClient sessionContentProviderClient;
private WeakReference<Context> contextWeakReference;
CustomerInfo customerInfo;
DisplayOrder displayOrder;
Map<String, String> properties = new HashMap<>();
Transaction transaction;

Set<SessionListener> sessionListeners = new LinkedHashSet<>();
private SessionContentObserver sessionContentObserver = null;
private ContentObserver propertyContentObserver;
Expand Down Expand Up @@ -115,10 +109,6 @@ public boolean removeSessionListener(SessionListener listener) {
}

public boolean clear() {
customerInfo = null;
displayOrder = null;
properties.clear();
transaction = null;
try {
if (connect()) {
sessionContentProviderClient.call(SessionContract.CALL_METHOD_CLEAR_SESSION, null, null);
Expand All @@ -131,7 +121,7 @@ public boolean clear() {
}

public CustomerInfo getCustomerInfo() {
customerInfo = null;
CustomerInfo customerInfo = null;
try {
if (connect()) {
try (Cursor cursor = sessionContentProviderClient.query(SessionContract.SESSION_CUSTOMER_URI, null, null, null, null)) {
Expand Down Expand Up @@ -163,7 +153,7 @@ public void setCustomerInfo(CustomerInfo customerInfo) {
}

public DisplayOrder getDisplayOrder() {
displayOrder = null;
DisplayOrder displayOrder = null;
try {
if (connect()) {
try (Cursor cursor = sessionContentProviderClient.query(SessionContract.SESSION_DISPLAY_ORDER_URI, null, null, null, null)) {
Expand Down Expand Up @@ -195,7 +185,7 @@ public void setDisplayOrder(DisplayOrder displayOrder, boolean isOrderModificati
}

public Map<String, String> getProperties() {
properties = new HashMap<>();
Map<String, String> properties = new HashMap<>();
try {
if (connect()) {
try (Cursor cursor = sessionContentProviderClient.query(SessionContract.PROPERTIES_URI, null, null, null, null)) {
Expand Down Expand Up @@ -252,11 +242,9 @@ public void setProperty(String key, String value) {
public String getProperty(String key) {
try {
if (!connect()) return null;

ContentValues values = new ContentValues();
values.put(SessionContract.COLUMN_KEY, key);
Uri propUri = SessionContract.PROPERTIES_KEY_URI.buildUpon().appendPath(key).build();
try (Cursor cursor = sessionContentProviderClient.query(propUri, null, null, null, null)) {
String selectionClause = SessionContract.COLUMN_KEY + " = ?";
String[] selectionArgs = {key};
try (Cursor cursor = sessionContentProviderClient.query(SessionContract.PROPERTIES_URI, null, selectionClause, selectionArgs, null)) {
if (null != cursor && cursor.moveToFirst()) {
return cursor.getString(1); // 0=Key, 1=Value
}
Expand All @@ -270,15 +258,16 @@ public String getProperty(String key) {
public void removeProperty(String key) {
try {
if (!connect()) return;

Uri propUri = SessionContract.PROPERTIES_KEY_URI.buildUpon().appendPath(key).build();
sessionContentProviderClient.delete(propUri, null, null);
String selectionClause = SessionContract.COLUMN_KEY + " = ?";
String[] selectionArgs = {key};
sessionContentProviderClient.delete(SessionContract.PROPERTIES_URI, selectionClause, selectionArgs);
} catch (Exception e) {
Log.e(TAG, e.getMessage(), e);
}
}

public Transaction getTransaction() {
Transaction transaction = null;
try {
if (connect()) {
try (Cursor cursor = sessionContentProviderClient.query(SessionContract.SESSION_TRANSACTION_URI, null, null, null, null)) {
Expand Down Expand Up @@ -324,34 +313,20 @@ public void sendSessionEvent(String eventType, String data) {

@Override
public void onSessionDataChanged(String type, Object data) {
Log.d(this.getClass().getSimpleName(), "onSessionDataChanged called with type = " + type);
for (SessionListener listener : sessionListeners) {
listener.onSessionDataChanged(type, data);
}
}

@Override
public void onSessionEvent(String type, String data) {
Log.d(this.getClass().getSimpleName(), "onSessionEvent called with type = " + type);
for (SessionListener listener : sessionListeners) {
listener.onSessionEvent(type, data);
}
}

public void announceCustomerProvidedData(String type, String data) {
Bundle bundle = new Bundle();
bundle.putString(BUNDLE_KEY_TYPE, type);
bundle.putString(BUNDLE_KEY_DATA, data);

try {
sessionContentProviderClient.call(SessionContract.CALL_METHOD_ANNOUNCE_CUSTOMER_PROVIDED_DATA, null, bundle);
} catch (Exception e) {
Log.e(TAG, e.getMessage(), e);
}
}

public void start(String type) {

}

private static void registerContentObserver(Context context, SessionContentObserver sessionContentObserver) {
if (null == context || null == sessionContentObserver) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ public class SessionContract {
public static final String COLUMN_TRANSACTION = "TX";
public static final String COLUMN_TRANSACTION_CLASS = "TX_CLASS";

// Session property key definitions
public static final String PROPERTY_LOYALTY_RECEIPT_PRINTED = "LOYALTY_RECEIPT_PRINTED";
public static final String PROPERTY_LOYALTY_POINTS_EARNED = "LOYALTY_POINTS_EARNED";
public static final String PROPERTY_LOYALTY_POINTS_CALCULATED = "LOYALTY_POINTS_CALCULATED";
public static final String PROPERTY_LOYALTY_UUID = "LOYALTY_UUID";
public static final String PROPERTY_LOYALTY_ORDER_ID = "LOYALTY_ORDER_ID";
// Session property table/column definition
public static final String PROPERTIES_TABLE_NAME = "SESSION_PROPERTY";
public static final String COLUMN_KEY = "KEY";
Expand Down
Loading

0 comments on commit d9aaed6

Please sign in to comment.