Skip to content

Commit

Permalink
Release 1.17.0 (#1417)
Browse files Browse the repository at this point in the history
* feat: add new localization keys and placeholders for Quran-related st… (#1402)

* feat: add new localization keys and placeholders for Quran-related strings

- Added new keys for Quran reading page placeholders in portrait mode in intl_sq.arb and intl_bs.arb
- Introduced 'switchQuranType' placeholder with 'name' in intl_sq.arb and intl_bs.arb
- Updated onboarding_language_selector.dart to include debug print for locale language code
- Ensured proper formatting with newlines at the end of arb files

* fix: remove Montenegrin because flutter doesn't support it

* remove the print

* Feat/quran/auto scrolling reading (#1389)

* feat(auto_reading): add state management for auto reading feature

- Implement `AutoScrollState` to handle auto scroll speed, visibility, and font size settings.
- Add `AutoScrollNotifier` to manage auto-scrolling functionality with start, stop, and speed control.
- Include derived properties for controlling the visibility of speed control and scroll behavior.
- Support toggling between single-page view and auto-scrolling.

* feat(quran): add play toggle button and refactor directory structure

- Add play toggle button to `QuranReadingScreen` with portrait and landscape support.
- Move `quran_reading_screen.dart` to new `reading` directory for better organization.
- Create `QuranFloatingActionButtons` widget for handling floating action buttons in portrait and landscape modes.

* refactor: Extract floating action controls into new widget with passed focus nodes

- Extracted floating action controls into `QuranFloatingActionControls` widget.
- Used `OrientationBuilder` within the new widget to determine orientation internally.
- Passed focus nodes from `QuranReadingScreen` to the new widget for external focus management.
- Maintained existing UI and design without modifications.

* feat: add the to_string and making the AutoScrollNotifier auto disposed

* modify the new ui

* feat: add auto-scrolling reading mode with font size and speed controls

- QuranFloatingActionControls:
  - Implemented `_buildAutoScrollingReadingMode` to display controls when auto-scroll is active.
  - Added methods:
    - `_buildFontSizeControls` for adjusting font size.
    - `_buildSpeedControls` for adjusting auto-scroll speed.
    - `_buildPlayPauseButton` for toggling auto-scroll.
    - `_buildActionButton` as a helper for creating action buttons.
  - Modified `_buildFloatingPortrait` and `_buildFloatingLandscape` to display auto-scroll controls based on the current state.

- AutoScrollState:
  - Fixed `isAutoScrolling` getter to correctly represent the auto-scrolling state.

- AutoScrollNotifier:
  - Added methods:
    - `increaseFontSize` and `decreaseFontSize` to adjust font size.
    - `increaseSpeed` and `decreaseSpeed` to adjust auto-scroll speed.
  - Updated `startAutoScroll` to use dynamic speed settings.

* fix: scrolling functionality and refactor Quran reading code

- Implement auto-scrolling that aligns with the current page and page height.
- Refactor floating action buttons into separate widget classes for better code organization.
- Update auto-scroll state and notifier to handle scroll controller and dynamic speed adjustments.

* refactor QuranReadingScreen: Remove unused imports and redundant widget functions

- Removed unnecessary imports such as SvgPicture and ReciterSelectionScreen.
- Cleaned up redundant widget methods like `buildFloatingPortrait`, `buildFloatingLandscape`, and other floating action button handlers.
- Simplified the UI logic by eliminating unused `QuranModeButton` and `PlayToggleButton` widgets.

* merge on main

* refactor: remove unused floating action buttons

* refactor: migrate screen rotation to state management

- Add isRotated field to QuranReadingState to manage rotation state
- Add toggleRotation method to QuranReadingNotifier
- Remove local ValueNotifier for rotation management
- Update QuranFloatingActionControls to use state-managed rotation
- Simplify _OrientationToggleButton to use state rotation
- Remove orientation dependencies from UserPreferencesManager

* refactor(quran): improve keyboard navigation and focus management

- Replace custom key event handlers with FocusTraversalPolicy for better focus management
- Add ArrowButtonsFocusTraversalPolicy to handle navigation between left/right buttons
- Implement up/down navigation from arrow buttons to back button and page selector
- Fix positioning issues with Stack and Positioned widgets
- Remove ValueNotifier in favor of setState for rotation state management
- Clean up widget hierarchy and remove redundant wrapper classes
- Add proper focus order using FocusTraversalOrder
- Fix duplicate Positioned widgets causing layout issues
- Improve code organization and readability

* remove unused `ArrowButtonsFocusTraversalPolicy` in the quran_reading_widgets.dart

* fix: resolve Positioned widget conflicts and improve focus navigation

- Remove nested Positioned widgets causing render conflicts
- Fix focus navigation system in reading screen:
  * Add proper FocusTraversalOrder for all interactive elements
  * Implement custom ArrowButtonsFocusTraversalPolicy
  * Add keyboard navigation support (arrows, tab, enter/space)
- Reorganize widget tree structure to prevent parent data conflicts
- Improve navigation button layout and accessibility
- Fix RTL/LTR direction handling in navigation buttons

* remove the unnecessary `FocusTraversalGroup` and order

* refactor: remove `QuranFocusTraversalPolicy` class from `quran_floating_action_buttons.dart`

* refactor: implement strategy pattern for Quran reading view and focus management

Introduced the `QuranViewStrategy` abstract class and created two concrete strategies, `AutoScrollViewStrategy` and `NormalViewStrategy`, to handle view and control layout for different Quran reading modes. Replaced previous inline focus management with a new `FocusNodes` helper class for organizing focus nodes. Refactored loading and error indicators into separate widget methods for cleaner code structure. This update enhances readability and allows for easier expansion of view strategies in the future.

* refactor: add font size and speed controls for Quran auto-scrolling mode

- Updated `autoScrollSpeed` default value in `AutoScrollState` to 0.1 for a slower starting speed.
- Added `cycleFontSize` and `cycleSpeed` methods in `AutoScrollNotifier` to allow cycling through font sizes and scroll speeds with a single button, improving user control and simplifying UI.
- Refactored `_FontSizeControls` and `_SpeedControls` widgets to use a single `_ActionButton` for adjusting font size and speed, displaying current values in tooltips.
- Re-introduced `_ActionButton` class with autofocus support for enhanced focus management.

* refactor: Quran reading widgets for improved modularity and maintainability

- Converted functions in `quran_reading_widgets.dart` into distinct `ConsumerWidget` classes:
  - `VerticalPageViewWidget`, `HorizontalPageViewWidget`
  - `RightSwitchButtonWidget`, `LeftSwitchButtonWidget`
  - `PageNumberIndicatorWidget`, `MoshafSelectorPositionedWidget`
  - `BackButtonWidget`, `SvgPictureWidget`

* feat: add scaling the size of the pages with the font

* feat: add stop and pause and add close the mode

* fix: maintain scroll position and speed when changing auto-scroll settings

- Prevent scroll position reset when changing scroll speed
- Only restart timer instead of full scroll reinitialize when adjusting speed

* remove _handleFloatingActionButtons in the quran floating action

* feat(quran-reader): Add auto-scroll pause/resume on tap

- Add tap gesture detection to auto-scrolling view
- Implement play/pause toggle functionality on tap
- Disable manual scrolling in auto-scroll mode
- Clean up code formatting and indentation

* reformat

* feat(quran): integrate surah name display in SurahSelectorWidget

- Replace icon with current surah name display in the top bar
- Add transparent background with white text for better visibility
- Maintain existing dialog functionality for surah selection

* feat(ui): show quran reading controls in both portrait & landscape modes

- Remove orientation-specific conditional rendering
- Display navigation controls, surah selector and page indicators in all orientations
- Maintain consistent control behavior across screen modes

* fix: portrait mode focus traversal for Quran reading screen

- Removed unused `FocusScopeNode` in `QuranFloatingActionControls`.
- Introduced a new focus traversal policy (`PortraitModeFocusTraversalPolicy`) for better keyboard navigation in portrait mode.
- Updated `_buildBody` to handle focus nodes in both portrait and landscape orientation

* refactor: `quran_floating_action_buttons.dart` for dynamic button sizing and improved readability

- Updated button and icon sizes to scale dynamically based on screen width, enhancing UI consistency across different devices.

* refactor

* refactor(quran-reading): update back button behavior and add exit button focus handling

- Removed the `BackButtonWidget` from the `quran_reading_screen.dart` page to simplify UI elements.
- Enhanced the `_ExitButton` widget in `quran_floating_action_buttons.dart`:
- Changed from `ConsumerWidget` to `ConsumerStatefulWidget` for state management.
- Added a `FocusNode` for the exit button to set autofocus on load.
- Implemented an `initState` method to request focus after widget binding.

* feat: add name for the exitFocusNode

* reformat

* keep highlight one same salah item until iqama (#1394)

* Fix/ Error in console for 403 images for loading the reciters (#1382)

* switch to extended image package to handle exception throw

* switch extended image version

* Update pubspec.yaml

* switch to fast cached library as a temp workaround

---------

Co-authored-by: Ibrahim ZEHHAF <97339607+ibrahim-zehhaf-mawaqit@users.noreply.github.com>

* Feat/close quran when salah (#1408)

* feat(routes): add Quran-specific routes and route generator

* refactor(routes): migrate to named routes and simplify navigation logic in the quran

* fix: Improve Quran mode selection navigation

- Modify route generator to handle QuranModeSelection separately

* fix: waiting for the handle push

* fix the formating

* fix: Pop the screen while it has dialog in reading

* refactor: AdhanSubScreen to use ConsumerStatefulWidget and manage Quran mode

- Updated AdhanSubScreen to use `ConsumerStatefulWidget` and `ConsumerState` for improved state management with Riverpod.
- Moved Quran mode exit logic to AdhanSubScreen and JummuaLive components, removing redundant code from salah_workflow.
- Added post-frame callback in AdhanSubScreen and JummuaLive to trigger `exitQuranMode` via `quranNotifierProvider`.

* pause quran player when adhan begins

---------

Co-authored-by: Ghassen Ben Zahra <ghassen.benzahra@gmail.com>

* Feat/Manual update rooted & non-rooted devices (#1427)

* invert parentheses (#1406)

* feat: add Ukrainian language support (#1416)

* feat: add and update more persian language (#1415)

* feat: update and add new translations (#1414)

* feat: add thai language support (#1413)

* test apk

* add launching the app after install

* add logs on launch

* try to launch app after uninstall

* create sript to launch on different process

* modify execute command to correctly handle result

* fix return statement

* try different method

* remove se linux permission

* add more delay

* modify script to retry

* new launch script'

* edit script launch

* refactor update notifier to ManualUpdateNotifier for improved clarity and distinction

- renamed `UpdateNotifier` to `ManualUpdateNotifier` for better differentiation of manual update functionality.
- updated `updateNotifierProvider` to `manualUpdateNotifierProvider` across relevant files.
- refactored `SettingScreen` to utilize the newly renamed `manualUpdateNotifierProvider`.

* change script

* fix missing imports

* change install method

* working install

* higher priority receiver

* add service

* try bash script

* try both commands

* stable working update

* feat: add for non-rooted update

* stable non-rooted & rooted devices update

* remove unused reciver & upgrade pubspec

---------

Co-authored-by: Yassin Nouh <70436855+YassinNouh21@users.noreply.github.com>
Co-authored-by: Yassin <yassinnouh21@gmail.com>

---------

Co-authored-by: Ghassen Ben Zahra <ghassen.benzahra@gmail.com>
Co-authored-by: Ibrahim ZEHHAF <97339607+ibrahim-zehhaf-mawaqit@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 20, 2024
1 parent c231971 commit b03c24a
Show file tree
Hide file tree
Showing 40 changed files with 2,719 additions and 812 deletions.
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>


<meta-data
android:name="google_analytics_adid_collection_enabled"
Expand Down
42 changes: 40 additions & 2 deletions android/app/src/main/kotlin/com/flyweb/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ import android.util.Log
import android.net.wifi.WifiConfiguration
import android.net.wifi.WifiManager
import android.net.ConnectivityManager

import java.util.concurrent.Executors
import android.os.Looper
import android.os.Handler
import android.content.BroadcastReceiver
import android.content.IntentFilter
class MainActivity : FlutterActivity() {
private lateinit var mAdminComponentName: ComponentName
private lateinit var mDevicePolicyManager: DevicePolicyManager
Expand Down Expand Up @@ -59,8 +63,40 @@ class MainActivity : FlutterActivity() {
val isSuccess = clearDataRestart()
result.success(isSuccess)
}
"installApk" -> {
val filePath = call.argument<String>("filePath")
if (filePath != null) {
AsyncTask.execute {
try {
// Check if file exists
val file = java.io.File(filePath)
if (!file.exists()) {
Log.e("APK_INSTALL", "APK file not found at path: $filePath")
result.error("FILE_NOT_FOUND", "APK file not found", null)
return@execute
}
// Check if device is rooted
if (!checkRoot()) {
Log.e("APK_INSTALL", "Device is not rooted")
result.error("NOT_ROOTED", "Device is not rooted", null)
return@execute
}



else -> result.notImplemented()
executeCommand(listOf("pm install -r -d $filePath"), result)

result.success("Installation initiated")
} catch (e: Exception) {
Log.e("APK_INSTALL", "Failed to install APK", e)
result.error("INSTALL_FAILED", e.message, null)
}
}
} else {
result.error("INVALID_PATH", "File path is null", null)
}
}
else -> result.notImplemented()
}
}
}
Expand Down Expand Up @@ -127,6 +163,7 @@ class MainActivity : FlutterActivity() {
}
}


private fun connectToWifi(call: MethodCall, result: MethodChannel.Result) {
AsyncTask.execute {
try {
Expand Down Expand Up @@ -251,6 +288,7 @@ fun connectToNetworkWPA(call: MethodCall, result: MethodChannel.Result) {
}
}
}

private fun sendDownArrowEvent(call: MethodCall, result: MethodChannel.Result) {
AsyncTask.execute {
try {
Expand Down
14 changes: 13 additions & 1 deletion lib/l10n/intl_ar.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,5 +352,17 @@
"example": "604"
}
}
}
},
"checkForUpdates": "التحقق من التحديثات",
"checkForNewVersion": "تحقق مما إذا كانت هناك نسخة جديدة متوفرة",
"wouldYouLikeToUpdate": "هل ترغب في تحديث التطبيق؟",
"updateCompleted": "تم التحديث بنجاح!",
"noUpdates": "لا توجد تحديثات",
"usingLatestVersion": "أنت تستخدم أحدث إصدار.",
"updateCancelled": "تم إلغاء التحديث",
"checkingUpdates": "جارٍ التحقق من التحديثات...",
"downloadingUpdate": "جارٍ تنزيل التحديث...",
"installingUpdate": "جارٍ تثبيت التحديث...",
"updateCompletedSuccessfully": "تم التحديث بنجاح",
"updateFailed": "فشل التحديث"
}
36 changes: 34 additions & 2 deletions lib/l10n/intl_bs.arb
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,20 @@
}
}
},
"quranReadingPagePortrait": "Strana {currentPage} / {totalPages}",
"@quranReadingPagePortrait": {
"description": "Placeholder text for displaying Quran reading page portrait numbers",
"placeholders": {
"currentPage": {
"type": "int",
"example": "1"
},
"totalPages": {
"type": "int",
"example": "604"
}
}
},
"chooseQuranPage": "Odaberite stranicu",
"checkingForUpdates": "Provjera za ažuriranje...",
"chooseQuranType": "Izaberi Kur'an",
Expand Down Expand Up @@ -320,5 +334,23 @@
"noFavoriteReciters": "Nema omiljenih učača. Pokušajte dodati jednog na listu",
"@noFavoriteReciters": {
"description": "Message shown when there are no favorite reciters"
}
}
},
"noReciterSearchResult": "Bez rezultata za vašu pretragu.",
"searchForReciter": "Potraži učača",
"downloadAllSuwarSuccessfully": "Kompletan Kur'an je preuzet",
"noSuwarDownload": "Nema novih sura za preuzimanje",
"connectDownloadQuran": "Da bi ste preuzeli molimo vas da se povežete na internetu",
"playInOnlineModeQuran": "Da bi ste slušali učenje Kur'ana molimo vas da se povežete na internetu",
"downloaded": "Preuzeto",
"switchQuranType": "Idi na {name}",
"@switchQuranType": {
"description": "Message shown when a reciter is added to favorites",
"placeholders": {
"name": {
"type": "String",
"example": "Warsh"
}
}
},
"surahSelector": "Odaberi suru"
}
15 changes: 14 additions & 1 deletion lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,5 +352,18 @@
}
}
},
"surahSelector":"Select Surah"
"surahSelector":"Select Surah",
"checkForUpdates": "Check for Updates",
"checkForNewVersion": "Check if a new version is available",
"wouldYouLikeToUpdate": "Would you like to update the app?",
"updateCompleted": "Update completed successfully!",
"noUpdates": "No Updates",
"usingLatestVersion": "You are using the latest version.",
"updateCancelled": "Update cancelled",
"checkingUpdates": "Checking updates...",
"downloadingUpdate": "Downloading update...",
"installingUpdate": "Installing update...",
"updateCompletedSuccessfully": "Update completed successfully",
"updateFailed": "Update failed"

}
14 changes: 13 additions & 1 deletion lib/l10n/intl_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,18 @@
"example": "604"
}
}
}
},
"checkForUpdates": "Vérifier les mises à jour",
"checkForNewVersion": "Vérifiez si une nouvelle version est disponible",
"wouldYouLikeToUpdate": "Souhaitez-vous mettre à jour l'application ?",
"updateCompleted": "Mise à jour terminée avec succès !",
"noUpdates": "Aucune mise à jour",
"usingLatestVersion": "Vous utilisez la dernière version.",
"updateCancelled": "Mise à jour annulée",
"checkingUpdates": "Vérification des mises à jour...",
"downloadingUpdate": "Téléchargement de la mise à jour...",
"installingUpdate": "Installation de la mise à jour...",
"updateCompletedSuccessfully": "Mise à jour terminée avec succès",
"updateFailed": "Échec de la mise à jour"

}
76 changes: 43 additions & 33 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'package:fast_cached_network_image/fast_cached_network_image.dart';
import 'dart:async';
import 'dart:developer' as developer;
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_kurdish_localization/flutter_kurdish_localization.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'
show ProviderBase, ProviderContainer, ProviderObserver, ProviderScope;
import 'package:flutter_riverpod/flutter_riverpod.dart' as riverpod;
import 'package:hive_flutter/adapters.dart';
import 'package:logger/logger.dart';
import 'package:mawaqit/i18n/AppLanguage.dart';
Expand Down Expand Up @@ -32,6 +34,7 @@ import 'package:path_provider/path_provider.dart';
import 'package:provider/provider.dart';
import 'package:sizer/sizer.dart';
import 'package:timezone/data/latest.dart' as tz;
import 'package:mawaqit/src/routes/route_generator.dart';

