Skip to content

Instantly share code, notes, and snippets.

class AuthInterceptor extends InterceptorsWrapper {
final Dio dio;
AuthInterceptor(this.dio);
// when accessToken is expired & having multiple requests call
// this variable to lock others request to make sure only trigger call refresh token 01 times
// to prevent duplicate refresh call
bool _isRefreshing = false;
void _onBackPress() {
_chatProvider.updateDataFirestore(
FirestoreConstants.pathUserCollection,
_currentUserId,
{FirestoreConstants.chattingWith: null},
);
Navigator.pop(context);
}
void _getSticker() {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
this.widget.arguments.peerNickname,
style: TextStyle(color: ColorConstants.primaryColor),
),
centerTitle: true,
),
const functions = require('firebase-functions')
const admin = require('firebase-admin')
admin.initializeApp()
exports.sendNotification = functions.firestore
.document('messages/{groupId1}/{groupId2}/{message}')
.onCreate((snap, context) => {
console.log('----------------start function--------------------')
const doc = snap.data()
Container(
child: StreamBuilder(
stream: Firestore.instance.collection('users').limit(_limit).snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(themeColor),
),
);
void registerNotification() {
firebaseMessaging.requestNotificationPermissions();
firebaseMessaging.configure(onMessage: (Map<String, dynamic> message) {
print('onMessage: $message');
Platform.isAndroid
? showNotification(message['notification'])
: showNotification(message['aps']['alert']);
return;
}, onResume: (Map<String, dynamic> message) {
StreamBuilder(
stream: Firestore.instance
.collection('messages')
.document(groupChatId)
.collection(groupChatId)
.orderBy('timestamp', descending: true)
.limit(_limit)
.snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
syncDb = () => {
this.setState({isLoading: true})
handlerSync = PouchDB.sync(remoteNoteDb, localNoteDb, {
live: true,
retry: true,
})
.on('change', (info) => {
// console.log(TAG, 'sync onChange', info)
})
.on('paused', (err) => {
class ViewController: UIViewController {
@IBOutlet weak var textField: UITextField!
@IBAction func BtnGoReactView(_ sender: Any) {
let messageFromNative: String = textField.text!
let rootView = RNViewManager.sharedInstance.viewForModule(
"DemoIntegrateRN",
initialProperties: ["message_from_native": messageFromNative])
class TestConnectNativeModule internal constructor(private val reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
override fun getName(): String {
return "TestConnectNative"
}
@ReactMethod
fun sendMessageToNative(rnMessage: String?) {
Log.d("This log is from java", rnMessage)
}