Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "tlistserver"
}
}
20 changes: 20 additions & 0 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge
on:
push:
branches:
- main
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: flutter build web
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_TLISTSERVER }}
channelId: live
projectId: tlistserver
21 changes: 21 additions & 0 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on PR
on: pull_request
permissions:
checks: write
contents: read
pull-requests: write
jobs:
build_and_preview:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: flutter build web
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_TLISTSERVER }}
projectId: tlistserver
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,13 @@ app.*.map.json
/android/app/profile
/android/app/release
/android/build/reports

# Firebase
.firebaserc
firebase.json
firebase-debug.log
.firebase
.github
firebaseconfig.js
lib/firebase_options.dart
web/update.json
3 changes: 3 additions & 0 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
plugins {
id("com.android.application")
// START: FlutterFire Configuration
id("com.google.gms.google-services")
// END: FlutterFire Configuration
id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
Expand Down
48 changes: 48 additions & 0 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"project_info": {
"project_number": "582262425557",
"firebase_url": "https://tlistserver-default-rtdb.asia-southeast1.firebasedatabase.app",
"project_id": "tlistserver",
"storage_bucket": "tlistserver.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:582262425557:android:81685a50fe61a2ad029f5c",
"android_client_info": {
"package_name": "com.friyn.tlist"
}
},
"oauth_client": [
{
"client_id": "582262425557-8dtdmlh6an70mqmcocl1quup2g1ds80s.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.friyn.tlist",
"certificate_hash": "d13679b2f83cde9bf1da3a91df669e3b63e30de5"
}
},
{
"client_id": "582262425557-doq1ic0ia81krqmelq24lkb6sh4oaef2.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAWYT98BF7VQr3y_qThu5wae0vG308nF6k"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "582262425557-doq1ic0ia81krqmelq24lkb6sh4oaef2.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
34 changes: 34 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
</intent>
</queries>
<application
android:label="TList"
android:name="${applicationName}"
Expand Down Expand Up @@ -30,6 +44,26 @@
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<receiver
android:name=".FinanceWidgetProvider"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/finance_widget_provider" />
</receiver>
<receiver
android:name=".QuickAddWidgetProvider"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/quick_add_widget_provider" />
</receiver>
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.friyn.tlist

import android.appwidget.AppWidgetManager
import android.content.Context
import android.content.SharedPreferences
import android.widget.RemoteViews
import es.antonborri.home_widget.HomeWidgetLaunchIntent
import es.antonborri.home_widget.HomeWidgetProvider

class FinanceWidgetProvider : HomeWidgetProvider() {
override fun onUpdate(
context: Context,
appWidgetManager: AppWidgetManager,
appWidgetIds: IntArray,
widgetData: SharedPreferences
) {
for (widgetId in appWidgetIds) {
val views = RemoteViews(context.packageName, R.layout.finance_widget)

val balance = widgetData.getString("balance", "-") ?: "-"
views.setTextViewText(R.id.txt_title, "Balance")
views.setTextViewText(R.id.txt_balance, balance)

val pendingIntent = HomeWidgetLaunchIntent.getActivity(context, MainActivity::class.java)
views.setOnClickPendingIntent(R.id.txt_title, pendingIntent)
views.setOnClickPendingIntent(R.id.txt_balance, pendingIntent)

appWidgetManager.updateAppWidget(widgetId, views)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.friyn.tlist

import android.app.PendingIntent
import android.appwidget.AppWidgetManager
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.widget.RemoteViews
import es.antonborri.home_widget.HomeWidgetLaunchIntent
import es.antonborri.home_widget.HomeWidgetProvider

class QuickAddWidgetProvider : HomeWidgetProvider() {
override fun onUpdate(
context: Context,
appWidgetManager: AppWidgetManager,
appWidgetIds: IntArray,
widgetData: SharedPreferences
) {
for (widgetId in appWidgetIds) {
val views = RemoteViews(context.packageName, R.layout.quick_add_widget)

// Set up click intents for quick actions
val addTaskIntent = createQuickActionIntent(context, "add_task")
val addNoteIntent = createQuickActionIntent(context, "add_note")
val openAppIntent = HomeWidgetLaunchIntent.getActivity(context, MainActivity::class.java)

// Set click listeners
views.setOnClickPendingIntent(R.id.btn_add_task, addTaskIntent)
views.setOnClickPendingIntent(R.id.btn_add_note, addNoteIntent)
views.setOnClickPendingIntent(R.id.btn_open_app, openAppIntent)

appWidgetManager.updateAppWidget(widgetId, views)
}
}

private fun createQuickActionIntent(context: Context, action: String): PendingIntent {
val intent = Intent(context, MainActivity::class.java).apply {
putExtra("widget_action", action)
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
}

val requestCode = when (action) {
"add_task" -> 1001
"add_note" -> 1002
else -> 1000
}

return PendingIntent.getActivity(
context,
requestCode,
intent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
}
}
40 changes: 40 additions & 0 deletions android/app/src/main/res/layout/finance_widget.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:padding="12dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="12dp"
android:background="@android:color/white"
android:elevation="4dp"
android:layout_centerInParent="true"
android:clipToPadding="false"
android:layout_margin="4dp">

<TextView
android:id="@+id/txt_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Balance"
android:textStyle="bold"
android:textSize="14sp"
android:textColor="#777"
/>

<TextView
android:id="@+id/txt_balance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textStyle="bold"
android:textSize="22sp"
android:textColor="#000"/>

</LinearLayout>

</RelativeLayout>
Loading