Skip to content

Instantly share code, notes, and snippets.

View nkenna's full-sized avatar

Ugwumsinachi Nnadi nkenna

  • Abuja
View GitHub Profile
exports.appleSignInCallback = (request, response) => {
const redirect = `intent://callback?${new URLSearchParams(
request.body
).toString()}#Intent;package=${process.env.ANDROID_PACKAGE_IDENTIFIER
};scheme=signinwithapple;end`;
console.log(`Redirecting to ${redirect}`);
response.redirect(307, redirect);
}
@nkenna
nkenna / download.dart
Created April 3, 2024 10:18
Download story
downloadAudioFile(MuseumObject object) async {
var size = object.media!.mediaSize ?? 0;
var fileSize = (object.media!.mediaSize! / 1000000).toStringAsPrecision(3);
var result = await Get.defaultDialog(
title: '',
middleText:
'You are about to download ${fileSize}MB of data. Do you want to continue?',
onCancel: () {
Navigator.of(context).pop(false);
@nkenna
nkenna / future_builder.dart
Last active February 10, 2024 11:55
Sample of FutureBuilder for screen
// sample of future builder starts
Future<PpleData?> _futurPple = // make request here
setState(() {});
FutureBuilder<PpleData?>(
future: _futurPple,
builder: (context, snapshot){
if(snapshot.connectionState == ConnectionState.waiting) return CircularProgressIndicator.adaptive(); // any other type of loader
Widget createBtn(){
return SizedBox(
width: 160,
height: 48,
child: ElevatedButton(
onPressed: () async{
var authUser = Provider.of<AuthProvider>(context, listen: false).user;
var eProvider = Provider.of<EventProvider>(context, listen: false);
ScreenshotController screenshotController = ScreenshotController();
print('lat: ${_selectedPrediction!.lat}');
void logDeletedAccountEvent(String userId) {
if(kDebugMode) return;
print('inside deleted account event analytics');
analytics!.logEvent(
name: 'deleted_account',
parameters: {
'user_id': userId,
'deviceOS': Platform.isAndroid ? 'android' : 'ios',
},
);
{
"data": [
{
"data_type": "post",
"data_result": {
"post_id": "96121ddd-8dd3-402b-9c8d-6be9cf1b6535",
"caption": "Foodie",
"is_a_moment": true,
"i_like": null,
"comments_count": 0,
Configuration createConfiguration() {
// final flutterSticker = Sticker(
// "example_sticker_logos_flutter", "Flutter", "assets/Flutter-logo.png");
// final imglySticker = Sticker(
// "example_sticker_logos_imgly", "img.ly", "assets/IgorSticker.png");
/// A completely custom category.
// final logos = StickerCategory(
// "example_sticker_category_logos", "Logos", "assets/Flutter-logo.png",
FirebaseMessaging.instance.getInitialMessage().then((RemoteMessage message) async{
if (message != null) {
if(message.data != null){
if(message.data['not_type'] == 'user_chat_new_message'){
print(message.data['not_type']);
// intialise chat between this two users
var startChat = await Provider.of<ChatProvider>(navigatorKey.currentState.context, listen: false).initChat(
message.data['user_1_id'],
message.data['user_2_id']
{
"stripeAmount": 143.75,
"quantity": 5,
"total": 143.75,
"charges": 12.5,
"vat": 5,
"vatAmount": 6.25,
"hostTip": 0,
"subTotal": 106.25,
"eventId": "6236013535bd756735d8d954",
{
"_id": "61322d9d2dceeb00312c13f0",
"name": "Intro to comp science",
"description": "Introduction to common problems and ideological concepts of computers",
"school": {
"_id": "613229fc2dceeb00312c13eb",
"name": "Obafemi Awolowo University"
},
"faculty": {
"_id": "61322ca92dceeb00312c13ec",