-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
603dc80
commit 7621a16
Showing
9 changed files
with
104 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Node.js Package | ||
on: | ||
release: | ||
types: [created] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# Setup .npmrc file to publish to GitHub Packages | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '12.x' | ||
registry-url: 'https://npm.pkg.github.com' | ||
# Defaults to the user or organization that owns the workflow file | ||
scope: '@teamdotworld' | ||
- run: npm install | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package dev.dotworld.ble | ||
|
||
import android.content.Context | ||
import android.content.SharedPreferences | ||
|
||
object AppPreferences { | ||
private const val NAME = "beambox" | ||
private const val MODE = Context.MODE_PRIVATE | ||
private lateinit var preferences: SharedPreferences | ||
|
||
private val USER_ID = Pair("user_id", null) | ||
|
||
fun init(context: Context) { | ||
preferences = context.getSharedPreferences(NAME, MODE) | ||
} | ||
|
||
private inline fun SharedPreferences.edit(operation: (SharedPreferences.Editor) -> Unit) { | ||
val editor = edit() | ||
operation(editor) | ||
editor.apply() | ||
} | ||
|
||
var userId: String? | ||
get() = preferences.getString(USER_ID.first, USER_ID.second) | ||
set(value) = preferences.edit { | ||
it.putString(USER_ID.first, value) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters