Update firebase dynamic links API

This commit is contained in:
Marvin W 2021-12-06 18:26:23 +01:00
parent ac779f9ac8
commit a7eb9a2732
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
15 changed files with 231 additions and 168 deletions

View File

@ -1,49 +1,35 @@
/*
* Copyright 2019 e 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.
* SPDX-FileCopyrightText: 2019, e Foundation
* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
apply plugin: 'com.android.library'
String getMyVersionName() {
def stdout = new ByteArrayOutputStream()
if (rootProject.file("gradlew").exists())
exec { commandLine 'git', 'describe', '--tags', '--always', '--dirty'; standardOutput = stdout }
else // automatic build system, don't tag dirty
exec { commandLine 'git', 'describe', '--tags', '--always'; standardOutput = stdout }
return stdout.toString().trim().substring(1)
}
group = 'org.microg'
version = getMyVersionName()
apply plugin: 'maven-publish'
apply plugin: 'signing'
android {
compileSdkVersion androidCompileSdk()
compileSdkVersion androidCompileSdk
buildToolsVersion "$androidBuildVersionTools"
defaultConfig {
versionName getMyVersionName()
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
dependencies {
api project(':play-services-basement')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
}
apply from: '../gradle/publish-android.gradle'
description = 'microG API for firebase-dynamic-links'

View File

@ -1,3 +1,10 @@
/*
* SPDX-FileCopyrightText: 2019, e Foundation
* SPDX-FileCopyrightText: 2021, Google LLC
* SPDX-FileCopyrightText: 2021, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.firebase.dynamiclinks.internal;
parcelable DynamicLinkData;
parcelable DynamicLinkData;

View File

@ -1,12 +1,17 @@
/*
* SPDX-FileCopyrightText: 2019, e Foundation
* SPDX-FileCopyrightText: 2021, Google LLC
* SPDX-FileCopyrightText: 2021, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.firebase.dynamiclinks.internal;
import com.google.firebase.dynamiclinks.internal.DynamicLinkData;
import com.google.firebase.dynamiclinks.internal.ShortDynamicLink;
import com.google.android.gms.common.api.Status;
import com.google.firebase.dynamiclinks.internal.DynamicLinkData;
import com.google.firebase.dynamiclinks.internal.ShortDynamicLinkImpl;
interface IDynamicLinksCallbacks {
void onStatusDynamicLinkData(in Status status, in DynamicLinkData dldata) = 0;
void onStatusShortDynamicLink(in Status status, in ShortDynamicLink sdlink) = 1;
void onStatusShortDynamicLink(in Status status, in ShortDynamicLinkImpl sdlink) = 1;
}

View File

@ -1,12 +1,16 @@
/*
* SPDX-FileCopyrightText: 2019, e Foundation
* SPDX-FileCopyrightText: 2021, Google LLC
* SPDX-FileCopyrightText: 2021, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.firebase.dynamiclinks.internal;
import com.google.firebase.dynamiclinks.internal.IDynamicLinksCallbacks;
import android.os.Bundle;
interface IDynamicLinksService {
void getInitialLink(IDynamicLinksCallbacks callback, String var2) = 0;
void func2(IDynamicLinksCallbacks callback, in Bundle var2) = 1;
void getInitialLink(IDynamicLinksCallbacks callback, String link) = 0;
void createShortDynamicLink(IDynamicLinksCallbacks callback, in Bundle extras) = 1;
}

View File

@ -1,3 +0,0 @@
package com.google.firebase.dynamiclinks.internal;
parcelable ShortDynamicLink;

View File

@ -0,0 +1,10 @@
/*
* SPDX-FileCopyrightText: 2019, e Foundation
* SPDX-FileCopyrightText: 2021, Google LLC
* SPDX-FileCopyrightText: 2021, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.firebase.dynamiclinks.internal;
parcelable ShortDynamicLinkImpl;

View File

@ -1,3 +0,0 @@
package com.google.firebase.dynamiclinks.internal;
parcelable Warning;

View File

@ -0,0 +1,10 @@
/*
* SPDX-FileCopyrightText: 2019, e Foundation
* SPDX-FileCopyrightText: 2021, Google LLC
* SPDX-FileCopyrightText: 2021, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.firebase.dynamiclinks.internal;
parcelable WarningImpl;

View File

@ -0,0 +1,72 @@
/*
* SPDX-FileCopyrightText: 2021, microG Project Team
* SPDX-License-Identifier: Apache-2.0
* Notice: Portions of this file are reproduced from work created and shared by Google and used
* according to terms described in the Creative Commons 4.0 Attribution License.
* See https://developers.google.com/readme/policies for details.
*/
package com.google.firebase.dynamiclinks;
import android.net.Uri;
import org.microg.gms.common.PublicApi;
import java.util.List;
/**
* Response from {@link DynamicLink.Builder#buildShortDynamicLink()} that returns the shortened Dynamic Link, link flow chart, and warnings from the requested Dynamic Link.
*/
@PublicApi
public interface ShortDynamicLink {
/**
* Gets the preview link to show the link flow chart.
*/
Uri getPreviewLink();
/**
* Gets the short Dynamic Link value.
*/
Uri getShortLink();
/**
* Gets information about potential warnings on link creation.
*/
List<? extends Warning> getWarnings();
/**
* Path generation option for short Dynamic Link length
*/
@interface Suffix {
/**
* Shorten the path to an unguessable string. Such strings are created by base62-encoding randomly generated
* 96-bit numbers, and consist of 17 alphanumeric characters. Use unguessable strings to prevent your Dynamic
* Links from being crawled, which can potentially expose sensitive information.
*/
int UNGUESSABLE = 1;
/**
* Shorten the path to a string that is only as long as needed to be unique, with a minimum length of 4
* characters. Use this method if sensitive information would not be exposed if a short Dynamic Link URL were
* guessed.
*/
int SHORT = 2;
}
/**
* Information about potential warnings on short Dynamic Link creation.
*/
interface Warning {
/**
* Gets the warning code.
*
* @deprecated See {@link #getMessage()} for more information on this warning and how to correct it.
*/
@Deprecated
String getCode();
/**
* Gets the warning message to help developers improve their requests.
*/
String getMessage();
}
}

