Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

Commit

Permalink
Release 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanZhilich committed Jul 13, 2015
2 parents 4ccd059 + 6272c4c commit cf2e0da
Show file tree
Hide file tree
Showing 57 changed files with 2,130 additions and 88 deletions.
3 changes: 3 additions & 0 deletions .idea/dictionaries/rzhilich.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -39,7 +39,7 @@ allprojects {
}

ext {
compileSdkVersion = 21
compileSdkVersion = 22
buildToolsVersion = "22.0.1"
}
}
6 changes: 3 additions & 3 deletions opfiab-providers/amazon/build.gradle
Expand Up @@ -22,14 +22,14 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 22
versionCode 2
versionName "0.3.0"
versionCode 1
versionName "0.4.0"
}
}

dependencies {
compile 'org.onepf:opfiab:0.3.0@aar'
//noinspection GradleDynamicVersion
provided 'org.onepf:opfutils:0.1.+'
provided 'org.onepf:opfutils:0.1.23'
provided 'com.amazon:in-app-purchasing:2.0.61'
}
6 changes: 3 additions & 3 deletions opfiab-providers/google/build.gradle
Expand Up @@ -22,13 +22,13 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 22
versionCode 2
versionName "0.3.0"
versionCode 1
versionName "0.4.0"
}
}

dependencies {
compile 'org.onepf:opfiab:0.3.0@aar'
//noinspection GradleDynamicVersion
provided 'org.onepf:opfutils:0.1.+'
provided 'org.onepf:opfutils:0.1.23'
}
Expand Up @@ -63,8 +63,6 @@
import java.util.List;
import java.util.Set;

import static android.Manifest.permission.GET_ACCOUNTS;

/**
* This {@link BillingProvider} implementation adds support for
* <a href="https://play.google.com/store">Google Play</a> App Store.
Expand Down Expand Up @@ -191,7 +189,6 @@ protected Status getStatus(@Nullable final Response response) {

@Override
public void checkManifest() {
OPFChecks.checkPermission(context, GET_ACCOUNTS);
OPFChecks.checkPermission(context, PERMISSION_BILLING);
}

Expand All @@ -218,8 +215,7 @@ public Compatibility checkCompatibility() {
return Compatibility.INCOMPATIBLE;
}
return INSTALLER.equals(OPFUtils.getPackageInstaller(context))
? Compatibility.PREFERRED
: Compatibility.COMPATIBLE;
? Compatibility.PREFERRED : Compatibility.COMPATIBLE;
}

@Override
Expand Down Expand Up @@ -275,6 +271,7 @@ protected void skuDetails(@NonNull final SkuDetailsRequest request) {
}
}
for (final String sku : unresolvedSkus) {
OPFLog.e("No details for SKU: " + sku);
skusDetails.add(new SkuDetails(sku));
}
postResponse(new SkuDetailsResponse(Status.SUCCESS, getName(), skusDetails));
Expand Down
Expand Up @@ -24,8 +24,12 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import org.onepf.opfutils.OPFChecks;

import java.util.ArrayList;

import static android.Manifest.permission.GET_ACCOUNTS;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

@SuppressFBWarnings({"CFS_CONFUSING_FUNCTION_SEMANTICS"})
Expand All @@ -47,6 +51,9 @@ public final class GoogleUtils {


public static boolean hasGoogleAccount(@NonNull final Context context) {
if (!OPFChecks.hasPermission(context, GET_ACCOUNTS)) {
return true;
}
final Object service = context.getSystemService(Context.ACCOUNT_SERVICE);
final AccountManager accountManager = (AccountManager) service;
// At least one Google account is present on device
Expand Down
1 change: 1 addition & 0 deletions opfiab-providers/openstore/.gitignore
@@ -0,0 +1 @@
/build
39 changes: 39 additions & 0 deletions opfiab-providers/openstore/build.gradle
@@ -0,0 +1,39 @@
/*
* Copyright 2012-2015 One Platform Foundation
*
* 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
*
* http://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.
*/

apply plugin: 'idea'
apply plugin: 'com.android.library'
apply from: urlCache.get('https://raw.githubusercontent.com/onepf/OPF-mvn-repo/gradle-commons/opf-commons.gradle')

android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "0.3.0-SNAPSHOT"
}
}

dependencies {
// compile('org.onepf:opfiab:0.3.+@aar') {
// changing = true
// }
compile project(':opfiab')
//noinspection GradleDynamicVersion
provided('org.onepf:opfutils:0.1.+') {
changing = true
}
}
19 changes: 19 additions & 0 deletions opfiab-providers/openstore/gradle.properties
@@ -0,0 +1,19 @@
#
# Copyright 2012-2015 One Platform Foundation
#
# 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
#
# http://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.
#

POM_ARTIFACT_ID = opfiab-google
POM_NAME = OPFIab Google module
POM_DESCRIPTION = Adds Google billing provider
17 changes: 17 additions & 0 deletions opfiab-providers/openstore/proguard-rules.pro
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.2/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
20 changes: 20 additions & 0 deletions opfiab-providers/openstore/src/main/AndroidManifest.xml
@@ -0,0 +1,20 @@
<!--
~ Copyright 2012-2015 One Platform Foundation
~
~ 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
~
~ http://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.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.onepf.opfiab.openstore">

