-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Abstract Vimeo sign into a class * Display proper error when using invalid token * Update readme to exclude unpublished asset in asset store * Save token on a per scene basis * Use scene name as a loose way to determine uniqueness for token saving
- Loading branch information
Showing
7 changed files
with
110 additions
and
120 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,50 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
namespace Vimeo.Config | ||
{ | ||
public class VimeoBehavior : MonoBehaviour | ||
{ | ||
public string vimeoToken; | ||
public bool saveVimeoToken = true; | ||
public bool vimeoSignIn = false; | ||
private const string VIMEO_TOKEN_NAME = "vimeo-token-"; | ||
|
||
public string GetVimeoToken() | ||
{ | ||
if (saveVimeoToken) { | ||
return vimeoToken; | ||
} | ||
else { | ||
return PlayerPrefs.GetString(VIMEO_TOKEN_NAME + this.gameObject.scene.name); | ||
} | ||
} | ||
|
||
public void SetVimeoToken(string token) | ||
{ | ||
// Wasn't able to DRY this up - PlayerPrefs started causing seg faults :/ | ||
string token_name = VIMEO_TOKEN_NAME + this.gameObject.scene.name; | ||
|
||
if (saveVimeoToken) { | ||
SetKey(token_name, null); | ||
vimeoToken = token; | ||
} | ||
else { | ||
vimeoToken = null; | ||
SetKey(token_name, token); | ||
} | ||
} | ||
|
||
public void SetKey(string key, string val) | ||
{ | ||
if (val == null || val == "") { | ||
PlayerPrefs.DeleteKey(key); | ||
} | ||
else { | ||
PlayerPrefs.SetString(key, val); | ||
} | ||
PlayerPrefs.Save(); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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