-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use twitch irc for sending messages (#1067)
- Loading branch information
Showing
9 changed files
with
109 additions
and
49 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:cloud_firestore/cloud_firestore.dart'; | ||
|
||
class TokensAdapter { | ||
final FirebaseFirestore db; | ||
|
||
TokensAdapter._({required this.db}); | ||
|
||
static TokensAdapter get instance => | ||
_instance ??= TokensAdapter._(db: FirebaseFirestore.instance); | ||
static TokensAdapter? _instance; | ||
|
||
Future<String?> getAccessToken( | ||
{required String userId, required String provider}) async { | ||
final doc = await db.collection("tokens").doc(userId).get(); | ||
if (!doc.exists) { | ||
return null; | ||
} | ||
final data = doc.data(); | ||
if (data == null || !data.containsKey(provider)) { | ||
return null; | ||
} | ||
return jsonDecode(data[provider])['access_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