Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Add gms.wallet stubs and foss flavor to donations
Browse files Browse the repository at this point in the history
  • Loading branch information
valldrac committed Jul 23, 2024
1 parent 3207930 commit 09d7c40
Show file tree
Hide file tree
Showing 133 changed files with 115 additions and 1 deletion.
16 changes: 15 additions & 1 deletion donations/lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ plugins {

android {
namespace = "org.signal.donations"

flavorDimensions += "license"

productFlavors {
create("gms") {
dimension = "license"
isDefault = true
}

create("foss") {
dimension = "license"
}
}
}

dependencies {
Expand All @@ -16,6 +29,7 @@ dependencies {
exclude(group = "com.google.protobuf", module = "protobuf-java")
}

api(libs.google.play.services.wallet)
"gmsApi"(libs.google.play.services.wallet)
"fossApi"(project(":libfakegms"))
api(libs.square.okhttp3)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.google.android.gms.common.api;

public class ApiException extends Exception {
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.google.android.gms.common.api;

public class Status {
public final String statusMessage = "";

public int getStatusCode() {
return CommonStatusCodes.ERROR;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ public TResult getResult() {
return null;
}

public <X extends Throwable> TResult getResult(Class<X> clazz) throws X {
return null;
}

public Exception getException() {
return new UnsupportedOperationException();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.google.android.gms.wallet;

import android.app.Activity;
import android.content.Intent;

import com.google.android.gms.common.api.Status;
import com.google.android.gms.tasks.Task;

public class AutoResolveHelper {
public static final int RESULT_ERROR = 1;

public static <T> void resolveTask(Task<T> task, Activity activity, int requestCode) {
}

public static Status getStatusFromIntent (Intent data) {
return new Status();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.google.android.gms.wallet;

public final class IsReadyToPayRequest {
public static IsReadyToPayRequest fromJson(String isReadyToPayRequestJson) {
return new IsReadyToPayRequest();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.google.android.gms.wallet;

import android.content.Intent;

public final class PaymentData {
public static PaymentData getFromIntent(Intent intent) {
return new PaymentData();
}

public String toJson() {
return "{}";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.google.android.gms.wallet;

public final class PaymentDataRequest {
public static PaymentDataRequest fromJson(String paymentDataRequestJson) {
return new PaymentDataRequest();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.google.android.gms.wallet;

import com.google.android.gms.tasks.Task;

public class PaymentsClient {
public Task<Boolean> isReadyToPay(IsReadyToPayRequest request) {
return new Task<>();
}

public Task<PaymentData> loadPaymentData(PaymentDataRequest request) {
return new Task<>();
}
}
21 changes: 21 additions & 0 deletions libfakegms/src/main/java/com/google/android/gms/wallet/Wallet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.google.android.gms.wallet;

import android.content.Context;

public final class Wallet {
public static PaymentsClient getPaymentsClient(Context context, WalletOptions options) {
return new PaymentsClient();
}

public static final class WalletOptions {
public static final class Builder {
public Builder setEnvironment(int environment) {
return this;
}

public WalletOptions build() {
return new WalletOptions();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.google.android.gms.wallet;

public final class WalletConstants {
public static final int ENVIRONMENT_PRODUCTION = 1;
public static final int ENVIRONMENT_TEST = 3;
}

0 comments on commit 09d7c40

Please sign in to comment.