-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5990d6
commit 354aef5
Showing
18 changed files
with
261 additions
and
137 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import 'package:android_intent_plus/android_intent.dart' as android_intent; | ||
import 'package:installed_apps/app_info.dart'; | ||
import 'package:installed_apps/installed_apps.dart' as installed_apps; | ||
|
||
import '../../interactor/models/app_model.dart'; | ||
import '../../interactor/repositories/apps_repository.dart'; | ||
|
||
class AndroidAppsRepository implements AppsRepository { | ||
@override | ||
Future<Set<AppModel>> getInstalledApps() async { | ||
List<AppInfo> apps = | ||
await installed_apps.InstalledApps.getInstalledApps(true, true); | ||
|
||
return apps.map((e) { | ||
return AppModel( | ||
name: e.name!, | ||
package: e.packageName!, | ||
icon: e.icon!, | ||
); | ||
}).toSet(); | ||
} | ||
|
||
@override | ||
Future<void> openApp(AppModel app) { | ||
return installed_apps.InstalledApps.startApp(app.package); | ||
} | ||
|
||
@override | ||
Future<void> openAppSettings(AppModel app) { | ||
return installed_apps.InstalledApps.openSettings(app.package); | ||
} | ||
|
||
@override | ||
Future<void> openConfiguration() async { | ||
const intent = android_intent.AndroidIntent( | ||
action: 'android.settings.SETTINGS', | ||
); | ||
|
||
await intent.launch(); | ||
} | ||
|
||
@override | ||
Future<void> openWithCustomConfig({ | ||
required String action, | ||
String? package, | ||
String? componentName, | ||
Map<String, dynamic> arguments = const {}, | ||
}) async { | ||
final intent = android_intent.AndroidIntent( | ||
action: action, | ||
package: package, | ||
componentName: componentName, | ||
arguments: arguments, | ||
); | ||
|
||
return intent.launch(); | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import 'package:yuno/injector.dart'; | ||
|
||
import '../atoms/gamepad_atom.dart'; | ||
import '../services/gamepad_service.dart'; | ||
|
||
void registerGamepad() { | ||
final gamepad = injector.get<GamepadService>(); | ||
gamepad.setHandleFunction(gamepadState.setValue); | ||
} |
Oops, something went wrong.