View File

@ -1,57 +1,45 @@
/*
* Copyright (C) 2019 e 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.
* SPDX-FileCopyrightText: 2019, e Foundation
* SPDX-FileCopyrightText: 2021, Google LLC
* SPDX-FileCopyrightText: 2021, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.firebase.dynamiclinks.internal;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
import android.os.Bundle;
import android.net.Uri;
public class DynamicLinkData extends AutoSafeParcelable {
@SafeParceled(1)
@Field(1)
public final String dynamicLink;
@SafeParceled(2)
@Field(2)
public final String deepLink;
@SafeParceled(3)
@Field(3)
public final int minVersion;
@SafeParceled(4)
@Field(4)
public final long clickTimestamp;
@SafeParceled(5)
@Field(5)
public final Bundle extensionBundle;
@SafeParceled(6)
@Field(6)
public final Uri redirectUrl;
public DynamicLinkData() {
dynamicLink = new String();
deepLink = new String();
dynamicLink = "";
deepLink = "";
minVersion = 0;
clickTimestamp = 0;
extensionBundle = new Bundle();
redirectUrl = Uri.EMPTY;
}
public static final Creator<DynamicLinkData> CREATOR = new AutoCreator<DynamicLinkData>(DynamicLinkData.class);
}
}

View File

@ -1,50 +0,0 @@
/*
* Copyright (C) 2019 e 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 com.google.firebase.dynamiclinks.internal;
import com.google.firebase.dynamiclinks.internal.Warning;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
import android.net.Uri;
import java.util.List;
import java.util.ArrayList;
public class ShortDynamicLink extends AutoSafeParcelable {
@SafeParceled(1)
public final Uri shortLink;
@SafeParceled(2)
public final Uri previewLink;
@SafeParceled(3)
public final List<Warning> warnings;
public ShortDynamicLink() {
shortLink = Uri.EMPTY;
previewLink = Uri.EMPTY;
warnings = new ArrayList<>();
}
public static final Creator<ShortDynamicLink> CREATOR = new AutoCreator<ShortDynamicLink>(ShortDynamicLink.class);
}

View File

@ -0,0 +1,38 @@
/*
* SPDX-FileCopyrightText: 2019, e Foundation
* SPDX-FileCopyrightText: 2021, Google LLC
* SPDX-FileCopyrightText: 2021, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.firebase.dynamiclinks.internal;
import android.net.Uri;
import org.microg.safeparcel.AutoSafeParcelable;
import java.util.ArrayList;
import java.util.List;
public class ShortDynamicLinkImpl extends AutoSafeParcelable {
@Field(1)
public final Uri shortLink;
@Field(2)
public final Uri previewLink;
@Field(3)
public final List<WarningImpl> warnings;
public ShortDynamicLinkImpl() {
shortLink = Uri.EMPTY;
previewLink = Uri.EMPTY;
warnings = new ArrayList<>();
}
public static final Creator<ShortDynamicLinkImpl> CREATOR = new AutoCreator<ShortDynamicLinkImpl>(ShortDynamicLinkImpl.class);
}

View File

@ -1,38 +0,0 @@
/*
* Copyright (C) 2019 e 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 com.google.firebase.dynamiclinks.internal;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class Warning extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
public final String message;
public Warning() {
message = null;
}
public static final Creator<Warning> CREATOR = new AutoCreator<Warning>(Warning.class);
}

View File

@ -0,0 +1,40 @@
/*
* SPDX-FileCopyrightText: 2021, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.firebase.dynamiclinks.internal;
import com.google.firebase.dynamiclinks.ShortDynamicLink;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class WarningImpl extends AutoSafeParcelable implements ShortDynamicLink.Warning {
@Field(1)
@Deprecated
private int code = 1;
@Field(2)
private final String message;
private WarningImpl() {
this.message = null;
}
public WarningImpl(String message) {
this.message = message;
}
@Override
public String getCode() {
return null;
}
@Override
public String getMessage() {
return message;
}
public static final Creator<WarningImpl> CREATOR = new AutoCreator<WarningImpl>(WarningImpl.class);
}

View File

@ -21,15 +21,13 @@ import android.os.RemoteException;
import android.os.Bundle;
import android.util.Log;
import android.content.Context;
import android.content.Intent;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.common.api.CommonStatusCodes;
import com.google.firebase.dynamiclinks.internal.IDynamicLinksService;
import com.google.firebase.dynamiclinks.internal.IDynamicLinksCallbacks;
import com.google.firebase.dynamiclinks.internal.DynamicLinkData;
import com.google.firebase.dynamiclinks.internal.ShortDynamicLink;
import com.google.firebase.dynamiclinks.internal.ShortDynamicLinkImpl;
public class DynamicLinksServiceImpl extends IDynamicLinksService.Stub {
@ -40,15 +38,14 @@ public class DynamicLinksServiceImpl extends IDynamicLinksService.Stub {
@Override
public void getInitialLink(IDynamicLinksCallbacks callback, String var2) throws RemoteException {
public void getInitialLink(IDynamicLinksCallbacks callback, String link) throws RemoteException {
callback.onStatusDynamicLinkData(Status.SUCCESS, new DynamicLinkData());
}
@Override
public void func2(IDynamicLinksCallbacks callback, Bundle var2) throws RemoteException {
Log.d(TAG, "func2: " + callback + ", " + var2);
callback.onStatusShortDynamicLink(Status.SUCCESS, new ShortDynamicLink());
public void createShortDynamicLink(IDynamicLinksCallbacks callback, Bundle extras) throws RemoteException {
callback.onStatusShortDynamicLink(Status.SUCCESS, new ShortDynamicLinkImpl());
}