Skip to content

Commit

Permalink
Fix: change convenience uri methods to take authority instead of pack…
Browse files Browse the repository at this point in the history
…age name
  • Loading branch information
iamllama committed Oct 28, 2024
1 parent 086d146 commit 26b876d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions api/src/main/java/com/ichi2/anki/FlashCardsContract.kt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public object FlashCardsContract {

public fun getPermission(ankiPackageName: String = BuildConfig.ANKI_PACKAGE_NAME): String = "$ankiPackageName.permission.READ_WRITE_DATABASE"

public fun getAuthorityUri(ankiPackageName: String = BuildConfig.ANKI_PACKAGE_NAME): Uri = Uri.parse("content://${getAuthority(ankiPackageName)}")
public fun getAuthorityUri(authority: String = getAuthority()): Uri = Uri.parse("content://$authority")

/**
* This assumes the default release/debug build package name. Use [getAuthority] and [getPermission] when working with parallel builds
Expand Down Expand Up @@ -229,7 +229,7 @@ public object FlashCardsContract {
@JvmField // required for Java API
public val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, CONTENT_URI_SEGMENT)

public fun getContentUri(ankiPackageName: String): Uri = Uri.withAppendedPath(getAuthorityUri(ankiPackageName), CONTENT_URI_SEGMENT)
public fun getContentUri(authority: Uri): Uri = Uri.withAppendedPath(authority, CONTENT_URI_SEGMENT)

public const val CONTENT_URI_V2_SEGMENT: String = "notes_v2"

Expand All @@ -240,7 +240,7 @@ public object FlashCardsContract {
@JvmField // required for Java API
public val CONTENT_URI_V2: Uri = Uri.withAppendedPath(AUTHORITY_URI, CONTENT_URI_V2_SEGMENT)

public fun getContentUriV2(ankiPackageName: String): Uri = Uri.withAppendedPath(getAuthorityUri(ankiPackageName), CONTENT_URI_V2_SEGMENT)
public fun getContentUriV2(authority: Uri): Uri = Uri.withAppendedPath(authority, CONTENT_URI_V2_SEGMENT)

/**
* This is the ID of the note. It is the same as the note ID in Anki. This ID can be
Expand Down Expand Up @@ -378,7 +378,7 @@ public object FlashCardsContract {
@JvmField // required for Java API
public val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, CONTENT_URI_SEGMENT)

public fun getContentUri(ankiPackageName: String): Uri = Uri.withAppendedPath(getAuthorityUri(ankiPackageName), CONTENT_URI_SEGMENT)
public fun getContentUri(authority: Uri): Uri = Uri.withAppendedPath(authority, CONTENT_URI_SEGMENT)

public const val CURRENT_MODEL_ID: String = "current"

Expand Down Expand Up @@ -775,7 +775,7 @@ public object FlashCardsContract {
@JvmField // required for Java API
public val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, CONTENT_URI_SEGMENT)

public fun getContentUri(ankiPackageName: String): Uri = Uri.withAppendedPath(getAuthorityUri(ankiPackageName), CONTENT_URI_SEGMENT)
public fun getContentUri(authority: Uri): Uri = Uri.withAppendedPath(authority, CONTENT_URI_SEGMENT)

/**
* This is the ID of the note that this card belongs to (i.e. [Note._ID]).
Expand Down Expand Up @@ -937,14 +937,14 @@ public object FlashCardsContract {
@JvmField // required for Java API
public val CONTENT_ALL_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, CONTENT_ALL_URI_SEGMENT)

public fun getContentAllUri(ankiPackageName: String): Uri = Uri.withAppendedPath(getAuthorityUri(ankiPackageName), CONTENT_ALL_URI_SEGMENT)
public fun getContentAllUri(authority: Uri): Uri = Uri.withAppendedPath(authority, CONTENT_ALL_URI_SEGMENT)

public const val CONTENT_SELECTED_URI_SEGMENT: String = "selected_deck"

@JvmField // required for Java API
public val CONTENT_SELECTED_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, CONTENT_SELECTED_URI_SEGMENT)

public fun getContentSelectedUri(ankiPackageName: String): Uri = Uri.withAppendedPath(getAuthorityUri(ankiPackageName), CONTENT_SELECTED_URI_SEGMENT)
public fun getContentSelectedUri(authority: Uri): Uri = Uri.withAppendedPath(authority, CONTENT_SELECTED_URI_SEGMENT)

/**
* The name of the Deck
Expand Down Expand Up @@ -1017,7 +1017,7 @@ public object FlashCardsContract {
@JvmField // required for Java API
public val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, CONTENT_URI_SEGMENT)

public fun getContentUri(ankiPackageName: String): Uri = Uri.withAppendedPath(getAuthorityUri(ankiPackageName), CONTENT_URI_SEGMENT)
public fun getContentUri(authority: Uri): Uri = Uri.withAppendedPath(authority, CONTENT_URI_SEGMENT)

/**
* Uri.toString() which points to the media file that is to be inserted.
Expand Down

0 comments on commit 26b876d

Please sign in to comment.