-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kipruto <[email protected]>
- Loading branch information
1 parent
800f5d9
commit ccf38f7
Showing
7 changed files
with
34 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,50 @@ | ||
/// Dart package for handling app information. | ||
import 'dart:typed_data'; | ||
|
||
// enum AppProfile { | ||
// Work, | ||
// Personal | ||
|
||
// // from string | ||
// } | ||
|
||
/// Class representing information about an app. | ||
class AppInfo { | ||
/// The name of the app. | ||
String name; | ||
|
||
/// The icon of the app as a list of unsigned 8-bit integers. | ||
Uint8List icon; | ||
|
||
/// The package name of the app. | ||
String packageName; | ||
|
||
/// A boolean value indicating whether the app is a system app. | ||
bool isSystemApp; | ||
|
||
AppInfo(this.name, this.icon, this.packageName, this.isSystemApp); | ||
/// The profile associated with the app. | ||
String profile; | ||
|
||
/// The serial number of the app. | ||
int serialNumber; | ||
|
||
/// Constructor for the AppInfo class. | ||
AppInfo(this.name, this.icon, this.packageName, this.isSystemApp, | ||
this.profile, this.serialNumber); | ||
|
||
/// Factory constructor for creating an instance of AppInfo from dynamic data. | ||
factory AppInfo.create(dynamic data) { | ||
return AppInfo( | ||
data["name"], | ||
data["icon"], | ||
data["package_name"], | ||
data["is_system_app"], | ||
data["profile"], | ||
data["serial_number"], | ||
); | ||
} | ||
|
||
/// Method for comparing this AppInfo instance with another based on name. | ||
int compareTo(AppInfo other) { | ||
return name.compareTo(other.name); | ||
} | ||
|
||
/// Method for converting this AppInfo instance to a string. | ||
@override | ||
String toString() { | ||
return "AppInfo{name=$name, packageName=$packageName, isSystemApp=$isSystemApp"; | ||
} | ||
} | ||
|
||
class AppInfoByProfile extends AppInfo { | ||
// profile can only be personal or work | ||
String profile; | ||
int serialNumber; | ||
|
||
AppInfoByProfile(String name, Uint8List icon, String packageName, | ||
bool isSystemApp, this.profile, this.serialNumber) | ||
: super(name, icon, packageName, isSystemApp); | ||
|
||
factory AppInfoByProfile.create(dynamic data) { | ||
// AppProfile profile = AppProfile.values[data["profile"]]; | ||
return AppInfoByProfile( | ||
data["name"], | ||
data["icon"], | ||
data["package_name"], | ||
data["is_system_app"], | ||
data["profile"], | ||
data["serial_number"], | ||
); | ||
} | ||
|
||
@override | ||
String toString() { | ||
return "AppInfoByProfile{name=$name, packageName=$packageName, isSystemApp=$isSystemApp, profile=$profile"; | ||
return "AppInfo{name=$name, packageName=$packageName, isSystemApp=$isSystemApp, profile=$profile, serialNumber=$serialNumber"; | ||
} | ||
} |
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