final logger = Logger();

Expand All @@ -42,12 +45,14 @@ Future<void> main() async {
await Firebase.initializeApp();
final directory = await getApplicationDocumentsDirectory();
Hive.init(directory.path);
await FastCachedImageConfig.init(subDir: directory.path, clearCacheAfter: const Duration(days: 60));

tz.initializeTimeZones();
Hive.registerAdapter(SurahModelAdapter());
Hive.registerAdapter(ReciterModelAdapter());
Hive.registerAdapter(MoshafModelAdapter());
runApp(
ProviderScope(
riverpod.ProviderScope(
child: MyApp(),
observers: [
RiverpodLogger(),
Expand All @@ -59,9 +64,9 @@ Future<void> main() async {
);
}

class MyApp extends StatelessWidget {
class MyApp extends riverpod.ConsumerWidget {
@override
Widget build(BuildContext context) {
Widget build(BuildContext context, riverpod.WidgetRef ref) {
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (context) => ThemeNotifier()),
Expand All @@ -85,35 +90,40 @@ class MyApp extends StatelessWidget {
return event;
}),
child: Consumer<ThemeNotifier>(
builder: (context, theme, _) => Shortcuts(
shortcuts: {SingleActivator(LogicalKeyboardKey.select): ActivateIntent()},
child: MaterialApp(
title: kAppName,
themeMode: theme.mode,
localeResolutionCallback: (locale, supportedLocales) {
if (locale?.languageCode.toLowerCase() == 'ba') return Locale('en');
builder: (context, theme, _) {
return Shortcuts(
shortcuts: {SingleActivator(LogicalKeyboardKey.select): ActivateIntent()},
child: MaterialApp(
title: kAppName,
themeMode: theme.mode,
localeResolutionCallback: (locale, supportedLocales) {
if (locale?.languageCode.toLowerCase() == 'ba') return Locale('en');

return locale;
},
theme: theme.lightTheme,
darkTheme: theme.darkTheme,
locale: model.appLocal,
navigatorKey: AppRouter.navigationKey,
navigatorObservers: [AnalyticsWrapper.observer()],
localizationsDelegates: [
S.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
KurdishMaterialLocalizations.delegate,
KurdishWidgetLocalizations.delegate,
KurdishCupertinoLocalizations.delegate
],
supportedLocales: S.supportedLocales,
debugShowCheckedModeBanner: false,
home: Splash(),
),
),
return locale;
},
theme: theme.lightTheme,
darkTheme: theme.darkTheme,
locale: model.appLocal,
navigatorKey: AppRouter.navigationKey,
navigatorObservers: [
AnalyticsWrapper.observer(),
],
localizationsDelegates: [
S.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
KurdishMaterialLocalizations.delegate,
KurdishWidgetLocalizations.delegate,
KurdishCupertinoLocalizations.delegate
],
supportedLocales: S.supportedLocales,
debugShowCheckedModeBanner: false,
onGenerateRoute: RouteGenerator.generateRoute,
home: Splash(),
),
);
},
),
);
});
Expand Down
5 changes: 5 additions & 0 deletions lib/src/const/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,8 @@ abstract class SystemFeaturesConstant {
static const String kHdmi = 'android.hardware.hdmi';
static const String kEthernet = 'android.hardware.ethernet';
}

abstract class ManualUpdateConstant {
static const String githubApiBaseUrl = 'https://api.github.com/repos/mawaqit/android-tv-app/releases';
static const String githubAcceptHeader = 'application/vnd.github.v3+json';
}
Loading

0 comments on commit b03c24a

Please sign in to comment.