Skip to content

feat(api): implement getIdentifier() to access tauri.conf.json identifier#12837

Merged
lucasfernog merged 7 commits intotauri-apps:devfrom
niladrix719:get-identifier#12753
Mar 2, 2025
Merged

feat(api): implement getIdentifier() to access tauri.conf.json identifier#12837
lucasfernog merged 7 commits intotauri-apps:devfrom
niladrix719:get-identifier#12753

Conversation

@niladrix719
Copy link
Contributor

@niladrix719 niladrix719 commented Feb 27, 2025

Description

This PR adds a new getIdentifier() API function to access the application's bundle identifier from the frontend. This allows developers to access the identifier configured in tauri.conf.json without having to maintain a separate constant or parse the config file.

Closes #12753

Changes

  • Added getIdentifier() function to the app API
  • Added the command to the core:app plugin with default permissions
  • Updated API example to demonstrate usage

Testing

  • Added the function to the API example app
  • Verified the returned identifier matches tauri.conf.json
  • Cargo test passes
  • Cargo clippy passes
  • All commits are signed

API Example

import { getIdentifier } from '@tauri-apps/api/app';
const identifier = await getIdentifier(); // returns "com.tauri.api"

@niladrix719 niladrix719 requested a review from a team as a code owner February 27, 2025 12:11
@github-project-automation github-project-automation bot moved this to 📬Proposal in Roadmap Feb 27, 2025
@niladrix719 niladrix719 changed the title feat(api): implement getIdentifier() to access tauri.conf.json identifier feat(api): implement getIdentifier() to access tauri.conf.json identifier Feb 27, 2025
@FabianLars FabianLars added this to the 2.4 milestone Feb 27, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2025

Package Changes Through 859146b

There are 2 changes which include tauri with minor, @tauri-apps/api with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.3.0 2.4.0
tauri 2.3.1 2.4.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@FabianLars
Copy link
Member

Nice, thank you! Can you also add a small changefile similar to https://github.com/tauri-apps/tauri/pull/9687/files#diff-e81fe1c50bf4d06ae9838270ec4f0bf64c36193d5d29c6c71fb523363ca57a7e ? (but just tauri and @tauri-apps/api)

p.s. CI is asking you to re-run pnpm build in packages/api and commit the generated files.

@niladrix719
Copy link
Contributor Author

Okay let me know if this is good

@FabianLars
Copy link
Member

just a fyi, because 2.3.0 was just released i'll have to wait a bit before i can merge new minor prs. You don't have to do anything here anymore :)

@lucasfernog
Copy link
Member

just a fyi, because 2.3.0 was just released i'll have to wait a bit before i can merge new minor prs. You don't have to do anything here anymore :)

well it's tagged as patch though :D

@FabianLars
Copy link
Member

welp, only looked at :feat 🙃

Co-authored-by: Fabian-Lars <github@fabianlars.de>
@niladrix719
Copy link
Contributor Author

oh my bad fixed it

@lucasfernog lucasfernog merged commit 060de5b into tauri-apps:dev Mar 2, 2025
25 checks passed
@github-project-automation github-project-automation bot moved this from 📬Proposal to 🔎 In audit in Roadmap Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🔎 In audit

Development

Successfully merging this pull request may close these issues.

[feat] Get app identifier from app api

3 participants