Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade Momento sdk dependencies in demos #80

Merged
merged 13 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/ModeratedChat/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ android {
dependencies {
implementation("io.coil-kt:coil-compose:2.5.0")
implementation("com.google.code.gson:gson:2.10.1")
implementation("software.momento.kotlin:sdk:0.1.3")
implementation("software.momento.kotlin:sdk:0.3.0")
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
implementation("androidx.activity:activity-compose:1.8.2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,17 @@ fun ModeratedChatLayout(
try {
topicSubscribe(language = currentLanguage)
{
val jsonMessage = JSONObject(it)
val parsedMessage = parseMessage(jsonMessage)
currentMessages.add(parsedMessage)
// Previously, we were adding the just-received message directly
// but this caused duplicate messages to appear when switching
// languages very soon after. This may be due to the sequence page
// change, prompting the topic to send the last message(s) again.
// Let's just fetch the authoritative list of messages from the
// translation service instead.
getMessagesForLanguage(languageCode = currentLanguage) {
for (i in 0..<it.count()) {
currentMessages.add(it[i])
}
}
}
} catch (e: RuntimeException) {
// TODO: getting a RuntimeException about grpc channel not
Expand Down
12 changes: 6 additions & 6 deletions flutter/moderated_chat/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,10 @@ packages:
dependency: "direct main"
description:
name: momento
sha256: "74913b8d1da834f0e79253694e8a251623598bc1bb02981b52673c40ba76892e"
sha256: b0f73d470b21706f71d0521df849663433919760a2681f70e8c4197d807454b9
url: "https://pub.dev"
source: hosted
version: "0.1.0"
version: "0.3.0"
nested:
dependency: transitive
description:
Expand Down Expand Up @@ -481,10 +481,10 @@ packages:
dependency: transitive
description:
name: string_validator
sha256: "54d4f42cd6878ae72793a58a529d9a18ebfdfbfebd9793bbe55c9b28935e8543"
sha256: a278d038104aa2df15d0e09c47cb39a49f907260732067d0034dc2f2e4e2ac94
url: "https://pub.dev"
source: hosted
version: "1.0.2"
version: "1.1.0"
term_glyph:
dependency: transitive
description:
Expand Down Expand Up @@ -513,10 +513,10 @@ packages:
dependency: "direct main"
description:
name: uuid
sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8
sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff
url: "https://pub.dev"
source: hosted
version: "4.3.3"
version: "4.5.1"
vector_graphics:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion flutter/moderated_chat/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
momento: ^0.1.0
momento: ^0.3.0
http: ^1.2.0
uuid: ^4.3.3
flutter_svg: ^2.0.9
Expand Down
26 changes: 13 additions & 13 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"@auth0/auth0-react": "^2.0.1",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@gomomento/sdk": "1.100.0",
"@gomomento/sdk-web": "1.100.0",
"@gomomento/sdk": "1.102.0",
"@gomomento/sdk-web": "1.102.0",
"@mui/icons-material": "^5.11.11",
"@mui/material": "^5.11.14",
"analytics": "^0.8.1",
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/ChatApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,13 @@ const ChatApp = () => {
sourceLanguage: selectedLanguage,
});
}
setChats((curr) => [...curr, message]);
// Previously, we were adding the just-received message directly
// but this caused duplicate messages to appear when switching
// languages very soon after. This may be due to the sequence page
// change, prompting the topic to send the last message(s) again.
// Let's just fetch the authoritative list of messages from the
// translation service instead.
fetchLatestChats();
} catch (e) {
console.error("unable to parse chat message", e);
}
Expand Down
62 changes: 62 additions & 0 deletions ios/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
xcuserdata/

## Obj-C/Swift specific
*.hmap

## App packaging
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
# *.xcodeproj
#
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
# .swiftpm

.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build/

# fastlane
#
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output
30 changes: 15 additions & 15 deletions ios/ModeratedChat/ModeratedChat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
083856442CF673C10090B718 /* Momento in Frameworks */ = {isa = PBXBuildFile; productRef = 083856432CF673C10090B718 /* Momento */; };
083F34212B743B6A00489C8D /* Profanity Filter in Frameworks */ = {isa = PBXBuildFile; productRef = 083F34202B743B6A00489C8D /* Profanity Filter */; };
08ABEF462B62F31A00A31A34 /* MessageStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08ABEF452B62F31A00A31A34 /* MessageStore.swift */; };
08B3F11E2B572889003D2CB3 /* ModeratedChatApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08B3F11D2B572889003D2CB3 /* ModeratedChatApp.swift */; };
Expand All @@ -17,7 +18,6 @@
08B3F12E2B57593A003D2CB3 /* ChatView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08B3F12D2B57593A003D2CB3 /* ChatView.swift */; };
08B3F1302B575A3E003D2CB3 /* HeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08B3F12F2B575A3E003D2CB3 /* HeaderView.swift */; };
08B3F1322B58418D003D2CB3 /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08B3F1312B58418D003D2CB3 /* Models.swift */; };
08B3F1352B5890ED003D2CB3 /* Momento in Frameworks */ = {isa = PBXBuildFile; productRef = 08B3F1342B5890ED003D2CB3 /* Momento */; };
08B3F1392B59AAE0003D2CB3 /* Users.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08B3F1382B59AAE0003D2CB3 /* Users.swift */; };
08B3F13C2B59B1DA003D2CB3 /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = 08B3F13B2B59B1DA003D2CB3 /* Alamofire */; };
08ED530F2B63001E008432E1 /* MomentoClients.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08ED530E2B63001E008432E1 /* MomentoClients.swift */; };
Expand Down Expand Up @@ -45,7 +45,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
08B3F1352B5890ED003D2CB3 /* Momento in Frameworks */,
083856442CF673C10090B718 /* Momento in Frameworks */,
083F34212B743B6A00489C8D /* Profanity Filter in Frameworks */,
08B3F13C2B59B1DA003D2CB3 /* Alamofire in Frameworks */,
);
Expand Down Expand Up @@ -114,9 +114,9 @@
);
name = ModeratedChat;
packageProductDependencies = (
08B3F1342B5890ED003D2CB3 /* Momento */,
08B3F13B2B59B1DA003D2CB3 /* Alamofire */,
083F34202B743B6A00489C8D /* Profanity Filter */,
083856432CF673C10090B718 /* Momento */,
);
productName = ModeratedChat;
productReference = 08B3F11A2B572889003D2CB3 /* ModeratedChat.app */;
Expand Down Expand Up @@ -147,9 +147,9 @@
);
mainGroup = 08B3F1112B572889003D2CB3;
packageReferences = (
08B3F1332B5890ED003D2CB3 /* XCRemoteSwiftPackageReference "client-sdk-swift" */,
08B3F13A2B59B1DA003D2CB3 /* XCRemoteSwiftPackageReference "Alamofire" */,
083F341F2B743B6A00489C8D /* XCRemoteSwiftPackageReference "profanitiy-filter-swift" */,
083856422CF673C10090B718 /* XCRemoteSwiftPackageReference "client-sdk-swift" */,
);
productRefGroup = 08B3F11B2B572889003D2CB3 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -398,20 +398,20 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
083F341F2B743B6A00489C8D /* XCRemoteSwiftPackageReference "profanitiy-filter-swift" */ = {
083856422CF673C10090B718 /* XCRemoteSwiftPackageReference "client-sdk-swift" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/jvanbrunt/profanitiy-filter-swift";
repositoryURL = "https://github.com/momentohq/client-sdk-swift";
requirement = {
kind = exactVersion;
version = 0.0.2;
version = 0.7.1;
};
};
08B3F1332B5890ED003D2CB3 /* XCRemoteSwiftPackageReference "client-sdk-swift" */ = {
083F341F2B743B6A00489C8D /* XCRemoteSwiftPackageReference "profanitiy-filter-swift" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/momentohq/client-sdk-swift";
repositoryURL = "https://github.com/jvanbrunt/profanitiy-filter-swift";
requirement = {
kind = exactVersion;
version = 0.5.0;
version = 0.0.2;
};
};
08B3F13A2B59B1DA003D2CB3 /* XCRemoteSwiftPackageReference "Alamofire" */ = {
Expand All @@ -425,16 +425,16 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
083856432CF673C10090B718 /* Momento */ = {
isa = XCSwiftPackageProductDependency;
package = 083856422CF673C10090B718 /* XCRemoteSwiftPackageReference "client-sdk-swift" */;
productName = Momento;
};
083F34202B743B6A00489C8D /* Profanity Filter */ = {
isa = XCSwiftPackageProductDependency;
package = 083F341F2B743B6A00489C8D /* XCRemoteSwiftPackageReference "profanitiy-filter-swift" */;
productName = "Profanity Filter";
};
08B3F1342B5890ED003D2CB3 /* Momento */ = {
isa = XCSwiftPackageProductDependency;
package = 08B3F1332B5890ED003D2CB3 /* XCRemoteSwiftPackageReference "client-sdk-swift" */;
productName = Momento;
};
08B3F13B2B59B1DA003D2CB3 /* Alamofire */ = {
isa = XCSwiftPackageProductDependency;
package = 08B3F13A2B59B1DA003D2CB3 /* XCRemoteSwiftPackageReference "Alamofire" */;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"originHash" : "2157297f3ba668b87b8ebc4cb6a19d97aedf6ac74c06b30b189552fe127daad5",
"pins" : [
{
"identity" : "alamofire",
Expand All @@ -14,8 +15,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/momentohq/client-sdk-swift",
"state" : {
"revision" : "7d1f7b377921e1867d074c654a7b6ba0d91eea48",
"version" : "0.5.0"
"revision" : "71048be91984c5117f02045aa8ee011638cb1493",
"version" : "0.7.1"
}
},
{
Expand Down Expand Up @@ -136,5 +137,5 @@
}
}
],
"version" : 2
"version" : 3
}
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
enableGPUValidationMode = "1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
Expand Down

This file was deleted.

This file was deleted.

Loading