-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from twin-te/fix-schedule-importing-feature-fr…
…om-TWINS Fix schedule importing feature from TWINS
- Loading branch information
Showing
6 changed files
with
56 additions
and
2 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
11 changes: 11 additions & 0 deletions
11
.../net/twinte/android/datastore/resetcookiesforsamesite/ResetCookiesForSameSiteDataStore.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,11 @@ | ||
package net.twinte.android.datastore.resetcookiesforsamesite | ||
|
||
/** | ||
* ref: https://github.com/twin-te/twinte-android/issues/44 | ||
* SameSite 属性が付与されていない twinte_session Cookie があるとき、 | ||
* lTWINS からの時間割インポートに失敗するため、一度 WebView が利用できる Cookie を | ||
* すべて削除し、再度 Twin:te の認証を行わせるために利用される DataStore | ||
*/ | ||
interface ResetCookiesForSameSiteDataStore { | ||
var shouldResetCookiesForSameSite: Boolean | ||
} |
25 changes: 25 additions & 0 deletions
25
.../twinte/android/datastore/resetcookiesforsamesite/ResetCookiesForSameSiteDataStoreImpl.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,25 @@ | ||
package net.twinte.android.datastore.resetcookiesforsamesite | ||
|
||
import android.content.Context | ||
import androidx.core.content.edit | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import javax.inject.Inject | ||
|
||
class ResetCookiesForSameSiteDataStoreImpl @Inject constructor( | ||
@ApplicationContext private val context: Context, | ||
) : ResetCookiesForSameSiteDataStore { | ||
private val preferences = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE) | ||
|
||
override var shouldResetCookiesForSameSite: Boolean | ||
get() = preferences.getBoolean(KEY_RESET_COOKIES_FOR_SAMESITE, true) | ||
set(value) { | ||
preferences.edit { | ||
putBoolean(KEY_RESET_COOKIES_FOR_SAMESITE, value) | ||
} | ||
} | ||
|
||
companion object { | ||
const val FILE_NAME = "reset_cookies_For_samesite" | ||
private const val KEY_RESET_COOKIES_FOR_SAMESITE = "resetCookiesForSameSite" | ||
} | ||
} |
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