An account that had Chess no longer gets Arcade installed: More apps lists Arcade with the download symbol, like any app not on this device, and Chess with its saved and friend games goes once the user installed Arcade.
80 lines
5.2 KiB
Ziran
80 lines
5.2 KiB
Ziran
// The names apps the node offers may use: their own, their records' keys,
|
|
// their collections and shared ids, kept apart from the bundled apps' and
|
|
// from Lists' own shared lists.
|
|
#import, file "../src/storage/app_records.zi";
|
|
#import, file "../src/storage/media_records.zi";
|
|
|
|
#program_export
|
|
Check :: () -> s32 {
|
|
if !NodeAppNameValid("chess") || !NodeAppNameValid("photos2") { return 1 }
|
|
if NodeAppNameValid("lumi") || NodeAppNameValid("diary") || NodeAppNameValid("feedback") { return 2 }
|
|
if NodeAppNameValid("Chess") || NodeAppNameValid("2048") || NodeAppNameValid("a") ||
|
|
NodeAppNameValid("chess-game") || NodeAppNameValid("abcdefghijklmnopqrstuvwxy") { return 3 }
|
|
if NodeAppInstallName("app_used_chess") != "chess" || NodeAppInstallKeyValid("app_used_lists") ||
|
|
NodeAppInstallKeyValid("app_used_") || NodeAppInstallKeyValid("app_order") { return 4 }
|
|
if NodeAppRecordOwner("cell.chess.computer") != "chess" ||
|
|
NodeAppRecordOwner("cell.chess.game.2-b") != "chess" { return 5 }
|
|
// Lumi's and Diary's records stay theirs; malformed names are refused.
|
|
if NodeAppRecordKeyValid("cell.lumi.history") || NodeAppRecordKeyValid("cell.diary.x") ||
|
|
NodeAppRecordKeyValid("cell.chess.") || NodeAppRecordKeyValid("cell.chess.Big") ||
|
|
NodeAppRecordKeyValid("cell.chess") || NodeAppRecordKeyValid("chess.computer") { return 6 }
|
|
if !NodeAppRecordsCollectionValid("private.inbe.v1.app.chess") ||
|
|
NodeAppRecordsCollectionValid("private.inbe.v1.app.lumi") ||
|
|
NodeAppRecordsCollectionValid("private.inbe.v1.app-installs") { return 7 }
|
|
if !NodeAppSharedIdValid("chess", "chess-0123456789abcdef0123456789abcd") ||
|
|
NodeAppSharedIdValid("chess", "photos-0123") || NodeAppSharedIdValid("chess", "chess-") ||
|
|
NodeAppSharedIdValid("chess", "chess-ABC") ||
|
|
NodeAppSharedIdValid("chess", "chess-0123456789abcdef0123456789abcde") { return 8 }
|
|
// Lists' UUIDs and an app named like eight hex digits never mix.
|
|
if !SharedIdLooksLikeList("3f1c2b7a-9d4e-4c1b-8a2f-0e9d7c6b5a41") ||
|
|
SharedIdLooksLikeList("chess-0123456789abcdef0123456789abcd") { return 9 }
|
|
if NodeAppSharedIdValid("abcdef01", "abcdef01-9d4e-4c1b-8a2f-0e9d7c6b5a41") { return 10 }
|
|
// The account's media library is no app's: its records keep their own
|
|
// collection.
|
|
hash := "1f2e3d4c5b6a79881f2e3d4c5b6a79881f2e3d4c5b6a79881f2e3d4c5b6a7988"
|
|
if NodeAppNameValid("media") || NodeAppRecordKeyValid("cell.media.1f2e3d4c5b6a7988") ||
|
|
NodeAppInstallKeyValid("app_used_media") || NodeAppRecordsCollectionValid("private.inbe.v1.app.media") { return 11 }
|
|
if !MediaRecordKeyAccepted("cell.media.1f2e3d4c5b6a79881f2e3d4c5b6a79881f2e3d4c5b6a79881f2e3d4c5b6a7988") ||
|
|
!MediaRecordKeyAccepted("cell.media.album.summer") || MediaRecordKeyAccepted("cell.media.") ||
|
|
MediaRecordKeyAccepted("cell.mediax.1") || MediaRecordKeyAccepted("cell.media.Big") { return 12 }
|
|
if MediaItemKeyHash("cell.media.1f2e3d4c5b6a79881f2e3d4c5b6a79881f2e3d4c5b6a79881f2e3d4c5b6a7988") != hash ||
|
|
MediaPreviewKeyHash("cell.media.preview.1f2e3d4c5b6a79881f2e3d4c5b6a79881f2e3d4c5b6a79881f2e3d4c5b6a7988") != hash ||
|
|
MediaItemKeyHash("cell.media.preview.1f2e3d4c5b6a79881f2e3d4c5b6a79881f2e3d4c5b6a79881f2e3d4c5b6a7988") != "" ||
|
|
MediaItemKeyHash("cell.media.1F2E3D4C5B6A79881F2E3D4C5B6A79881F2E3D4C5B6A79881F2E3D4C5B6A7988") != "" { return 13 }
|
|
if !NestedAppRecordKeyValid("nested.0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef.position") ||
|
|
!NodeAppRecordKeyValid("nested.0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef.state") ||
|
|
NestedAppRecordKeyValid("nested.0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef.") ||
|
|
NestedAppRecordKeyValid("nested.0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdeg.state") ||
|
|
NestedAppRecordKeyValid("nested.0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef.Big") ||
|
|
NestedAppRecordKeyValid("nested.0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef../position") {
|
|
return 14
|
|
}
|
|
// Arcade replaced Chess; no other app has a replacement.
|
|
if NODE_APP_REPLACED_COUNT != 1 || NodeAppReplaced(0) != "chess" || NodeAppReplaced(1) != "" ||
|
|
NodeAppReplacement("chess") != "arcade" || NodeAppReplacement("arcade") != "" ||
|
|
NodeAppReplacement("photos") != "" || NodeAppReplacement("") != "" {
|
|
return 16
|
|
}
|
|
// An account without Chess has nothing to replace.
|
|
if NodeAppReplacementStep(false, false) != NODE_APP_REPLACE_WAIT ||
|
|
NodeAppReplacementStep(false, true) != NODE_APP_REPLACE_WAIT {
|
|
return 17
|
|
}
|
|
// Chess stays until the user installs Arcade and it runs here carrying
|
|
// Chess; Arcade is never installed for them.
|
|
if NodeAppReplacementStep(true, false) != NODE_APP_REPLACE_WAIT {
|
|
return 19
|
|
}
|
|
// Chess goes once Arcade runs here and carries it, offered or not.
|
|
if NodeAppReplacementStep(true, true) != NODE_APP_REPLACE_RETIRE {
|
|
return 20
|
|
}
|
|
// Achievements use a dedicated account collection, never an app owner.
|
|
if NodeAppNameValid("achievement") || NodeAppInstallKeyValid("app_used_achievement") ||
|
|
NodeAppRecordKeyValid("cell.achievement.photo") ||
|
|
NodeAppRecordsCollectionValid("private.inbe.v1.app.achievement") {
|
|
return 15
|
|
}
|
|
return 0
|
|
}
|