GithubHelp home page GithubHelp logo

isabella232 / appsflyer-urlresolver-client Goto Github PK

View Code? Open in Web Editor NEW

This project forked from appsflyersdk/appsflyer-urlresolver-client

0.0 0.0 0.0 139 KB

License: MIT License

Ruby 4.85% Swift 46.50% Kotlin 39.98% Java 6.35% Objective-C 2.31%

appsflyer-urlresolver-client's Introduction

AppsFlyer URL Resolver

The AppsFlyer URLResolver library is a simple tool to perform redirections of a URL and get a final URL from it.

Table of contents

Install the URLResolver library using Gradle.
Step 1: Declare repositories
In the Project build.gradle file, declare the mavenCentral repository:

 allprojects {  
      repositories {  
           mavenCentral()
      }  
   }  

Step 2: Add dependency In the application build.gradle file, add the dependency to latest version of library:

   dependencies {  
      implementation 'com.appsflyer:appsflyer-url-resolver:1.0.0'
   }  

Swift Package Manger (SPM)

Step 1: Navigate to Add Package Dependency
In Xcode, go to File > Add Packages

Step 2: Add iOS SDK GitHub repository
Enter the AppsFlyer SDK GitHub repository:
https://github.com/AppsFlyerSDK/AppsFlyerURLResolver.git

Step 3: Select SDK version

Step 4: Add AppsFlyerURLResolver to desired Target

Cocoapods

Step 1: Download CocoaPods
Download and install the latest version of CocoaPods.

Step 2: Add dependencies
Add the latest version of AppsFlyerURLResolver to your project's Podfile:

pod 'AppsFlyerURLResolver'

Step 3: Install dependencies
In your terminal, navigate to your project's root folder and run pod install.

Step 4: Open Xcode workspace
In Xcode, use the .xcworkspace file to open the project from this point forward, instead of the .xcodeproj file.

Carthage

Step 1: Install Carthage
Install the latest version of Carthage.

Step 2: Add dependencies
Add the following line to your Cartfile :

github "AppsFlyerSDK/AppsFlyerURLResolver" ~> 1.0.0

resolve

Method signature

fun resolve(url: String?,maxRedirections: Int = 10, urlResolverListener: URLResolverListener): String?

Description Resolve a given URL. This function will perform redirects until it gets to the final URL or up to the maximum redirects. The function will return the last URL address.

  • null URL will return null.
  • An invalid URL will return the original input (passed in the url parameter).

Input arguments

Type Name Description
String? url The URL to resolve
Int maxRedirections The maximum redirections to relove. The default value is 10 Redirections
URLResolverListener urlResolverListener The listener for the output of the URL resolving

Example

  override fun onDeepLinking(deepLinkResult: DeepLinkResult) {
        if (deepLinkResult.status == DeepLinkResult.Status.FOUND) {
            URLResolver().resolve(deepLinkResult.deepLink?.deepLinkValue, 5, object : URLResolverListener {
            override fun onComplete(url: String?) {
            	Log.d(TAG, "final URL: $url")
            }
        })
        }
    }

resolve

Method signature

resolve(url: String?, maxRedirections: Int  =  10 , completionHandler: @escaping (String?) ->  Void)

Description Resolve a given URL. This function will perform redirects until to final URL or up to the maximum redirects. The function will return the last URL address using the completion handler.

  • nil URL will return nil.
  • Not a vailid URL will return the input to the function (url parameter).

Input arguments

Type Name Description
String? url The URL to resolve
Int maxRedirections The maximum redirections to relove. The default value is 10 Redirections
@escaping (String?) -> Void completionHandler Completion handler that will return the result as a optional string

Example

  // add this import
 import AppsFlyerURLResolver
    
 func didResolveDeepLink(_ result: DeepLinkResult) {
        if result.status == .found{
            URLResolver().resolve(url: result.deepLink?.deeplinkValue, maxRedirections: 9){ res in
                print("The URL is: \(res ?? "nil")")
            }
        }
    }

The logs are disabled by default. You can enable the debugging logs by adding true as the argument for the URLResolver() constructor.

Android

URLResolver(true)

iOS

URLResolver(isDebug: true)

๐Ÿ›  In order for us to provide optimal support, we would kindly ask you to submit any issues to [email protected]

When submitting an issue please specify your AppsFlyer sign-up (account) email , your app ID , production steps, logs, code snippets and any additional relevant information.

appsflyer-urlresolver-client's People

Contributors

pazlavi avatar afdima avatar af-fess avatar guysarfatty-af avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.