Skip to content

feat: Add widgets - #70

Open
Maotechh wants to merge 11 commits into
HeZeBang:masterfrom
Maotechh:master
Open

feat: Add widgets#70
Maotechh wants to merge 11 commits into
HeZeBang:masterfrom
Maotechh:master

Conversation

@Maotechh

Copy link
Copy Markdown
Contributor

No description provided.

@Maotechh

Copy link
Copy Markdown
Contributor Author

*widgets are ugly now, needs some redesign

@Maotechh

Copy link
Copy Markdown
Contributor Author

@HeZeBang @Honahec

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a Home Screen widget feature by adding the home_widget Flutter plugin, implementing widget data synchronization from the app’s schedule/assignments services, and adding an iOS WidgetKit extension to render that shared data.

Changes:

  • Add home_widget dependency and corresponding iOS CocoaPods integration.
  • Introduce WidgetSyncService and trigger widget sync from ScheduleService / AssignmentService.
  • Add an iOS WidgetKit extension target (SwiftUI) plus app group entitlements for data sharing.

Reviewed changes

Copilot reviewed 20 out of 22 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
pubspec.yaml Adds home_widget dependency.
pubspec.lock Adds home_widget and updates many locked dependencies + SDK metadata.
lib/services/widget_sync_service.dart New service that writes schedule/assignment JSON into widget storage and triggers widget updates.
lib/services/schedule_service.dart Calls widget sync after loading cached schedule and after fetching course table.
lib/services/assignment_service.dart Calls widget sync after loading cached assignments, persisting overrides, and after fetch/merge flows.
ios/TechPieWidgetExtension.entitlements Adds app group entitlement for the widget extension.
ios/TechPieWidget/TechPieWidgetBundle.swift Declares the widget bundle entry point.
ios/TechPieWidget/TechPieWidget.swift Implements WidgetKit timeline + SwiftUI views and reads shared JSON from app group defaults.
ios/TechPieWidget/Info.plist Adds widget extension Info.plist with WidgetKit extension point identifier.
ios/TechPieWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json Adds widget asset catalog entry.
ios/TechPieWidget/Assets.xcassets/Contents.json Adds widget asset catalog root metadata.
ios/TechPieWidget/Assets.xcassets/AppIcon.appiconset/Contents.json Adds widget extension app icon catalog metadata.
ios/TechPieWidget/Assets.xcassets/AccentColor.colorset/Contents.json Adds accent color asset catalog metadata.
ios/Runner/Runner.entitlements Adds app group entitlement for the main iOS app.
ios/Runner/NativeGlass/NativeNavigationBar.swift Adds compiler guards around newer iOS API usage.
ios/Runner/NativeGlass/NativeGlassSelect.swift Adds compiler-conditional fallback configuration for older compilers.
ios/Runner/NativeGlass/NativeGlassDropdownMenu.swift Adds compiler-conditional fallback configuration for older compilers.
ios/Runner/NativeGlass/NativeGlassConfirmationButton.swift Adds compiler-conditional fallback configuration for older compilers.
ios/Runner/NativeGlass/NativeGlassButton.swift Adds compiler-conditional fallback configuration for older compilers.
ios/Runner.xcodeproj/project.pbxproj Adds widget extension target, embeds extension, sets entitlements, and bumps iOS deployment target to 14.0.
ios/Podfile.lock Adds home_widget pod and updates pod checksums.
ios/Podfile Raises iOS platform minimum to 14.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/services/widget_sync_service.dart Outdated
Comment on lines +18 to +36
// Convert to display courses, filtering for current week
final displayCourses = eamsToDisplayCourses(table.courses, currentWeek);

// Get today's active courses, sorted by period
final todayCourses = displayCourses
.where((c) => c.dayOfWeek == weekday && !c.isGhost)
.toList();
todayCourses.sort((a, b) => a.startPeriod.compareTo(b.startPeriod));

final coursesJson = todayCourses.map((c) {
final startTime = defaultPeriods.firstWhere((p) => p.number == c.startPeriod, orElse: () => const Period(number: 0, startTime: '', endTime: '')).startTime;
final endTime = defaultPeriods.firstWhere((p) => p.number == c.endPeriod, orElse: () => const Period(number: 0, startTime: '', endTime: '')).endTime;
return {
'name': c.name,
'location': c.location,
'startTime': startTime,
'endTime': endTime,
};
}).toList();
Comment on lines +1 to +4
import 'dart:convert';

import 'package:home_widget/home_widget.dart';

Comment thread lib/services/widget_sync_service.dart Outdated
Comment on lines +38 to +40
await HomeWidget.setAppGroupId(_groupId);
await HomeWidget.saveWidgetData('schedule_data', jsonEncode(coursesJson));
await HomeWidget.updateWidget(name: 'TechPieWidget', iOSName: 'TechPieWidget');
Comment thread lib/services/widget_sync_service.dart Outdated
Comment on lines +63 to +65
await HomeWidget.setAppGroupId(_groupId);
await HomeWidget.saveWidgetData('assignment_data', jsonEncode(assignmentsJson));
await HomeWidget.updateWidget(name: 'TechPieWidget', iOSName: 'TechPieWidget');
Comment on lines +248 to +254
void _syncWidget() {
if (_courseTable != null) {
try {
unawaited(WidgetSyncService.syncSchedule(_courseTable!, currentWeek()));
} catch (_) {}
}
}
Comment on lines +577 to +581
void _syncWidget() {
try {
unawaited(WidgetSyncService.syncAssignments(_assignments, _overrides));
} catch (_) {}
}
Comment thread ios/TechPieWidget/TechPieWidget.swift Outdated
Comment on lines +22 to +23
let nextUpdate = Calendar.current.date(byAdding: .minute, value: 30, to: Date())!
let timeline = Timeline(entries: [entry], policy: .after(nextUpdate))
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.example.techpie.TechPieWidget;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CNDY1390 Does this require additional configuration in CD?

Comment thread lib/services/widget_sync_service.dart Outdated
import '../models/course_table.dart';

class WidgetSyncService {
static const String _groupId = 'group.com.example.techpie';

@Honahec Honahec Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above. Do we need to write it all in a single configuration?

Comment thread pubspec.lock Outdated
@Honahec Honahec added the ios:release:minor ios-vx.y.z+b->ios-vx.(y+1).0+1 label Jun 14, 2026

@Honahec Honahec left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Widget seems to be working properly.
Only CD problem remaining.

@github-project-automation github-project-automation Bot moved this from Backlog to Ready in TechPie Jun 14, 2026
@Honahec
Honahec requested a review from CNDY1390 June 15, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ios:release:minor ios-vx.y.z+b->ios-vx.(y+1).0+1

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

4 participants