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 stripe = require('stripe')(functions.config().stripe.key); | |
const admin = require("firebase-admin"); | |
const axios = require('axios'); | |
admin.initializeApp(); | |
// // Create and Deploy Your First Cloud Functions | |
// // https://firebase.google.com/docs/functions/write-firebase-functions | |
// |
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 stripe = require('stripe')(functions.config().stripe.testkey); | |
const admin = require("firebase-admin"); | |
const axios = require('axios'); | |
admin.initializeApp(); | |
// // Create and Deploy Your First Cloud Functions | |
// // https://firebase.google.com/docs/functions/write-firebase-functions | |
// |
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(); | |
const cors = require("cors")({ origin: true }); | |
const axios = require('axios') | |
exports.payWithStripeAPI = functions.https.onRequest((request, response) => { | |
let secretKey; | |
let stripe; |
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
export interface FireProductNormalized extends FireModel { | |
store_id: string; | |
user_id: string; | |
paused: boolean; | |
///provider source: eg. woocommerce | |
source?: string; | |
///Returns the description of the product. | |
description?: string; | |
/// For Algolia sorting |
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
import 'package:cloud_firestore/cloud_firestore.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:nutes/core/models/story.dart'; | |
import 'package:nutes/core/services/repository.dart'; | |
import 'package:nutes/ui/screens/my_profile_screen.dart'; | |
import 'package:nutes/ui/screens/profile_screen.dart'; | |
import 'package:nutes/ui/shared/loading_indicator.dart'; | |
import 'package:nutes/ui/widgets/story_view.dart'; | |
class StoryPageView extends StatefulWidget { |
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
import 'dart:io'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/cupertino.dart'; | |
import 'package:agora/ui/shared/loading_indicator.dart'; | |
class RefreshListView extends StatefulWidget { | |
final ScrollController controller; | |
final VoidCallback onRefresh; | |
final VoidCallback onLoadMore; | |
final Widget child; |
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
static Future getRecentSearches() => shared._firestore.getRecentSearches(); | |
static Future deleteRecentSearch(String uid) => | |
shared._firestore.deleteRecentSearch(uid); | |
static Future createRecentSearch(User user) => | |
shared._firestore.createRecentSearch(user); | |
static Future<List<User>> searchUsers(String text) => | |
shared._firestore.searchUsers(text); |
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
async function sendFCM(uid: string, payload: admin.messaging.DataMessagePayload) { | |
const message: admin.messaging.MessagingPayload = { | |
notification: { | |
title: payload.title, | |
body: payload.body, | |
clickAction: 'FLUTTER_NOTIFICATION_CLICK', | |
}, | |
data: payload, |
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
export const fanOutPostWrite = functions.firestore | |
.document('users/{uid}/posts/{postId}') | |
.onWrite(async (change, context) => { | |
const postId = context.params.postId; | |
const uploader = context.params.uid; | |
const followerRefs = await firestore | |
.collection('users').doc(uploader) | |
.collection('followers').get(); |
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
export const updatePostLikeCount = functions.firestore | |
.document('posts/{postId}/likes/{uid}') | |
.onWrite((change, context) => { | |
const postId = context.params.postId; | |
let increment: number; | |
const publicPostRef = firestore.collection('posts').doc(postId); |