</manifest>
@@ -0,0 +1,62 @@
/*******************************************************************************
* Copyright 2013 One Platform Foundation
*
* 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
*
* http://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 org.onepf.oms;

import android.content.Intent;

/**
* Service interface to implement by OpenStore implementation
*
* @author Boris Minaev, Oleg Orlov
* @since 29.04.2013
*/
interface IOpenAppstore {

/**
* Every OpenStore implementation must provide their name. It's required for core OpenIAB functions
*/
String getAppstoreName();

/**
* OpenStores must provide information about packages it installed. If OpenStore is installer
* and supports In-App billing it will be used for purchases
*/
boolean isPackageInstaller(String packageName);

/**
* If <b>true</b> OpenIAB assumes In-App items (SKU) for app are published and ready to use
*/
boolean isBillingAvailable(String packageName);

/**
* Provides android:versionCode of .apk published in OpenStore
* @return -1 if UNDEFINED
*/
int getPackageVersion(String packageName);

/**
* Should provide Intent to be used for binding IOpenInAppBillingService
*/
Intent getBillingServiceIntent();

Intent getProductPageIntent(String packageName);

Intent getRateItPageIntent(String packageName);

Intent getSameDeveloperPageIntent(String packageName);

boolean areOutsideLinksAllowed();
}
@@ -0,0 +1,50 @@
/*******************************************************************************
* Copyright 2013 One Platform Foundation
*
* 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
*
* http://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 org.onepf.oms;

/**
* IOpenInAppBillingService is the service that provides in-app billing.
* It's based on com.android.vending.billing.IInAppBillingService provided by Google Play In-App API v3
* This service provides the following features:
* 1. Provides a new API to get details of in-app items published for the app including
* price, type, title and description.
* 2. The purchase flow is synchronous and purchase information is available immediately
* after it completes.
* 3. Purchase information of in-app purchases is maintained within the Google Play system
* till the purchase is consumed.
* 4. An API to consume a purchase of an inapp item. All purchases of one-time
* in-app items are consumable and thereafter can be purchased again.
* 5. An API to get current purchases of the user immediately. This will not contain any
* consumed purchases.
*
* All calls will give a response code with the following possible values
* RESULT_OK = 0 - success
* RESULT_USER_CANCELED = 1 - user pressed back or canceled a dialog
* RESULT_BILLING_UNAVAILABLE = 3 - this billing API version is not supported for the type requested
* RESULT_ITEM_UNAVAILABLE = 4 - requested SKU is not available for purchase
* RESULT_DEVELOPER_ERROR = 5 - invalid arguments provided to the API
* RESULT_ERROR = 6 - Fatal error during the API action
* RESULT_ITEM_ALREADY_OWNED = 7 - Failure to purchase since item is already owned
* RESULT_ITEM_NOT_OWNED = 8 - Failure to consume since item is not owned
*/
interface IOpenInAppBillingService {
int isBillingSupported(int apiVersion, String packageName, String type);
Bundle getSkuDetails(int apiVersion, String packageName, String type, in Bundle skusBundle);
Bundle getBuyIntent(int apiVersion, String packageName, String sku, String type, String developerPayload);
Bundle getPurchases(int apiVersion, String packageName, String type, String continuationToken);
int consumePurchase(int apiVersion, String packageName, String purchaseToken);
}
@@ -0,0 +1,57 @@
/*
* Copyright 2012-2015 One Platform Foundation
*
* 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
*
* http://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 org.onepf.opfiab.openstore;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import org.onepf.opfiab.billing.BaseBillingProvider;
import org.onepf.opfiab.sku.TypedSkuResolver;
import org.onepf.opfiab.verification.PurchaseVerifier;

public class ApplandBillingProvider extends OpenStoreBillingProvider {

public static final String NAME = "APPLAND";
protected static final String[] PACKAGES = new String[]{"se.appland.market.android"};


public ApplandBillingProvider(@NonNull final Context context,
@NonNull final TypedSkuResolver skuResolver,
@NonNull final PurchaseVerifier purchaseVerifier,
@Nullable final OpenStoreIntentMaker intentMaker) {
super(context, skuResolver, purchaseVerifier, intentMaker);
}

public static class Builder extends OpenStoreBuilder<Builder> {

public Builder(@NonNull final Context context) {
super(context);
setIntentMaker(OpenStoreUtils.getIntentMaker(NAME, PACKAGES));
}

@Override
public BaseBillingProvider build() {
if (skuResolver == null) {
throw new IllegalStateException();
}
return new ApplandBillingProvider(context, skuResolver,
purchaseVerifier == null ? PurchaseVerifier.DEFAULT : purchaseVerifier,
intentMaker);
}
}
}

0 comments on commit cf2e0da

Please sign in to comment.