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
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; |
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
void _onBackPress() { | |
_chatProvider.updateDataFirestore( | |
FirestoreConstants.pathUserCollection, | |
_currentUserId, | |
{FirestoreConstants.chattingWith: null}, | |
); | |
Navigator.pop(context); | |
} | |
void _getSticker() { |
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
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text( | |
this.widget.arguments.peerNickname, | |
style: TextStyle(color: ColorConstants.primaryColor), | |
), | |
centerTitle: true, | |
), |
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
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() |
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
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), | |
), | |
); |
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
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) { |
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
StreamBuilder( | |
stream: Firestore.instance | |
.collection('messages') | |
.document(groupChatId) | |
.collection(groupChatId) | |
.orderBy('timestamp', descending: true) | |
.limit(_limit) | |
.snapshots(), | |
builder: (context, snapshot) { | |
if (!snapshot.hasData) { |
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
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) => { |
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
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]) | |
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
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) | |
} |
NewerOlder