-
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.
feat: refactored and optimized various classes
The main changes in this commit include: - Refactored SessionManager and made its methods more generic. - Simplified the logout method in MainViewModel. - Updated the AttendanceService, AttendanceReceiver and Auth classes for better error handling and code readability. - Made minor adjustments in MainActivity and SettingsView for better UI management. - Optimized Auth class for better data handling during login and logout operations. This commit is aimed at improving overall code quality and efficiency.
- Loading branch information
1 parent
9d424d3
commit 95522ac
Showing
7 changed files
with
86 additions
and
94 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import android.app.IntentService | ||
import android.content.Intent | ||
import com.uad.portal.MainViewModel | ||
import com.uad.portal.SessionManager | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.launch | ||
|
||
class AttendanceService : IntentService("AttendanceService") { | ||
|
||
override fun onHandleIntent(intent: Intent?) { | ||
val klsdtId = intent?.getStringExtra("klsdtId") | ||
val presklsId = intent?.getStringExtra("presklsId") | ||
val klsdtId = intent?.getStringExtra("klsdtId") ?: return | ||
val presklsId = intent?.getStringExtra("presklsId") ?: return | ||
|
||
val sessionManager = SessionManager(this) | ||
val viewModel = MainViewModel().apply { | ||
initSessionManager(this@AttendanceService) | ||
} | ||
|
||
CoroutineScope(Dispatchers.IO).launch { | ||
val isAttendanceMarked = viewModel.markAttendance(klsdtId!!, presklsId!!) | ||
viewModel.markAttendance(klsdtId, presklsId) | ||
} | ||
} | ||
} |
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