-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added background processing in Android, implemented option to log out
- Loading branch information
Showing
27 changed files
with
234 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,35 @@ | ||
#!/bin/sh | ||
|
||
CONFIG=Debug | ||
TARGET=iphoneos | ||
CERTIFICATE="" | ||
|
||
while getopts "c:r" opt; do | ||
case $opt in | ||
c) | ||
CERTIFICATE="${OPTARG}" | ||
;; | ||
r) | ||
CONFIG=Release | ||
;; | ||
t) | ||
TARGET="${OPTARG}" | ||
;; | ||
esac | ||
done | ||
|
||
oldPwd=$(pwd) | ||
|
||
cd $oldPwd/iosApp | ||
xcodebuild -project iosApp.xcodeproj -scheme iosApp -sdk iphoneos -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO SYMROOT=$PWD/Build | ||
cd Build/Release-iphoneos | ||
xcodebuild -project iosApp.xcodeproj -scheme iosApp -sdk "${TARGET}" -configuration "${CONFIG}" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO SYMROOT=$PWD/Build | ||
cd Build/${CONFIG}-${TARGET} | ||
mkdir -p Payload | ||
cp -pr Violet.app Payload | ||
|
||
if [ -n "${CERTIFICATE}" ]; then | ||
codesign --force --sign "${CERTIFICATE}" Payload/Violet.app/Violet | ||
fi | ||
|
||
zip -r $oldPwd/Violet.ipa Payload | ||
cd $oldPwd | ||
rm -rf $oldPwd/iosApp/Build |
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
12 changes: 10 additions & 2 deletions
12
composeApp/src/androidMain/kotlin/com/github/aeoliux/violet/MainActivity.kt
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
24 changes: 24 additions & 0 deletions
24
...pp/src/androidMain/kotlin/com/github/aeoliux/violet/app/appState/BackgroundJob.android.kt
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,24 @@ | ||
package com.github.aeoliux.violet.app.appState | ||
|
||
import android.app.Service | ||
import android.content.Intent | ||
import android.os.IBinder | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.launch | ||
|
||
var taskToBePerformed: suspend () -> Unit = {} | ||
|
||
class BackgroundJob: Service() { | ||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { | ||
CoroutineScope(Dispatchers.Default).launch { | ||
taskToBePerformed() | ||
} | ||
|
||
return START_STICKY | ||
} | ||
|
||
override fun onBind(intent: Intent?): IBinder? = null | ||
} | ||
|
||
actual var runBackgroundTask: (task: suspend () -> Unit) -> Unit = {} |
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
3 changes: 3 additions & 0 deletions
3
composeApp/src/commonMain/kotlin/com/github/aeoliux/violet/app/appState/BackgroundJob.kt
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,3 @@ | ||
package com.github.aeoliux.violet.app.appState | ||
|
||
expect var runBackgroundTask: (task: suspend () -> Unit) -> Unit |
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
Oops, something went wrong.