Tweakr
Android Library for Remote Debugging, Autogenerating Settings/Preference UIs, and Wizard-of-Ozing
com.google.tweakr.TweakrFirebaseRepoMultiuser Class Reference
Inheritance diagram for com.google.tweakr.TweakrFirebaseRepoMultiuser:
com.google.tweakr.TweakrFirebaseRepo com.google.tweakr.TweakrRepo

Public Member Functions

 TweakrFirebaseRepoMultiuser (Context context)
 
synchronized CompletableFuture< String > getUserKey ()
 
- Public Member Functions inherited from com.google.tweakr.TweakrFirebaseRepo
CompletableFuture< String > getUserKey ()
 
void addListener (OnChangeListener listener)
 
void removeListener (OnChangeListener listener)
 
void add (String name, int targetId, ValueType valueType, Object initialValue, TweakMetadata tweakMetadata)
 
void addListener (OnChangeListener listener)
 
void removeListener (OnChangeListener listener)
 
void add (String name, int targetId, ValueType valueType, Object initialValue, TweakMetadata tweakMetadata)
 

Additional Inherited Members

- Public Attributes inherited from com.google.tweakr.TweakrRepo
String FIELD_SEPARATOR = ":"
 
- Protected Member Functions inherited from com.google.tweakr.TweakrFirebaseRepo
CompletableFuture< Boolean > authenticate ()
 
FirebaseDatabase getDatabase ()
 
String getRootCollectionKey ()
 
- Static Protected Attributes inherited from com.google.tweakr.TweakrFirebaseRepo
static final String TAG = "TweakrRepo"
 

Detailed Description

A TweakrFirebaseRepo that automatically creates unique, simple User Keys for each device so that the user only can Tweak their own values, not other people's.

Use getUserKey() to display the User Key to the user as a "PIN Code", then send the user to your Tweakr URL with "?promptForUserKey=true" appended. It will prompt them for their "PIN Code" and let them Tweak those values.

You can also specify a custom prompt message with the "?promptMessage=[message]" query string parameter. This would be a good place to give your user instructions on where to find the user key in your app. e.g.:

tweakr/index.html#/tweak?promptForUserKey=true&promptMessage=Enter%20pin%20from%20settings%20screen

Note: this is not at all secure. Users can simply click a different tab to alter other users' values. If you want to restrict users to their own data, try authenticating first, then return the userId from the getUserKey() method. Then alter your firebase rules to restrict read/write access to only that user key.

Member Function Documentation

◆ getUserKey()

synchronized CompletableFuture< String > com.google.tweakr.TweakrFirebaseRepoMultiuser.getUserKey ( )

Returns the user's sub-collection key. Use this if you want each user to be able to Tweak their own set of values, which will not change the other users' values.

Returns
an alphanumeric identifier that is unique per user.

Reimplemented from com.google.tweakr.TweakrFirebaseRepo.


The documentation for this class was generated from the following file: