mobilecompat

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	HeaderPlatform = "X-App-Platform"
	HeaderVersion  = "X-App-Version"
	HeaderBuild    = "X-App-Build"

	HeaderUpdateScope    = "X-App-Update-Scope"
	HeaderMinimumVersion = "X-App-Minimum-Version"
	HeaderMinimumBuild   = "X-App-Minimum-Build"
	HeaderStoreURL       = "X-App-Store-URL"
)
View Source
const (
	UpdateScopeGlobal   = "global"
	UpdateScopeEndpoint = "endpoint"
)

Variables

This section is empty.

Functions

func AndroidBelowMinimum

func AndroidBelowMinimum(currentVersionCode, minimumVersionCode int64) bool

AndroidBelowMinimum compares versionCode, represented by the build header.

func IOSBelowMinimum

func IOSBelowMinimum(
	currentVersion string,
	currentBuild int64,
	minimumVersion string,
	minimumBuild int64,
) (bool, error)

IOSBelowMinimum compares the release version first. The build is compared only when the installed and minimum release versions are equal.

func NewInterceptor

func NewInterceptor(policy Policy) connect.Interceptor

func ValidateVersion

func ValidateVersion(value string) error

Types

type Client

type Client struct {
	Platform Platform
	Version  string
	Build    int64
}

func ParseHeaders

func ParseHeaders(headers http.Header) (*Client, error)

ParseHeaders returns nil when no mobile headers are supplied. If any mobile header is present, all three are required.

type Platform

type Platform string
const (
	PlatformIOS     Platform = "ios"
	PlatformAndroid Platform = "android"
)

type Policy

type Policy interface {
	IsExempt(procedure string) bool
	Global(platform Platform) *Requirement
	Endpoint(platform Platform, procedure string) *Requirement
}

type Requirement

type Requirement struct {
	Scope          string
	MinimumVersion string
	MinimumBuild   int64
	StoreURL       string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL